Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChanged(item); first when overriding this event.
6899{
6901 {
6902 return true;
6903 }
6904};
6905
6906
6907
6909{
6913
6915
6918
6919
6920
6921
6922
6931
6937
6942
6947
6968 protected bool m_IsResultOfSplit
6969
6971
6976
6977
6978
6980
6984
6985
6986
6988
6991
6992
6993
6999
7000
7008
7011
7012
7014
7015
7017
7018
7023
7024
7029
7030
7032
7033
7035 {
7040
7041 if (!
GetGame().IsDedicatedServer())
7042 {
7044 {
7046
7048 {
7050 }
7051 }
7052
7055 }
7056
7057 m_OldLocation = null;
7058
7060 {
7062 }
7063
7064 if (ConfigIsExisting("headSelectionsToHide"))
7065 {
7068 }
7069
7071 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7072 {
7074 }
7075
7077
7078 m_IsResultOfSplit = false;
7079
7081 }
7082
7084 {
7085 super.InitItemVariables();
7086
7092 m_Count = ConfigGetInt(
"count");
7093
7096
7101
7104
7109
7121
7125
7126
7129 if (ConfigIsExisting("canBeSplit"))
7130 {
7133 }
7134
7136 if (ConfigIsExisting("itemBehaviour"))
7138
7139
7142 RegisterNetSyncVariableInt("m_VarLiquidType");
7143 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7144
7145 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7146 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7147 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7148
7149 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7150 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7151 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7152 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7153
7154 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7155 RegisterNetSyncVariableBool("m_IsTakeable");
7156 RegisterNetSyncVariableBool("m_IsHologram");
7157
7160 {
7163 }
7164
7166
7168 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7170
7171 }
7172
7174 {
7176 }
7177
7179 {
7182 {
7187 }
7188 }
7189
7190 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7191 {
7193 {
7196 }
7197
7199 }
7200
7202 {
7208 }
7209
7211
7213 {
7215
7216 if (!action)
7217 {
7218 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7219 return;
7220 }
7221
7223 if (!ai)
7224 {
7226 return;
7227 }
7228
7230 if (!action_array)
7231 {
7232 action_array = new array<ActionBase_Basic>;
7234 }
7235 if (LogManager.IsActionLogEnable())
7236 {
7237 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7238 }
7239
7240 if (action_array.Find(action) != -1)
7241 {
7242 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7243 }
7244 else
7245 {
7246 action_array.Insert(action);
7247 }
7248 }
7249
7251 {
7253 ActionBase action = player.GetActionManager().GetAction(actionName);
7256
7257 if (action_array)
7258 {
7259 action_array.RemoveItem(action);
7260 }
7261 }
7262
7263
7264
7266 {
7267 ActionOverrideData overrideData = new ActionOverrideData();
7271
7273 if (!actionMap)
7274 {
7277 }
7278
7279 actionMap.Insert(this.
Type(), overrideData);
7280
7281 }
7282
7284
7286
7287
7289 {
7292
7295
7296 string config_to_search = "CfgVehicles";
7297 string muzzle_owner_config;
7298
7300 {
7301 if (IsInherited(Weapon))
7302 config_to_search = "CfgWeapons";
7303
7304 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7305
7306 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7307
7309
7310 if (config_OnFire_subclass_count > 0)
7311 {
7312 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7313
7314 for (int i = 0; i < config_OnFire_subclass_count; i++)
7315 {
7316 string particle_class = "";
7318 string config_OnFire_entry = config_OnFire_class + particle_class;
7319 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7320 WPOF_array.Insert(WPOF);
7321 }
7322
7323
7325 }
7326 }
7327
7329 {
7330 config_to_search = "CfgWeapons";
7331 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7332
7333 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7334
7336
7337 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7338 {
7339 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7340
7341 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7342 {
7343 string particle_class2 = "";
7345 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7346 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7347 WPOBE_array.Insert(WPOBE);
7348 }
7349
7350
7352 }
7353 }
7354 }
7355
7356
7358 {
7361
7363 {
7364 string config_to_search = "CfgVehicles";
7365
7366 if (IsInherited(Weapon))
7367 config_to_search = "CfgWeapons";
7368
7369 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7370 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7371
7372 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
7373 {
7374
7376
7378 {
7380 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7382 return;
7383 }
7384
7387
7388
7389
7391 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7392
7393 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7394 {
7395 string particle_class = "";
7397 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7399
7400 if (entry_type == CT_CLASS)
7401 {
7402 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7403 WPOOH_array.Insert(WPOF);
7404 }
7405 }
7406
7407
7409 }
7410 }
7411 }
7412
7414 {
7416 }
7417
7419 {
7421 {
7423
7426
7429
7430 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7431 }
7432 }
7433
7435 {
7437 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7438
7440 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7441
7443 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7444
7446 {
7448 }
7449 }
7450
7452 {
7454 }
7455
7457 {
7460 else
7462
7464 {
7467 }
7468 else
7469 {
7472
7475 }
7476
7478 }
7479
7481 {
7483 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7484 }
7485
7487 {
7489 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7491 }
7492
7494 {
7496 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7497 }
7498
7500 {
7503
7504 OverheatingParticle OP = new OverheatingParticle();
7509
7511 }
7512
7514 {
7517
7518 return -1;
7519 }
7520
7522 {
7524 {
7527
7528 for (int i = count; i > 0; --i)
7529 {
7530 int id = i - 1;
7533
7536
7537 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7538 {
7539 if (p)
7540 {
7543 }
7544 }
7545 }
7546 }
7547 }
7548
7550 {
7552 {
7554 {
7555 int id = i - 1;
7557
7558 if (OP)
7559 {
7561
7562 if (p)
7563 {
7565 }
7566
7567 delete OP;
7568 }
7569 }
7570
7573 }
7574 }
7575
7578 {
7579 return 0.0;
7580 }
7581
7582
7584 {
7585 return 250;
7586 }
7587
7589 {
7590 return 0;
7591 }
7592
7595 {
7597 return true;
7598
7599 return false;
7600 }
7601
7604 {
7607
7609 {
7611 }
7612 else
7613 {
7614
7616 }
7617
7619 }
7620
7627 {
7628 return -1;
7629 }
7630
7631
7632
7633
7635 {
7637 {
7639 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7640
7641 if (r_index >= 0)
7642 {
7643 InventoryLocation r_il = new InventoryLocation;
7644 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7645
7646 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7649 {
7650 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7651 }
7653 {
7654 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7655 }
7656
7657 }
7658
7659 player.GetHumanInventory().ClearUserReservedLocation(this);
7660 }
7661
7664 }
7665
7666
7667
7668
7670 {
7671 return ItemBase.m_DebugActionsMask;
7672 }
7673
7675 {
7676 return ItemBase.m_DebugActionsMask & mask;
7677 }
7678
7680 {
7681 ItemBase.m_DebugActionsMask = mask;
7682 }
7683
7685 {
7686 ItemBase.m_DebugActionsMask |= mask;
7687 }
7688
7690 {
7691 ItemBase.m_DebugActionsMask &= ~mask;
7692 }
7693
7695 {
7697 {
7699 }
7700 else
7701 {
7703 }
7704 }
7705
7706
7708 {
7709 if (GetEconomyProfile())
7710 {
7711 float q_max = GetEconomyProfile().GetQuantityMax();
7712 if (q_max > 0)
7713 {
7714 float q_min = GetEconomyProfile().GetQuantityMin();
7715 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7716
7718 {
7719 ComponentEnergyManager comp = GetCompEM();
7721 {
7723 }
7724 }
7726 {
7728
7729 }
7730
7731 }
7732 }
7733 }
7734
7737 {
7738 EntityAI parent = GetHierarchyParent();
7739
7740 if (parent)
7741 {
7742 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7743 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7744 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7745 }
7746 }
7747
7750 {
7751 EntityAI parent = GetHierarchyParent();
7752
7753 if (parent)
7754 {
7755 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7756 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7757 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7758 }
7759 }
7760
7762 {
7763
7764
7765
7766
7768
7770 {
7771 if (ScriptInputUserData.CanStoreInputUserData())
7772 {
7773 ScriptInputUserData ctx = new ScriptInputUserData;
7779 ctx.
Write(use_stack_max);
7782
7784 {
7785 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7786 }
7787 }
7788 }
7789 else if (!
GetGame().IsMultiplayer())
7790 {
7792 }
7793 }
7794
7796 {
7798 }
7799
7801 {
7803 }
7804
7806 {
7808 }
7809
7811 {
7812
7813 return false;
7814 }
7815
7817 {
7818 return false;
7819 }
7820
7824 {
7825 return false;
7826 }
7827
7829 {
7830 return "";
7831 }
7832
7834
7836 {
7837 return false;
7838 }
7839
7841 {
7842 return true;
7843 }
7844
7845
7846
7848 {
7849 return true;
7850 }
7851
7853 {
7854 return true;
7855 }
7856
7858 {
7859 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7861 }
7862
7864 {
7866 }
7867
7869 {
7871 if (!is_being_placed)
7873 SetSynchDirty();
7874 }
7875
7876
7878
7880 {
7882 }
7883
7885 {
7887 }
7888
7890 {
7891 return 1;
7892 }
7893
7895 {
7896 return false;
7897 }
7898
7900 {
7902 SetSynchDirty();
7903 }
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7940 {
7941 super.OnMovedInsideCargo(container);
7942
7943 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7944 }
7945
7946 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7947 {
7948 super.EEItemLocationChanged(oldLoc,newLoc);
7949
7950 PlayerBase new_player = null;
7951 PlayerBase old_player = null;
7952
7953 if (newLoc.GetParent())
7954 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7955
7956 if (oldLoc.GetParent())
7957 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7958
7960 {
7961 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7962
7963 if (r_index >= 0)
7964 {
7965 InventoryLocation r_il = new InventoryLocation;
7966 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7967
7968 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7971 {
7972 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7973 }
7975 {
7976 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7977 }
7978
7979 }
7980 }
7981
7983 {
7984 if (new_player)
7985 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7986
7987 if (new_player == old_player)
7988 {
7989
7990 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7991 {
7993 {
7994 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7995 {
7996 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7997 }
7998 }
7999 else
8000 {
8001 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8002 }
8003 }
8004
8005 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8006 {
8007 int type = oldLoc.GetType();
8009 {
8010 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8011 }
8013 {
8014 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8015 }
8016 }
8017 if (!m_OldLocation)
8018 {
8019 m_OldLocation = new InventoryLocation;
8020 }
8021 m_OldLocation.Copy(oldLoc);
8022 }
8023 else
8024 {
8025 if (m_OldLocation)
8026 {
8027 m_OldLocation.Reset();
8028 }
8029 }
8030
8032 }
8033 else
8034 {
8035 if (new_player)
8036 {
8037 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8038 if (res_index >= 0)
8039 {
8040 InventoryLocation il = new InventoryLocation;
8041 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
8043 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
8046 {
8047 il.
GetParent().GetOnReleaseLock().Invoke(it);
8048 }
8050 {
8052 }
8053
8054 }
8055 }
8057 {
8058
8060 }
8061
8062 if (m_OldLocation)
8063 {
8064 m_OldLocation.Reset();
8065 }
8066 }
8067 }
8068
8069 override void EOnContact(IEntity other, Contact extra)
8070 {
8072 {
8073 int liquidType = -1;
8075 if (impactSpeed > 0.0)
8076 {
8078 #ifndef SERVER
8080 #else
8082 SetSynchDirty();
8083 #endif
8085 }
8086 }
8087
8088 #ifdef SERVER
8089 if (GetCompEM() && GetCompEM().IsPlugged())
8090 {
8091 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8092 GetCompEM().UnplugThis();
8093 }
8094 #endif
8095 }
8096
8098
8100 {
8102 }
8103
8105 {
8106
8107 }
8108
8110 {
8111 super.OnItemLocationChanged(old_owner, new_owner);
8112
8113 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8114 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8115
8116 if (!relatedPlayer && playerNew)
8117 relatedPlayer = playerNew;
8118
8119 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8120 {
8122 if (actionMgr)
8123 {
8124 ActionBase currentAction = actionMgr.GetRunningAction();
8125 if (currentAction)
8127 }
8128 }
8129
8130 Man ownerPlayerOld = null;
8131 Man ownerPlayerNew = null;
8132
8133 if (old_owner)
8134 {
8135 if (old_owner.
IsMan())
8136 {
8137 ownerPlayerOld = Man.Cast(old_owner);
8138 }
8139 else
8140 {
8141 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8142 }
8143 }
8144 else
8145 {
8147 {
8149
8150 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8151 {
8152 GetCompEM().UnplugThis();
8153 }
8154 }
8155 }
8156
8157 if (new_owner)
8158 {
8159 if (new_owner.
IsMan())
8160 {
8161 ownerPlayerNew = Man.Cast(new_owner);
8162 }
8163 else
8164 {
8165 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8166 }
8167 }
8168
8169 if (ownerPlayerOld != ownerPlayerNew)
8170 {
8171 if (ownerPlayerOld)
8172 {
8173 array<EntityAI> subItemsExit = new array<EntityAI>;
8175 for (int i = 0; i < subItemsExit.Count(); i++)
8176 {
8179 }
8180 }
8181
8182 if (ownerPlayerNew)
8183 {
8184 array<EntityAI> subItemsEnter = new array<EntityAI>;
8186 for (int j = 0; j < subItemsEnter.Count(); j++)
8187 {
8190 }
8191 }
8192 }
8193 else if (ownerPlayerNew != null)
8194 {
8195 PlayerBase nplayer;
8196 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8197 {
8198 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8200 for (int k = 0; k < subItemsUpdate.Count(); k++)
8201 {
8203 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8204 }
8205 }
8206 }
8207
8208 if (old_owner)
8209 old_owner.OnChildItemRemoved(this);
8210 if (new_owner)
8211 new_owner.OnChildItemReceived(this);
8212 }
8213
8214
8216 {
8217 super.EEDelete(parent);
8218 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8219 if (player)
8220 {
8222
8223 if (player.IsAlive())
8224 {
8225 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8226 if (r_index >= 0)
8227 {
8228 InventoryLocation r_il = new InventoryLocation;
8229 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8230
8231 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8234 {
8235 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8236 }
8238 {
8239 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8240 }
8241
8242 }
8243
8244 player.RemoveQuickBarEntityShortcut(this);
8245 }
8246 }
8247 }
8248
8250 {
8251 super.EEKilled(killer);
8252
8255 {
8256 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8257 {
8258 if (IsMagazine())
8259 {
8260 if (Magazine.Cast(this).GetAmmoCount() > 0)
8261 {
8263 }
8264 }
8265 else
8266 {
8268 }
8269 }
8270 }
8271 }
8272
8274 {
8275 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8276
8277 super.OnWasAttached(parent, slot_id);
8278
8281
8283 }
8284
8286 {
8287 super.OnWasDetached(parent, slot_id);
8288
8291 }
8292
8294 {
8295 int idx;
8298
8299 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8300 if (inventory_slots.Count() < 1)
8301 {
8302 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8303 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8304 }
8305 else
8306 {
8307 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8308 }
8309
8310 idx = inventory_slots.Find(slot);
8311 if (idx < 0)
8312 return "";
8313
8314 return attach_types.Get(idx);
8315 }
8316
8318 {
8319 int idx = -1;
8320 string slot;
8321
8324
8325 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8326 if (inventory_slots.Count() < 1)
8327 {
8328 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8329 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8330 }
8331 else
8332 {
8333 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8334 if (detach_types.Count() < 1)
8335 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8336 }
8337
8338 for (int i = 0; i < inventory_slots.Count(); i++)
8339 {
8340 slot = inventory_slots.Get(i);
8341 }
8342
8343 if (slot != "")
8344 {
8345 if (detach_types.Count() == 1)
8346 idx = 0;
8347 else
8348 idx = inventory_slots.Find(slot);
8349 }
8350 if (idx < 0)
8351 return "";
8352
8353 return detach_types.Get(idx);
8354 }
8355
8357 {
8358
8360
8361
8362 float min_time = 1;
8363 float max_time = 3;
8364 float delay = Math.RandomFloat(min_time, max_time);
8365
8366 explode_timer.Run(delay, this, "DoAmmoExplosion");
8367 }
8368
8370 {
8371 Magazine magazine = Magazine.Cast(this);
8372 int pop_sounds_count = 6;
8373 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8374
8375
8376 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8377 string sound_name = pop_sounds[ sound_idx ];
8379
8380
8381 magazine.ServerAddAmmoCount(-1);
8382
8383
8384 float min_temp_to_explode = 100;
8385
8386 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8387 {
8389 }
8390 }
8391
8392
8393 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8394 {
8395 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8396
8397 const int CHANCE_DAMAGE_CARGO = 4;
8398 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8399 const int CHANCE_DAMAGE_NOTHING = 2;
8400
8402 {
8403 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8404 int chances;
8405 int rnd;
8406
8407 if (GetInventory().GetCargo())
8408 {
8409 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8410 rnd = Math.RandomInt(0,chances);
8411
8412 if (rnd < CHANCE_DAMAGE_CARGO)
8413 {
8415 }
8416 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8417 {
8419 }
8420 }
8421 else
8422 {
8423 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8424 rnd = Math.RandomInt(0,chances);
8425
8426 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8427 {
8429 }
8430 }
8431 }
8432 }
8433
8435 {
8436 if (GetInventory().GetCargo())
8437 {
8438 int item_count = GetInventory().GetCargo().GetItemCount();
8439 if (item_count > 0)
8440 {
8441 int random_pick = Math.RandomInt(0, item_count);
8443 if (!item.IsExplosive())
8444 {
8445 item.AddHealth("","",damage);
8446 return true;
8447 }
8448 }
8449 }
8450 return false;
8451 }
8452
8454 {
8455 int attachment_count = GetInventory().AttachmentCount();
8456 if (attachment_count > 0)
8457 {
8458 int random_pick = Math.RandomInt(0, attachment_count);
8459 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8460 if (!attachment.IsExplosive())
8461 {
8462 attachment.AddHealth("","",damage);
8463 return true;
8464 }
8465 }
8466 return false;
8467 }
8468
8470 {
8472 }
8473
8475 {
8477 return GetInventory().CanRemoveEntity();
8478
8479 return false;
8480 }
8481
8483 {
8484
8486 return false;
8487
8488
8490 return false;
8491
8492
8493
8495 if (delta == 0)
8496 return false;
8497
8498
8499 return true;
8500 }
8501
8503 {
8505 {
8506 if (ScriptInputUserData.CanStoreInputUserData())
8507 {
8508 ScriptInputUserData ctx = new ScriptInputUserData;
8513 ctx.
Write(destination_entity);
8517 }
8518 }
8519 else if (!
GetGame().IsMultiplayer())
8520 {
8522 }
8523 }
8524
8526 {
8527 float split_quantity_new;
8531 InventoryLocation loc = new InventoryLocation;
8532
8533 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8534 {
8536 split_quantity_new = stack_max;
8537 else
8539
8541 {
8542 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8543 if (new_item)
8544 {
8545 new_item.SetResultOfSplit(true);
8546 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8548 new_item.
SetQuantity(split_quantity_new,
false,
true);
8549 }
8550 }
8551 }
8552 else if (destination_entity && slot_id == -1)
8553 {
8554 if (quantity > stack_max)
8555 split_quantity_new = stack_max;
8556 else
8557 split_quantity_new = quantity;
8558
8560 {
8562 {
8565 }
8566
8567 if (new_item)
8568 {
8569 new_item.SetResultOfSplit(true);
8570 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8572 new_item.
SetQuantity(split_quantity_new,
false,
true);
8573 }
8574 }
8575 }
8576 else
8577 {
8578 if (stack_max != 0)
8579 {
8581 {
8583 }
8584
8585 if (split_quantity_new == 0)
8586 {
8587 if (!
GetGame().IsMultiplayer())
8588 player.PhysicalPredictiveDropItem(this);
8589 else
8590 player.ServerDropEntity(this);
8591 return;
8592 }
8593
8595 {
8597
8598 if (new_item)
8599 {
8600 new_item.SetResultOfSplit(true);
8601 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8604 new_item.PlaceOnSurface();
8605 }
8606 }
8607 }
8608 }
8609 }
8610
8612 {
8613 float split_quantity_new;
8617 InventoryLocation loc = new InventoryLocation;
8618
8619 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8620 {
8622 split_quantity_new = stack_max;
8623 else
8625
8627 {
8628 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8629 if (new_item)
8630 {
8631 new_item.SetResultOfSplit(true);
8632 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8634 new_item.
SetQuantity(split_quantity_new,
false,
true);
8635 }
8636 }
8637 }
8638 else if (destination_entity && slot_id == -1)
8639 {
8640 if (quantity > stack_max)
8641 split_quantity_new = stack_max;
8642 else
8643 split_quantity_new = quantity;
8644
8646 {
8648 {
8651 }
8652
8653 if (new_item)
8654 {
8655 new_item.SetResultOfSplit(true);
8656 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8658 new_item.
SetQuantity(split_quantity_new,
false,
true);
8659 }
8660 }
8661 }
8662 else
8663 {
8664 if (stack_max != 0)
8665 {
8667 {
8669 }
8670
8672 {
8674
8675 if (new_item)
8676 {
8677 new_item.SetResultOfSplit(true);
8678 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8681 new_item.PlaceOnSurface();
8682 }
8683 }
8684 }
8685 }
8686 }
8687
8689 {
8691 {
8692 if (ScriptInputUserData.CanStoreInputUserData())
8693 {
8694 ScriptInputUserData ctx = new ScriptInputUserData;
8699 dst.WriteToContext(ctx);
8701 }
8702 }
8703 else if (!
GetGame().IsMultiplayer())
8704 {
8706 }
8707 }
8708
8710 {
8712 {
8713 if (ScriptInputUserData.CanStoreInputUserData())
8714 {
8715 ScriptInputUserData ctx = new ScriptInputUserData;
8720 ctx.
Write(destination_entity);
8726 }
8727 }
8728 else if (!
GetGame().IsMultiplayer())
8729 {
8731 }
8732 }
8733
8735 {
8737 }
8738
8740 {
8742 float split_quantity_new;
8744 if (dst.IsValid())
8745 {
8746 int slot_id = dst.GetSlot();
8748
8749 if (quantity > stack_max)
8750 split_quantity_new = stack_max;
8751 else
8752 split_quantity_new = quantity;
8753
8755 {
8757
8758 if (new_item)
8759 {
8760 new_item.SetResultOfSplit(true);
8761 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8763 new_item.
SetQuantity(split_quantity_new,
false,
true);
8764 }
8765
8766 return new_item;
8767 }
8768 }
8769
8770 return null;
8771 }
8772
8774 {
8776 float split_quantity_new;
8778 if (destination_entity)
8779 {
8781 if (quantity > stackable)
8782 split_quantity_new = stackable;
8783 else
8784 split_quantity_new = quantity;
8785
8787 {
8788 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8789 if (new_item)
8790 {
8791 new_item.SetResultOfSplit(true);
8792 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8794 new_item.
SetQuantity(split_quantity_new,
false,
true);
8795 }
8796 }
8797 }
8798 }
8799
8801 {
8803 {
8804 if (ScriptInputUserData.CanStoreInputUserData())
8805 {
8806 ScriptInputUserData ctx = new ScriptInputUserData;
8811 ItemBase destination_entity =
this;
8812 ctx.
Write(destination_entity);
8816 }
8817 }
8818 else if (!
GetGame().IsMultiplayer())
8819 {
8821 }
8822 }
8823
8825 {
8827 float split_quantity_new;
8829 if (player)
8830 {
8832 if (quantity > stackable)
8833 split_quantity_new = stackable;
8834 else
8835 split_quantity_new = quantity;
8836
8838 {
8839 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8840 new_item =
ItemBase.Cast(in_hands);
8841 if (new_item)
8842 {
8843 new_item.SetResultOfSplit(true);
8844 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8846 new_item.SetQuantity(split_quantity_new, false, true);
8847 }
8848 }
8849 }
8850 }
8851
8853 {
8855 float split_quantity_new = Math.Floor(quantity * 0.5);
8856
8858 return;
8859
8861
8862 if (new_item)
8863 {
8864 if (new_item.GetQuantityMax() < split_quantity_new)
8865 {
8866 split_quantity_new = new_item.GetQuantityMax();
8867 }
8868
8869 new_item.SetResultOfSplit(true);
8870 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8871
8873 {
8876 }
8877 else
8878 {
8880 new_item.
SetQuantity(split_quantity_new,
false,
true);
8881 }
8882 }
8883 }
8884
8886 {
8888 float split_quantity_new = Math.Floor(quantity / 2);
8889
8891 return;
8892
8893 InventoryLocation invloc = new InventoryLocation;
8895
8897 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8898
8899 if (new_item)
8900 {
8901 if (new_item.GetQuantityMax() < split_quantity_new)
8902 {
8903 split_quantity_new = new_item.GetQuantityMax();
8904 }
8906 {
8909 }
8910 else if (split_quantity_new > 1)
8911 {
8913 new_item.
SetQuantity(split_quantity_new,
false,
true);
8914 }
8915 }
8916 }
8917
8920 {
8921 SetWeightDirty();
8923
8924 if (parent)
8925 parent.OnAttachmentQuantityChangedEx(this, delta);
8926
8928 {
8930 {
8932 }
8934 {
8935 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8937 }
8938 }
8939
8940 }
8941
8944 {
8945
8946 }
8947
8950 {
8952 }
8953
8955 {
8956 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8957
8959 {
8960 if (newLevel == GameConstants.STATE_RUINED)
8961 {
8963 EntityAI parent = GetHierarchyParent();
8964 if (parent && parent.IsFireplace())
8965 {
8966 CargoBase cargo = GetInventory().GetCargo();
8967 if (cargo)
8968 {
8970 {
8972 }
8973 }
8974 }
8975 }
8976
8978 {
8979
8981 return;
8982 }
8983
8984 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8985 {
8987 }
8988 }
8989 }
8990
8991
8993 {
8994 super.OnRightClick();
8995
8997 {
8999 {
9000 if (ScriptInputUserData.CanStoreInputUserData())
9001 {
9002 EntityAI root = GetHierarchyRoot();
9003 Man playerOwner = GetHierarchyRootPlayer();
9004 InventoryLocation dst = new InventoryLocation;
9005
9006
9007 if (!playerOwner && root && root == this)
9008 {
9010 }
9011 else
9012 {
9013
9014 GetInventory().GetCurrentInventoryLocation(dst);
9016 {
9019 {
9021 }
9022 else
9023 {
9025
9026
9027 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9028 {
9030 }
9031 else
9032 {
9033 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9034 }
9035 }
9036 }
9037 }
9038
9039 ScriptInputUserData ctx = new ScriptInputUserData;
9047 }
9048 }
9049 else if (!
GetGame().IsMultiplayer())
9050 {
9052 }
9053 }
9054 }
9055
9057 {
9058 if (root)
9059 {
9060 vector m4[4];
9061 root.GetTransform(m4);
9062 dst.SetGround(this, m4);
9063 }
9064 else
9065 {
9066 GetInventory().GetCurrentInventoryLocation(dst);
9067 }
9068 }
9069
9070 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9071 {
9072
9073 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9074 return false;
9075
9076 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9077 return false;
9078
9079
9081 return false;
9082
9083
9084 Magazine mag = Magazine.Cast(this);
9085 if (mag)
9086 {
9087 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9088 return false;
9089
9090 if (stack_max_limit)
9091 {
9092 Magazine other_mag = Magazine.Cast(other_item);
9093 if (other_item)
9094 {
9095 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9096 return false;
9097 }
9098
9099 }
9100 }
9101 else
9102 {
9103
9105 return false;
9106
9108 return false;
9109 }
9110
9111 PlayerBase player = null;
9112 if (CastTo(player, GetHierarchyRootPlayer()))
9113 {
9114 if (player.GetInventory().HasAttachment(this))
9115 return false;
9116
9117 if (player.IsItemsToDelete())
9118 return false;
9119 }
9120
9121 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9122 return false;
9123
9124 int slotID;
9126 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9127 return false;
9128
9129 return true;
9130 }
9131
9133 {
9135 }
9136
9138 {
9139 return m_IsResultOfSplit;
9140 }
9141
9143 {
9144 m_IsResultOfSplit = value;
9145 }
9146
9148 {
9150 }
9151
9153 {
9154 float other_item_quantity = other_item.GetQuantity();
9155 float this_free_space;
9156
9158
9160
9161 if (other_item_quantity > this_free_space)
9162 {
9163 return this_free_space;
9164 }
9165 else
9166 {
9167 return other_item_quantity;
9168 }
9169 }
9170
9172 {
9174 }
9175
9177 {
9179 return;
9180
9181 if (!IsMagazine() && other_item)
9182 {
9184 if (quantity_used != 0)
9185 {
9186 float hp1 = GetHealth01("","");
9187 float hp2 = other_item.GetHealth01("","");
9188 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9189 hpResult = hpResult / (
GetQuantity() + quantity_used);
9190
9191 hpResult *= GetMaxHealth();
9192 Math.Round(hpResult);
9193 SetHealth("", "Health", hpResult);
9194
9196 other_item.AddQuantity(-quantity_used);
9197 }
9198 }
9200 }
9201
9203 {
9204 #ifdef SERVER
9205 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9206 GetHierarchyParent().IncreaseLifetimeUp();
9207 #endif
9208 };
9209
9211 {
9212 PlayerBase p = PlayerBase.Cast(player);
9213
9214 array<int> recipesIds = p.m_Recipes;
9215 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9216 if (moduleRecipesManager)
9217 {
9218 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9219 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9220 }
9221
9222 for (int i = 0;i < recipesIds.Count(); i++)
9223 {
9224 int key = recipesIds.Get(i);
9225 string recipeName = moduleRecipesManager.GetRecipeName(key);
9227 }
9228 }
9229
9230
9231 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9232 {
9233 super.GetDebugActions(outputList);
9234
9235
9241
9242
9247
9252
9253
9257
9258
9260 {
9264 }
9265
9268
9269
9273
9275
9276 InventoryLocation loc = new InventoryLocation();
9277 GetInventory().GetCurrentInventoryLocation(loc);
9279 {
9280 if (Gizmo_IsSupported())
9283 }
9284
9286 }
9287
9288
9289
9290
9292 {
9293 super.OnAction(action_id, player, ctx);
9294
9296 {
9297 switch (action_id)
9298 {
9301 return true;
9304 return true;
9305 }
9306 }
9307
9309 {
9310 switch (action_id)
9311 {
9313 Delete();
9314 return true;
9315 }
9316 }
9317
9318 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9319 {
9320 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9321 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9322 PlayerBase p = PlayerBase.Cast(player);
9323 if (
EActions.RECIPES_RANGE_START < 1000)
9324 {
9325 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9326 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9327 }
9328 }
9329 #ifndef SERVER
9330 else if (action_id ==
EActions.WATCH_PLAYER)
9331 {
9332 PluginDeveloper.SetDeveloperItemClientEx(player);
9333 }
9334 #endif
9336 {
9337 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9338 {
9339 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9340 OnDebugButtonPressServer(id + 1);
9341 }
9342
9343 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9344 {
9345 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9347 }
9348
9349 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9350 {
9351 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9353 }
9354
9355 else if (action_id ==
EActions.ADD_QUANTITY)
9356 {
9357 if (IsMagazine())
9358 {
9359 Magazine mag = Magazine.Cast(this);
9360 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9361 }
9362 else
9363 {
9365 }
9366
9367 if (m_EM)
9368 {
9369 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9370 }
9371
9372 }
9373
9374 else if (action_id ==
EActions.REMOVE_QUANTITY)
9375 {
9376 if (IsMagazine())
9377 {
9378 Magazine mag2 = Magazine.Cast(this);
9379 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9380 }
9381 else
9382 {
9384 }
9385 if (m_EM)
9386 {
9387 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9388 }
9389
9390 }
9391
9392 else if (action_id ==
EActions.SET_QUANTITY_0)
9393 {
9395
9396 if (m_EM)
9397 {
9398 m_EM.SetEnergy(0);
9399 }
9400 }
9401
9402 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9403 {
9405
9406 if (m_EM)
9407 {
9408 m_EM.SetEnergy(m_EM.GetEnergyMax());
9409 }
9410 }
9411
9412 else if (action_id ==
EActions.ADD_HEALTH)
9413 {
9414 AddHealth("","",GetMaxHealth("","Health")/5);
9415 }
9416 else if (action_id ==
EActions.REMOVE_HEALTH)
9417 {
9418 AddHealth("","",-GetMaxHealth("","Health")/5);
9419 }
9420 else if (action_id ==
EActions.DESTROY_HEALTH)
9421 {
9422 SetHealth01("","",0);
9423 }
9424 else if (action_id ==
EActions.WATCH_ITEM)
9425 {
9427 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9428 #ifdef DEVELOPER
9429 SetDebugDeveloper_item(this);
9430 #endif
9431 }
9432
9433 else if (action_id ==
EActions.ADD_TEMPERATURE)
9434 {
9435 AddTemperature(20);
9436
9437 }
9438
9439 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9440 {
9441 AddTemperature(-20);
9442
9443 }
9444
9445 else if (action_id ==
EActions.FLIP_FROZEN)
9446 {
9447 SetFrozen(!GetIsFrozen());
9448
9449 }
9450
9451 else if (action_id ==
EActions.ADD_WETNESS)
9452 {
9454
9455 }
9456
9457 else if (action_id ==
EActions.REMOVE_WETNESS)
9458 {
9460
9461 }
9462
9463 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9464 {
9467
9468
9469 }
9470
9471 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9472 {
9475 }
9476
9477 else if (action_id ==
EActions.MAKE_SPECIAL)
9478 {
9479 auto debugParams = DebugSpawnParams.WithPlayer(player);
9480 OnDebugSpawnEx(debugParams);
9481 }
9482
9483 }
9484
9485
9486 return false;
9487 }
9488
9489
9490
9491
9495
9498
9499
9500
9502 {
9503 return false;
9504 }
9505
9506
9508 {
9509 return true;
9510 }
9511
9512
9514 {
9515 return true;
9516 }
9517
9518
9519
9521 {
9522 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9524 }
9525
9528 {
9529 return null;
9530 }
9531
9533 {
9534 return false;
9535 }
9536
9538 {
9539 return false;
9540 }
9541
9545
9546
9548 {
9549 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9550 return module_repairing.CanRepair(this, item_repair_kit);
9551 }
9552
9553
9554 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9555 {
9556 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9557 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9558 }
9559
9560
9562 {
9563
9564
9565
9566
9567
9568
9569
9570
9571 return 1;
9572 }
9573
9574
9575
9577 {
9579 }
9580
9581
9582
9584 {
9586 }
9587
9588
9597 {
9598 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9599
9600 if (player)
9601 {
9602 player.MessageStatus(text);
9603 }
9604 }
9605
9606
9615 {
9616 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9617
9618 if (player)
9619 {
9620 player.MessageAction(text);
9621 }
9622 }
9623
9624
9633 {
9634 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9635
9636 if (player)
9637 {
9638 player.MessageFriendly(text);
9639 }
9640 }
9641
9642
9651 {
9652 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9653
9654 if (player)
9655 {
9656 player.MessageImportant(text);
9657 }
9658 }
9659
9661 {
9662 return true;
9663 }
9664
9665
9666 override bool KindOf(
string tag)
9667 {
9668 bool found = false;
9669 string item_name = this.
GetType();
9672
9673 int array_size = item_tag_array.Count();
9674 for (int i = 0; i < array_size; i++)
9675 {
9676 if (item_tag_array.Get(i) == tag)
9677 {
9678 found = true;
9679 break;
9680 }
9681 }
9682 return found;
9683 }
9684
9685
9687 {
9688
9689 super.OnRPC(sender, rpc_type,ctx);
9690
9691
9692 switch (rpc_type)
9693 {
9694 #ifndef SERVER
9695 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9696 Param2<bool, string> p = new Param2<bool, string>(false, "");
9697
9699 return;
9700
9701 bool play = p.param1;
9702 string soundSet = p.param2;
9703
9704 if (play)
9705 {
9707 {
9709 {
9711 }
9712 }
9713 else
9714 {
9716 }
9717 }
9718 else
9719 {
9721 }
9722
9723 break;
9724 #endif
9725
9726 }
9727
9729 {
9731 }
9732 }
9733
9734
9735
9736
9738 {
9739 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9740 return plugin.GetID(
name);
9741 }
9742
9744 {
9745 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9746 return plugin.GetName(id);
9747 }
9748
9751 {
9752
9753
9754 int varFlags;
9755 if (!ctx.
Read(varFlags))
9756 return;
9757
9758 if (varFlags & ItemVariableFlags.FLOAT)
9759 {
9761 }
9762 }
9763
9765 {
9766
9767 super.SerializeNumericalVars(floats_out);
9768
9769
9770
9772 {
9774 }
9775
9777 {
9779 }
9780
9782 {
9784 }
9785
9787 {
9792 }
9793
9795 {
9797 }
9798 }
9799
9801 {
9802
9803 super.DeSerializeNumericalVars(floats);
9804
9805
9806 int index = 0;
9807 int mask = Math.Round(floats.Get(index));
9808
9809 index++;
9810
9812 {
9814 {
9816 }
9817 else
9818 {
9819 float quantity = floats.Get(index);
9821 }
9822 index++;
9823 }
9824
9826 {
9827 float wet = floats.Get(index);
9829 index++;
9830 }
9831
9833 {
9834 int liquidtype = Math.Round(floats.Get(index));
9836 index++;
9837 }
9838
9840 {
9842 index++;
9844 index++;
9846 index++;
9848 index++;
9849 }
9850
9852 {
9853 int cleanness = Math.Round(floats.Get(index));
9855 index++;
9856 }
9857 }
9858
9860 {
9861 super.WriteVarsToCTX(ctx);
9862
9863
9865 {
9867 }
9868
9870 {
9872 }
9873
9875 {
9877 }
9878
9880 {
9881 int r,g,b,a;
9887 }
9888
9890 {
9892 }
9893 }
9894
9896 {
9897 if (!super.ReadVarsFromCTX(ctx,version))
9898 return false;
9899
9900 int intValue;
9901 float value;
9902
9903 if (version < 140)
9904 {
9905 if (!ctx.
Read(intValue))
9906 return false;
9907
9908 m_VariablesMask = intValue;
9909 }
9910
9912 {
9913 if (!ctx.
Read(value))
9914 return false;
9915
9917 {
9919 }
9920 else
9921 {
9923 }
9924 }
9925
9926 if (version < 140)
9927 {
9929 {
9930 if (!ctx.
Read(value))
9931 return false;
9932 SetTemperatureDirect(value);
9933 }
9934 }
9935
9937 {
9938 if (!ctx.
Read(value))
9939 return false;
9941 }
9942
9944 {
9945 if (!ctx.
Read(intValue))
9946 return false;
9948 }
9949
9951 {
9952 int r,g,b,a;
9954 return false;
9956 return false;
9958 return false;
9960 return false;
9961
9963 }
9964
9966 {
9967 if (!ctx.
Read(intValue))
9968 return false;
9970 }
9971
9972 if (version >= 138 && version < 140)
9973 {
9975 {
9976 if (!ctx.
Read(intValue))
9977 return false;
9978 SetFrozen(intValue);
9979 }
9980 }
9981
9982 return true;
9983 }
9984
9985
9987 {
9990 {
9992 }
9993
9994 if (!super.OnStoreLoad(ctx, version))
9995 {
9997 return false;
9998 }
9999
10000 if (version >= 114)
10001 {
10002 bool hasQuickBarIndexSaved;
10003
10004 if (!ctx.
Read(hasQuickBarIndexSaved))
10005 {
10007 return false;
10008 }
10009
10010 if (hasQuickBarIndexSaved)
10011 {
10012 int itmQBIndex;
10013
10014
10015 if (!ctx.
Read(itmQBIndex))
10016 {
10018 return false;
10019 }
10020
10021 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10022 if (itmQBIndex != -1 && parentPlayer)
10023 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10024 }
10025 }
10026 else
10027 {
10028
10029 PlayerBase player;
10030 int itemQBIndex;
10031 if (version ==
int.
MAX)
10032 {
10033 if (!ctx.
Read(itemQBIndex))
10034 {
10036 return false;
10037 }
10038 }
10039 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10040 {
10041
10042 if (!ctx.
Read(itemQBIndex))
10043 {
10045 return false;
10046 }
10047 if (itemQBIndex != -1 && player)
10048 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10049 }
10050 }
10051
10052 if (version < 140)
10053 {
10054
10055 if (!LoadVariables(ctx, version))
10056 {
10058 return false;
10059 }
10060 }
10061
10062
10064 {
10066 return false;
10067 }
10068 if (version >= 132)
10069 {
10071 if (raib)
10072 {
10074 {
10076 return false;
10077 }
10078 }
10079 }
10080
10082 return true;
10083 }
10084
10085
10086
10088 {
10089 super.OnStoreSave(ctx);
10090
10091 PlayerBase player;
10092 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10093 {
10095
10096 int itemQBIndex = -1;
10097 itemQBIndex = player.FindQuickBarEntityIndex(this);
10098 ctx.
Write(itemQBIndex);
10099 }
10100 else
10101 {
10103 }
10104
10106
10108 if (raib)
10109 {
10111 }
10112 }
10113
10114
10116 {
10117 super.AfterStoreLoad();
10118
10120 {
10122 }
10123
10125 {
10128 }
10129 }
10130
10132 {
10133 super.EEOnAfterLoad();
10134
10136 {
10138 }
10139
10142 }
10143
10145 {
10146 return false;
10147 }
10148
10149
10150
10152 {
10154 {
10155 #ifdef PLATFORM_CONSOLE
10156
10158 {
10160 if (menu)
10161 {
10163 }
10164 }
10165 #endif
10166 }
10167
10169 {
10172 }
10173
10175 {
10176 SetWeightDirty();
10178 }
10180 {
10183 }
10184
10186 {
10189 }
10191 {
10194 }
10195
10196 super.OnVariablesSynchronized();
10197 }
10198
10199
10200
10202 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10203 {
10204 if (!IsServerCheck(allow_client))
10205 return false;
10206
10208 return false;
10209
10212
10213 if (value <= (min + 0.001))
10214 value = min;
10215
10216 if (value == min)
10217 {
10218 if (destroy_config)
10219 {
10220 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10221 if (dstr)
10222 {
10224 this.Delete();
10225 return true;
10226 }
10227 }
10228 else if (destroy_forced)
10229 {
10231 this.Delete();
10232 return true;
10233 }
10234
10236 }
10237
10240
10242 {
10244
10245 if (delta)
10247 }
10248
10250
10251 return false;
10252 }
10253
10254
10256 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10257 {
10259 }
10260
10262 {
10265 }
10266
10268 {
10271 }
10272
10274 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10275 {
10276 float value_clamped = Math.Clamp(value, 0, 1);
10278 SetQuantity(result, destroy_config, destroy_forced);
10279 }
10280
10281
10284 {
10286 }
10287
10289 {
10291 }
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10303 {
10304 int slot = -1;
10305 if (GetInventory())
10306 {
10307 InventoryLocation il = new InventoryLocation;
10308 GetInventory().GetCurrentInventoryLocation(il);
10310 }
10311
10313 }
10314
10316 {
10317 float quantity_max = 0;
10318
10320 {
10321 if (attSlotID != -1)
10322 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10323
10324 if (quantity_max <= 0)
10326 }
10327
10328 if (quantity_max <= 0)
10330
10331 return quantity_max;
10332 }
10333
10335 {
10337 }
10338
10340 {
10342 }
10343
10344
10346 {
10348 }
10349
10351 {
10353 }
10354
10356 {
10358 }
10359
10360
10362 {
10363
10364 float weightEx = GetWeightEx();
10365 float special = GetInventoryAndCargoWeight();
10366 return weightEx - special;
10367 }
10368
10369
10371 {
10373 }
10374
10376 {
10378 {
10379 #ifdef DEVELOPER
10380 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10381 {
10382 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10384 }
10385 #endif
10386
10387 return GetQuantity() * GetConfigWeightModified();
10388 }
10389 else if (HasEnergyManager())
10390 {
10391 #ifdef DEVELOPER
10392 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10393 {
10394 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10395 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10396 }
10397 #endif
10398 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10399 }
10400 else
10401 {
10402 #ifdef DEVELOPER
10403 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10404 {
10405 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10406 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10407 }
10408 #endif
10409 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10410 }
10411 }
10412
10415 {
10416 int item_count = 0;
10418
10419 if (GetInventory().GetCargo() != NULL)
10420 {
10421 item_count = GetInventory().GetCargo().GetItemCount();
10422 }
10423
10424 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10425 {
10426 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10427 if (item)
10428 item_count += item.GetNumberOfItems();
10429 }
10430 return item_count;
10431 }
10432
10435 {
10436 float weight = 0;
10437 float wetness = 1;
10438 if (include_wetness)
10441 {
10442 weight = wetness * m_ConfigWeight;
10443 }
10445 {
10446 weight = 1;
10447 }
10448 return weight;
10449 }
10450
10451
10452
10454 {
10455 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
10456 {
10457 GameInventory inv = GetInventory();
10458 array<EntityAI> items = new array<EntityAI>;
10460 for (int i = 0; i < items.Count(); i++)
10461 {
10463 if (item)
10464 {
10466 }
10467 }
10468 }
10469 }
10470
10471
10472
10473
10475 {
10476 float energy = 0;
10477 if (HasEnergyManager())
10478 {
10479 energy = GetCompEM().GetEnergy();
10480 }
10481 return energy;
10482 }
10483
10484
10486 {
10487 super.OnEnergyConsumed();
10488
10490 }
10491
10493 {
10494 super.OnEnergyAdded();
10495
10497 }
10498
10499
10501 {
10502 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10503 {
10505 {
10506 float energy_0to1 = GetCompEM().GetEnergy0To1();
10508 }
10509 }
10510 }
10511
10512
10514 {
10515 return ConfigGetFloat("heatIsolation");
10516 }
10517
10519 {
10521 }
10522
10524 {
10525 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10526 if (
GetGame().ConfigIsExisting(paramPath))
10528
10529 return 0.0;
10530 }
10531
10533 {
10534 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10535 if (
GetGame().ConfigIsExisting(paramPath))
10537
10538 return 0.0;
10539 }
10540
10541 override void SetWet(
float value,
bool allow_client =
false)
10542 {
10543 if (!IsServerCheck(allow_client))
10544 return;
10545
10548
10550
10551 m_VarWet = Math.Clamp(value, min, max);
10552
10554 {
10557 }
10558 }
10559
10560 override void AddWet(
float value)
10561 {
10563 }
10564
10566 {
10568 }
10569
10571 {
10573 }
10574
10576 {
10578 }
10579
10581 {
10583 }
10584
10586 {
10588 }
10589
10590 override void OnWetChanged(
float newVal,
float oldVal)
10591 {
10594 if (newLevel != oldLevel)
10595 {
10597 }
10598 }
10599
10601 {
10602 SetWeightDirty();
10603 }
10604
10606 {
10607 return GetWetLevelInternal(
m_VarWet);
10608 }
10609
10610
10611
10613 {
10615 }
10616
10618 {
10620 }
10621
10623 {
10625 }
10626
10628 {
10630 }
10631
10632
10633
10635 {
10636 if (ConfigIsExisting("itemModelLength"))
10637 {
10638 return ConfigGetFloat("itemModelLength");
10639 }
10640 return 0;
10641 }
10642
10644 {
10645 if (ConfigIsExisting("itemAttachOffset"))
10646 {
10647 return ConfigGetFloat("itemAttachOffset");
10648 }
10649 return 0;
10650 }
10651
10652 override void SetCleanness(
int value,
bool allow_client =
false)
10653 {
10654 if (!IsServerCheck(allow_client))
10655 return;
10656
10658
10660
10663 }
10664
10666 {
10668 }
10669
10671 {
10672 return true;
10673 }
10674
10675
10676
10677
10679 {
10681 }
10682
10684 {
10686 }
10687
10688
10689
10690
10691 override void SetColor(
int r,
int g,
int b,
int a)
10692 {
10698 }
10700 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10701 {
10706 }
10707
10709 {
10711 }
10712
10715 {
10716 int r,g,b,a;
10718 r = r/255;
10719 g = g/255;
10720 b = b/255;
10721 a = a/255;
10722 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10723 }
10724
10725
10726
10727 override void SetLiquidType(
int value,
bool allow_client =
false)
10728 {
10729 if (!IsServerCheck(allow_client))
10730 return;
10731
10736 }
10737
10739 {
10740 return ConfigGetInt("varLiquidTypeInit");
10741 }
10742
10744 {
10746 }
10747
10749 {
10751 SetFrozen(false);
10752 }
10753
10756 {
10757 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10758 }
10759
10760
10763 {
10764 PlayerBase nplayer;
10765 if (PlayerBase.CastTo(nplayer, player))
10766 {
10768
10769 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10770 }
10771 }
10772
10773
10776 {
10777 PlayerBase nplayer;
10778 if (PlayerBase.CastTo(nplayer,player))
10779 {
10780
10781 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10782
10783 }
10784
10785
10786 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10787
10788
10789 if (HasEnergyManager())
10790 {
10791 GetCompEM().UpdatePlugState();
10792 }
10793 }
10794
10795
10797 {
10798 super.OnPlacementStarted(player);
10799
10801 }
10802
10803 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10804 {
10806 {
10807 m_AdminLog.OnPlacementComplete(player,
this);
10808 }
10809
10810 super.OnPlacementComplete(player, position, orientation);
10811 }
10812
10813
10814
10815
10816
10818 {
10820 {
10821 return true;
10822 }
10823 else
10824 {
10825 return false;
10826 }
10827 }
10828
10829
10831 {
10833 {
10835 }
10836 }
10837
10838
10840 {
10842 }
10843
10845 {
10847 }
10848
10849 override void InsertAgent(
int agent,
float count = 1)
10850 {
10851 if (count < 1)
10852 return;
10853
10855 }
10856
10859 {
10861 }
10862
10863
10865 {
10867 }
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10911 {
10913 return false;
10914 return true;
10915 }
10916
10918 {
10919
10921 }
10922
10923
10926 {
10927 super.CheckForRoofLimited(timeTresholdMS);
10928
10930 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10931 {
10932 m_PreviousRoofTestTime = time;
10933 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10934 }
10935 }
10936
10937
10939 {
10941 {
10942 return 0;
10943 }
10944
10945 if (GetInventory().GetAttachmentSlotsCount() != 0)
10946 {
10947 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10948 if (filter)
10949 return filter.GetProtectionLevel(type, false, system);
10950 else
10951 return 0;
10952 }
10953
10954 string subclassPath, entryName;
10955
10956 switch (type)
10957 {
10959 entryName = "biological";
10960 break;
10962 entryName = "chemical";
10963 break;
10964 default:
10965 entryName = "biological";
10966 break;
10967 }
10968
10969 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10970
10972 }
10973
10974
10975
10978 {
10979 if (!IsMagazine())
10981
10983 }
10984
10985
10986
10987
10988
10993 {
10994 return true;
10995 }
10996
10998 {
11000 }
11001
11002
11003
11004
11005
11007 {
11008 if (parent)
11009 {
11010 if (parent.IsInherited(DayZInfected))
11011 return true;
11012
11013 if (!parent.IsRuined())
11014 return true;
11015 }
11016
11017 return true;
11018 }
11019
11021 {
11022 if (!super.CanPutAsAttachment(parent))
11023 {
11024 return false;
11025 }
11026
11027 if (!IsRuined() && !parent.IsRuined())
11028 {
11029 return true;
11030 }
11031
11032 return false;
11033 }
11034
11036 {
11037
11038
11039
11040
11041 return super.CanReceiveItemIntoCargo(item);
11042 }
11043
11045 {
11046
11047
11048
11049
11050 GameInventory attachmentInv = attachment.GetInventory();
11052 {
11053 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11054 return false;
11055 }
11056
11057 InventoryLocation loc = new InventoryLocation();
11058 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11059 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11060 return false;
11061
11062 return super.CanReceiveAttachment(attachment, slotId);
11063 }
11064
11066 {
11067 if (!super.CanReleaseAttachment(attachment))
11068 return false;
11069
11070 return GetInventory().AreChildrenAccessible();
11071 }
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11094 {
11095 int id = muzzle_owner.GetMuzzleID();
11096 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11097
11098 if (WPOF_array)
11099 {
11100 for (int i = 0; i < WPOF_array.Count(); i++)
11101 {
11102 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11103
11104 if (WPOF)
11105 {
11106 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11107 }
11108 }
11109 }
11110 }
11111
11112
11114 {
11115 int id = muzzle_owner.GetMuzzleID();
11117
11118 if (WPOBE_array)
11119 {
11120 for (int i = 0; i < WPOBE_array.Count(); i++)
11121 {
11122 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11123
11124 if (WPOBE)
11125 {
11126 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11127 }
11128 }
11129 }
11130 }
11131
11132
11134 {
11135 int id = muzzle_owner.GetMuzzleID();
11136 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11137
11138 if (WPOOH_array)
11139 {
11140 for (int i = 0; i < WPOOH_array.Count(); i++)
11141 {
11142 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11143
11144 if (WPOOH)
11145 {
11146 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11147 }
11148 }
11149 }
11150 }
11151
11152
11154 {
11155 int id = muzzle_owner.GetMuzzleID();
11156 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11157
11158 if (WPOOH_array)
11159 {
11160 for (int i = 0; i < WPOOH_array.Count(); i++)
11161 {
11162 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11163
11164 if (WPOOH)
11165 {
11166 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11167 }
11168 }
11169 }
11170 }
11171
11172
11174 {
11175 int id = muzzle_owner.GetMuzzleID();
11176 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11177
11178 if (WPOOH_array)
11179 {
11180 for (int i = 0; i < WPOOH_array.Count(); i++)
11181 {
11182 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11183
11184 if (WPOOH)
11185 {
11186 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11187 }
11188 }
11189 }
11190 }
11191
11192
11193
11195 {
11197 {
11198 return true;
11199 }
11200
11201 return false;
11202 }
11203
11205 {
11207 {
11208 return true;
11209 }
11210
11211 return false;
11212 }
11213
11215 {
11217 {
11218 return true;
11219 }
11220
11221 return false;
11222 }
11223
11225 {
11226 return false;
11227 }
11228
11231 {
11232 return UATimeSpent.DEFAULT_DEPLOY;
11233 }
11234
11235
11236
11237
11239 {
11241 SetSynchDirty();
11242 }
11243
11245 {
11247 }
11248
11249
11251 {
11252 return false;
11253 }
11254
11257 {
11258 string att_type = "None";
11259
11260 if (ConfigIsExisting("soundAttType"))
11261 {
11262 att_type = ConfigGetString("soundAttType");
11263 }
11264
11266 }
11267
11269 {
11271 }
11272
11273
11274
11275
11276
11282
11284 {
11287
11289 }
11290
11291
11293 {
11295 return;
11296
11298
11301
11304
11305 SoundParameters params = new SoundParameters();
11309 }
11310
11311
11313 {
11315 return;
11316
11318 SetSynchDirty();
11319
11322 }
11323
11324
11326 {
11328 return;
11329
11331 SetSynchDirty();
11332
11335 }
11336
11338 {
11340 }
11341
11343 {
11345 }
11346
11349 {
11350 if (!
GetGame().IsDedicatedServer())
11351 {
11352 if (ConfigIsExisting("attachSoundSet"))
11353 {
11354 string cfg_path = "";
11355 string soundset = "";
11356 string type_name =
GetType();
11357
11360 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11361 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11362
11363 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11364 {
11365 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11366 {
11367 if (cfg_slot_array[i] == slot_type)
11368 {
11369 soundset = cfg_soundset_array[i];
11370 break;
11371 }
11372 }
11373 }
11374
11375 if (soundset != "")
11376 {
11377 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11379 }
11380 }
11381 }
11382 }
11383
11385 {
11386
11387 }
11388
11389 void OnApply(PlayerBase player);
11390
11392 {
11393 return 1.0;
11394 };
11395
11397 {
11399 }
11400
11402 {
11404 }
11405
11407
11409 {
11410 SetDynamicPhysicsLifeTime(0.01);
11412 }
11413
11415 {
11416 array<string> zone_names = new array<string>;
11417 GetDamageZones(zone_names);
11418 for (int i = 0; i < zone_names.Count(); i++)
11419 {
11420 SetHealthMax(zone_names.Get(i),"Health");
11421 }
11422 SetHealthMax("","Health");
11423 }
11424
11427 {
11428 float global_health = GetHealth01("","Health");
11429 array<string> zones = new array<string>;
11430 GetDamageZones(zones);
11431
11432 for (int i = 0; i < zones.Count(); i++)
11433 {
11434 SetHealth01(zones.Get(i),"Health",global_health);
11435 }
11436 }
11437
11440 {
11441 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11442 }
11443
11445 {
11446 if (!hasRootAsPlayer)
11447 {
11448 if (refParentIB)
11449 {
11450
11451 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11452 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11453
11454 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11455 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11456
11459 }
11460 else
11461 {
11462
11465 }
11466 }
11467 }
11468
11470 {
11472 {
11473 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11474 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11475 {
11476 float heatPermCoef = 1.0;
11478 while (ent)
11479 {
11480 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11481 ent = ent.GetHierarchyParent();
11482 }
11483
11484 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11485 }
11486 }
11487 }
11488
11490 {
11491
11492 EntityAI parent = GetHierarchyParent();
11493 if (!parent)
11494 {
11495 hasParent = false;
11496 hasRootAsPlayer = false;
11497 }
11498 else
11499 {
11500 hasParent = true;
11501 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11502 refParentIB =
ItemBase.Cast(parent);
11503 }
11504 }
11505
11506 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11507 {
11508
11509 }
11510
11512 {
11513
11514 return false;
11515 }
11516
11518 {
11519
11520
11521 return false;
11522 }
11523
11525 {
11526
11527 return false;
11528 }
11529
11532 {
11533 return !GetIsFrozen() &&
IsOpen();
11534 }
11535
11537 {
11538 bool hasParent = false, hasRootAsPlayer = false;
11540
11541 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11542 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11543
11544 if (wwtu || foodDecay)
11545 {
11549
11550 if (processWetness || processTemperature || processDecay)
11551 {
11553
11554 if (processWetness)
11555 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11556
11557 if (processTemperature)
11559
11560 if (processDecay)
11561 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11562 }
11563 }
11564 }
11565
11568 {
11570 }
11571
11573 {
11576
11577 return super.GetTemperatureFreezeThreshold();
11578 }
11579
11581 {
11584
11585 return super.GetTemperatureThawThreshold();
11586 }
11587
11589 {
11592
11593 return super.GetItemOverheatThreshold();
11594 }
11595
11597 {
11599 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11600
11601 return super.GetTemperatureFreezeTime();
11602 }
11603
11605 {
11607 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11608
11609 return super.GetTemperatureThawTime();
11610 }
11611
11616
11618 {
11619 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11620 }
11621
11623 {
11624 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11625 }
11626
11629 {
11631 }
11632
11634 {
11636 }
11637
11639 {
11641 }
11642
11645 {
11646 return null;
11647 }
11648
11651 {
11652 return false;
11653 }
11654
11656 {
11658 {
11661 if (!trg)
11662 {
11664 explosive = this;
11665 }
11666
11667 explosive.PairRemote(trg);
11669
11670 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11671 trg.SetPersistentPairID(persistentID);
11672 explosive.SetPersistentPairID(persistentID);
11673
11674 return true;
11675 }
11676 return false;
11677 }
11678
11681 {
11682 float ret = 1.0;
11685 ret *= GetHealth01();
11686
11687 return ret;
11688 }
11689
11690 #ifdef DEVELOPER
11691 override void SetDebugItem()
11692 {
11693 super.SetDebugItem();
11694 _itemBase = this;
11695 }
11696
11698 {
11699 string text = super.GetDebugText();
11700
11702 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11703
11704 return text;
11705 }
11706 #endif
11707
11709 {
11710 return true;
11711 }
11712
11714
11716
11718 {
11721 }
11722
11723
11731
11747}
11748
11750{
11752 if (entity)
11753 {
11754 bool is_item = entity.IsInherited(
ItemBase);
11755 if (is_item && full_quantity)
11756 {
11759 }
11760 }
11761 else
11762 {
11764 return NULL;
11765 }
11766 return entity;
11767}
11768
11770{
11771 if (item)
11772 {
11773 if (health > 0)
11774 item.SetHealth("", "", health);
11775
11776 if (item.CanHaveTemperature())
11777 {
11779 if (item.CanFreeze())
11780 item.SetFrozen(false);
11781 }
11782
11783 if (item.HasEnergyManager())
11784 {
11785 if (quantity >= 0)
11786 {
11787 item.GetCompEM().SetEnergy0To1(quantity);
11788 }
11789 else
11790 {
11792 }
11793 }
11794 else if (item.IsMagazine())
11795 {
11796 Magazine mag = Magazine.Cast(item);
11797 if (quantity >= 0)
11798 {
11799 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11800 }
11801 else
11802 {
11804 }
11805
11806 }
11807 else
11808 {
11809 if (quantity >= 0)
11810 {
11811 item.SetQuantityNormalized(quantity, false);
11812 }
11813 else
11814 {
11816 }
11817
11818 }
11819 }
11820}
11821
11822#ifdef DEVELOPER
11824#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
Open
Implementations only.
override void EEOnCECreate()
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 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)
bool ShouldSplitQuantity(float quantity)
static ref map< string, int > m_WeaponTypeToID
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
array< int > GetValidFinishers()
returns an array of possible finishers
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
ItemSoundHandler GetItemSoundHandler()
override int GetQuantityMin()
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
override int GetQuickBarBonus()
override void SetTakeable(bool pState)
float m_OverheatingDecayInterval
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
void RemoveAudioVisualsOnClient()
static void AddDebugActionsMask(int mask)
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
bool CanRepair(ItemBase item_repair_kit)
bool can_this_be_combined
EffectSound m_SoundDeploy
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
float GetDeployTime()
how long it takes to deploy this item in seconds
override bool IsSplitable()
bool DamageItemAttachments(float damage)
override void WriteVarsToCTX(ParamsWriteContext ctx)
void ConvertEnergyToQuantity()
override void RemoveAllAgents()
override void SetQuantityToMinimum()
bool m_WantPlayImpactSound
override float GetTemperatureThawTime()
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
float m_StoreLoadedQuantity
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
float GetFilterDamageRatio()
override void SetLiquidType(int value, bool allow_client=false)
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
void OnApply(PlayerBase player)
override void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
ref Timer m_CheckOverheating
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool IsOneHandedBehaviour()
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetDisinfectQuantity(int system=0, Param param1=null)
override bool IsHologram()
float GetItemAttachOffset()
static int GetDebugActionsMask()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnEnergyAdded()
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
EffectSound m_DeployLoopSoundEx
override void DeSerializeNumericalVars(array< float > floats)
void StopItemDynamicPhysics()
override void SetStoreLoad(bool value)
float GetOverheatingValue()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
override void EOnContact(IEntity other, Contact extra)
void SplitIntoStackMaxHands(PlayerBase player)
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override void SetStoreLoadedQuantity(float value)
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void OnLiquidTypeChanged(int oldType, int newType)
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void PlayDeployFinishSound()
bool AllowFoodConsumption()
bool m_IsOverheatingEffectActive
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
bool PairWithDevice(notnull ItemBase otherDevice)
static void RemoveDebugActionsMask(int mask)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void PerformDamageSystemReinit()
override void ClearInventory()
static int m_LastRegisteredWeaponID
ItemBase GetLightSourceItem()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
override float GetItemOverheatThreshold()
void StopDeployLoopSoundEx()
override void SerializeNumericalVars(array< float > floats_out)
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
static int m_DebugActionsMask
void KillAllOverheatingParticles()
bool CanBeCookedOnStick()
override int GetQuantityMax()
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
void OnActivatedByTripWire()
override void RemoveAgent(int agent_id)
bool m_ItemBeingDroppedPhys
override bool CanPutAsAttachment(EntityAI parent)
void PlayDetachSound(string slot_type)
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override bool IsBeingPlaced()
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
bool m_FixDamageSystemInit
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
void LoadParticleConfigOnOverheating(int id)
bool IsSoundSynchRemote()
override void OnRightClick()
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
bool IsActionTargetVisible()
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
int NameToID(string name)
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
void ClearStopItemSoundServer()
override string ChangeIntoOnDetach()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
EffectSound m_SoundDeployFinish
float GetQuantityNormalizedScripted()
override void SetCleanness(int value, bool allow_client=false)
override float GetWetMin()
ref ItemSoundHandler m_ItemSoundHandler
override bool KindOf(string tag)
void ItemSoundHandler(ItemBase parent)
EffectSound m_LockingSound
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
void RemoteDetonatorTrigger()
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
override void Explode(int damageType, string ammoType="")
void OnItemLocationChanged(ItemBase item)
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 void GizmoSelectObject(Object object)
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 native void GizmoSelectPhysics(Physics physics)
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
bool WriteToContext(ParamsWriteContext ctx)
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
override bool CanDisplayCargo()
override void OnInventoryEnter(Man player)
override string GetFoldSoundset()
override bool CanPutAsAttachment(EntityAI parent)
override bool CanReceiveItemIntoCargo(EntityAI item)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
override void EEDelete(EntityAI parent)
override bool CanBeRepairedByCrafting()
override void OnPlacementStarted(Man player)
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override bool IsElectricAppliance()
override bool IsItemTent()
override void SetActions()
override string GetLoopFoldSoundset()
override bool CanMakeGardenplot()
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override WrittenNoteData GetWrittenNoteData()
override int GetDamageSystemVersionChange()
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
override void InitItemVariables()
override void SetActionAnimOverrides()
override void OnCreatePhysics()
override string GetDeploySoundset()
override float GetBandagingEffectivity()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void OnStoreSave(ParamsWriteContext ctx)
override void AfterStoreLoad()
override int GetOnDigWormsAmount()
override bool IsSelfAdjustingTemperature()
override bool IsPlayerInside(PlayerBase player, string selection)
override void OnVariablesSynchronized()
override void RefreshPhysics()
override bool CanObstruct()
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanPutInCargo(EntityAI parent)
override string GetLoopDeploySoundset()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override void OnInventoryExit(Man player)
override bool IsTakeable()
override bool IsIgnoredByConstruction()
override void InitItemSounds()
override void EEKilled(Object killer)
override void OnCombine(ItemBase other_item)
override bool CanExplodeInFire()
override bool IsFacingPlayer(PlayerBase player, string selection)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
override bool IsBloodContainer()
override bool IsClothing()
override bool CanBeSplit()
override bool IsDeployable()
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
override bool CanBeDisinfected()
override float GetInfectionChance(int system=0, Param param=null)
override void OnEndPlacement()
float GetOverheatingLimitMax()
void SetOverheatingLimitMax(float max)
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
float GetOverheatingLimitMin()
void SetOverheatingLimitMin(float min)
void RegisterParticle(Particle p)
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
void SetControlledDevice(EntityAI pDevice)
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto 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.