Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChanged(item); first when overriding this event.
6807{
6809 {
6810 return true;
6811 }
6812};
6813
6814
6815
6817{
6821
6823
6826
6827
6828
6829
6830
6839
6845
6850
6855
6876 protected bool m_IsResultOfSplit
6877
6879
6884
6885
6886
6888
6892
6893
6894
6896
6899
6900
6901
6907
6908
6916
6919
6920
6922
6923
6925
6926
6931
6932
6937
6938
6940
6941
6943 {
6948
6949 if (!
GetGame().IsDedicatedServer())
6950 {
6952 {
6954
6956 {
6958 }
6959 }
6960
6963 }
6964
6965 m_OldLocation = null;
6966
6968 {
6970 }
6971
6972 if (ConfigIsExisting("headSelectionsToHide"))
6973 {
6976 }
6977
6979 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6980 {
6982 }
6983
6985
6986 m_IsResultOfSplit = false;
6987
6989 }
6990
6992 {
6993 super.InitItemVariables();
6994
7000 m_Count = ConfigGetInt(
"count");
7001
7004
7009
7012
7017
7029
7033
7034
7037 if (ConfigIsExisting("canBeSplit"))
7038 {
7041 }
7042
7044 if (ConfigIsExisting("itemBehaviour"))
7046
7047
7050 RegisterNetSyncVariableInt("m_VarLiquidType");
7051 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7052
7053 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7054 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7055 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7056
7057 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7058 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7059 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7060 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7061
7062 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7063 RegisterNetSyncVariableBool("m_IsTakeable");
7064 RegisterNetSyncVariableBool("m_IsHologram");
7065
7068 {
7071 }
7072
7074
7076 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7078
7079 }
7080
7082 {
7084 }
7085
7087 {
7090 {
7095 }
7096 }
7097
7098 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7099 {
7101 {
7104 }
7105
7107 }
7108
7110 {
7116 }
7117
7119
7121 {
7123
7124 if (!action)
7125 {
7126 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7127 return;
7128 }
7129
7131 if (!ai)
7132 {
7134 return;
7135 }
7136
7138 if (!action_array)
7139 {
7140 action_array = new array<ActionBase_Basic>;
7142 }
7143 if (LogManager.IsActionLogEnable())
7144 {
7145 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7146 }
7147
7148 if (action_array.Find(action) != -1)
7149 {
7150 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7151 }
7152 else
7153 {
7154 action_array.Insert(action);
7155 }
7156 }
7157
7159 {
7161 ActionBase action = player.GetActionManager().GetAction(actionName);
7164
7165 if (action_array)
7166 {
7167 action_array.RemoveItem(action);
7168 }
7169 }
7170
7171
7172
7174 {
7175 ActionOverrideData overrideData = new ActionOverrideData();
7179
7181 if (!actionMap)
7182 {
7185 }
7186
7187 actionMap.Insert(this.
Type(), overrideData);
7188
7189 }
7190
7192
7194
7195
7197 {
7200
7203
7204 string config_to_search = "CfgVehicles";
7205 string muzzle_owner_config;
7206
7208 {
7209 if (IsInherited(Weapon))
7210 config_to_search = "CfgWeapons";
7211
7212 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7213
7214 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7215
7217
7218 if (config_OnFire_subclass_count > 0)
7219 {
7220 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7221
7222 for (int i = 0; i < config_OnFire_subclass_count; i++)
7223 {
7224 string particle_class = "";
7226 string config_OnFire_entry = config_OnFire_class + particle_class;
7227 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7228 WPOF_array.Insert(WPOF);
7229 }
7230
7231
7233 }
7234 }
7235
7237 {
7238 config_to_search = "CfgWeapons";
7239 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7240
7241 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7242
7244
7245 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7246 {
7247 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7248
7249 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7250 {
7251 string particle_class2 = "";
7253 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7254 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7255 WPOBE_array.Insert(WPOBE);
7256 }
7257
7258
7260 }
7261 }
7262 }
7263
7264
7266 {
7269
7271 {
7272 string config_to_search = "CfgVehicles";
7273
7274 if (IsInherited(Weapon))
7275 config_to_search = "CfgWeapons";
7276
7277 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7278 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7279
7280 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
7281 {
7282
7284
7286 {
7288 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7290 return;
7291 }
7292
7295
7296
7297
7299 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7300
7301 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7302 {
7303 string particle_class = "";
7305 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7307
7308 if (entry_type == CT_CLASS)
7309 {
7310 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7311 WPOOH_array.Insert(WPOF);
7312 }
7313 }
7314
7315
7317 }
7318 }
7319 }
7320
7322 {
7324 }
7325
7327 {
7329 {
7331
7334
7337
7338 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7339 }
7340 }
7341
7343 {
7345 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7346
7348 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7349
7351 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7352
7354 {
7356 }
7357 }
7358
7360 {
7362 }
7363
7365 {
7368 else
7370
7372 {
7375 }
7376 else
7377 {
7380
7383 }
7384
7386 }
7387
7389 {
7391 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7392 }
7393
7395 {
7397 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7399 }
7400
7402 {
7404 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7405 }
7406
7408 {
7411
7412 OverheatingParticle OP = new OverheatingParticle();
7417
7419 }
7420
7422 {
7425
7426 return -1;
7427 }
7428
7430 {
7432 {
7435
7436 for (int i = count; i > 0; --i)
7437 {
7438 int id = i - 1;
7441
7444
7445 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7446 {
7447 if (p)
7448 {
7451 }
7452 }
7453 }
7454 }
7455 }
7456
7458 {
7460 {
7462 {
7463 int id = i - 1;
7465
7466 if (OP)
7467 {
7469
7470 if (p)
7471 {
7473 }
7474
7475 delete OP;
7476 }
7477 }
7478
7481 }
7482 }
7483
7486 {
7487 return 0.0;
7488 }
7489
7490
7492 {
7493 return 250;
7494 }
7495
7497 {
7498 return 0;
7499 }
7500
7503 {
7505 return true;
7506
7507 return false;
7508 }
7509
7512 {
7515
7517 {
7519 }
7520 else
7521 {
7522
7524 }
7525
7527 }
7528
7535 {
7536 return -1;
7537 }
7538
7539
7540
7541
7543 {
7545 {
7547 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7548
7549 if (r_index >= 0)
7550 {
7551 InventoryLocation r_il = new InventoryLocation;
7552 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7553
7554 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7557 {
7558 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7559 }
7561 {
7562 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7563 }
7564
7565 }
7566
7567 player.GetHumanInventory().ClearUserReservedLocation(this);
7568 }
7569
7572 }
7573
7574
7575
7576
7578 {
7579 return ItemBase.m_DebugActionsMask;
7580 }
7581
7583 {
7584 return ItemBase.m_DebugActionsMask & mask;
7585 }
7586
7588 {
7589 ItemBase.m_DebugActionsMask = mask;
7590 }
7591
7593 {
7594 ItemBase.m_DebugActionsMask |= mask;
7595 }
7596
7598 {
7599 ItemBase.m_DebugActionsMask &= ~mask;
7600 }
7601
7603 {
7605 {
7607 }
7608 else
7609 {
7611 }
7612 }
7613
7614
7616 {
7617 if (GetEconomyProfile())
7618 {
7619 float q_max = GetEconomyProfile().GetQuantityMax();
7620 if (q_max > 0)
7621 {
7622 float q_min = GetEconomyProfile().GetQuantityMin();
7623 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7624
7626 {
7627 ComponentEnergyManager comp = GetCompEM();
7629 {
7631 }
7632 }
7634 {
7636
7637 }
7638
7639 }
7640 }
7641 }
7642
7645 {
7646 EntityAI parent = GetHierarchyParent();
7647
7648 if (parent)
7649 {
7650 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7651 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7652 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7653 }
7654 }
7655
7658 {
7659 EntityAI parent = GetHierarchyParent();
7660
7661 if (parent)
7662 {
7663 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7664 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7665 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7666 }
7667 }
7668
7670 {
7671
7672
7673
7674
7676
7678 {
7679 if (ScriptInputUserData.CanStoreInputUserData())
7680 {
7681 ScriptInputUserData ctx = new ScriptInputUserData;
7687 ctx.
Write(use_stack_max);
7690
7692 {
7693 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7694 }
7695 }
7696 }
7697 else if (!
GetGame().IsMultiplayer())
7698 {
7700 }
7701 }
7702
7704 {
7706 }
7707
7709 {
7711 }
7712
7714 {
7716 }
7717
7719 {
7720
7721 return false;
7722 }
7723
7725 {
7726 return false;
7727 }
7728
7732 {
7733 return false;
7734 }
7735
7737 {
7738 return "";
7739 }
7740
7742
7744 {
7745 return false;
7746 }
7747
7749 {
7750 return true;
7751 }
7752
7753
7754
7756 {
7757 return true;
7758 }
7759
7761 {
7762 return true;
7763 }
7764
7766 {
7767 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7769 }
7770
7772 {
7774 }
7775
7777 {
7779 if (!is_being_placed)
7781 SetSynchDirty();
7782 }
7783
7784
7786
7788 {
7790 }
7791
7793 {
7795 }
7796
7798 {
7799 return 1;
7800 }
7801
7803 {
7804 return false;
7805 }
7806
7808 {
7810 SetSynchDirty();
7811 }
7812
7813
7814
7815
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
7848 {
7849 super.OnMovedInsideCargo(container);
7850
7851 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7852 }
7853
7854 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7855 {
7856 super.EEItemLocationChanged(oldLoc,newLoc);
7857
7858 PlayerBase new_player = null;
7859 PlayerBase old_player = null;
7860
7861 if (newLoc.GetParent())
7862 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7863
7864 if (oldLoc.GetParent())
7865 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7866
7868 {
7869 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7870
7871 if (r_index >= 0)
7872 {
7873 InventoryLocation r_il = new InventoryLocation;
7874 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7875
7876 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7879 {
7880 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7881 }
7883 {
7884 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7885 }
7886
7887 }
7888 }
7889
7891 {
7892 if (new_player)
7893 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7894
7895 if (new_player == old_player)
7896 {
7897
7898 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7899 {
7901 {
7902 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7903 {
7904 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7905 }
7906 }
7907 else
7908 {
7909 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7910 }
7911 }
7912
7913 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7914 {
7915 int type = oldLoc.GetType();
7917 {
7918 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7919 }
7921 {
7922 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7923 }
7924 }
7925 if (!m_OldLocation)
7926 {
7927 m_OldLocation = new InventoryLocation;
7928 }
7929 m_OldLocation.Copy(oldLoc);
7930 }
7931 else
7932 {
7933 if (m_OldLocation)
7934 {
7935 m_OldLocation.Reset();
7936 }
7937 }
7938
7940 }
7941 else
7942 {
7943 if (new_player)
7944 {
7945 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7946 if (res_index >= 0)
7947 {
7948 InventoryLocation il = new InventoryLocation;
7949 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7951 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7954 {
7955 il.
GetParent().GetOnReleaseLock().Invoke(it);
7956 }
7958 {
7960 }
7961
7962 }
7963 }
7965 {
7966
7968 }
7969
7970 if (m_OldLocation)
7971 {
7972 m_OldLocation.Reset();
7973 }
7974 }
7975 }
7976
7977 override void EOnContact(IEntity other, Contact extra)
7978 {
7980 {
7981 int liquidType = -1;
7983 if (impactSpeed > 0.0)
7984 {
7986 #ifndef SERVER
7988 #else
7990 SetSynchDirty();
7991 #endif
7993 }
7994 }
7995
7996 #ifdef SERVER
7997 if (GetCompEM() && GetCompEM().IsPlugged())
7998 {
7999 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8000 GetCompEM().UnplugThis();
8001 }
8002 #endif
8003 }
8004
8006
8008 {
8010 }
8011
8013 {
8014
8015 }
8016
8018 {
8019 super.OnItemLocationChanged(old_owner, new_owner);
8020
8021 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8022 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8023
8024 if (!relatedPlayer && playerNew)
8025 relatedPlayer = playerNew;
8026
8027 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8028 {
8030 if (actionMgr)
8031 {
8032 ActionBase currentAction = actionMgr.GetRunningAction();
8033 if (currentAction)
8035 }
8036 }
8037
8038 Man ownerPlayerOld = null;
8039 Man ownerPlayerNew = null;
8040
8041 if (old_owner)
8042 {
8043 if (old_owner.
IsMan())
8044 {
8045 ownerPlayerOld = Man.Cast(old_owner);
8046 }
8047 else
8048 {
8049 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8050 }
8051 }
8052 else
8053 {
8055 {
8057
8058 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8059 {
8060 GetCompEM().UnplugThis();
8061 }
8062 }
8063 }
8064
8065 if (new_owner)
8066 {
8067 if (new_owner.
IsMan())
8068 {
8069 ownerPlayerNew = Man.Cast(new_owner);
8070 }
8071 else
8072 {
8073 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8074 }
8075 }
8076
8077 if (ownerPlayerOld != ownerPlayerNew)
8078 {
8079 if (ownerPlayerOld)
8080 {
8081 array<EntityAI> subItemsExit = new array<EntityAI>;
8083 for (int i = 0; i < subItemsExit.Count(); i++)
8084 {
8087 }
8088 }
8089
8090 if (ownerPlayerNew)
8091 {
8092 array<EntityAI> subItemsEnter = new array<EntityAI>;
8094 for (int j = 0; j < subItemsEnter.Count(); j++)
8095 {
8098 }
8099 }
8100 }
8101 else if (ownerPlayerNew != null)
8102 {
8103 PlayerBase nplayer;
8104 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8105 {
8106 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8108 for (int k = 0; k < subItemsUpdate.Count(); k++)
8109 {
8111 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8112 }
8113 }
8114 }
8115
8116 if (old_owner)
8117 old_owner.OnChildItemRemoved(this);
8118 if (new_owner)
8119 new_owner.OnChildItemReceived(this);
8120 }
8121
8122
8124 {
8125 super.EEDelete(parent);
8126 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8127 if (player)
8128 {
8130
8131 if (player.IsAlive())
8132 {
8133 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8134 if (r_index >= 0)
8135 {
8136 InventoryLocation r_il = new InventoryLocation;
8137 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8138
8139 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8142 {
8143 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8144 }
8146 {
8147 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8148 }
8149
8150 }
8151
8152 player.RemoveQuickBarEntityShortcut(this);
8153 }
8154 }
8155 }
8156
8158 {
8159 super.EEKilled(killer);
8160
8163 {
8164 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8165 {
8166 if (IsMagazine())
8167 {
8168 if (Magazine.Cast(this).GetAmmoCount() > 0)
8169 {
8171 }
8172 }
8173 else
8174 {
8176 }
8177 }
8178 }
8179 }
8180
8182 {
8183 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8184
8185 super.OnWasAttached(parent, slot_id);
8186
8189
8191 }
8192
8194 {
8195 super.OnWasDetached(parent, slot_id);
8196
8199 }
8200
8202 {
8203 int idx;
8206
8207 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8208 if (inventory_slots.Count() < 1)
8209 {
8210 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8211 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8212 }
8213 else
8214 {
8215 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8216 }
8217
8218 idx = inventory_slots.Find(slot);
8219 if (idx < 0)
8220 return "";
8221
8222 return attach_types.Get(idx);
8223 }
8224
8226 {
8227 int idx = -1;
8228 string slot;
8229
8232
8233 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8234 if (inventory_slots.Count() < 1)
8235 {
8236 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8237 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8238 }
8239 else
8240 {
8241 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8242 if (detach_types.Count() < 1)
8243 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8244 }
8245
8246 for (int i = 0; i < inventory_slots.Count(); i++)
8247 {
8248 slot = inventory_slots.Get(i);
8249 }
8250
8251 if (slot != "")
8252 {
8253 if (detach_types.Count() == 1)
8254 idx = 0;
8255 else
8256 idx = inventory_slots.Find(slot);
8257 }
8258 if (idx < 0)
8259 return "";
8260
8261 return detach_types.Get(idx);
8262 }
8263
8265 {
8266
8268
8269
8270 float min_time = 1;
8271 float max_time = 3;
8272 float delay = Math.RandomFloat(min_time, max_time);
8273
8274 explode_timer.Run(delay, this, "DoAmmoExplosion");
8275 }
8276
8278 {
8279 Magazine magazine = Magazine.Cast(this);
8280 int pop_sounds_count = 6;
8281 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8282
8283
8284 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8285 string sound_name = pop_sounds[ sound_idx ];
8287
8288
8289 magazine.ServerAddAmmoCount(-1);
8290
8291
8292 float min_temp_to_explode = 100;
8293
8294 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode)
8295 {
8297 }
8298 }
8299
8300
8301 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8302 {
8303 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8304
8305 const int CHANCE_DAMAGE_CARGO = 4;
8306 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8307 const int CHANCE_DAMAGE_NOTHING = 2;
8308
8310 {
8311 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8312 int chances;
8313 int rnd;
8314
8315 if (GetInventory().GetCargo())
8316 {
8317 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8318 rnd = Math.RandomInt(0,chances);
8319
8320 if (rnd < CHANCE_DAMAGE_CARGO)
8321 {
8323 }
8324 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8325 {
8327 }
8328 }
8329 else
8330 {
8331 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8332 rnd = Math.RandomInt(0,chances);
8333
8334 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8335 {
8337 }
8338 }
8339 }
8340 }
8341
8343 {
8344 if (GetInventory().GetCargo())
8345 {
8346 int item_count = GetInventory().GetCargo().GetItemCount();
8347 if (item_count > 0)
8348 {
8349 int random_pick = Math.RandomInt(0, item_count);
8351 if (!item.IsExplosive())
8352 {
8353 item.AddHealth("","",damage);
8354 return true;
8355 }
8356 }
8357 }
8358 return false;
8359 }
8360
8362 {
8363 int attachment_count = GetInventory().AttachmentCount();
8364 if (attachment_count > 0)
8365 {
8366 int random_pick = Math.RandomInt(0, attachment_count);
8367 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8368 if (!attachment.IsExplosive())
8369 {
8370 attachment.AddHealth("","",damage);
8371 return true;
8372 }
8373 }
8374 return false;
8375 }
8376
8378 {
8380 }
8381
8383 {
8385 return GetInventory().CanRemoveEntity();
8386
8387 return false;
8388 }
8389
8391 {
8393 return;
8394
8396 {
8397 if (ScriptInputUserData.CanStoreInputUserData())
8398 {
8399 ScriptInputUserData ctx = new ScriptInputUserData;
8404 ctx.
Write(destination_entity);
8408 }
8409 }
8410 else if (!
GetGame().IsMultiplayer())
8411 {
8413 }
8414 }
8415
8417 {
8419 return;
8420
8421 float split_quantity_new;
8425 InventoryLocation loc = new InventoryLocation;
8426
8427 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8428 {
8430 split_quantity_new = stack_max;
8431 else
8433
8434 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8435 if (new_item)
8436 {
8437 new_item.SetResultOfSplit(true);
8438 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8440 new_item.SetQuantity(split_quantity_new);
8441 }
8442 }
8443 else if (destination_entity && slot_id == -1)
8444 {
8445 if (quantity > stack_max)
8446 split_quantity_new = stack_max;
8447 else
8448 split_quantity_new = quantity;
8449
8451 {
8454 }
8455
8456 if (new_item)
8457 {
8458 new_item.SetResultOfSplit(true);
8459 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8461 new_item.SetQuantity(split_quantity_new);
8462 }
8463 }
8464 else
8465 {
8466 if (stack_max != 0)
8467 {
8469 {
8471 }
8472
8473 if (split_quantity_new == 0)
8474 {
8475 if (!
GetGame().IsMultiplayer())
8476 player.PhysicalPredictiveDropItem(this);
8477 else
8478 player.ServerDropEntity(this);
8479 return;
8480 }
8481
8483
8484 if (new_item)
8485 {
8486 new_item.SetResultOfSplit(true);
8487 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8489 new_item.SetQuantity(stack_max);
8490 new_item.PlaceOnSurface();
8491 }
8492 }
8493 }
8494 }
8495
8497 {
8499 return;
8500
8501 float split_quantity_new;
8505 InventoryLocation loc = new InventoryLocation;
8506
8507 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8508 {
8510 split_quantity_new = stack_max;
8511 else
8513
8514 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8515 if (new_item)
8516 {
8517 new_item.SetResultOfSplit(true);
8518 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8520 new_item.SetQuantity(split_quantity_new);
8521 }
8522 }
8523 else if (destination_entity && slot_id == -1)
8524 {
8525 if (quantity > stack_max)
8526 split_quantity_new = stack_max;
8527 else
8528 split_quantity_new = quantity;
8529
8531 {
8534 }
8535
8536 if (new_item)
8537 {
8538 new_item.SetResultOfSplit(true);
8539 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8541 new_item.SetQuantity(split_quantity_new);
8542 }
8543 }
8544 else
8545 {
8546 if (stack_max != 0)
8547 {
8549 {
8551 }
8552
8554
8555 if (new_item)
8556 {
8557 new_item.SetResultOfSplit(true);
8558 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8560 new_item.SetQuantity(stack_max);
8561 new_item.PlaceOnSurface();
8562 }
8563 }
8564 }
8565 }
8566
8568 {
8570 return;
8571
8573 {
8574 if (ScriptInputUserData.CanStoreInputUserData())
8575 {
8576 ScriptInputUserData ctx = new ScriptInputUserData;
8581 dst.WriteToContext(ctx);
8583 }
8584 }
8585 else if (!
GetGame().IsMultiplayer())
8586 {
8588 }
8589 }
8590
8592 {
8594 return;
8595
8597 {
8598 if (ScriptInputUserData.CanStoreInputUserData())
8599 {
8600 ScriptInputUserData ctx = new ScriptInputUserData;
8605 ctx.
Write(destination_entity);
8611 }
8612 }
8613 else if (!
GetGame().IsMultiplayer())
8614 {
8616 }
8617 }
8618
8620 {
8622 }
8623
8625 {
8627 return this;
8628
8630 float split_quantity_new;
8632 if (dst.IsValid())
8633 {
8634 int slot_id = dst.GetSlot();
8636
8637 if (quantity > stack_max)
8638 split_quantity_new = stack_max;
8639 else
8640 split_quantity_new = quantity;
8641
8643
8644 if (new_item)
8645 {
8646 new_item.SetResultOfSplit(true);
8647 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8650 }
8651
8652 return new_item;
8653 }
8654
8655 return null;
8656 }
8657
8659 {
8661 return;
8662
8664 float split_quantity_new;
8666 if (destination_entity)
8667 {
8669 if (quantity > stackable)
8670 split_quantity_new = stackable;
8671 else
8672 split_quantity_new = quantity;
8673
8674 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8675 if (new_item)
8676 {
8677 new_item.SetResultOfSplit(true);
8678 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8680 new_item.SetQuantity(split_quantity_new);
8681 }
8682 }
8683 }
8684
8686 {
8688 return;
8689
8691 {
8692 if (ScriptInputUserData.CanStoreInputUserData())
8693 {
8694 ScriptInputUserData ctx = new ScriptInputUserData;
8699 ItemBase destination_entity =
this;
8700 ctx.
Write(destination_entity);
8704 }
8705 }
8706 else if (!
GetGame().IsMultiplayer())
8707 {
8709 }
8710 }
8711
8713 {
8715 return;
8716
8718 float split_quantity_new;
8720 if (player)
8721 {
8723 if (quantity > stackable)
8724 split_quantity_new = stackable;
8725 else
8726 split_quantity_new = quantity;
8727
8728 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8729 new_item =
ItemBase.Cast(in_hands);
8730 if (new_item)
8731 {
8732 new_item.SetResultOfSplit(true);
8733 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8735 new_item.SetQuantity(split_quantity_new);
8736 }
8737 }
8738 }
8739
8741 {
8743 return;
8744
8746 float split_quantity_new = Math.Floor(quantity * 0.5);
8747
8749
8750 if (new_item)
8751 {
8752 if (new_item.GetQuantityMax() < split_quantity_new)
8753 {
8754 split_quantity_new = new_item.GetQuantityMax();
8755 }
8756
8757 new_item.SetResultOfSplit(true);
8758 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8759
8761 {
8764 }
8765 else
8766 {
8769 }
8770 }
8771 }
8772
8774 {
8776 return;
8777
8779 float split_quantity_new = Math.Floor(quantity / 2);
8780
8781 InventoryLocation invloc = new InventoryLocation;
8783
8785 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8786
8787 if (new_item)
8788 {
8789 if (new_item.GetQuantityMax() < split_quantity_new)
8790 {
8791 split_quantity_new = new_item.GetQuantityMax();
8792 }
8794 {
8797 }
8798 else
8799 {
8802 }
8803 }
8804 }
8805
8808 {
8809 SetWeightDirty();
8811
8812 if (parent)
8813 parent.OnAttachmentQuantityChangedEx(this, delta);
8814
8816 {
8818 {
8820 }
8822 {
8823 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8825 }
8826 }
8827
8828 }
8829
8832 {
8833
8834 }
8835
8838 {
8840 }
8841
8843 {
8844 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8845
8847 {
8848 if (newLevel == GameConstants.STATE_RUINED)
8849 {
8851 EntityAI parent = GetHierarchyParent();
8852 if (parent && parent.IsFireplace())
8853 {
8854 CargoBase cargo = GetInventory().GetCargo();
8855 if (cargo)
8856 {
8858 {
8860 }
8861 }
8862 }
8863 }
8864
8866 {
8867
8869 return;
8870 }
8871
8872 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8873 {
8875 }
8876 }
8877 }
8878
8879
8881 {
8882 super.OnRightClick();
8883
8885 {
8887 {
8888 if (ScriptInputUserData.CanStoreInputUserData())
8889 {
8890 vector m4[4];
8892
8893 EntityAI root = GetHierarchyRoot();
8894
8895 InventoryLocation dst = new InventoryLocation;
8897 {
8898 if (root)
8899 {
8900 root.GetTransform(m4);
8902 }
8903 else
8904 GetInventory().GetCurrentInventoryLocation(dst);
8905 }
8906 else
8907 {
8909
8910
8911 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8912 {
8913 if (root)
8914 {
8915 root.GetTransform(m4);
8917 }
8918 else
8919 GetInventory().GetCurrentInventoryLocation(dst);
8920 }
8921 else
8922 {
8923 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8924 }
8925 }
8926
8927 ScriptInputUserData ctx = new ScriptInputUserData;
8935 }
8936 }
8937 else if (!
GetGame().IsMultiplayer())
8938 {
8940 }
8941 }
8942 }
8943
8944 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8945 {
8946
8947 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8948 return false;
8949
8950 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8951 return false;
8952
8953
8955 return false;
8956
8957
8958 Magazine mag = Magazine.Cast(this);
8959 if (mag)
8960 {
8961 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8962 return false;
8963
8964 if (stack_max_limit)
8965 {
8966 Magazine other_mag = Magazine.Cast(other_item);
8967 if (other_item)
8968 {
8969 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8970 return false;
8971 }
8972
8973 }
8974 }
8975 else
8976 {
8977
8979 return false;
8980
8982 return false;
8983 }
8984
8985 PlayerBase player = null;
8986 if (CastTo(player, GetHierarchyRootPlayer()))
8987 {
8988 if (player.GetInventory().HasAttachment(this))
8989 return false;
8990
8991 if (player.IsItemsToDelete())
8992 return false;
8993 }
8994
8995 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8996 return false;
8997
8998 int slotID;
9000 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9001 return false;
9002
9003 return true;
9004 }
9005
9007 {
9009 }
9010
9012 {
9013 return m_IsResultOfSplit;
9014 }
9015
9017 {
9018 m_IsResultOfSplit = value;
9019 }
9020
9022 {
9024 }
9025
9027 {
9028 float other_item_quantity = other_item.GetQuantity();
9029 float this_free_space;
9030
9032
9034
9035 if (other_item_quantity > this_free_space)
9036 {
9037 return this_free_space;
9038 }
9039 else
9040 {
9041 return other_item_quantity;
9042 }
9043 }
9044
9046 {
9048 }
9049
9051 {
9053 return;
9054
9055 if (!IsMagazine() && other_item)
9056 {
9058 if (quantity_used != 0)
9059 {
9060 float hp1 = GetHealth01("","");
9061 float hp2 = other_item.GetHealth01("","");
9062 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9063 hpResult = hpResult / (
GetQuantity() + quantity_used);
9064
9065 hpResult *= GetMaxHealth();
9066 Math.Round(hpResult);
9067 SetHealth("", "Health", hpResult);
9068
9070 other_item.AddQuantity(-quantity_used);
9071 }
9072 }
9074 }
9075
9077 {
9078 #ifdef SERVER
9079 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9080 GetHierarchyParent().IncreaseLifetimeUp();
9081 #endif
9082 };
9083
9085 {
9086 PlayerBase p = PlayerBase.Cast(player);
9087
9088 array<int> recipesIds = p.m_Recipes;
9089 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9090 if (moduleRecipesManager)
9091 {
9092 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9093 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9094 }
9095
9096 for (int i = 0;i < recipesIds.Count(); i++)
9097 {
9098 int key = recipesIds.Get(i);
9099 string recipeName = moduleRecipesManager.GetRecipeName(key);
9101 }
9102 }
9103
9104
9105 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9106 {
9107 super.GetDebugActions(outputList);
9108
9109
9114
9115
9119
9123
9124
9127
9128
9130 {
9133 }
9134
9136
9139
9143 }
9144
9145
9146
9147
9149 {
9150 super.OnAction(action_id, player, ctx);
9151 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9152 {
9153 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9154 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9155 PlayerBase p = PlayerBase.Cast(player);
9156 if (
EActions.RECIPES_RANGE_START < 1000)
9157 {
9158 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9159 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9160 }
9161 }
9162 #ifndef SERVER
9163 else if (action_id ==
EActions.WATCH_PLAYER)
9164 {
9165 PluginDeveloper.SetDeveloperItemClientEx(player);
9166 }
9167 #endif
9169 {
9170 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9171 {
9172 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9173 OnDebugButtonPressServer(id + 1);
9174 }
9175
9176 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9177 {
9178 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9180 }
9181
9182 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9183 {
9184 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9186 }
9187
9188 else if (action_id ==
EActions.ADD_QUANTITY)
9189 {
9190 if (IsMagazine())
9191 {
9192 Magazine mag = Magazine.Cast(this);
9193 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9194 }
9195 else
9196 {
9198 }
9199
9200 if (m_EM)
9201 {
9202 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9203 }
9204
9205 }
9206
9207 else if (action_id ==
EActions.REMOVE_QUANTITY)
9208 {
9209 if (IsMagazine())
9210 {
9211 Magazine mag2 = Magazine.Cast(this);
9212 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9213 }
9214 else
9215 {
9217 }
9218 if (m_EM)
9219 {
9220 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9221 }
9222
9223 }
9224
9225 else if (action_id ==
EActions.SET_QUANTITY_0)
9226 {
9228
9229 if (m_EM)
9230 {
9231 m_EM.SetEnergy(0);
9232 }
9233 }
9234
9235 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9236 {
9238
9239 if (m_EM)
9240 {
9241 m_EM.SetEnergy(m_EM.GetEnergyMax());
9242 }
9243 }
9244
9245 else if (action_id ==
EActions.ADD_HEALTH)
9246 {
9247 AddHealth("","",GetMaxHealth("","Health")/5);
9248 }
9249 else if (action_id ==
EActions.REMOVE_HEALTH)
9250 {
9251 AddHealth("","",-GetMaxHealth("","Health")/5);
9252 }
9253 else if (action_id ==
EActions.DESTROY_HEALTH)
9254 {
9255 SetHealth01("","",0);
9256 }
9257 else if (action_id ==
EActions.WATCH_ITEM)
9258 {
9260 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9261 #ifdef DEVELOPER
9262 SetDebugDeveloper_item(this);
9263 #endif
9264 }
9265
9266 else if (action_id ==
EActions.ADD_TEMPERATURE)
9267 {
9268 AddTemperature(20);
9269
9270 }
9271
9272 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9273 {
9274 AddTemperature(-20);
9275
9276 }
9277
9278 else if (action_id ==
EActions.FLIP_FROZEN)
9279 {
9280 SetFrozen(!GetIsFrozen());
9281
9282 }
9283
9284 else if (action_id ==
EActions.ADD_WETNESS)
9285 {
9287
9288 }
9289
9290 else if (action_id ==
EActions.REMOVE_WETNESS)
9291 {
9293
9294 }
9295
9296 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9297 {
9300
9301
9302 }
9303
9304 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9305 {
9308 }
9309
9310 else if (action_id ==
EActions.MAKE_SPECIAL)
9311 {
9312 auto debugParams = DebugSpawnParams.WithPlayer(player);
9313 OnDebugSpawnEx(debugParams);
9314 }
9315
9316 else if (action_id ==
EActions.DELETE)
9317 {
9318 Delete();
9319 }
9320
9321 }
9322
9323
9324 return false;
9325 }
9326
9327
9328
9329
9333
9336
9337
9338
9340 {
9341 return false;
9342 }
9343
9344
9346 {
9347 return true;
9348 }
9349
9350
9352 {
9353 return true;
9354 }
9355
9356
9357
9359 {
9360 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9362 }
9363
9366 {
9367 return null;
9368 }
9369
9371 {
9372 return false;
9373 }
9374
9376 {
9377 return false;
9378 }
9379
9383
9384
9386 {
9387 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9388 return module_repairing.CanRepair(this, item_repair_kit);
9389 }
9390
9391
9392 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9393 {
9394 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9395 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9396 }
9397
9398
9400 {
9401
9402
9403
9404
9405
9406
9407
9408
9409 return 1;
9410 }
9411
9412
9413
9415 {
9417 }
9418
9419
9420
9422 {
9424 }
9425
9426
9435 {
9436 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9437
9438 if (player)
9439 {
9440 player.MessageStatus(text);
9441 }
9442 }
9443
9444
9453 {
9454 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9455
9456 if (player)
9457 {
9458 player.MessageAction(text);
9459 }
9460 }
9461
9462
9471 {
9472 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9473
9474 if (player)
9475 {
9476 player.MessageFriendly(text);
9477 }
9478 }
9479
9480
9489 {
9490 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9491
9492 if (player)
9493 {
9494 player.MessageImportant(text);
9495 }
9496 }
9497
9499 {
9500 return true;
9501 }
9502
9503
9504 override bool KindOf(
string tag)
9505 {
9506 bool found = false;
9507 string item_name = this.
GetType();
9510
9511 int array_size = item_tag_array.Count();
9512 for (int i = 0; i < array_size; i++)
9513 {
9514 if (item_tag_array.Get(i) == tag)
9515 {
9516 found = true;
9517 break;
9518 }
9519 }
9520 return found;
9521 }
9522
9523
9525 {
9526
9527 super.OnRPC(sender, rpc_type,ctx);
9528
9529
9530 switch (rpc_type)
9531 {
9532 #ifndef SERVER
9533 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9534 Param2<bool, string> p = new Param2<bool, string>(false, "");
9535
9537 return;
9538
9539 bool play = p.param1;
9540 string soundSet = p.param2;
9541
9542 if (play)
9543 {
9545 {
9547 {
9549 }
9550 }
9551 else
9552 {
9554 }
9555 }
9556 else
9557 {
9559 }
9560
9561 break;
9562 #endif
9563
9564 }
9565
9567 {
9569 }
9570 }
9571
9572
9573
9574
9576 {
9577 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9578 return plugin.GetID(
name);
9579 }
9580
9582 {
9583 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9584 return plugin.GetName(id);
9585 }
9586
9589 {
9590
9591
9592 int varFlags;
9593 if (!ctx.
Read(varFlags))
9594 return;
9595
9596 if (varFlags & ItemVariableFlags.FLOAT)
9597 {
9599 }
9600 }
9601
9603 {
9604
9605 super.SerializeNumericalVars(floats_out);
9606
9607
9608
9610 {
9612 }
9613
9615 {
9617 }
9618
9620 {
9622 }
9623
9625 {
9630 }
9631
9633 {
9635 }
9636 }
9637
9639 {
9640
9641 super.DeSerializeNumericalVars(floats);
9642
9643
9644 int index = 0;
9645 int mask = Math.Round(floats.Get(index));
9646
9647 index++;
9648
9650 {
9652 {
9654 }
9655 else
9656 {
9657 float quantity = floats.Get(index);
9659 }
9660 index++;
9661 }
9662
9664 {
9665 float wet = floats.Get(index);
9667 index++;
9668 }
9669
9671 {
9672 int liquidtype = Math.Round(floats.Get(index));
9674 index++;
9675 }
9676
9678 {
9680 index++;
9682 index++;
9684 index++;
9686 index++;
9687 }
9688
9690 {
9691 int cleanness = Math.Round(floats.Get(index));
9693 index++;
9694 }
9695 }
9696
9698 {
9699 super.WriteVarsToCTX(ctx);
9700
9701
9703 {
9705 }
9706
9708 {
9710 }
9711
9713 {
9715 }
9716
9718 {
9719 int r,g,b,a;
9725 }
9726
9728 {
9730 }
9731 }
9732
9734 {
9735 if (!super.ReadVarsFromCTX(ctx,version))
9736 return false;
9737
9738 int intValue;
9739 float value;
9740
9741 if (version < 140)
9742 {
9743 if (!ctx.
Read(intValue))
9744 return false;
9745
9746 m_VariablesMask = intValue;
9747 }
9748
9750 {
9751 if (!ctx.
Read(value))
9752 return false;
9753
9755 {
9757 }
9758 else
9759 {
9761 }
9762 }
9763
9764 if (version < 140)
9765 {
9767 {
9768 if (!ctx.
Read(value))
9769 return false;
9770 SetTemperatureDirect(value);
9771 }
9772 }
9773
9775 {
9776 if (!ctx.
Read(value))
9777 return false;
9779 }
9780
9782 {
9783 if (!ctx.
Read(intValue))
9784 return false;
9786 }
9787
9789 {
9790 int r,g,b,a;
9792 return false;
9794 return false;
9796 return false;
9798 return false;
9799
9801 }
9802
9804 {
9805 if (!ctx.
Read(intValue))
9806 return false;
9808 }
9809
9810 if (version >= 138 && version < 140)
9811 {
9813 {
9814 if (!ctx.
Read(intValue))
9815 return false;
9816 SetFrozen(intValue);
9817 }
9818 }
9819
9820 return true;
9821 }
9822
9823
9825 {
9828 {
9830 }
9831
9832 if (!super.OnStoreLoad(ctx, version))
9833 {
9835 return false;
9836 }
9837
9838 if (version >= 114)
9839 {
9840 bool hasQuickBarIndexSaved;
9841
9842 if (!ctx.
Read(hasQuickBarIndexSaved))
9843 {
9845 return false;
9846 }
9847
9848 if (hasQuickBarIndexSaved)
9849 {
9850 int itmQBIndex;
9851
9852
9853 if (!ctx.
Read(itmQBIndex))
9854 {
9856 return false;
9857 }
9858
9859 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9860 if (itmQBIndex != -1 && parentPlayer)
9861 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9862 }
9863 }
9864 else
9865 {
9866
9867 PlayerBase player;
9868 int itemQBIndex;
9869 if (version ==
int.
MAX)
9870 {
9871 if (!ctx.
Read(itemQBIndex))
9872 {
9874 return false;
9875 }
9876 }
9877 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9878 {
9879
9880 if (!ctx.
Read(itemQBIndex))
9881 {
9883 return false;
9884 }
9885 if (itemQBIndex != -1 && player)
9886 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9887 }
9888 }
9889
9890 if (version < 140)
9891 {
9892
9893 if (!LoadVariables(ctx, version))
9894 {
9896 return false;
9897 }
9898 }
9899
9900
9902 {
9904 return false;
9905 }
9906 if (version >= 132)
9907 {
9909 if (raib)
9910 {
9912 {
9914 return false;
9915 }
9916 }
9917 }
9918
9920 return true;
9921 }
9922
9923
9924
9926 {
9927 super.OnStoreSave(ctx);
9928
9929 PlayerBase player;
9930 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9931 {
9933
9934 int itemQBIndex = -1;
9935 itemQBIndex = player.FindQuickBarEntityIndex(this);
9936 ctx.
Write(itemQBIndex);
9937 }
9938 else
9939 {
9941 }
9942
9944
9946 if (raib)
9947 {
9949 }
9950 }
9951
9952
9954 {
9955 super.AfterStoreLoad();
9956
9958 {
9960 }
9961
9963 {
9966 }
9967 }
9968
9970 {
9971 super.EEOnAfterLoad();
9972
9974 {
9976 }
9977
9980 }
9981
9983 {
9984 return false;
9985 }
9986
9987
9988
9990 {
9992 {
9993 #ifdef PLATFORM_CONSOLE
9994
9996 {
9998 if (menu)
9999 {
10001 }
10002 }
10003 #endif
10004 }
10005
10007 {
10010 }
10011
10013 {
10014 SetWeightDirty();
10016 }
10018 {
10021 }
10022
10024 {
10027 }
10029 {
10032 }
10033
10034 super.OnVariablesSynchronized();
10035 }
10036
10037
10038
10040 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10041 {
10042 if (!IsServerCheck(allow_client))
10043 return false;
10044
10046 return false;
10047
10050
10051 if (value <= (min + 0.001))
10052 value = min;
10053
10054 if (value == min)
10055 {
10056 if (destroy_config)
10057 {
10058 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10059 if (dstr)
10060 {
10062 this.Delete();
10063 return true;
10064 }
10065 }
10066 else if (destroy_forced)
10067 {
10069 this.Delete();
10070 return true;
10071 }
10072
10074 }
10075
10078
10080 {
10082
10083 if (delta)
10085 }
10086
10088
10089 return false;
10090 }
10091
10092
10094 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10095 {
10097 }
10098
10100 {
10103 }
10104
10106 {
10109 }
10110
10113 {
10114 float value_clamped = Math.Clamp(value, 0, 1);
10116 SetQuantity(result, destroy_config, destroy_forced);
10117 }
10118
10119
10122 {
10124 }
10125
10127 {
10129 }
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10141 {
10142 int slot = -1;
10143 if (GetInventory())
10144 {
10145 InventoryLocation il = new InventoryLocation;
10146 GetInventory().GetCurrentInventoryLocation(il);
10148 }
10149
10151 }
10152
10154 {
10155 float quantity_max = 0;
10156
10158 {
10159 if (attSlotID != -1)
10160 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10161
10162 if (quantity_max <= 0)
10164 }
10165
10166 if (quantity_max <= 0)
10168
10169 return quantity_max;
10170 }
10171
10173 {
10175 }
10176
10178 {
10180 }
10181
10182
10184 {
10186 }
10187
10189 {
10191 }
10192
10194 {
10196 }
10197
10198
10200 {
10201
10202 float weightEx = GetWeightEx();
10203 float special = GetInventoryAndCargoWeight();
10204 return weightEx - special;
10205 }
10206
10207
10209 {
10211 }
10212
10214 {
10216 {
10217 #ifdef DEVELOPER
10218 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10219 {
10220 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10222 }
10223 #endif
10224
10225 return GetQuantity() * GetConfigWeightModified();
10226 }
10227 else if (HasEnergyManager())
10228 {
10229 #ifdef DEVELOPER
10230 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10231 {
10232 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10233 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10234 }
10235 #endif
10236 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
10237 }
10238 else
10239 {
10240 #ifdef DEVELOPER
10241 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10242 {
10243 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10244 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10245 }
10246 #endif
10247 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified());
10248 }
10249 }
10250
10253 {
10254 int item_count = 0;
10256
10257 if (GetInventory().GetCargo() != NULL)
10258 {
10259 item_count = GetInventory().GetCargo().GetItemCount();
10260 }
10261
10262 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10263 {
10264 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10265 if (item)
10266 item_count += item.GetNumberOfItems();
10267 }
10268 return item_count;
10269 }
10270
10273 {
10274 float weight = 0;
10275 float wetness = 1;
10276 if (include_wetness)
10279 {
10280 weight = wetness * m_ConfigWeight;
10281 }
10283 {
10284 weight = 1;
10285 }
10286 return weight;
10287 }
10288
10289
10290
10292 {
10293 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
10294 {
10295 GameInventory inv = GetInventory();
10296 array<EntityAI> items = new array<EntityAI>;
10298 for (int i = 0; i < items.Count(); i++)
10299 {
10301 if (item)
10302 {
10304 }
10305 }
10306 }
10307 }
10308
10309
10310
10311
10313 {
10314 float energy = 0;
10315 if (HasEnergyManager())
10316 {
10317 energy = GetCompEM().GetEnergy();
10318 }
10319 return energy;
10320 }
10321
10322
10324 {
10325 super.OnEnergyConsumed();
10326
10328 }
10329
10331 {
10332 super.OnEnergyAdded();
10333
10335 }
10336
10337
10339 {
10340 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10341 {
10343 {
10344 float energy_0to1 = GetCompEM().GetEnergy0To1();
10346 }
10347 }
10348 }
10349
10350
10352 {
10353 return ConfigGetFloat("heatIsolation");
10354 }
10355
10357 {
10359 }
10360
10362 {
10363 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10364 if (
GetGame().ConfigIsExisting(paramPath))
10366
10367 return 0.0;
10368 }
10369
10371 {
10372 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10373 if (
GetGame().ConfigIsExisting(paramPath))
10375
10376 return 0.0;
10377 }
10378
10379 override void SetWet(
float value,
bool allow_client =
false)
10380 {
10381 if (!IsServerCheck(allow_client))
10382 return;
10383
10386
10388
10389 m_VarWet = Math.Clamp(value, min, max);
10390
10392 {
10395 }
10396 }
10397
10398 override void AddWet(
float value)
10399 {
10401 }
10402
10404 {
10406 }
10407
10409 {
10411 }
10412
10414 {
10416 }
10417
10419 {
10421 }
10422
10424 {
10426 }
10427
10428 override void OnWetChanged(
float newVal,
float oldVal)
10429 {
10432 if (newLevel != oldLevel)
10433 {
10435 }
10436 }
10437
10439 {
10440 SetWeightDirty();
10441 }
10442
10444 {
10445 return GetWetLevelInternal(
m_VarWet);
10446 }
10447
10448
10449
10451 {
10453 }
10454
10456 {
10458 }
10459
10461 {
10463 }
10464
10466 {
10468 }
10469
10470
10471
10473 {
10474 if (ConfigIsExisting("itemModelLength"))
10475 {
10476 return ConfigGetFloat("itemModelLength");
10477 }
10478 return 0;
10479 }
10480
10482 {
10483 if (ConfigIsExisting("itemAttachOffset"))
10484 {
10485 return ConfigGetFloat("itemAttachOffset");
10486 }
10487 return 0;
10488 }
10489
10490 override void SetCleanness(
int value,
bool allow_client =
false)
10491 {
10492 if (!IsServerCheck(allow_client))
10493 return;
10494
10496
10498
10501 }
10502
10504 {
10506 }
10507
10509 {
10510 return true;
10511 }
10512
10513
10514
10515
10517 {
10519 }
10520
10522 {
10524 }
10525
10526
10527
10528
10529 override void SetColor(
int r,
int g,
int b,
int a)
10530 {
10536 }
10538 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10539 {
10544 }
10545
10547 {
10549 }
10550
10553 {
10554 int r,g,b,a;
10556 r = r/255;
10557 g = g/255;
10558 b = b/255;
10559 a = a/255;
10560 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10561 }
10562
10563
10564
10565 override void SetLiquidType(
int value,
bool allow_client =
false)
10566 {
10567 if (!IsServerCheck(allow_client))
10568 return;
10569
10574 }
10575
10577 {
10578 return ConfigGetInt("varLiquidTypeInit");
10579 }
10580
10582 {
10584 }
10585
10587 {
10589 SetFrozen(false);
10590 }
10591
10594 {
10595 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10596 }
10597
10598
10601 {
10602 PlayerBase nplayer;
10603 if (PlayerBase.CastTo(nplayer, player))
10604 {
10606
10607 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10608 }
10609 }
10610
10611
10614 {
10615 PlayerBase nplayer;
10616 if (PlayerBase.CastTo(nplayer,player))
10617 {
10618
10619 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10620
10621 }
10622
10623
10624 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10625
10626
10627 if (HasEnergyManager())
10628 {
10629 GetCompEM().UpdatePlugState();
10630 }
10631 }
10632
10633
10635 {
10636 super.OnPlacementStarted(player);
10637
10639 }
10640
10641 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10642 {
10644 {
10645 m_AdminLog.OnPlacementComplete(player,
this);
10646 }
10647
10648 super.OnPlacementComplete(player, position, orientation);
10649 }
10650
10651
10652
10653
10654
10656 {
10658 {
10659 return true;
10660 }
10661 else
10662 {
10663 return false;
10664 }
10665 }
10666
10667
10669 {
10671 {
10673 }
10674 }
10675
10676
10678 {
10680 }
10681
10683 {
10685 }
10686
10687 override void InsertAgent(
int agent,
float count = 1)
10688 {
10689 if (count < 1)
10690 return;
10691
10693 }
10694
10697 {
10699 }
10700
10701
10703 {
10705 }
10706
10707
10708
10709
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
10749 {
10751 return false;
10752 return true;
10753 }
10754
10756 {
10757
10759 }
10760
10761
10764 {
10765 super.CheckForRoofLimited(timeTresholdMS);
10766
10768 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10769 {
10770 m_PreviousRoofTestTime = time;
10771 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10772 }
10773 }
10774
10775
10777 {
10779 {
10780 return 0;
10781 }
10782
10783 if (GetInventory().GetAttachmentSlotsCount() != 0)
10784 {
10785 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10786 if (filter)
10787 return filter.GetProtectionLevel(type, false, system);
10788 else
10789 return 0;
10790 }
10791
10792 string subclassPath, entryName;
10793
10794 switch (type)
10795 {
10797 entryName = "biological";
10798 break;
10800 entryName = "chemical";
10801 break;
10802 default:
10803 entryName = "biological";
10804 break;
10805 }
10806
10807 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10808
10810 }
10811
10812
10813
10816 {
10817 if (!IsMagazine())
10819
10821 }
10822
10823
10824
10825
10826
10831 {
10832 return true;
10833 }
10834
10836 {
10838 }
10839
10840
10841
10842
10843
10845 {
10846 if (parent)
10847 {
10848 if (parent.IsInherited(DayZInfected))
10849 return true;
10850
10851 if (!parent.IsRuined())
10852 return true;
10853 }
10854
10855 return true;
10856 }
10857
10859 {
10860 if (!super.CanPutAsAttachment(parent))
10861 {
10862 return false;
10863 }
10864
10865 if (!IsRuined() && !parent.IsRuined())
10866 {
10867 return true;
10868 }
10869
10870 return false;
10871 }
10872
10874 {
10875
10876
10877
10878
10879 return super.CanReceiveItemIntoCargo(item);
10880 }
10881
10883 {
10884
10885
10886
10887
10888 GameInventory attachmentInv = attachment.GetInventory();
10890 {
10891 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10892 return false;
10893 }
10894
10895 InventoryLocation loc = new InventoryLocation();
10896 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10897 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10898 return false;
10899
10900 return super.CanReceiveAttachment(attachment, slotId);
10901 }
10902
10904 {
10905 if (!super.CanReleaseAttachment(attachment))
10906 return false;
10907
10908 return GetInventory().AreChildrenAccessible();
10909 }
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10932 {
10933 int id = muzzle_owner.GetMuzzleID();
10934 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10935
10936 if (WPOF_array)
10937 {
10938 for (int i = 0; i < WPOF_array.Count(); i++)
10939 {
10940 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10941
10942 if (WPOF)
10943 {
10944 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10945 }
10946 }
10947 }
10948 }
10949
10950
10952 {
10953 int id = muzzle_owner.GetMuzzleID();
10955
10956 if (WPOBE_array)
10957 {
10958 for (int i = 0; i < WPOBE_array.Count(); i++)
10959 {
10960 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10961
10962 if (WPOBE)
10963 {
10964 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10965 }
10966 }
10967 }
10968 }
10969
10970
10972 {
10973 int id = muzzle_owner.GetMuzzleID();
10974 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10975
10976 if (WPOOH_array)
10977 {
10978 for (int i = 0; i < WPOOH_array.Count(); i++)
10979 {
10980 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10981
10982 if (WPOOH)
10983 {
10984 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10985 }
10986 }
10987 }
10988 }
10989
10990
10992 {
10993 int id = muzzle_owner.GetMuzzleID();
10994 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10995
10996 if (WPOOH_array)
10997 {
10998 for (int i = 0; i < WPOOH_array.Count(); i++)
10999 {
11000 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11001
11002 if (WPOOH)
11003 {
11004 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11005 }
11006 }
11007 }
11008 }
11009
11010
11012 {
11013 int id = muzzle_owner.GetMuzzleID();
11014 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11015
11016 if (WPOOH_array)
11017 {
11018 for (int i = 0; i < WPOOH_array.Count(); i++)
11019 {
11020 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11021
11022 if (WPOOH)
11023 {
11024 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11025 }
11026 }
11027 }
11028 }
11029
11030
11031
11033 {
11035 {
11036 return true;
11037 }
11038
11039 return false;
11040 }
11041
11043 {
11045 {
11046 return true;
11047 }
11048
11049 return false;
11050 }
11051
11053 {
11055 {
11056 return true;
11057 }
11058
11059 return false;
11060 }
11061
11063 {
11064 return false;
11065 }
11066
11069 {
11070 return UATimeSpent.DEFAULT_DEPLOY;
11071 }
11072
11073
11074
11075
11077 {
11079 SetSynchDirty();
11080 }
11081
11083 {
11085 }
11086
11087
11089 {
11090 return false;
11091 }
11092
11095 {
11096 string att_type = "None";
11097
11098 if (ConfigIsExisting("soundAttType"))
11099 {
11100 att_type = ConfigGetString("soundAttType");
11101 }
11102
11104 }
11105
11107 {
11109 }
11110
11111
11112
11113
11114
11118
11120 {
11123
11125 }
11126
11127
11129 {
11131 return;
11132
11134
11137
11140
11141 SoundParameters params = new SoundParameters();
11145 }
11146
11147
11149 {
11151 return;
11152
11154 SetSynchDirty();
11155
11158 }
11159
11160
11162 {
11164 return;
11165
11167 SetSynchDirty();
11168
11171 }
11172
11174 {
11176 }
11177
11179 {
11181 }
11182
11185 {
11186 if (!
GetGame().IsDedicatedServer())
11187 {
11188 if (ConfigIsExisting("attachSoundSet"))
11189 {
11190 string cfg_path = "";
11191 string soundset = "";
11192 string type_name =
GetType();
11193
11196 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11197 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11198
11199 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11200 {
11201 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11202 {
11203 if (cfg_slot_array[i] == slot_type)
11204 {
11205 soundset = cfg_soundset_array[i];
11206 break;
11207 }
11208 }
11209 }
11210
11211 if (soundset != "")
11212 {
11213 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11215 }
11216 }
11217 }
11218 }
11219
11221 {
11222
11223 }
11224
11225 void OnApply(PlayerBase player);
11226
11228 {
11229 return 1.0;
11230 };
11231
11233 {
11235 }
11236
11238 {
11240 }
11241
11243
11245 {
11246 SetDynamicPhysicsLifeTime(0.01);
11248 }
11249
11251 {
11252 array<string> zone_names = new array<string>;
11253 GetDamageZones(zone_names);
11254 for (int i = 0; i < zone_names.Count(); i++)
11255 {
11256 SetHealthMax(zone_names.Get(i),"Health");
11257 }
11258 SetHealthMax("","Health");
11259 }
11260
11263 {
11264 float global_health = GetHealth01("","Health");
11265 array<string> zones = new array<string>;
11266 GetDamageZones(zones);
11267
11268 for (int i = 0; i < zones.Count(); i++)
11269 {
11270 SetHealth01(zones.Get(i),"Health",global_health);
11271 }
11272 }
11273
11276 {
11277 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11278 }
11279
11281 {
11282 if (!hasRootAsPlayer)
11283 {
11284 if (refParentIB)
11285 {
11286
11287 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11288 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11289
11290 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11291 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11292
11295 }
11296 else
11297 {
11298
11301 }
11302 }
11303 }
11304
11306 {
11308 {
11309 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11310 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
11311 {
11312 float heatPermCoef = 1.0;
11314 while (ent)
11315 {
11316 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11317 ent = ent.GetHierarchyParent();
11318 }
11319
11320 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11321 }
11322 }
11323 }
11324
11326 {
11327
11328 EntityAI parent = GetHierarchyParent();
11329 if (!parent)
11330 {
11331 hasParent = false;
11332 hasRootAsPlayer = false;
11333 }
11334 else
11335 {
11336 hasParent = true;
11337 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11338 refParentIB =
ItemBase.Cast(parent);
11339 }
11340 }
11341
11342 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11343 {
11344
11345 }
11346
11348 {
11349
11350 return false;
11351 }
11352
11354 {
11355
11356
11357 return false;
11358 }
11359
11361 {
11362
11363 return false;
11364 }
11365
11368 {
11369 return !GetIsFrozen() &&
IsOpen();
11370 }
11371
11373 {
11374 bool hasParent = false, hasRootAsPlayer = false;
11376
11377 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11378 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11379
11380 if (wwtu || foodDecay)
11381 {
11385
11386 if (processWetness || processTemperature || processDecay)
11387 {
11389
11390 if (processWetness)
11391 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11392
11393 if (processTemperature)
11395
11396 if (processDecay)
11397 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11398 }
11399 }
11400 }
11401
11404 {
11406 }
11407
11409 {
11412
11413 return super.GetTemperatureFreezeThreshold();
11414 }
11415
11417 {
11420
11421 return super.GetTemperatureThawThreshold();
11422 }
11423
11425 {
11428
11429 return super.GetItemOverheatThreshold();
11430 }
11431
11433 {
11435 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11436
11437 return super.GetTemperatureFreezeTime();
11438 }
11439
11441 {
11443 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11444
11445 return super.GetTemperatureThawTime();
11446 }
11447
11452
11454 {
11455 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11456 }
11457
11459 {
11460 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11461 }
11462
11465 {
11467 }
11468
11470 {
11472 }
11473
11475 {
11477 }
11478
11481 {
11482 return null;
11483 }
11484
11487 {
11488 return false;
11489 }
11490
11492 {
11494 {
11497 if (!trg)
11498 {
11500 explosive = this;
11501 }
11502
11503 explosive.PairRemote(trg);
11505
11506 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11507 trg.SetPersistentPairID(persistentID);
11508 explosive.SetPersistentPairID(persistentID);
11509
11510 return true;
11511 }
11512 return false;
11513 }
11514
11517 {
11518 float ret = 1.0;
11521 ret *= GetHealth01();
11522
11523 return ret;
11524 }
11525
11526 #ifdef DEVELOPER
11527 override void SetDebugItem()
11528 {
11529 super.SetDebugItem();
11530 _itemBase = this;
11531 }
11532
11534 {
11535 string text = super.GetDebugText();
11536
11538 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11539
11540 return text;
11541 }
11542 #endif
11543
11545 {
11546 return true;
11547 }
11548
11550
11552
11554 {
11557 }
11558
11559
11567
11583}
11584
11586{
11588 if (entity)
11589 {
11590 bool is_item = entity.IsInherited(
ItemBase);
11591 if (is_item && full_quantity)
11592 {
11595 }
11596 }
11597 else
11598 {
11600 return NULL;
11601 }
11602 return entity;
11603}
11604
11606{
11607 if (item)
11608 {
11609 if (health > 0)
11610 item.SetHealth("", "", health);
11611
11612 if (item.CanHaveTemperature())
11613 {
11615 if (item.CanFreeze())
11616 item.SetFrozen(false);
11617 }
11618
11619 if (item.HasEnergyManager())
11620 {
11621 if (quantity >= 0)
11622 {
11623 item.GetCompEM().SetEnergy0To1(quantity);
11624 }
11625 else
11626 {
11628 }
11629 }
11630 else if (item.IsMagazine())
11631 {
11632 Magazine mag = Magazine.Cast(item);
11633 if (quantity >= 0)
11634 {
11635 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11636 }
11637 else
11638 {
11640 }
11641
11642 }
11643 else
11644 {
11645 if (quantity >= 0)
11646 {
11647 item.SetQuantityNormalized(quantity, false);
11648 }
11649 else
11650 {
11652 }
11653
11654 }
11655 }
11656}
11657
11658#ifdef DEVELOPER
11660#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.