6812{
6814 {
6815 return true;
6816 }
6817};
6818
6819
6820
6822{
6826
6828
6831
6832
6833
6834
6835
6844
6850
6855
6860
6881 protected bool m_IsResultOfSplit
6882
6884
6889
6890
6891
6893
6897
6898
6899
6901
6904
6905
6906
6912
6913
6921
6924
6925
6927
6928
6930
6931
6936
6937
6942
6943
6945
6946
6948 {
6953
6954 if (!
GetGame().IsDedicatedServer())
6955 {
6957 {
6959
6961 {
6963 }
6964 }
6965
6968 }
6969
6970 m_OldLocation = null;
6971
6973 {
6975 }
6976
6977 if (ConfigIsExisting("headSelectionsToHide"))
6978 {
6981 }
6982
6984 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6985 {
6987 }
6988
6990
6991 m_IsResultOfSplit = false;
6992
6994 }
6995
6997 {
6998 super.InitItemVariables();
6999
7005 m_Count = ConfigGetInt(
"count");
7006
7009
7014
7017
7022
7034
7038
7039
7042 if (ConfigIsExisting("canBeSplit"))
7043 {
7046 }
7047
7049 if (ConfigIsExisting("itemBehaviour"))
7051
7052
7055 RegisterNetSyncVariableInt("m_VarLiquidType");
7056 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7057
7058 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7059 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7060 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7061
7062 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7063 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7064 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7065 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7066
7067 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7068 RegisterNetSyncVariableBool("m_IsTakeable");
7069 RegisterNetSyncVariableBool("m_IsHologram");
7070
7073 {
7076 }
7077
7079
7081 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7083
7084 }
7085
7087 {
7089 }
7090
7092 {
7095 {
7100 }
7101 }
7102
7103 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7104 {
7106 {
7109 }
7110
7112 }
7113
7115 {
7121 }
7122
7124
7126 {
7128
7129 if (!action)
7130 {
7131 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7132 return;
7133 }
7134
7136 if (!ai)
7137 {
7139 return;
7140 }
7141
7143 if (!action_array)
7144 {
7145 action_array = new array<ActionBase_Basic>;
7147 }
7148 if (LogManager.IsActionLogEnable())
7149 {
7150 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7151 }
7152
7153 if (action_array.Find(action) != -1)
7154 {
7155 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7156 }
7157 else
7158 {
7159 action_array.Insert(action);
7160 }
7161 }
7162
7164 {
7166 ActionBase action = player.GetActionManager().GetAction(actionName);
7169
7170 if (action_array)
7171 {
7172 action_array.RemoveItem(action);
7173 }
7174 }
7175
7176
7177
7179 {
7180 ActionOverrideData overrideData = new ActionOverrideData();
7184
7186 if (!actionMap)
7187 {
7190 }
7191
7192 actionMap.Insert(this.
Type(), overrideData);
7193
7194 }
7195
7197
7199
7200
7202 {
7205
7208
7209 string config_to_search = "CfgVehicles";
7210 string muzzle_owner_config;
7211
7213 {
7214 if (IsInherited(Weapon))
7215 config_to_search = "CfgWeapons";
7216
7217 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7218
7219 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7220
7222
7223 if (config_OnFire_subclass_count > 0)
7224 {
7225 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7226
7227 for (int i = 0; i < config_OnFire_subclass_count; i++)
7228 {
7229 string particle_class = "";
7231 string config_OnFire_entry = config_OnFire_class + particle_class;
7232 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7233 WPOF_array.Insert(WPOF);
7234 }
7235
7236
7238 }
7239 }
7240
7242 {
7243 config_to_search = "CfgWeapons";
7244 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7245
7246 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7247
7249
7250 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7251 {
7252 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7253
7254 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7255 {
7256 string particle_class2 = "";
7258 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7259 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7260 WPOBE_array.Insert(WPOBE);
7261 }
7262
7263
7265 }
7266 }
7267 }
7268
7269
7271 {
7274
7276 {
7277 string config_to_search = "CfgVehicles";
7278
7279 if (IsInherited(Weapon))
7280 config_to_search = "CfgWeapons";
7281
7282 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7283 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7284
7285 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
7286 {
7287
7289
7291 {
7293 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7295 return;
7296 }
7297
7300
7301
7302
7304 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7305
7306 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7307 {
7308 string particle_class = "";
7310 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7312
7313 if (entry_type == CT_CLASS)
7314 {
7315 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7316 WPOOH_array.Insert(WPOF);
7317 }
7318 }
7319
7320
7322 }
7323 }
7324 }
7325
7327 {
7329 }
7330
7332 {
7334 {
7336
7339
7342
7343 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7344 }
7345 }
7346
7348 {
7350 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7351
7353 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7354
7356 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7357
7359 {
7361 }
7362 }
7363
7365 {
7367 }
7368
7370 {
7373 else
7375
7377 {
7380 }
7381 else
7382 {
7385
7388 }
7389
7391 }
7392
7394 {
7396 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7397 }
7398
7400 {
7402 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7404 }
7405
7407 {
7409 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7410 }
7411
7413 {
7416
7417 OverheatingParticle OP = new OverheatingParticle();
7422
7424 }
7425
7427 {
7430
7431 return -1;
7432 }
7433
7435 {
7437 {
7440
7441 for (int i = count; i > 0; --i)
7442 {
7443 int id = i - 1;
7446
7449
7450 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7451 {
7452 if (p)
7453 {
7456 }
7457 }
7458 }
7459 }
7460 }
7461
7463 {
7465 {
7467 {
7468 int id = i - 1;
7470
7471 if (OP)
7472 {
7474
7475 if (p)
7476 {
7478 }
7479
7480 delete OP;
7481 }
7482 }
7483
7486 }
7487 }
7488
7491 {
7492 return 0.0;
7493 }
7494
7495
7497 {
7498 return 250;
7499 }
7500
7502 {
7503 return 0;
7504 }
7505
7508 {
7510 return true;
7511
7512 return false;
7513 }
7514
7517 {
7520
7522 {
7524 }
7525 else
7526 {
7527
7529 }
7530
7532 }
7533
7540 {
7541 return -1;
7542 }
7543
7544
7545
7546
7548 {
7550 {
7552 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7553
7554 if (r_index >= 0)
7555 {
7556 InventoryLocation r_il = new InventoryLocation;
7557 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7558
7559 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7562 {
7563 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7564 }
7566 {
7567 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7568 }
7569
7570 }
7571
7572 player.GetHumanInventory().ClearUserReservedLocation(this);
7573 }
7574
7577 }
7578
7579
7580
7581
7583 {
7584 return ItemBase.m_DebugActionsMask;
7585 }
7586
7588 {
7589 return ItemBase.m_DebugActionsMask & mask;
7590 }
7591
7593 {
7594 ItemBase.m_DebugActionsMask = mask;
7595 }
7596
7598 {
7599 ItemBase.m_DebugActionsMask |= mask;
7600 }
7601
7603 {
7604 ItemBase.m_DebugActionsMask &= ~mask;
7605 }
7606
7608 {
7610 {
7612 }
7613 else
7614 {
7616 }
7617 }
7618
7619
7621 {
7622 if (GetEconomyProfile())
7623 {
7624 float q_max = GetEconomyProfile().GetQuantityMax();
7625 if (q_max > 0)
7626 {
7627 float q_min = GetEconomyProfile().GetQuantityMin();
7628 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7629
7631 {
7632 ComponentEnergyManager comp = GetCompEM();
7634 {
7636 }
7637 }
7639 {
7641
7642 }
7643
7644 }
7645 }
7646 }
7647
7650 {
7651 EntityAI parent = GetHierarchyParent();
7652
7653 if (parent)
7654 {
7655 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7656 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7657 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7658 }
7659 }
7660
7663 {
7664 EntityAI parent = GetHierarchyParent();
7665
7666 if (parent)
7667 {
7668 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7669 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7670 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7671 }
7672 }
7673
7675 {
7676
7677
7678
7679
7681
7683 {
7684 if (ScriptInputUserData.CanStoreInputUserData())
7685 {
7686 ScriptInputUserData ctx = new ScriptInputUserData;
7692 ctx.
Write(use_stack_max);
7695
7697 {
7698 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7699 }
7700 }
7701 }
7702 else if (!
GetGame().IsMultiplayer())
7703 {
7705 }
7706 }
7707
7709 {
7711 }
7712
7714 {
7716 }
7717
7719 {
7721 }
7722
7724 {
7725
7726 return false;
7727 }
7728
7730 {
7731 return false;
7732 }
7733
7737 {
7738 return false;
7739 }
7740
7742 {
7743 return "";
7744 }
7745
7747
7749 {
7750 return false;
7751 }
7752
7754 {
7755 return true;
7756 }
7757
7758
7759
7761 {
7762 return true;
7763 }
7764
7766 {
7767 return true;
7768 }
7769
7771 {
7772 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7774 }
7775
7777 {
7779 }
7780
7782 {
7784 if (!is_being_placed)
7786 SetSynchDirty();
7787 }
7788
7789
7791
7793 {
7795 }
7796
7798 {
7800 }
7801
7803 {
7804 return 1;
7805 }
7806
7808 {
7809 return false;
7810 }
7811
7813 {
7815 SetSynchDirty();
7816 }
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7853 {
7854 super.OnMovedInsideCargo(container);
7855
7856 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7857 }
7858
7859 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7860 {
7861 super.EEItemLocationChanged(oldLoc,newLoc);
7862
7863 PlayerBase new_player = null;
7864 PlayerBase old_player = null;
7865
7866 if (newLoc.GetParent())
7867 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7868
7869 if (oldLoc.GetParent())
7870 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7871
7873 {
7874 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7875
7876 if (r_index >= 0)
7877 {
7878 InventoryLocation r_il = new InventoryLocation;
7879 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7880
7881 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7884 {
7885 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7886 }
7888 {
7889 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7890 }
7891
7892 }
7893 }
7894
7896 {
7897 if (new_player)
7898 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7899
7900 if (new_player == old_player)
7901 {
7902
7903 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7904 {
7906 {
7907 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7908 {
7909 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7910 }
7911 }
7912 else
7913 {
7914 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7915 }
7916 }
7917
7918 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7919 {
7920 int type = oldLoc.GetType();
7922 {
7923 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7924 }
7926 {
7927 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7928 }
7929 }
7930 if (!m_OldLocation)
7931 {
7932 m_OldLocation = new InventoryLocation;
7933 }
7934 m_OldLocation.Copy(oldLoc);
7935 }
7936 else
7937 {
7938 if (m_OldLocation)
7939 {
7940 m_OldLocation.Reset();
7941 }
7942 }
7943
7945 }
7946 else
7947 {
7948 if (new_player)
7949 {
7950 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7951 if (res_index >= 0)
7952 {
7953 InventoryLocation il = new InventoryLocation;
7954 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7956 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7959 {
7960 il.
GetParent().GetOnReleaseLock().Invoke(it);
7961 }
7963 {
7965 }
7966
7967 }
7968 }
7970 {
7971
7973 }
7974
7975 if (m_OldLocation)
7976 {
7977 m_OldLocation.Reset();
7978 }
7979 }
7980 }
7981
7982 override void EOnContact(IEntity other, Contact extra)
7983 {
7985 {
7986 int liquidType = -1;
7988 if (impactSpeed > 0.0)
7989 {
7991 #ifndef SERVER
7993 #else
7995 SetSynchDirty();
7996 #endif
7998 }
7999 }
8000
8001 #ifdef SERVER
8002 if (GetCompEM() && GetCompEM().IsPlugged())
8003 {
8004 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8005 GetCompEM().UnplugThis();
8006 }
8007 #endif
8008 }
8009
8011
8013 {
8015 }
8016
8018 {
8019
8020 }
8021
8023 {
8024 super.OnItemLocationChanged(old_owner, new_owner);
8025
8026 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8027 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8028
8029 if (!relatedPlayer && playerNew)
8030 relatedPlayer = playerNew;
8031
8032 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8033 {
8035 if (actionMgr)
8036 {
8037 ActionBase currentAction = actionMgr.GetRunningAction();
8038 if (currentAction)
8040 }
8041 }
8042
8043 Man ownerPlayerOld = null;
8044 Man ownerPlayerNew = null;
8045
8046 if (old_owner)
8047 {
8048 if (old_owner.
IsMan())
8049 {
8050 ownerPlayerOld = Man.Cast(old_owner);
8051 }
8052 else
8053 {
8054 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8055 }
8056 }
8057 else
8058 {
8060 {
8062
8063 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8064 {
8065 GetCompEM().UnplugThis();
8066 }
8067 }
8068 }
8069
8070 if (new_owner)
8071 {
8072 if (new_owner.
IsMan())
8073 {
8074 ownerPlayerNew = Man.Cast(new_owner);
8075 }
8076 else
8077 {
8078 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8079 }
8080 }
8081
8082 if (ownerPlayerOld != ownerPlayerNew)
8083 {
8084 if (ownerPlayerOld)
8085 {
8086 array<EntityAI> subItemsExit = new array<EntityAI>;
8088 for (int i = 0; i < subItemsExit.Count(); i++)
8089 {
8092 }
8093 }
8094
8095 if (ownerPlayerNew)
8096 {
8097 array<EntityAI> subItemsEnter = new array<EntityAI>;
8099 for (int j = 0; j < subItemsEnter.Count(); j++)
8100 {
8103 }
8104 }
8105 }
8106 else if (ownerPlayerNew != null)
8107 {
8108 PlayerBase nplayer;
8109 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8110 {
8111 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8113 for (int k = 0; k < subItemsUpdate.Count(); k++)
8114 {
8116 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8117 }
8118 }
8119 }
8120
8121 if (old_owner)
8122 old_owner.OnChildItemRemoved(this);
8123 if (new_owner)
8124 new_owner.OnChildItemReceived(this);
8125 }
8126
8127
8129 {
8130 super.EEDelete(parent);
8131 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8132 if (player)
8133 {
8135
8136 if (player.IsAlive())
8137 {
8138 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8139 if (r_index >= 0)
8140 {
8141 InventoryLocation r_il = new InventoryLocation;
8142 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8143
8144 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8147 {
8148 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8149 }
8151 {
8152 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8153 }
8154
8155 }
8156
8157 player.RemoveQuickBarEntityShortcut(this);
8158 }
8159 }
8160 }
8161
8163 {
8164 super.EEKilled(killer);
8165
8168 {
8169 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8170 {
8171 if (IsMagazine())
8172 {
8173 if (Magazine.Cast(this).GetAmmoCount() > 0)
8174 {
8176 }
8177 }
8178 else
8179 {
8181 }
8182 }
8183 }
8184 }
8185
8187 {
8188 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8189
8190 super.OnWasAttached(parent, slot_id);
8191
8194
8196 }
8197
8199 {
8200 super.OnWasDetached(parent, slot_id);
8201
8204 }
8205
8207 {
8208 int idx;
8211
8212 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8213 if (inventory_slots.Count() < 1)
8214 {
8215 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8216 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8217 }
8218 else
8219 {
8220 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8221 }
8222
8223 idx = inventory_slots.Find(slot);
8224 if (idx < 0)
8225 return "";
8226
8227 return attach_types.Get(idx);
8228 }
8229
8231 {
8232 int idx = -1;
8233 string slot;
8234
8237
8238 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8239 if (inventory_slots.Count() < 1)
8240 {
8241 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8242 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8243 }
8244 else
8245 {
8246 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8247 if (detach_types.Count() < 1)
8248 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8249 }
8250
8251 for (int i = 0; i < inventory_slots.Count(); i++)
8252 {
8253 slot = inventory_slots.Get(i);
8254 }
8255
8256 if (slot != "")
8257 {
8258 if (detach_types.Count() == 1)
8259 idx = 0;
8260 else
8261 idx = inventory_slots.Find(slot);
8262 }
8263 if (idx < 0)
8264 return "";
8265
8266 return detach_types.Get(idx);
8267 }
8268
8270 {
8271
8273
8274
8275 float min_time = 1;
8276 float max_time = 3;
8277 float delay = Math.RandomFloat(min_time, max_time);
8278
8279 explode_timer.Run(delay, this, "DoAmmoExplosion");
8280 }
8281
8283 {
8284 Magazine magazine = Magazine.Cast(this);
8285 int pop_sounds_count = 6;
8286 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8287
8288
8289 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8290 string sound_name = pop_sounds[ sound_idx ];
8292
8293
8294 magazine.ServerAddAmmoCount(-1);
8295
8296
8297 float min_temp_to_explode = 100;
8298
8299 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode)
8300 {
8302 }
8303 }
8304
8305
8306 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8307 {
8308 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8309
8310 const int CHANCE_DAMAGE_CARGO = 4;
8311 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8312 const int CHANCE_DAMAGE_NOTHING = 2;
8313
8315 {
8316 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8317 int chances;
8318 int rnd;
8319
8320 if (GetInventory().GetCargo())
8321 {
8322 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8323 rnd = Math.RandomInt(0,chances);
8324
8325 if (rnd < CHANCE_DAMAGE_CARGO)
8326 {
8328 }
8329 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8330 {
8332 }
8333 }
8334 else
8335 {
8336 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8337 rnd = Math.RandomInt(0,chances);
8338
8339 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8340 {
8342 }
8343 }
8344 }
8345 }
8346
8348 {
8349 if (GetInventory().GetCargo())
8350 {
8351 int item_count = GetInventory().GetCargo().GetItemCount();
8352 if (item_count > 0)
8353 {
8354 int random_pick = Math.RandomInt(0, item_count);
8356 if (!item.IsExplosive())
8357 {
8358 item.AddHealth("","",damage);
8359 return true;
8360 }
8361 }
8362 }
8363 return false;
8364 }
8365
8367 {
8368 int attachment_count = GetInventory().AttachmentCount();
8369 if (attachment_count > 0)
8370 {
8371 int random_pick = Math.RandomInt(0, attachment_count);
8372 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8373 if (!attachment.IsExplosive())
8374 {
8375 attachment.AddHealth("","",damage);
8376 return true;
8377 }
8378 }
8379 return false;
8380 }
8381
8383 {
8385 }
8386
8388 {
8390 return GetInventory().CanRemoveEntity();
8391
8392 return false;
8393 }
8394
8396 {
8398 return;
8399
8401 {
8402 if (ScriptInputUserData.CanStoreInputUserData())
8403 {
8404 ScriptInputUserData ctx = new ScriptInputUserData;
8409 ctx.
Write(destination_entity);
8413 }
8414 }
8415 else if (!
GetGame().IsMultiplayer())
8416 {
8418 }
8419 }
8420
8422 {
8424 return;
8425
8426 float split_quantity_new;
8430 InventoryLocation loc = new InventoryLocation;
8431
8432 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8433 {
8435 split_quantity_new = stack_max;
8436 else
8438
8439 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8440 if (new_item)
8441 {
8442 new_item.SetResultOfSplit(true);
8443 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8445 new_item.SetQuantity(split_quantity_new);
8446 }
8447 }
8448 else if (destination_entity && slot_id == -1)
8449 {
8450 if (quantity > stack_max)
8451 split_quantity_new = stack_max;
8452 else
8453 split_quantity_new = quantity;
8454
8456 {
8459 }
8460
8461 if (new_item)
8462 {
8463 new_item.SetResultOfSplit(true);
8464 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8466 new_item.SetQuantity(split_quantity_new);
8467 }
8468 }
8469 else
8470 {
8471 if (stack_max != 0)
8472 {
8474 {
8476 }
8477
8478 if (split_quantity_new == 0)
8479 {
8480 if (!
GetGame().IsMultiplayer())
8481 player.PhysicalPredictiveDropItem(this);
8482 else
8483 player.ServerDropEntity(this);
8484 return;
8485 }
8486
8488
8489 if (new_item)
8490 {
8491 new_item.SetResultOfSplit(true);
8492 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8494 new_item.SetQuantity(stack_max);
8495 new_item.PlaceOnSurface();
8496 }
8497 }
8498 }
8499 }
8500
8502 {
8504 return;
8505
8506 float split_quantity_new;
8510 InventoryLocation loc = new InventoryLocation;
8511
8512 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8513 {
8515 split_quantity_new = stack_max;
8516 else
8518
8519 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8520 if (new_item)
8521 {
8522 new_item.SetResultOfSplit(true);
8523 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8525 new_item.SetQuantity(split_quantity_new);
8526 }
8527 }
8528 else if (destination_entity && slot_id == -1)
8529 {
8530 if (quantity > stack_max)
8531 split_quantity_new = stack_max;
8532 else
8533 split_quantity_new = quantity;
8534
8536 {
8539 }
8540
8541 if (new_item)
8542 {
8543 new_item.SetResultOfSplit(true);
8544 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8546 new_item.SetQuantity(split_quantity_new);
8547 }
8548 }
8549 else
8550 {
8551 if (stack_max != 0)
8552 {
8554 {
8556 }
8557
8559
8560 if (new_item)
8561 {
8562 new_item.SetResultOfSplit(true);
8563 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8565 new_item.SetQuantity(stack_max);
8566 new_item.PlaceOnSurface();
8567 }
8568 }
8569 }
8570 }
8571
8573 {
8575 return;
8576
8578 {
8579 if (ScriptInputUserData.CanStoreInputUserData())
8580 {
8581 ScriptInputUserData ctx = new ScriptInputUserData;
8586 dst.WriteToContext(ctx);
8588 }
8589 }
8590 else if (!
GetGame().IsMultiplayer())
8591 {
8593 }
8594 }
8595
8597 {
8599 return;
8600
8602 {
8603 if (ScriptInputUserData.CanStoreInputUserData())
8604 {
8605 ScriptInputUserData ctx = new ScriptInputUserData;
8610 ctx.
Write(destination_entity);
8616 }
8617 }
8618 else if (!
GetGame().IsMultiplayer())
8619 {
8621 }
8622 }
8623
8625 {
8627 }
8628
8630 {
8632 return this;
8633
8635 float split_quantity_new;
8637 if (dst.IsValid())
8638 {
8639 int slot_id = dst.GetSlot();
8641
8642 if (quantity > stack_max)
8643 split_quantity_new = stack_max;
8644 else
8645 split_quantity_new = quantity;
8646
8648
8649 if (new_item)
8650 {
8651 new_item.SetResultOfSplit(true);
8652 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8655 }
8656
8657 return new_item;
8658 }
8659
8660 return null;
8661 }
8662
8664 {
8666 return;
8667
8669 float split_quantity_new;
8671 if (destination_entity)
8672 {
8674 if (quantity > stackable)
8675 split_quantity_new = stackable;
8676 else
8677 split_quantity_new = quantity;
8678
8679 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8680 if (new_item)
8681 {
8682 new_item.SetResultOfSplit(true);
8683 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8685 new_item.SetQuantity(split_quantity_new);
8686 }
8687 }
8688 }
8689
8691 {
8693 return;
8694
8696 {
8697 if (ScriptInputUserData.CanStoreInputUserData())
8698 {
8699 ScriptInputUserData ctx = new ScriptInputUserData;
8704 ItemBase destination_entity =
this;
8705 ctx.
Write(destination_entity);
8709 }
8710 }
8711 else if (!
GetGame().IsMultiplayer())
8712 {
8714 }
8715 }
8716
8718 {
8720 return;
8721
8723 float split_quantity_new;
8725 if (player)
8726 {
8728 if (quantity > stackable)
8729 split_quantity_new = stackable;
8730 else
8731 split_quantity_new = quantity;
8732
8733 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8734 new_item =
ItemBase.Cast(in_hands);
8735 if (new_item)
8736 {
8737 new_item.SetResultOfSplit(true);
8738 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8740 new_item.SetQuantity(split_quantity_new);
8741 }
8742 }
8743 }
8744
8746 {
8748 return;
8749
8751 float split_quantity_new = Math.Floor(quantity * 0.5);
8752
8754
8755 if (new_item)
8756 {
8757 if (new_item.GetQuantityMax() < split_quantity_new)
8758 {
8759 split_quantity_new = new_item.GetQuantityMax();
8760 }
8761
8762 new_item.SetResultOfSplit(true);
8763 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8764
8766 {
8769 }
8770 else
8771 {
8774 }
8775 }
8776 }
8777
8779 {
8781 return;
8782
8784 float split_quantity_new = Math.Floor(quantity / 2);
8785
8786 InventoryLocation invloc = new InventoryLocation;
8788
8790 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8791
8792 if (new_item)
8793 {
8794 if (new_item.GetQuantityMax() < split_quantity_new)
8795 {
8796 split_quantity_new = new_item.GetQuantityMax();
8797 }
8799 {
8802 }
8803 else
8804 {
8807 }
8808 }
8809 }
8810
8813 {
8814 SetWeightDirty();
8816
8817 if (parent)
8818 parent.OnAttachmentQuantityChangedEx(this, delta);
8819
8821 {
8823 {
8825 }
8827 {
8828 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8830 }
8831 }
8832
8833 }
8834
8837 {
8838
8839 }
8840
8843 {
8845 }
8846
8848 {
8849 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8850
8852 {
8853 if (newLevel == GameConstants.STATE_RUINED)
8854 {
8856 EntityAI parent = GetHierarchyParent();
8857 if (parent && parent.IsFireplace())
8858 {
8859 CargoBase cargo = GetInventory().GetCargo();
8860 if (cargo)
8861 {
8863 {
8865 }
8866 }
8867 }
8868 }
8869
8871 {
8872
8874 return;
8875 }
8876
8877 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8878 {
8880 }
8881 }
8882 }
8883
8884
8886 {
8887 super.OnRightClick();
8888
8890 {
8892 {
8893 if (ScriptInputUserData.CanStoreInputUserData())
8894 {
8895 vector m4[4];
8897
8898 EntityAI root = GetHierarchyRoot();
8899
8900 InventoryLocation dst = new InventoryLocation;
8902 {
8903 if (root)
8904 {
8905 root.GetTransform(m4);
8907 }
8908 else
8909 GetInventory().GetCurrentInventoryLocation(dst);
8910 }
8911 else
8912 {
8914
8915
8916 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8917 {
8918 if (root)
8919 {
8920 root.GetTransform(m4);
8922 }
8923 else
8924 GetInventory().GetCurrentInventoryLocation(dst);
8925 }
8926 else
8927 {
8928 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8929 }
8930 }
8931
8932 ScriptInputUserData ctx = new ScriptInputUserData;
8940 }
8941 }
8942 else if (!
GetGame().IsMultiplayer())
8943 {
8945 }
8946 }
8947 }
8948
8949 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8950 {
8951
8952 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8953 return false;
8954
8955 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8956 return false;
8957
8958
8960 return false;
8961
8962
8963 Magazine mag = Magazine.Cast(this);
8964 if (mag)
8965 {
8966 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8967 return false;
8968
8969 if (stack_max_limit)
8970 {
8971 Magazine other_mag = Magazine.Cast(other_item);
8972 if (other_item)
8973 {
8974 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8975 return false;
8976 }
8977
8978 }
8979 }
8980 else
8981 {
8982
8984 return false;
8985
8987 return false;
8988 }
8989
8990 PlayerBase player = null;
8991 if (CastTo(player, GetHierarchyRootPlayer()))
8992 {
8993 if (player.GetInventory().HasAttachment(this))
8994 return false;
8995
8996 if (player.IsItemsToDelete())
8997 return false;
8998 }
8999
9000 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9001 return false;
9002
9003 int slotID;
9005 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9006 return false;
9007
9008 return true;
9009 }
9010
9012 {
9014 }
9015
9017 {
9018 return m_IsResultOfSplit;
9019 }
9020
9022 {
9023 m_IsResultOfSplit = value;
9024 }
9025
9027 {
9029 }
9030
9032 {
9033 float other_item_quantity = other_item.GetQuantity();
9034 float this_free_space;
9035
9037
9039
9040 if (other_item_quantity > this_free_space)
9041 {
9042 return this_free_space;
9043 }
9044 else
9045 {
9046 return other_item_quantity;
9047 }
9048 }
9049
9051 {
9053 }
9054
9056 {
9058 return;
9059
9060 if (!IsMagazine() && other_item)
9061 {
9063 if (quantity_used != 0)
9064 {
9065 float hp1 = GetHealth01("","");
9066 float hp2 = other_item.GetHealth01("","");
9067 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9068 hpResult = hpResult / (
GetQuantity() + quantity_used);
9069
9070 hpResult *= GetMaxHealth();
9071 Math.Round(hpResult);
9072 SetHealth("", "Health", hpResult);
9073
9075 other_item.AddQuantity(-quantity_used);
9076 }
9077 }
9079 }
9080
9082 {
9083 #ifdef SERVER
9084 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9085 GetHierarchyParent().IncreaseLifetimeUp();
9086 #endif
9087 };
9088
9090 {
9091 PlayerBase p = PlayerBase.Cast(player);
9092
9093 array<int> recipesIds = p.m_Recipes;
9094 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9095 if (moduleRecipesManager)
9096 {
9097 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9098 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9099 }
9100
9101 for (int i = 0;i < recipesIds.Count(); i++)
9102 {
9103 int key = recipesIds.Get(i);
9104 string recipeName = moduleRecipesManager.GetRecipeName(key);
9106 }
9107 }
9108
9109
9110 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9111 {
9112 super.GetDebugActions(outputList);
9113
9114
9119
9120
9124
9128
9129
9132
9133
9135 {
9138 }
9139
9141
9144
9148 }
9149
9150
9151
9152
9154 {
9155 super.OnAction(action_id, player, ctx);
9156 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9157 {
9158 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9159 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9160 PlayerBase p = PlayerBase.Cast(player);
9161 if (
EActions.RECIPES_RANGE_START < 1000)
9162 {
9163 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9164 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9165 }
9166 }
9167 #ifndef SERVER
9168 else if (action_id ==
EActions.WATCH_PLAYER)
9169 {
9170 PluginDeveloper.SetDeveloperItemClientEx(player);
9171 }
9172 #endif
9174 {
9175 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9176 {
9177 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9178 OnDebugButtonPressServer(id + 1);
9179 }
9180
9181 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9182 {
9183 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9185 }
9186
9187 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9188 {
9189 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9191 }
9192
9193 else if (action_id ==
EActions.ADD_QUANTITY)
9194 {
9195 if (IsMagazine())
9196 {
9197 Magazine mag = Magazine.Cast(this);
9198 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9199 }
9200 else
9201 {
9203 }
9204
9205 if (m_EM)
9206 {
9207 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9208 }
9209
9210 }
9211
9212 else if (action_id ==
EActions.REMOVE_QUANTITY)
9213 {
9214 if (IsMagazine())
9215 {
9216 Magazine mag2 = Magazine.Cast(this);
9217 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9218 }
9219 else
9220 {
9222 }
9223 if (m_EM)
9224 {
9225 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9226 }
9227
9228 }
9229
9230 else if (action_id ==
EActions.SET_QUANTITY_0)
9231 {
9233
9234 if (m_EM)
9235 {
9236 m_EM.SetEnergy(0);
9237 }
9238 }
9239
9240 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9241 {
9243
9244 if (m_EM)
9245 {
9246 m_EM.SetEnergy(m_EM.GetEnergyMax());
9247 }
9248 }
9249
9250 else if (action_id ==
EActions.ADD_HEALTH)
9251 {
9252 AddHealth("","",GetMaxHealth("","Health")/5);
9253 }
9254 else if (action_id ==
EActions.REMOVE_HEALTH)
9255 {
9256 AddHealth("","",-GetMaxHealth("","Health")/5);
9257 }
9258 else if (action_id ==
EActions.DESTROY_HEALTH)
9259 {
9260 SetHealth01("","",0);
9261 }
9262 else if (action_id ==
EActions.WATCH_ITEM)
9263 {
9265 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9266 #ifdef DEVELOPER
9267 SetDebugDeveloper_item(this);
9268 #endif
9269 }
9270
9271 else if (action_id ==
EActions.ADD_TEMPERATURE)
9272 {
9273 AddTemperature(20);
9274
9275 }
9276
9277 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9278 {
9279 AddTemperature(-20);
9280
9281 }
9282
9283 else if (action_id ==
EActions.FLIP_FROZEN)
9284 {
9285 SetFrozen(!GetIsFrozen());
9286
9287 }
9288
9289 else if (action_id ==
EActions.ADD_WETNESS)
9290 {
9292
9293 }
9294
9295 else if (action_id ==
EActions.REMOVE_WETNESS)
9296 {
9298
9299 }
9300
9301 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9302 {
9305
9306
9307 }
9308
9309 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9310 {
9313 }
9314
9315 else if (action_id ==
EActions.MAKE_SPECIAL)
9316 {
9317 auto debugParams = DebugSpawnParams.WithPlayer(player);
9318 OnDebugSpawnEx(debugParams);
9319 }
9320
9321 else if (action_id ==
EActions.DELETE)
9322 {
9323 Delete();
9324 }
9325
9326 }
9327
9328
9329 return false;
9330 }
9331
9332
9333
9334
9338
9341
9342
9343
9345 {
9346 return false;
9347 }
9348
9349
9351 {
9352 return true;
9353 }
9354
9355
9357 {
9358 return true;
9359 }
9360
9361
9362
9364 {
9365 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9367 }
9368
9371 {
9372 return null;
9373 }
9374
9376 {
9377 return false;
9378 }
9379
9381 {
9382 return false;
9383 }
9384
9388
9389
9391 {
9392 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9393 return module_repairing.CanRepair(this, item_repair_kit);
9394 }
9395
9396
9397 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9398 {
9399 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9400 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9401 }
9402
9403
9405 {
9406
9407
9408
9409
9410
9411
9412
9413
9414 return 1;
9415 }
9416
9417
9418
9420 {
9422 }
9423
9424
9425
9427 {
9429 }
9430
9431
9440 {
9441 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9442
9443 if (player)
9444 {
9445 player.MessageStatus(text);
9446 }
9447 }
9448
9449
9458 {
9459 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9460
9461 if (player)
9462 {
9463 player.MessageAction(text);
9464 }
9465 }
9466
9467
9476 {
9477 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9478
9479 if (player)
9480 {
9481 player.MessageFriendly(text);
9482 }
9483 }
9484
9485
9494 {
9495 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9496
9497 if (player)
9498 {
9499 player.MessageImportant(text);
9500 }
9501 }
9502
9504 {
9505 return true;
9506 }
9507
9508
9509 override bool KindOf(
string tag)
9510 {
9511 bool found = false;
9512 string item_name = this.
GetType();
9515
9516 int array_size = item_tag_array.Count();
9517 for (int i = 0; i < array_size; i++)
9518 {
9519 if (item_tag_array.Get(i) == tag)
9520 {
9521 found = true;
9522 break;
9523 }
9524 }
9525 return found;
9526 }
9527
9528
9530 {
9531
9532 super.OnRPC(sender, rpc_type,ctx);
9533
9534
9535 switch (rpc_type)
9536 {
9537 #ifndef SERVER
9538 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9539 Param2<bool, string> p = new Param2<bool, string>(false, "");
9540
9542 return;
9543
9544 bool play = p.param1;
9545 string soundSet = p.param2;
9546
9547 if (play)
9548 {
9550 {
9552 {
9554 }
9555 }
9556 else
9557 {
9559 }
9560 }
9561 else
9562 {
9564 }
9565
9566 break;
9567 #endif
9568
9569 }
9570
9572 {
9574 }
9575 }
9576
9577
9578
9579
9581 {
9582 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9583 return plugin.GetID(
name);
9584 }
9585
9587 {
9588 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9589 return plugin.GetName(id);
9590 }
9591
9594 {
9595
9596
9597 int varFlags;
9598 if (!ctx.
Read(varFlags))
9599 return;
9600
9601 if (varFlags & ItemVariableFlags.FLOAT)
9602 {
9604 }
9605 }
9606
9608 {
9609
9610 super.SerializeNumericalVars(floats_out);
9611
9612
9613
9615 {
9617 }
9618
9620 {
9622 }
9623
9625 {
9627 }
9628
9630 {
9635 }
9636
9638 {
9640 }
9641 }
9642
9644 {
9645
9646 super.DeSerializeNumericalVars(floats);
9647
9648
9649 int index = 0;
9650 int mask = Math.Round(floats.Get(index));
9651
9652 index++;
9653
9655 {
9657 {
9659 }
9660 else
9661 {
9662 float quantity = floats.Get(index);
9664 }
9665 index++;
9666 }
9667
9669 {
9670 float wet = floats.Get(index);
9672 index++;
9673 }
9674
9676 {
9677 int liquidtype = Math.Round(floats.Get(index));
9679 index++;
9680 }
9681
9683 {
9685 index++;
9687 index++;
9689 index++;
9691 index++;
9692 }
9693
9695 {
9696 int cleanness = Math.Round(floats.Get(index));
9698 index++;
9699 }
9700 }
9701
9703 {
9704 super.WriteVarsToCTX(ctx);
9705
9706
9708 {
9710 }
9711
9713 {
9715 }
9716
9718 {
9720 }
9721
9723 {
9724 int r,g,b,a;
9730 }
9731
9733 {
9735 }
9736 }
9737
9739 {
9740 if (!super.ReadVarsFromCTX(ctx,version))
9741 return false;
9742
9743 int intValue;
9744 float value;
9745
9746 if (version < 140)
9747 {
9748 if (!ctx.
Read(intValue))
9749 return false;
9750
9751 m_VariablesMask = intValue;
9752 }
9753
9755 {
9756 if (!ctx.
Read(value))
9757 return false;
9758
9760 {
9762 }
9763 else
9764 {
9766 }
9767 }
9768
9769 if (version < 140)
9770 {
9772 {
9773 if (!ctx.
Read(value))
9774 return false;
9775 SetTemperatureDirect(value);
9776 }
9777 }
9778
9780 {
9781 if (!ctx.
Read(value))
9782 return false;
9784 }
9785
9787 {
9788 if (!ctx.
Read(intValue))
9789 return false;
9791 }
9792
9794 {
9795 int r,g,b,a;
9797 return false;
9799 return false;
9801 return false;
9803 return false;
9804
9806 }
9807
9809 {
9810 if (!ctx.
Read(intValue))
9811 return false;
9813 }
9814
9815 if (version >= 138 && version < 140)
9816 {
9818 {
9819 if (!ctx.
Read(intValue))
9820 return false;
9821 SetFrozen(intValue);
9822 }
9823 }
9824
9825 return true;
9826 }
9827
9828
9830 {
9833 {
9835 }
9836
9837 if (!super.OnStoreLoad(ctx, version))
9838 {
9840 return false;
9841 }
9842
9843 if (version >= 114)
9844 {
9845 bool hasQuickBarIndexSaved;
9846
9847 if (!ctx.
Read(hasQuickBarIndexSaved))
9848 {
9850 return false;
9851 }
9852
9853 if (hasQuickBarIndexSaved)
9854 {
9855 int itmQBIndex;
9856
9857
9858 if (!ctx.
Read(itmQBIndex))
9859 {
9861 return false;
9862 }
9863
9864 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9865 if (itmQBIndex != -1 && parentPlayer)
9866 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9867 }
9868 }
9869 else
9870 {
9871
9872 PlayerBase player;
9873 int itemQBIndex;
9874 if (version ==
int.
MAX)
9875 {
9876 if (!ctx.
Read(itemQBIndex))
9877 {
9879 return false;
9880 }
9881 }
9882 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9883 {
9884
9885 if (!ctx.
Read(itemQBIndex))
9886 {
9888 return false;
9889 }
9890 if (itemQBIndex != -1 && player)
9891 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9892 }
9893 }
9894
9895 if (version < 140)
9896 {
9897
9898 if (!LoadVariables(ctx, version))
9899 {
9901 return false;
9902 }
9903 }
9904
9905
9907 {
9909 return false;
9910 }
9911 if (version >= 132)
9912 {
9914 if (raib)
9915 {
9917 {
9919 return false;
9920 }
9921 }
9922 }
9923
9925 return true;
9926 }
9927
9928
9929
9931 {
9932 super.OnStoreSave(ctx);
9933
9934 PlayerBase player;
9935 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9936 {
9938
9939 int itemQBIndex = -1;
9940 itemQBIndex = player.FindQuickBarEntityIndex(this);
9941 ctx.
Write(itemQBIndex);
9942 }
9943 else
9944 {
9946 }
9947
9949
9951 if (raib)
9952 {
9954 }
9955 }
9956
9957
9959 {
9960 super.AfterStoreLoad();
9961
9963 {
9965 }
9966
9968 {
9971 }
9972 }
9973
9975 {
9976 super.EEOnAfterLoad();
9977
9979 {
9981 }
9982
9985 }
9986
9988 {
9989 return false;
9990 }
9991
9992
9993
9995 {
9997 {
9998 #ifdef PLATFORM_CONSOLE
9999
10001 {
10003 if (menu)
10004 {
10006 }
10007 }
10008 #endif
10009 }
10010
10012 {
10015 }
10016
10018 {
10019 SetWeightDirty();
10021 }
10023 {
10026 }
10027
10029 {
10032 }
10034 {
10037 }
10038
10039 super.OnVariablesSynchronized();
10040 }
10041
10042
10043
10045 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10046 {
10047 if (!IsServerCheck(allow_client))
10048 return false;
10049
10051 return false;
10052
10055
10056 if (value <= (min + 0.001))
10057 value = min;
10058
10059 if (value == min)
10060 {
10061 if (destroy_config)
10062 {
10063 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10064 if (dstr)
10065 {
10067 this.Delete();
10068 return true;
10069 }
10070 }
10071 else if (destroy_forced)
10072 {
10074 this.Delete();
10075 return true;
10076 }
10077
10079 }
10080
10083
10085 {
10087
10088 if (delta)
10090 }
10091
10093
10094 return false;
10095 }
10096
10097
10099 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10100 {
10102 }
10103
10105 {
10108 }
10109
10111 {
10114 }
10115
10118 {
10119 float value_clamped = Math.Clamp(value, 0, 1);
10121 SetQuantity(result, destroy_config, destroy_forced);
10122 }
10123
10124
10127 {
10129 }
10130
10132 {
10134 }
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10146 {
10147 int slot = -1;
10148 if (GetInventory())
10149 {
10150 InventoryLocation il = new InventoryLocation;
10151 GetInventory().GetCurrentInventoryLocation(il);
10153 }
10154
10156 }
10157
10159 {
10160 float quantity_max = 0;
10161
10163 {
10164 if (attSlotID != -1)
10165 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10166
10167 if (quantity_max <= 0)
10169 }
10170
10171 if (quantity_max <= 0)
10173
10174 return quantity_max;
10175 }
10176
10178 {
10180 }
10181
10183 {
10185 }
10186
10187
10189 {
10191 }
10192
10194 {
10196 }
10197
10199 {
10201 }
10202
10203
10205 {
10206
10207 float weightEx = GetWeightEx();
10208 float special = GetInventoryAndCargoWeight();
10209 return weightEx - special;
10210 }
10211
10212
10214 {
10216 }
10217
10219 {
10221 {
10222 #ifdef DEVELOPER
10223 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10224 {
10225 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10227 }
10228 #endif
10229
10230 return GetQuantity() * GetConfigWeightModified();
10231 }
10232 else if (HasEnergyManager())
10233 {
10234 #ifdef DEVELOPER
10235 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10236 {
10237 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10238 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10239 }
10240 #endif
10241 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
10242 }
10243 else
10244 {
10245 #ifdef DEVELOPER
10246 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10247 {
10248 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10249 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10250 }
10251 #endif
10252 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified());
10253 }
10254 }
10255
10258 {
10259 int item_count = 0;
10261
10262 if (GetInventory().GetCargo() != NULL)
10263 {
10264 item_count = GetInventory().GetCargo().GetItemCount();
10265 }
10266
10267 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10268 {
10269 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10270 if (item)
10271 item_count += item.GetNumberOfItems();
10272 }
10273 return item_count;
10274 }
10275
10278 {
10279 float weight = 0;
10280 float wetness = 1;
10281 if (include_wetness)
10284 {
10285 weight = wetness * m_ConfigWeight;
10286 }
10288 {
10289 weight = 1;
10290 }
10291 return weight;
10292 }
10293
10294
10295
10297 {
10298 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
10299 {
10300 GameInventory inv = GetInventory();
10301 array<EntityAI> items = new array<EntityAI>;
10303 for (int i = 0; i < items.Count(); i++)
10304 {
10306 if (item)
10307 {
10309 }
10310 }
10311 }
10312 }
10313
10314
10315
10316
10318 {
10319 float energy = 0;
10320 if (HasEnergyManager())
10321 {
10322 energy = GetCompEM().GetEnergy();
10323 }
10324 return energy;
10325 }
10326
10327
10329 {
10330 super.OnEnergyConsumed();
10331
10333 }
10334
10336 {
10337 super.OnEnergyAdded();
10338
10340 }
10341
10342
10344 {
10345 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10346 {
10348 {
10349 float energy_0to1 = GetCompEM().GetEnergy0To1();
10351 }
10352 }
10353 }
10354
10355
10357 {
10358 return ConfigGetFloat("heatIsolation");
10359 }
10360
10362 {
10364 }
10365
10367 {
10368 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10369 if (
GetGame().ConfigIsExisting(paramPath))
10371
10372 return 0.0;
10373 }
10374
10376 {
10377 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10378 if (
GetGame().ConfigIsExisting(paramPath))
10380
10381 return 0.0;
10382 }
10383
10384 override void SetWet(
float value,
bool allow_client =
false)
10385 {
10386 if (!IsServerCheck(allow_client))
10387 return;
10388
10391
10393
10394 m_VarWet = Math.Clamp(value, min, max);
10395
10397 {
10400 }
10401 }
10402
10403 override void AddWet(
float value)
10404 {
10406 }
10407
10409 {
10411 }
10412
10414 {
10416 }
10417
10419 {
10421 }
10422
10424 {
10426 }
10427
10429 {
10431 }
10432
10433 override void OnWetChanged(
float newVal,
float oldVal)
10434 {
10437 if (newLevel != oldLevel)
10438 {
10440 }
10441 }
10442
10444 {
10445 SetWeightDirty();
10446 }
10447
10449 {
10450 return GetWetLevelInternal(
m_VarWet);
10451 }
10452
10453
10454
10456 {
10458 }
10459
10461 {
10463 }
10464
10466 {
10468 }
10469
10471 {
10473 }
10474
10475
10476
10478 {
10479 if (ConfigIsExisting("itemModelLength"))
10480 {
10481 return ConfigGetFloat("itemModelLength");
10482 }
10483 return 0;
10484 }
10485
10487 {
10488 if (ConfigIsExisting("itemAttachOffset"))
10489 {
10490 return ConfigGetFloat("itemAttachOffset");
10491 }
10492 return 0;
10493 }
10494
10495 override void SetCleanness(
int value,
bool allow_client =
false)
10496 {
10497 if (!IsServerCheck(allow_client))
10498 return;
10499
10501
10503
10506 }
10507
10509 {
10511 }
10512
10514 {
10515 return true;
10516 }
10517
10518
10519
10520
10522 {
10524 }
10525
10527 {
10529 }
10530
10531
10532
10533
10534 override void SetColor(
int r,
int g,
int b,
int a)
10535 {
10541 }
10543 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10544 {
10549 }
10550
10552 {
10554 }
10555
10558 {
10559 int r,g,b,a;
10561 r = r/255;
10562 g = g/255;
10563 b = b/255;
10564 a = a/255;
10565 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10566 }
10567
10568
10569
10570 override void SetLiquidType(
int value,
bool allow_client =
false)
10571 {
10572 if (!IsServerCheck(allow_client))
10573 return;
10574
10579 }
10580
10582 {
10583 return ConfigGetInt("varLiquidTypeInit");
10584 }
10585
10587 {
10589 }
10590
10592 {
10594 SetFrozen(false);
10595 }
10596
10599 {
10600 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10601 }
10602
10603
10606 {
10607 PlayerBase nplayer;
10608 if (PlayerBase.CastTo(nplayer, player))
10609 {
10611
10612 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10613 }
10614 }
10615
10616
10619 {
10620 PlayerBase nplayer;
10621 if (PlayerBase.CastTo(nplayer,player))
10622 {
10623
10624 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10625
10626 }
10627
10628
10629 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10630
10631
10632 if (HasEnergyManager())
10633 {
10634 GetCompEM().UpdatePlugState();
10635 }
10636 }
10637
10638
10640 {
10641 super.OnPlacementStarted(player);
10642
10644 }
10645
10646 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10647 {
10649 {
10650 m_AdminLog.OnPlacementComplete(player,
this);
10651 }
10652
10653 super.OnPlacementComplete(player, position, orientation);
10654 }
10655
10656
10657
10658
10659
10661 {
10663 {
10664 return true;
10665 }
10666 else
10667 {
10668 return false;
10669 }
10670 }
10671
10672
10674 {
10676 {
10678 }
10679 }
10680
10681
10683 {
10685 }
10686
10688 {
10690 }
10691
10692 override void InsertAgent(
int agent,
float count = 1)
10693 {
10694 if (count < 1)
10695 return;
10696
10698 }
10699
10702 {
10704 }
10705
10706
10708 {
10710 }
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10754 {
10756 return false;
10757 return true;
10758 }
10759
10761 {
10762
10764 }
10765
10766
10769 {
10770 super.CheckForRoofLimited(timeTresholdMS);
10771
10773 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10774 {
10775 m_PreviousRoofTestTime = time;
10776 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10777 }
10778 }
10779
10780
10782 {
10784 {
10785 return 0;
10786 }
10787
10788 if (GetInventory().GetAttachmentSlotsCount() != 0)
10789 {
10790 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10791 if (filter)
10792 return filter.GetProtectionLevel(type, false, system);
10793 else
10794 return 0;
10795 }
10796
10797 string subclassPath, entryName;
10798
10799 switch (type)
10800 {
10802 entryName = "biological";
10803 break;
10805 entryName = "chemical";
10806 break;
10807 default:
10808 entryName = "biological";
10809 break;
10810 }
10811
10812 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10813
10815 }
10816
10817
10818
10821 {
10822 if (!IsMagazine())
10824
10826 }
10827
10828
10829
10830
10831
10836 {
10837 return true;
10838 }
10839
10841 {
10843 }
10844
10845
10846
10847
10848
10850 {
10851 if (parent)
10852 {
10853 if (parent.IsInherited(DayZInfected))
10854 return true;
10855
10856 if (!parent.IsRuined())
10857 return true;
10858 }
10859
10860 return true;
10861 }
10862
10864 {
10865 if (!super.CanPutAsAttachment(parent))
10866 {
10867 return false;
10868 }
10869
10870 if (!IsRuined() && !parent.IsRuined())
10871 {
10872 return true;
10873 }
10874
10875 return false;
10876 }
10877
10879 {
10880
10881
10882
10883
10884 return super.CanReceiveItemIntoCargo(item);
10885 }
10886
10888 {
10889
10890
10891
10892
10893 GameInventory attachmentInv = attachment.GetInventory();
10895 {
10896 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10897 return false;
10898 }
10899
10900 InventoryLocation loc = new InventoryLocation();
10901 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10902 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10903 return false;
10904
10905 return super.CanReceiveAttachment(attachment, slotId);
10906 }
10907
10909 {
10910 if (!super.CanReleaseAttachment(attachment))
10911 return false;
10912
10913 return GetInventory().AreChildrenAccessible();
10914 }
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10937 {
10938 int id = muzzle_owner.GetMuzzleID();
10939 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10940
10941 if (WPOF_array)
10942 {
10943 for (int i = 0; i < WPOF_array.Count(); i++)
10944 {
10945 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10946
10947 if (WPOF)
10948 {
10949 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10950 }
10951 }
10952 }
10953 }
10954
10955
10957 {
10958 int id = muzzle_owner.GetMuzzleID();
10960
10961 if (WPOBE_array)
10962 {
10963 for (int i = 0; i < WPOBE_array.Count(); i++)
10964 {
10965 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10966
10967 if (WPOBE)
10968 {
10969 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10970 }
10971 }
10972 }
10973 }
10974
10975
10977 {
10978 int id = muzzle_owner.GetMuzzleID();
10979 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10980
10981 if (WPOOH_array)
10982 {
10983 for (int i = 0; i < WPOOH_array.Count(); i++)
10984 {
10985 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10986
10987 if (WPOOH)
10988 {
10989 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10990 }
10991 }
10992 }
10993 }
10994
10995
10997 {
10998 int id = muzzle_owner.GetMuzzleID();
10999 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11000
11001 if (WPOOH_array)
11002 {
11003 for (int i = 0; i < WPOOH_array.Count(); i++)
11004 {
11005 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11006
11007 if (WPOOH)
11008 {
11009 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11010 }
11011 }
11012 }
11013 }
11014
11015
11017 {
11018 int id = muzzle_owner.GetMuzzleID();
11019 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11020
11021 if (WPOOH_array)
11022 {
11023 for (int i = 0; i < WPOOH_array.Count(); i++)
11024 {
11025 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11026
11027 if (WPOOH)
11028 {
11029 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11030 }
11031 }
11032 }
11033 }
11034
11035
11036
11038 {
11040 {
11041 return true;
11042 }
11043
11044 return false;
11045 }
11046
11048 {
11050 {
11051 return true;
11052 }
11053
11054 return false;
11055 }
11056
11058 {
11060 {
11061 return true;
11062 }
11063
11064 return false;
11065 }
11066
11068 {
11069 return false;
11070 }
11071
11074 {
11075 return UATimeSpent.DEFAULT_DEPLOY;
11076 }
11077
11078
11079
11080
11082 {
11084 SetSynchDirty();
11085 }
11086
11088 {
11090 }
11091
11092
11094 {
11095 return false;
11096 }
11097
11100 {
11101 string att_type = "None";
11102
11103 if (ConfigIsExisting("soundAttType"))
11104 {
11105 att_type = ConfigGetString("soundAttType");
11106 }
11107
11109 }
11110
11112 {
11114 }
11115
11116
11117
11118
11119
11123
11125 {
11128
11130 }
11131
11132
11134 {
11136 return;
11137
11139
11142
11145
11146 SoundParameters params = new SoundParameters();
11150 }
11151
11152
11154 {
11156 return;
11157
11159 SetSynchDirty();
11160
11163 }
11164
11165
11167 {
11169 return;
11170
11172 SetSynchDirty();
11173
11176 }
11177
11179 {
11181 }
11182
11184 {
11186 }
11187
11190 {
11191 if (!
GetGame().IsDedicatedServer())
11192 {
11193 if (ConfigIsExisting("attachSoundSet"))
11194 {
11195 string cfg_path = "";
11196 string soundset = "";
11197 string type_name =
GetType();
11198
11201 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11202 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11203
11204 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11205 {
11206 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11207 {
11208 if (cfg_slot_array[i] == slot_type)
11209 {
11210 soundset = cfg_soundset_array[i];
11211 break;
11212 }
11213 }
11214 }
11215
11216 if (soundset != "")
11217 {
11218 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11220 }
11221 }
11222 }
11223 }
11224
11226 {
11227
11228 }
11229
11230 void OnApply(PlayerBase player);
11231
11233 {
11234 return 1.0;
11235 };
11236
11238 {
11240 }
11241
11243 {
11245 }
11246
11248
11250 {
11251 SetDynamicPhysicsLifeTime(0.01);
11253 }
11254
11256 {
11257 array<string> zone_names = new array<string>;
11258 GetDamageZones(zone_names);
11259 for (int i = 0; i < zone_names.Count(); i++)
11260 {
11261 SetHealthMax(zone_names.Get(i),"Health");
11262 }
11263 SetHealthMax("","Health");
11264 }
11265
11268 {
11269 float global_health = GetHealth01("","Health");
11270 array<string> zones = new array<string>;
11271 GetDamageZones(zones);
11272
11273 for (int i = 0; i < zones.Count(); i++)
11274 {
11275 SetHealth01(zones.Get(i),"Health",global_health);
11276 }
11277 }
11278
11281 {
11282 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11283 }
11284
11286 {
11287 if (!hasRootAsPlayer)
11288 {
11289 if (refParentIB)
11290 {
11291
11292 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11293 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11294
11295 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11296 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11297
11300 }
11301 else
11302 {
11303
11306 }
11307 }
11308 }
11309
11311 {
11313 {
11314 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11315 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
11316 {
11317 float heatPermCoef = 1.0;
11319 while (ent)
11320 {
11321 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11322 ent = ent.GetHierarchyParent();
11323 }
11324
11325 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11326 }
11327 }
11328 }
11329
11331 {
11332
11333 EntityAI parent = GetHierarchyParent();
11334 if (!parent)
11335 {
11336 hasParent = false;
11337 hasRootAsPlayer = false;
11338 }
11339 else
11340 {
11341 hasParent = true;
11342 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11343 refParentIB =
ItemBase.Cast(parent);
11344 }
11345 }
11346
11347 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11348 {
11349
11350 }
11351
11353 {
11354
11355 return false;
11356 }
11357
11359 {
11360
11361
11362 return false;
11363 }
11364
11366 {
11367
11368 return false;
11369 }
11370
11373 {
11374 return !GetIsFrozen() &&
IsOpen();
11375 }
11376
11378 {
11379 bool hasParent = false, hasRootAsPlayer = false;
11381
11382 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11383 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11384
11385 if (wwtu || foodDecay)
11386 {
11390
11391 if (processWetness || processTemperature || processDecay)
11392 {
11394
11395 if (processWetness)
11396 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11397
11398 if (processTemperature)
11400
11401 if (processDecay)
11402 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11403 }
11404 }
11405 }
11406
11409 {
11411 }
11412
11414 {
11417
11418 return super.GetTemperatureFreezeThreshold();
11419 }
11420
11422 {
11425
11426 return super.GetTemperatureThawThreshold();
11427 }
11428
11430 {
11433
11434 return super.GetItemOverheatThreshold();
11435 }
11436
11438 {
11440 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11441
11442 return super.GetTemperatureFreezeTime();
11443 }
11444
11446 {
11448 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11449
11450 return super.GetTemperatureThawTime();
11451 }
11452
11457
11459 {
11460 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11461 }
11462
11464 {
11465 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11466 }
11467
11470 {
11472 }
11473
11475 {
11477 }
11478
11480 {
11482 }
11483
11486 {
11487 return null;
11488 }
11489
11492 {
11493 return false;
11494 }
11495
11497 {
11499 {
11502 if (!trg)
11503 {
11505 explosive = this;
11506 }
11507
11508 explosive.PairRemote(trg);
11510
11511 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11512 trg.SetPersistentPairID(persistentID);
11513 explosive.SetPersistentPairID(persistentID);
11514
11515 return true;
11516 }
11517 return false;
11518 }
11519
11522 {
11523 float ret = 1.0;
11526 ret *= GetHealth01();
11527
11528 return ret;
11529 }
11530
11531 #ifdef DEVELOPER
11532 override void SetDebugItem()
11533 {
11534 super.SetDebugItem();
11535 _itemBase = this;
11536 }
11537
11539 {
11540 string text = super.GetDebugText();
11541
11543 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11544
11545 return text;
11546 }
11547 #endif
11548
11550 {
11551 return true;
11552 }
11553
11555
11557
11559 {
11562 }
11563
11564
11572
11588}
11589
11591{
11593 if (entity)
11594 {
11595 bool is_item = entity.IsInherited(
ItemBase);
11596 if (is_item && full_quantity)
11597 {
11600 }
11601 }
11602 else
11603 {
11605 return NULL;
11606 }
11607 return entity;
11608}
11609
11611{
11612 if (item)
11613 {
11614 if (health > 0)
11615 item.SetHealth("", "", health);
11616
11617 if (item.CanHaveTemperature())
11618 {
11620 if (item.CanFreeze())
11621 item.SetFrozen(false);
11622 }
11623
11624 if (item.HasEnergyManager())
11625 {
11626 if (quantity >= 0)
11627 {
11628 item.GetCompEM().SetEnergy0To1(quantity);
11629 }
11630 else
11631 {
11633 }
11634 }
11635 else if (item.IsMagazine())
11636 {
11637 Magazine mag = Magazine.Cast(item);
11638 if (quantity >= 0)
11639 {
11640 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11641 }
11642 else
11643 {
11645 }
11646
11647 }
11648 else
11649 {
11650 if (quantity >= 0)
11651 {
11652 item.SetQuantityNormalized(quantity, false);
11653 }
11654 else
11655 {
11657 }
11658
11659 }
11660 }
11661}
11662
11663#ifdef DEVELOPER
11665#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
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
DamageType
exposed from C++ (do not change)
PluginAdminLog m_AdminLog
override bool IsExplosive()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
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
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 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...
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)
void StartItemSoundServer(int id)
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)
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)
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
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)
void Open()
Implementations only.
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 EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
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)
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
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 bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
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
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
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 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 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 void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, 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)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
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
proto native CGame GetGame()
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
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
class JsonUndergroundAreaTriggerData GetPosition
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.