Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChanged(item); first when overriding this event.
6893{
6895 {
6896 return true;
6897 }
6898};
6899
6900
6901
6903{
6907
6909
6912
6913
6914
6915
6916
6925
6931
6936
6941
6962 protected bool m_IsResultOfSplit
6963
6965
6970
6971
6972
6974
6978
6979
6980
6982
6985
6986
6987
6993
6994
7002
7005
7006
7008
7009
7011
7012
7017
7018
7023
7024
7026
7027
7029 {
7034
7035 if (!
GetGame().IsDedicatedServer())
7036 {
7038 {
7040
7042 {
7044 }
7045 }
7046
7049 }
7050
7051 m_OldLocation = null;
7052
7054 {
7056 }
7057
7058 if (ConfigIsExisting("headSelectionsToHide"))
7059 {
7062 }
7063
7065 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7066 {
7068 }
7069
7071
7072 m_IsResultOfSplit = false;
7073
7075 }
7076
7078 {
7079 super.InitItemVariables();
7080
7086 m_Count = ConfigGetInt(
"count");
7087
7090
7095
7098
7103
7115
7119
7120
7123 if (ConfigIsExisting("canBeSplit"))
7124 {
7127 }
7128
7130 if (ConfigIsExisting("itemBehaviour"))
7132
7133
7136 RegisterNetSyncVariableInt("m_VarLiquidType");
7137 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7138
7139 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7140 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7141 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7142
7143 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7144 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7145 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7146 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7147
7148 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7149 RegisterNetSyncVariableBool("m_IsTakeable");
7150 RegisterNetSyncVariableBool("m_IsHologram");
7151
7154 {
7157 }
7158
7160
7162 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7164
7165 }
7166
7168 {
7170 }
7171
7173 {
7176 {
7181 }
7182 }
7183
7184 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7185 {
7187 {
7190 }
7191
7193 }
7194
7196 {
7202 }
7203
7205
7207 {
7209
7210 if (!action)
7211 {
7212 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7213 return;
7214 }
7215
7217 if (!ai)
7218 {
7220 return;
7221 }
7222
7224 if (!action_array)
7225 {
7226 action_array = new array<ActionBase_Basic>;
7228 }
7229 if (LogManager.IsActionLogEnable())
7230 {
7231 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7232 }
7233
7234 if (action_array.Find(action) != -1)
7235 {
7236 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7237 }
7238 else
7239 {
7240 action_array.Insert(action);
7241 }
7242 }
7243
7245 {
7247 ActionBase action = player.GetActionManager().GetAction(actionName);
7250
7251 if (action_array)
7252 {
7253 action_array.RemoveItem(action);
7254 }
7255 }
7256
7257
7258
7260 {
7261 ActionOverrideData overrideData = new ActionOverrideData();
7265
7267 if (!actionMap)
7268 {
7271 }
7272
7273 actionMap.Insert(this.
Type(), overrideData);
7274
7275 }
7276
7278
7280
7281
7283 {
7286
7289
7290 string config_to_search = "CfgVehicles";
7291 string muzzle_owner_config;
7292
7294 {
7295 if (IsInherited(Weapon))
7296 config_to_search = "CfgWeapons";
7297
7298 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7299
7300 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7301
7303
7304 if (config_OnFire_subclass_count > 0)
7305 {
7306 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7307
7308 for (int i = 0; i < config_OnFire_subclass_count; i++)
7309 {
7310 string particle_class = "";
7312 string config_OnFire_entry = config_OnFire_class + particle_class;
7313 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7314 WPOF_array.Insert(WPOF);
7315 }
7316
7317
7319 }
7320 }
7321
7323 {
7324 config_to_search = "CfgWeapons";
7325 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7326
7327 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7328
7330
7331 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7332 {
7333 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7334
7335 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7336 {
7337 string particle_class2 = "";
7339 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7340 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7341 WPOBE_array.Insert(WPOBE);
7342 }
7343
7344
7346 }
7347 }
7348 }
7349
7350
7352 {
7355
7357 {
7358 string config_to_search = "CfgVehicles";
7359
7360 if (IsInherited(Weapon))
7361 config_to_search = "CfgWeapons";
7362
7363 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7364 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7365
7366 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
7367 {
7368
7370
7372 {
7374 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7376 return;
7377 }
7378
7381
7382
7383
7385 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7386
7387 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7388 {
7389 string particle_class = "";
7391 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7393
7394 if (entry_type == CT_CLASS)
7395 {
7396 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7397 WPOOH_array.Insert(WPOF);
7398 }
7399 }
7400
7401
7403 }
7404 }
7405 }
7406
7408 {
7410 }
7411
7413 {
7415 {
7417
7420
7423
7424 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7425 }
7426 }
7427
7429 {
7431 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7432
7434 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7435
7437 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7438
7440 {
7442 }
7443 }
7444
7446 {
7448 }
7449
7451 {
7454 else
7456
7458 {
7461 }
7462 else
7463 {
7466
7469 }
7470
7472 }
7473
7475 {
7477 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7478 }
7479
7481 {
7483 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7485 }
7486
7488 {
7490 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7491 }
7492
7494 {
7497
7498 OverheatingParticle OP = new OverheatingParticle();
7503
7505 }
7506
7508 {
7511
7512 return -1;
7513 }
7514
7516 {
7518 {
7521
7522 for (int i = count; i > 0; --i)
7523 {
7524 int id = i - 1;
7527
7530
7531 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7532 {
7533 if (p)
7534 {
7537 }
7538 }
7539 }
7540 }
7541 }
7542
7544 {
7546 {
7548 {
7549 int id = i - 1;
7551
7552 if (OP)
7553 {
7555
7556 if (p)
7557 {
7559 }
7560
7561 delete OP;
7562 }
7563 }
7564
7567 }
7568 }
7569
7572 {
7573 return 0.0;
7574 }
7575
7576
7578 {
7579 return 250;
7580 }
7581
7583 {
7584 return 0;
7585 }
7586
7589 {
7591 return true;
7592
7593 return false;
7594 }
7595
7598 {
7601
7603 {
7605 }
7606 else
7607 {
7608
7610 }
7611
7613 }
7614
7621 {
7622 return -1;
7623 }
7624
7625
7626
7627
7629 {
7631 {
7633 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7634
7635 if (r_index >= 0)
7636 {
7637 InventoryLocation r_il = new InventoryLocation;
7638 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7639
7640 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7643 {
7644 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7645 }
7647 {
7648 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7649 }
7650
7651 }
7652
7653 player.GetHumanInventory().ClearUserReservedLocation(this);
7654 }
7655
7658 }
7659
7660
7661
7662
7664 {
7665 return ItemBase.m_DebugActionsMask;
7666 }
7667
7669 {
7670 return ItemBase.m_DebugActionsMask & mask;
7671 }
7672
7674 {
7675 ItemBase.m_DebugActionsMask = mask;
7676 }
7677
7679 {
7680 ItemBase.m_DebugActionsMask |= mask;
7681 }
7682
7684 {
7685 ItemBase.m_DebugActionsMask &= ~mask;
7686 }
7687
7689 {
7691 {
7693 }
7694 else
7695 {
7697 }
7698 }
7699
7700
7702 {
7703 if (GetEconomyProfile())
7704 {
7705 float q_max = GetEconomyProfile().GetQuantityMax();
7706 if (q_max > 0)
7707 {
7708 float q_min = GetEconomyProfile().GetQuantityMin();
7709 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7710
7712 {
7713 ComponentEnergyManager comp = GetCompEM();
7715 {
7717 }
7718 }
7720 {
7722
7723 }
7724
7725 }
7726 }
7727 }
7728
7731 {
7732 EntityAI parent = GetHierarchyParent();
7733
7734 if (parent)
7735 {
7736 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7737 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7738 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7739 }
7740 }
7741
7744 {
7745 EntityAI parent = GetHierarchyParent();
7746
7747 if (parent)
7748 {
7749 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7750 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7751 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7752 }
7753 }
7754
7756 {
7757
7758
7759
7760
7762
7764 {
7765 if (ScriptInputUserData.CanStoreInputUserData())
7766 {
7767 ScriptInputUserData ctx = new ScriptInputUserData;
7773 ctx.
Write(use_stack_max);
7776
7778 {
7779 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7780 }
7781 }
7782 }
7783 else if (!
GetGame().IsMultiplayer())
7784 {
7786 }
7787 }
7788
7790 {
7792 }
7793
7795 {
7797 }
7798
7800 {
7802 }
7803
7805 {
7806
7807 return false;
7808 }
7809
7811 {
7812 return false;
7813 }
7814
7818 {
7819 return false;
7820 }
7821
7823 {
7824 return "";
7825 }
7826
7828
7830 {
7831 return false;
7832 }
7833
7835 {
7836 return true;
7837 }
7838
7839
7840
7842 {
7843 return true;
7844 }
7845
7847 {
7848 return true;
7849 }
7850
7852 {
7853 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7855 }
7856
7858 {
7860 }
7861
7863 {
7865 if (!is_being_placed)
7867 SetSynchDirty();
7868 }
7869
7870
7872
7874 {
7876 }
7877
7879 {
7881 }
7882
7884 {
7885 return 1;
7886 }
7887
7889 {
7890 return false;
7891 }
7892
7894 {
7896 SetSynchDirty();
7897 }
7898
7899
7900
7901
7902
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
7934 {
7935 super.OnMovedInsideCargo(container);
7936
7937 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7938 }
7939
7940 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7941 {
7942 super.EEItemLocationChanged(oldLoc,newLoc);
7943
7944 PlayerBase new_player = null;
7945 PlayerBase old_player = null;
7946
7947 if (newLoc.GetParent())
7948 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7949
7950 if (oldLoc.GetParent())
7951 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7952
7954 {
7955 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7956
7957 if (r_index >= 0)
7958 {
7959 InventoryLocation r_il = new InventoryLocation;
7960 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7961
7962 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7965 {
7966 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7967 }
7969 {
7970 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7971 }
7972
7973 }
7974 }
7975
7977 {
7978 if (new_player)
7979 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7980
7981 if (new_player == old_player)
7982 {
7983
7984 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7985 {
7987 {
7988 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7989 {
7990 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7991 }
7992 }
7993 else
7994 {
7995 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7996 }
7997 }
7998
7999 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8000 {
8001 int type = oldLoc.GetType();
8003 {
8004 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8005 }
8007 {
8008 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8009 }
8010 }
8011 if (!m_OldLocation)
8012 {
8013 m_OldLocation = new InventoryLocation;
8014 }
8015 m_OldLocation.Copy(oldLoc);
8016 }
8017 else
8018 {
8019 if (m_OldLocation)
8020 {
8021 m_OldLocation.Reset();
8022 }
8023 }
8024
8026 }
8027 else
8028 {
8029 if (new_player)
8030 {
8031 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8032 if (res_index >= 0)
8033 {
8034 InventoryLocation il = new InventoryLocation;
8035 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
8037 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
8040 {
8041 il.
GetParent().GetOnReleaseLock().Invoke(it);
8042 }
8044 {
8046 }
8047
8048 }
8049 }
8051 {
8052
8054 }
8055
8056 if (m_OldLocation)
8057 {
8058 m_OldLocation.Reset();
8059 }
8060 }
8061 }
8062
8063 override void EOnContact(IEntity other, Contact extra)
8064 {
8066 {
8067 int liquidType = -1;
8069 if (impactSpeed > 0.0)
8070 {
8072 #ifndef SERVER
8074 #else
8076 SetSynchDirty();
8077 #endif
8079 }
8080 }
8081
8082 #ifdef SERVER
8083 if (GetCompEM() && GetCompEM().IsPlugged())
8084 {
8085 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8086 GetCompEM().UnplugThis();
8087 }
8088 #endif
8089 }
8090
8092
8094 {
8096 }
8097
8099 {
8100
8101 }
8102
8104 {
8105 super.OnItemLocationChanged(old_owner, new_owner);
8106
8107 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8108 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8109
8110 if (!relatedPlayer && playerNew)
8111 relatedPlayer = playerNew;
8112
8113 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8114 {
8116 if (actionMgr)
8117 {
8118 ActionBase currentAction = actionMgr.GetRunningAction();
8119 if (currentAction)
8121 }
8122 }
8123
8124 Man ownerPlayerOld = null;
8125 Man ownerPlayerNew = null;
8126
8127 if (old_owner)
8128 {
8129 if (old_owner.
IsMan())
8130 {
8131 ownerPlayerOld = Man.Cast(old_owner);
8132 }
8133 else
8134 {
8135 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8136 }
8137 }
8138 else
8139 {
8141 {
8143
8144 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8145 {
8146 GetCompEM().UnplugThis();
8147 }
8148 }
8149 }
8150
8151 if (new_owner)
8152 {
8153 if (new_owner.
IsMan())
8154 {
8155 ownerPlayerNew = Man.Cast(new_owner);
8156 }
8157 else
8158 {
8159 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8160 }
8161 }
8162
8163 if (ownerPlayerOld != ownerPlayerNew)
8164 {
8165 if (ownerPlayerOld)
8166 {
8167 array<EntityAI> subItemsExit = new array<EntityAI>;
8169 for (int i = 0; i < subItemsExit.Count(); i++)
8170 {
8173 }
8174 }
8175
8176 if (ownerPlayerNew)
8177 {
8178 array<EntityAI> subItemsEnter = new array<EntityAI>;
8180 for (int j = 0; j < subItemsEnter.Count(); j++)
8181 {
8184 }
8185 }
8186 }
8187 else if (ownerPlayerNew != null)
8188 {
8189 PlayerBase nplayer;
8190 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8191 {
8192 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8194 for (int k = 0; k < subItemsUpdate.Count(); k++)
8195 {
8197 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8198 }
8199 }
8200 }
8201
8202 if (old_owner)
8203 old_owner.OnChildItemRemoved(this);
8204 if (new_owner)
8205 new_owner.OnChildItemReceived(this);
8206 }
8207
8208
8210 {
8211 super.EEDelete(parent);
8212 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8213 if (player)
8214 {
8216
8217 if (player.IsAlive())
8218 {
8219 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8220 if (r_index >= 0)
8221 {
8222 InventoryLocation r_il = new InventoryLocation;
8223 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8224
8225 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8228 {
8229 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8230 }
8232 {
8233 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8234 }
8235
8236 }
8237
8238 player.RemoveQuickBarEntityShortcut(this);
8239 }
8240 }
8241 }
8242
8244 {
8245 super.EEKilled(killer);
8246
8249 {
8250 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8251 {
8252 if (IsMagazine())
8253 {
8254 if (Magazine.Cast(this).GetAmmoCount() > 0)
8255 {
8257 }
8258 }
8259 else
8260 {
8262 }
8263 }
8264 }
8265 }
8266
8268 {
8269 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8270
8271 super.OnWasAttached(parent, slot_id);
8272
8275
8277 }
8278
8280 {
8281 super.OnWasDetached(parent, slot_id);
8282
8285 }
8286
8288 {
8289 int idx;
8292
8293 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8294 if (inventory_slots.Count() < 1)
8295 {
8296 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8297 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8298 }
8299 else
8300 {
8301 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8302 }
8303
8304 idx = inventory_slots.Find(slot);
8305 if (idx < 0)
8306 return "";
8307
8308 return attach_types.Get(idx);
8309 }
8310
8312 {
8313 int idx = -1;
8314 string slot;
8315
8318
8319 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8320 if (inventory_slots.Count() < 1)
8321 {
8322 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8323 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8324 }
8325 else
8326 {
8327 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8328 if (detach_types.Count() < 1)
8329 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8330 }
8331
8332 for (int i = 0; i < inventory_slots.Count(); i++)
8333 {
8334 slot = inventory_slots.Get(i);
8335 }
8336
8337 if (slot != "")
8338 {
8339 if (detach_types.Count() == 1)
8340 idx = 0;
8341 else
8342 idx = inventory_slots.Find(slot);
8343 }
8344 if (idx < 0)
8345 return "";
8346
8347 return detach_types.Get(idx);
8348 }
8349
8351 {
8352
8354
8355
8356 float min_time = 1;
8357 float max_time = 3;
8358 float delay = Math.RandomFloat(min_time, max_time);
8359
8360 explode_timer.Run(delay, this, "DoAmmoExplosion");
8361 }
8362
8364 {
8365 Magazine magazine = Magazine.Cast(this);
8366 int pop_sounds_count = 6;
8367 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8368
8369
8370 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8371 string sound_name = pop_sounds[ sound_idx ];
8373
8374
8375 magazine.ServerAddAmmoCount(-1);
8376
8377
8378 float min_temp_to_explode = 100;
8379
8380 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8381 {
8383 }
8384 }
8385
8386
8387 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8388 {
8389 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8390
8391 const int CHANCE_DAMAGE_CARGO = 4;
8392 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8393 const int CHANCE_DAMAGE_NOTHING = 2;
8394
8396 {
8397 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8398 int chances;
8399 int rnd;
8400
8401 if (GetInventory().GetCargo())
8402 {
8403 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8404 rnd = Math.RandomInt(0,chances);
8405
8406 if (rnd < CHANCE_DAMAGE_CARGO)
8407 {
8409 }
8410 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8411 {
8413 }
8414 }
8415 else
8416 {
8417 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8418 rnd = Math.RandomInt(0,chances);
8419
8420 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8421 {
8423 }
8424 }
8425 }
8426 }
8427
8429 {
8430 if (GetInventory().GetCargo())
8431 {
8432 int item_count = GetInventory().GetCargo().GetItemCount();
8433 if (item_count > 0)
8434 {
8435 int random_pick = Math.RandomInt(0, item_count);
8437 if (!item.IsExplosive())
8438 {
8439 item.AddHealth("","",damage);
8440 return true;
8441 }
8442 }
8443 }
8444 return false;
8445 }
8446
8448 {
8449 int attachment_count = GetInventory().AttachmentCount();
8450 if (attachment_count > 0)
8451 {
8452 int random_pick = Math.RandomInt(0, attachment_count);
8453 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8454 if (!attachment.IsExplosive())
8455 {
8456 attachment.AddHealth("","",damage);
8457 return true;
8458 }
8459 }
8460 return false;
8461 }
8462
8464 {
8466 }
8467
8469 {
8471 return GetInventory().CanRemoveEntity();
8472
8473 return false;
8474 }
8475
8477 {
8478
8480 return false;
8481
8482
8484 return false;
8485
8486
8487
8489 if (delta == 0)
8490 return false;
8491
8492
8493 return true;
8494 }
8495
8497 {
8499 {
8500 if (ScriptInputUserData.CanStoreInputUserData())
8501 {
8502 ScriptInputUserData ctx = new ScriptInputUserData;
8507 ctx.
Write(destination_entity);
8511 }
8512 }
8513 else if (!
GetGame().IsMultiplayer())
8514 {
8516 }
8517 }
8518
8520 {
8521 float split_quantity_new;
8525 InventoryLocation loc = new InventoryLocation;
8526
8527 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8528 {
8530 split_quantity_new = stack_max;
8531 else
8533
8535 {
8536 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8537 if (new_item)
8538 {
8539 new_item.SetResultOfSplit(true);
8540 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8542 new_item.
SetQuantity(split_quantity_new,
false,
true);
8543 }
8544 }
8545 }
8546 else if (destination_entity && slot_id == -1)
8547 {
8548 if (quantity > stack_max)
8549 split_quantity_new = stack_max;
8550 else
8551 split_quantity_new = quantity;
8552
8554 {
8556 {
8559 }
8560
8561 if (new_item)
8562 {
8563 new_item.SetResultOfSplit(true);
8564 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8566 new_item.
SetQuantity(split_quantity_new,
false,
true);
8567 }
8568 }
8569 }
8570 else
8571 {
8572 if (stack_max != 0)
8573 {
8575 {
8577 }
8578
8579 if (split_quantity_new == 0)
8580 {
8581 if (!
GetGame().IsMultiplayer())
8582 player.PhysicalPredictiveDropItem(this);
8583 else
8584 player.ServerDropEntity(this);
8585 return;
8586 }
8587
8589 {
8591
8592 if (new_item)
8593 {
8594 new_item.SetResultOfSplit(true);
8595 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8598 new_item.PlaceOnSurface();
8599 }
8600 }
8601 }
8602 }
8603 }
8604
8606 {
8607 float split_quantity_new;
8611 InventoryLocation loc = new InventoryLocation;
8612
8613 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8614 {
8616 split_quantity_new = stack_max;
8617 else
8619
8621 {
8622 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8623 if (new_item)
8624 {
8625 new_item.SetResultOfSplit(true);
8626 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8628 new_item.
SetQuantity(split_quantity_new,
false,
true);
8629 }
8630 }
8631 }
8632 else if (destination_entity && slot_id == -1)
8633 {
8634 if (quantity > stack_max)
8635 split_quantity_new = stack_max;
8636 else
8637 split_quantity_new = quantity;
8638
8640 {
8642 {
8645 }
8646
8647 if (new_item)
8648 {
8649 new_item.SetResultOfSplit(true);
8650 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8652 new_item.
SetQuantity(split_quantity_new,
false,
true);
8653 }
8654 }
8655 }
8656 else
8657 {
8658 if (stack_max != 0)
8659 {
8661 {
8663 }
8664
8666 {
8668
8669 if (new_item)
8670 {
8671 new_item.SetResultOfSplit(true);
8672 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8675 new_item.PlaceOnSurface();
8676 }
8677 }
8678 }
8679 }
8680 }
8681
8683 {
8685 {
8686 if (ScriptInputUserData.CanStoreInputUserData())
8687 {
8688 ScriptInputUserData ctx = new ScriptInputUserData;
8693 dst.WriteToContext(ctx);
8695 }
8696 }
8697 else if (!
GetGame().IsMultiplayer())
8698 {
8700 }
8701 }
8702
8704 {
8706 {
8707 if (ScriptInputUserData.CanStoreInputUserData())
8708 {
8709 ScriptInputUserData ctx = new ScriptInputUserData;
8714 ctx.
Write(destination_entity);
8720 }
8721 }
8722 else if (!
GetGame().IsMultiplayer())
8723 {
8725 }
8726 }
8727
8729 {
8731 }
8732
8734 {
8736 float split_quantity_new;
8738 if (dst.IsValid())
8739 {
8740 int slot_id = dst.GetSlot();
8742
8743 if (quantity > stack_max)
8744 split_quantity_new = stack_max;
8745 else
8746 split_quantity_new = quantity;
8747
8749 {
8751
8752 if (new_item)
8753 {
8754 new_item.SetResultOfSplit(true);
8755 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8757 new_item.
SetQuantity(split_quantity_new,
false,
true);
8758 }
8759
8760 return new_item;
8761 }
8762 }
8763
8764 return null;
8765 }
8766
8768 {
8770 float split_quantity_new;
8772 if (destination_entity)
8773 {
8775 if (quantity > stackable)
8776 split_quantity_new = stackable;
8777 else
8778 split_quantity_new = quantity;
8779
8781 {
8782 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8783 if (new_item)
8784 {
8785 new_item.SetResultOfSplit(true);
8786 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8788 new_item.
SetQuantity(split_quantity_new,
false,
true);
8789 }
8790 }
8791 }
8792 }
8793
8795 {
8797 {
8798 if (ScriptInputUserData.CanStoreInputUserData())
8799 {
8800 ScriptInputUserData ctx = new ScriptInputUserData;
8805 ItemBase destination_entity =
this;
8806 ctx.
Write(destination_entity);
8810 }
8811 }
8812 else if (!
GetGame().IsMultiplayer())
8813 {
8815 }
8816 }
8817
8819 {
8821 float split_quantity_new;
8823 if (player)
8824 {
8826 if (quantity > stackable)
8827 split_quantity_new = stackable;
8828 else
8829 split_quantity_new = quantity;
8830
8832 {
8833 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8834 new_item =
ItemBase.Cast(in_hands);
8835 if (new_item)
8836 {
8837 new_item.SetResultOfSplit(true);
8838 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8840 new_item.SetQuantity(split_quantity_new, false, true);
8841 }
8842 }
8843 }
8844 }
8845
8847 {
8849 float split_quantity_new = Math.Floor(quantity * 0.5);
8850
8852 return;
8853
8855
8856 if (new_item)
8857 {
8858 if (new_item.GetQuantityMax() < split_quantity_new)
8859 {
8860 split_quantity_new = new_item.GetQuantityMax();
8861 }
8862
8863 new_item.SetResultOfSplit(true);
8864 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8865
8867 {
8870 }
8871 else
8872 {
8874 new_item.
SetQuantity(split_quantity_new,
false,
true);
8875 }
8876 }
8877 }
8878
8880 {
8882 float split_quantity_new = Math.Floor(quantity / 2);
8883
8885 return;
8886
8887 InventoryLocation invloc = new InventoryLocation;
8889
8891 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8892
8893 if (new_item)
8894 {
8895 if (new_item.GetQuantityMax() < split_quantity_new)
8896 {
8897 split_quantity_new = new_item.GetQuantityMax();
8898 }
8900 {
8903 }
8904 else if (split_quantity_new > 1)
8905 {
8907 new_item.
SetQuantity(split_quantity_new,
false,
true);
8908 }
8909 }
8910 }
8911
8914 {
8915 SetWeightDirty();
8917
8918 if (parent)
8919 parent.OnAttachmentQuantityChangedEx(this, delta);
8920
8922 {
8924 {
8926 }
8928 {
8929 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8931 }
8932 }
8933
8934 }
8935
8938 {
8939
8940 }
8941
8944 {
8946 }
8947
8949 {
8950 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8951
8953 {
8954 if (newLevel == GameConstants.STATE_RUINED)
8955 {
8957 EntityAI parent = GetHierarchyParent();
8958 if (parent && parent.IsFireplace())
8959 {
8960 CargoBase cargo = GetInventory().GetCargo();
8961 if (cargo)
8962 {
8964 {
8966 }
8967 }
8968 }
8969 }
8970
8972 {
8973
8975 return;
8976 }
8977
8978 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8979 {
8981 }
8982 }
8983 }
8984
8985
8987 {
8988 super.OnRightClick();
8989
8991 {
8993 {
8994 if (ScriptInputUserData.CanStoreInputUserData())
8995 {
8996 EntityAI root = GetHierarchyRoot();
8997 Man playerOwner = GetHierarchyRootPlayer();
8998 InventoryLocation dst = new InventoryLocation;
8999
9000
9001 if (!playerOwner && root && root == this)
9002 {
9004 }
9005 else
9006 {
9007
9008 GetInventory().GetCurrentInventoryLocation(dst);
9010 {
9013 {
9015 }
9016 else
9017 {
9019
9020
9021 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9022 {
9024 }
9025 else
9026 {
9027 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9028 }
9029 }
9030 }
9031 }
9032
9033 ScriptInputUserData ctx = new ScriptInputUserData;
9041 }
9042 }
9043 else if (!
GetGame().IsMultiplayer())
9044 {
9046 }
9047 }
9048 }
9049
9051 {
9052 if (root)
9053 {
9054 vector m4[4];
9055 root.GetTransform(m4);
9056 dst.SetGround(this, m4);
9057 }
9058 else
9059 {
9060 GetInventory().GetCurrentInventoryLocation(dst);
9061 }
9062 }
9063
9064 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9065 {
9066
9067 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9068 return false;
9069
9070 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9071 return false;
9072
9073
9075 return false;
9076
9077
9078 Magazine mag = Magazine.Cast(this);
9079 if (mag)
9080 {
9081 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9082 return false;
9083
9084 if (stack_max_limit)
9085 {
9086 Magazine other_mag = Magazine.Cast(other_item);
9087 if (other_item)
9088 {
9089 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9090 return false;
9091 }
9092
9093 }
9094 }
9095 else
9096 {
9097
9099 return false;
9100
9102 return false;
9103 }
9104
9105 PlayerBase player = null;
9106 if (CastTo(player, GetHierarchyRootPlayer()))
9107 {
9108 if (player.GetInventory().HasAttachment(this))
9109 return false;
9110
9111 if (player.IsItemsToDelete())
9112 return false;
9113 }
9114
9115 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9116 return false;
9117
9118 int slotID;
9120 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9121 return false;
9122
9123 return true;
9124 }
9125
9127 {
9129 }
9130
9132 {
9133 return m_IsResultOfSplit;
9134 }
9135
9137 {
9138 m_IsResultOfSplit = value;
9139 }
9140
9142 {
9144 }
9145
9147 {
9148 float other_item_quantity = other_item.GetQuantity();
9149 float this_free_space;
9150
9152
9154
9155 if (other_item_quantity > this_free_space)
9156 {
9157 return this_free_space;
9158 }
9159 else
9160 {
9161 return other_item_quantity;
9162 }
9163 }
9164
9166 {
9168 }
9169
9171 {
9173 return;
9174
9175 if (!IsMagazine() && other_item)
9176 {
9178 if (quantity_used != 0)
9179 {
9180 float hp1 = GetHealth01("","");
9181 float hp2 = other_item.GetHealth01("","");
9182 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9183 hpResult = hpResult / (
GetQuantity() + quantity_used);
9184
9185 hpResult *= GetMaxHealth();
9186 Math.Round(hpResult);
9187 SetHealth("", "Health", hpResult);
9188
9190 other_item.AddQuantity(-quantity_used);
9191 }
9192 }
9194 }
9195
9197 {
9198 #ifdef SERVER
9199 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9200 GetHierarchyParent().IncreaseLifetimeUp();
9201 #endif
9202 };
9203
9205 {
9206 PlayerBase p = PlayerBase.Cast(player);
9207
9208 array<int> recipesIds = p.m_Recipes;
9209 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9210 if (moduleRecipesManager)
9211 {
9212 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9213 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9214 }
9215
9216 for (int i = 0;i < recipesIds.Count(); i++)
9217 {
9218 int key = recipesIds.Get(i);
9219 string recipeName = moduleRecipesManager.GetRecipeName(key);
9221 }
9222 }
9223
9224
9225 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9226 {
9227 super.GetDebugActions(outputList);
9228
9229
9235
9236
9241
9246
9247
9251
9252
9254 {
9258 }
9259
9262
9263
9267
9269
9270 InventoryLocation loc = new InventoryLocation();
9271 GetInventory().GetCurrentInventoryLocation(loc);
9273 {
9274 if (Gizmo_IsSupported())
9277 }
9278
9280 }
9281
9282
9283
9284
9286 {
9287 super.OnAction(action_id, player, ctx);
9288
9290 {
9291 switch (action_id)
9292 {
9295 return true;
9298 return true;
9299 }
9300 }
9301
9303 {
9304 switch (action_id)
9305 {
9307 Delete();
9308 return true;
9309 }
9310 }
9311
9312 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9313 {
9314 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9315 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9316 PlayerBase p = PlayerBase.Cast(player);
9317 if (
EActions.RECIPES_RANGE_START < 1000)
9318 {
9319 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9320 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9321 }
9322 }
9323 #ifndef SERVER
9324 else if (action_id ==
EActions.WATCH_PLAYER)
9325 {
9326 PluginDeveloper.SetDeveloperItemClientEx(player);
9327 }
9328 #endif
9330 {
9331 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9332 {
9333 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9334 OnDebugButtonPressServer(id + 1);
9335 }
9336
9337 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9338 {
9339 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9341 }
9342
9343 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9344 {
9345 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9347 }
9348
9349 else if (action_id ==
EActions.ADD_QUANTITY)
9350 {
9351 if (IsMagazine())
9352 {
9353 Magazine mag = Magazine.Cast(this);
9354 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9355 }
9356 else
9357 {
9359 }
9360
9361 if (m_EM)
9362 {
9363 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9364 }
9365
9366 }
9367
9368 else if (action_id ==
EActions.REMOVE_QUANTITY)
9369 {
9370 if (IsMagazine())
9371 {
9372 Magazine mag2 = Magazine.Cast(this);
9373 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9374 }
9375 else
9376 {
9378 }
9379 if (m_EM)
9380 {
9381 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9382 }
9383
9384 }
9385
9386 else if (action_id ==
EActions.SET_QUANTITY_0)
9387 {
9389
9390 if (m_EM)
9391 {
9392 m_EM.SetEnergy(0);
9393 }
9394 }
9395
9396 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9397 {
9399
9400 if (m_EM)
9401 {
9402 m_EM.SetEnergy(m_EM.GetEnergyMax());
9403 }
9404 }
9405
9406 else if (action_id ==
EActions.ADD_HEALTH)
9407 {
9408 AddHealth("","",GetMaxHealth("","Health")/5);
9409 }
9410 else if (action_id ==
EActions.REMOVE_HEALTH)
9411 {
9412 AddHealth("","",-GetMaxHealth("","Health")/5);
9413 }
9414 else if (action_id ==
EActions.DESTROY_HEALTH)
9415 {
9416 SetHealth01("","",0);
9417 }
9418 else if (action_id ==
EActions.WATCH_ITEM)
9419 {
9421 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9422 #ifdef DEVELOPER
9423 SetDebugDeveloper_item(this);
9424 #endif
9425 }
9426
9427 else if (action_id ==
EActions.ADD_TEMPERATURE)
9428 {
9429 AddTemperature(20);
9430
9431 }
9432
9433 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9434 {
9435 AddTemperature(-20);
9436
9437 }
9438
9439 else if (action_id ==
EActions.FLIP_FROZEN)
9440 {
9441 SetFrozen(!GetIsFrozen());
9442
9443 }
9444
9445 else if (action_id ==
EActions.ADD_WETNESS)
9446 {
9448
9449 }
9450
9451 else if (action_id ==
EActions.REMOVE_WETNESS)
9452 {
9454
9455 }
9456
9457 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9458 {
9461
9462
9463 }
9464
9465 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9466 {
9469 }
9470
9471 else if (action_id ==
EActions.MAKE_SPECIAL)
9472 {
9473 auto debugParams = DebugSpawnParams.WithPlayer(player);
9474 OnDebugSpawnEx(debugParams);
9475 }
9476
9477 }
9478
9479
9480 return false;
9481 }
9482
9483
9484
9485
9489
9492
9493
9494
9496 {
9497 return false;
9498 }
9499
9500
9502 {
9503 return true;
9504 }
9505
9506
9508 {
9509 return true;
9510 }
9511
9512
9513
9515 {
9516 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9518 }
9519
9522 {
9523 return null;
9524 }
9525
9527 {
9528 return false;
9529 }
9530
9532 {
9533 return false;
9534 }
9535
9539
9540
9542 {
9543 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9544 return module_repairing.CanRepair(this, item_repair_kit);
9545 }
9546
9547
9548 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9549 {
9550 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9551 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9552 }
9553
9554
9556 {
9557
9558
9559
9560
9561
9562
9563
9564
9565 return 1;
9566 }
9567
9568
9569
9571 {
9573 }
9574
9575
9576
9578 {
9580 }
9581
9582
9591 {
9592 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9593
9594 if (player)
9595 {
9596 player.MessageStatus(text);
9597 }
9598 }
9599
9600
9609 {
9610 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9611
9612 if (player)
9613 {
9614 player.MessageAction(text);
9615 }
9616 }
9617
9618
9627 {
9628 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9629
9630 if (player)
9631 {
9632 player.MessageFriendly(text);
9633 }
9634 }
9635
9636
9645 {
9646 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9647
9648 if (player)
9649 {
9650 player.MessageImportant(text);
9651 }
9652 }
9653
9655 {
9656 return true;
9657 }
9658
9659
9660 override bool KindOf(
string tag)
9661 {
9662 bool found = false;
9663 string item_name = this.
GetType();
9666
9667 int array_size = item_tag_array.Count();
9668 for (int i = 0; i < array_size; i++)
9669 {
9670 if (item_tag_array.Get(i) == tag)
9671 {
9672 found = true;
9673 break;
9674 }
9675 }
9676 return found;
9677 }
9678
9679
9681 {
9682
9683 super.OnRPC(sender, rpc_type,ctx);
9684
9685
9686 switch (rpc_type)
9687 {
9688 #ifndef SERVER
9689 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9690 Param2<bool, string> p = new Param2<bool, string>(false, "");
9691
9693 return;
9694
9695 bool play = p.param1;
9696 string soundSet = p.param2;
9697
9698 if (play)
9699 {
9701 {
9703 {
9705 }
9706 }
9707 else
9708 {
9710 }
9711 }
9712 else
9713 {
9715 }
9716
9717 break;
9718 #endif
9719
9720 }
9721
9723 {
9725 }
9726 }
9727
9728
9729
9730
9732 {
9733 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9734 return plugin.GetID(
name);
9735 }
9736
9738 {
9739 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9740 return plugin.GetName(id);
9741 }
9742
9745 {
9746
9747
9748 int varFlags;
9749 if (!ctx.
Read(varFlags))
9750 return;
9751
9752 if (varFlags & ItemVariableFlags.FLOAT)
9753 {
9755 }
9756 }
9757
9759 {
9760
9761 super.SerializeNumericalVars(floats_out);
9762
9763
9764
9766 {
9768 }
9769
9771 {
9773 }
9774
9776 {
9778 }
9779
9781 {
9786 }
9787
9789 {
9791 }
9792 }
9793
9795 {
9796
9797 super.DeSerializeNumericalVars(floats);
9798
9799
9800 int index = 0;
9801 int mask = Math.Round(floats.Get(index));
9802
9803 index++;
9804
9806 {
9808 {
9810 }
9811 else
9812 {
9813 float quantity = floats.Get(index);
9815 }
9816 index++;
9817 }
9818
9820 {
9821 float wet = floats.Get(index);
9823 index++;
9824 }
9825
9827 {
9828 int liquidtype = Math.Round(floats.Get(index));
9830 index++;
9831 }
9832
9834 {
9836 index++;
9838 index++;
9840 index++;
9842 index++;
9843 }
9844
9846 {
9847 int cleanness = Math.Round(floats.Get(index));
9849 index++;
9850 }
9851 }
9852
9854 {
9855 super.WriteVarsToCTX(ctx);
9856
9857
9859 {
9861 }
9862
9864 {
9866 }
9867
9869 {
9871 }
9872
9874 {
9875 int r,g,b,a;
9881 }
9882
9884 {
9886 }
9887 }
9888
9890 {
9891 if (!super.ReadVarsFromCTX(ctx,version))
9892 return false;
9893
9894 int intValue;
9895 float value;
9896
9897 if (version < 140)
9898 {
9899 if (!ctx.
Read(intValue))
9900 return false;
9901
9902 m_VariablesMask = intValue;
9903 }
9904
9906 {
9907 if (!ctx.
Read(value))
9908 return false;
9909
9911 {
9913 }
9914 else
9915 {
9917 }
9918 }
9919
9920 if (version < 140)
9921 {
9923 {
9924 if (!ctx.
Read(value))
9925 return false;
9926 SetTemperatureDirect(value);
9927 }
9928 }
9929
9931 {
9932 if (!ctx.
Read(value))
9933 return false;
9935 }
9936
9938 {
9939 if (!ctx.
Read(intValue))
9940 return false;
9942 }
9943
9945 {
9946 int r,g,b,a;
9948 return false;
9950 return false;
9952 return false;
9954 return false;
9955
9957 }
9958
9960 {
9961 if (!ctx.
Read(intValue))
9962 return false;
9964 }
9965
9966 if (version >= 138 && version < 140)
9967 {
9969 {
9970 if (!ctx.
Read(intValue))
9971 return false;
9972 SetFrozen(intValue);
9973 }
9974 }
9975
9976 return true;
9977 }
9978
9979
9981 {
9984 {
9986 }
9987
9988 if (!super.OnStoreLoad(ctx, version))
9989 {
9991 return false;
9992 }
9993
9994 if (version >= 114)
9995 {
9996 bool hasQuickBarIndexSaved;
9997
9998 if (!ctx.
Read(hasQuickBarIndexSaved))
9999 {
10001 return false;
10002 }
10003
10004 if (hasQuickBarIndexSaved)
10005 {
10006 int itmQBIndex;
10007
10008
10009 if (!ctx.
Read(itmQBIndex))
10010 {
10012 return false;
10013 }
10014
10015 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10016 if (itmQBIndex != -1 && parentPlayer)
10017 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10018 }
10019 }
10020 else
10021 {
10022
10023 PlayerBase player;
10024 int itemQBIndex;
10025 if (version ==
int.
MAX)
10026 {
10027 if (!ctx.
Read(itemQBIndex))
10028 {
10030 return false;
10031 }
10032 }
10033 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10034 {
10035
10036 if (!ctx.
Read(itemQBIndex))
10037 {
10039 return false;
10040 }
10041 if (itemQBIndex != -1 && player)
10042 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10043 }
10044 }
10045
10046 if (version < 140)
10047 {
10048
10049 if (!LoadVariables(ctx, version))
10050 {
10052 return false;
10053 }
10054 }
10055
10056
10058 {
10060 return false;
10061 }
10062 if (version >= 132)
10063 {
10065 if (raib)
10066 {
10068 {
10070 return false;
10071 }
10072 }
10073 }
10074
10076 return true;
10077 }
10078
10079
10080
10082 {
10083 super.OnStoreSave(ctx);
10084
10085 PlayerBase player;
10086 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10087 {
10089
10090 int itemQBIndex = -1;
10091 itemQBIndex = player.FindQuickBarEntityIndex(this);
10092 ctx.
Write(itemQBIndex);
10093 }
10094 else
10095 {
10097 }
10098
10100
10102 if (raib)
10103 {
10105 }
10106 }
10107
10108
10110 {
10111 super.AfterStoreLoad();
10112
10114 {
10116 }
10117
10119 {
10122 }
10123 }
10124
10126 {
10127 super.EEOnAfterLoad();
10128
10130 {
10132 }
10133
10136 }
10137
10139 {
10140 return false;
10141 }
10142
10143
10144
10146 {
10148 {
10149 #ifdef PLATFORM_CONSOLE
10150
10152 {
10154 if (menu)
10155 {
10157 }
10158 }
10159 #endif
10160 }
10161
10163 {
10166 }
10167
10169 {
10170 SetWeightDirty();
10172 }
10174 {
10177 }
10178
10180 {
10183 }
10185 {
10188 }
10189
10190 super.OnVariablesSynchronized();
10191 }
10192
10193
10194
10196 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10197 {
10198 if (!IsServerCheck(allow_client))
10199 return false;
10200
10202 return false;
10203
10206
10207 if (value <= (min + 0.001))
10208 value = min;
10209
10210 if (value == min)
10211 {
10212 if (destroy_config)
10213 {
10214 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10215 if (dstr)
10216 {
10218 this.Delete();
10219 return true;
10220 }
10221 }
10222 else if (destroy_forced)
10223 {
10225 this.Delete();
10226 return true;
10227 }
10228
10230 }
10231
10234
10236 {
10238
10239 if (delta)
10241 }
10242
10244
10245 return false;
10246 }
10247
10248
10250 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10251 {
10253 }
10254
10256 {
10259 }
10260
10262 {
10265 }
10266
10268 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10269 {
10270 float value_clamped = Math.Clamp(value, 0, 1);
10272 SetQuantity(result, destroy_config, destroy_forced);
10273 }
10274
10275
10278 {
10280 }
10281
10283 {
10285 }
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10297 {
10298 int slot = -1;
10299 if (GetInventory())
10300 {
10301 InventoryLocation il = new InventoryLocation;
10302 GetInventory().GetCurrentInventoryLocation(il);
10304 }
10305
10307 }
10308
10310 {
10311 float quantity_max = 0;
10312
10314 {
10315 if (attSlotID != -1)
10316 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10317
10318 if (quantity_max <= 0)
10320 }
10321
10322 if (quantity_max <= 0)
10324
10325 return quantity_max;
10326 }
10327
10329 {
10331 }
10332
10334 {
10336 }
10337
10338
10340 {
10342 }
10343
10345 {
10347 }
10348
10350 {
10352 }
10353
10354
10356 {
10357
10358 float weightEx = GetWeightEx();
10359 float special = GetInventoryAndCargoWeight();
10360 return weightEx - special;
10361 }
10362
10363
10365 {
10367 }
10368
10370 {
10372 {
10373 #ifdef DEVELOPER
10374 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10375 {
10376 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10378 }
10379 #endif
10380
10381 return GetQuantity() * GetConfigWeightModified();
10382 }
10383 else if (HasEnergyManager())
10384 {
10385 #ifdef DEVELOPER
10386 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10387 {
10388 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10389 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10390 }
10391 #endif
10392 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10393 }
10394 else
10395 {
10396 #ifdef DEVELOPER
10397 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10398 {
10399 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10400 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10401 }
10402 #endif
10403 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10404 }
10405 }
10406
10409 {
10410 int item_count = 0;
10412
10413 if (GetInventory().GetCargo() != NULL)
10414 {
10415 item_count = GetInventory().GetCargo().GetItemCount();
10416 }
10417
10418 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10419 {
10420 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10421 if (item)
10422 item_count += item.GetNumberOfItems();
10423 }
10424 return item_count;
10425 }
10426
10429 {
10430 float weight = 0;
10431 float wetness = 1;
10432 if (include_wetness)
10435 {
10436 weight = wetness * m_ConfigWeight;
10437 }
10439 {
10440 weight = 1;
10441 }
10442 return weight;
10443 }
10444
10445
10446
10448 {
10449 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
10450 {
10451 GameInventory inv = GetInventory();
10452 array<EntityAI> items = new array<EntityAI>;
10454 for (int i = 0; i < items.Count(); i++)
10455 {
10457 if (item)
10458 {
10460 }
10461 }
10462 }
10463 }
10464
10465
10466
10467
10469 {
10470 float energy = 0;
10471 if (HasEnergyManager())
10472 {
10473 energy = GetCompEM().GetEnergy();
10474 }
10475 return energy;
10476 }
10477
10478
10480 {
10481 super.OnEnergyConsumed();
10482
10484 }
10485
10487 {
10488 super.OnEnergyAdded();
10489
10491 }
10492
10493
10495 {
10496 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10497 {
10499 {
10500 float energy_0to1 = GetCompEM().GetEnergy0To1();
10502 }
10503 }
10504 }
10505
10506
10508 {
10509 return ConfigGetFloat("heatIsolation");
10510 }
10511
10513 {
10515 }
10516
10518 {
10519 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10520 if (
GetGame().ConfigIsExisting(paramPath))
10522
10523 return 0.0;
10524 }
10525
10527 {
10528 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10529 if (
GetGame().ConfigIsExisting(paramPath))
10531
10532 return 0.0;
10533 }
10534
10535 override void SetWet(
float value,
bool allow_client =
false)
10536 {
10537 if (!IsServerCheck(allow_client))
10538 return;
10539
10542
10544
10545 m_VarWet = Math.Clamp(value, min, max);
10546
10548 {
10551 }
10552 }
10553
10554 override void AddWet(
float value)
10555 {
10557 }
10558
10560 {
10562 }
10563
10565 {
10567 }
10568
10570 {
10572 }
10573
10575 {
10577 }
10578
10580 {
10582 }
10583
10584 override void OnWetChanged(
float newVal,
float oldVal)
10585 {
10588 if (newLevel != oldLevel)
10589 {
10591 }
10592 }
10593
10595 {
10596 SetWeightDirty();
10597 }
10598
10600 {
10601 return GetWetLevelInternal(
m_VarWet);
10602 }
10603
10604
10605
10607 {
10609 }
10610
10612 {
10614 }
10615
10617 {
10619 }
10620
10622 {
10624 }
10625
10626
10627
10629 {
10630 if (ConfigIsExisting("itemModelLength"))
10631 {
10632 return ConfigGetFloat("itemModelLength");
10633 }
10634 return 0;
10635 }
10636
10638 {
10639 if (ConfigIsExisting("itemAttachOffset"))
10640 {
10641 return ConfigGetFloat("itemAttachOffset");
10642 }
10643 return 0;
10644 }
10645
10646 override void SetCleanness(
int value,
bool allow_client =
false)
10647 {
10648 if (!IsServerCheck(allow_client))
10649 return;
10650
10652
10654
10657 }
10658
10660 {
10662 }
10663
10665 {
10666 return true;
10667 }
10668
10669
10670
10671
10673 {
10675 }
10676
10678 {
10680 }
10681
10682
10683
10684
10685 override void SetColor(
int r,
int g,
int b,
int a)
10686 {
10692 }
10694 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10695 {
10700 }
10701
10703 {
10705 }
10706
10709 {
10710 int r,g,b,a;
10712 r = r/255;
10713 g = g/255;
10714 b = b/255;
10715 a = a/255;
10716 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10717 }
10718
10719
10720
10721 override void SetLiquidType(
int value,
bool allow_client =
false)
10722 {
10723 if (!IsServerCheck(allow_client))
10724 return;
10725
10730 }
10731
10733 {
10734 return ConfigGetInt("varLiquidTypeInit");
10735 }
10736
10738 {
10740 }
10741
10743 {
10745 SetFrozen(false);
10746 }
10747
10750 {
10751 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10752 }
10753
10754
10757 {
10758 PlayerBase nplayer;
10759 if (PlayerBase.CastTo(nplayer, player))
10760 {
10762
10763 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10764 }
10765 }
10766
10767
10770 {
10771 PlayerBase nplayer;
10772 if (PlayerBase.CastTo(nplayer,player))
10773 {
10774
10775 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10776
10777 }
10778
10779
10780 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10781
10782
10783 if (HasEnergyManager())
10784 {
10785 GetCompEM().UpdatePlugState();
10786 }
10787 }
10788
10789
10791 {
10792 super.OnPlacementStarted(player);
10793
10795 }
10796
10797 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10798 {
10800 {
10801 m_AdminLog.OnPlacementComplete(player,
this);
10802 }
10803
10804 super.OnPlacementComplete(player, position, orientation);
10805 }
10806
10807
10808
10809
10810
10812 {
10814 {
10815 return true;
10816 }
10817 else
10818 {
10819 return false;
10820 }
10821 }
10822
10823
10825 {
10827 {
10829 }
10830 }
10831
10832
10834 {
10836 }
10837
10839 {
10841 }
10842
10843 override void InsertAgent(
int agent,
float count = 1)
10844 {
10845 if (count < 1)
10846 return;
10847
10849 }
10850
10853 {
10855 }
10856
10857
10859 {
10861 }
10862
10863
10864
10865
10866
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
10905 {
10907 return false;
10908 return true;
10909 }
10910
10912 {
10913
10915 }
10916
10917
10920 {
10921 super.CheckForRoofLimited(timeTresholdMS);
10922
10924 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10925 {
10926 m_PreviousRoofTestTime = time;
10927 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10928 }
10929 }
10930
10931
10933 {
10935 {
10936 return 0;
10937 }
10938
10939 if (GetInventory().GetAttachmentSlotsCount() != 0)
10940 {
10941 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10942 if (filter)
10943 return filter.GetProtectionLevel(type, false, system);
10944 else
10945 return 0;
10946 }
10947
10948 string subclassPath, entryName;
10949
10950 switch (type)
10951 {
10953 entryName = "biological";
10954 break;
10956 entryName = "chemical";
10957 break;
10958 default:
10959 entryName = "biological";
10960 break;
10961 }
10962
10963 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10964
10966 }
10967
10968
10969
10972 {
10973 if (!IsMagazine())
10975
10977 }
10978
10979
10980
10981
10982
10987 {
10988 return true;
10989 }
10990
10992 {
10994 }
10995
10996
10997
10998
10999
11001 {
11002 if (parent)
11003 {
11004 if (parent.IsInherited(DayZInfected))
11005 return true;
11006
11007 if (!parent.IsRuined())
11008 return true;
11009 }
11010
11011 return true;
11012 }
11013
11015 {
11016 if (!super.CanPutAsAttachment(parent))
11017 {
11018 return false;
11019 }
11020
11021 if (!IsRuined() && !parent.IsRuined())
11022 {
11023 return true;
11024 }
11025
11026 return false;
11027 }
11028
11030 {
11031
11032
11033
11034
11035 return super.CanReceiveItemIntoCargo(item);
11036 }
11037
11039 {
11040
11041
11042
11043
11044 GameInventory attachmentInv = attachment.GetInventory();
11046 {
11047 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11048 return false;
11049 }
11050
11051 InventoryLocation loc = new InventoryLocation();
11052 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11053 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11054 return false;
11055
11056 return super.CanReceiveAttachment(attachment, slotId);
11057 }
11058
11060 {
11061 if (!super.CanReleaseAttachment(attachment))
11062 return false;
11063
11064 return GetInventory().AreChildrenAccessible();
11065 }
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11088 {
11089 int id = muzzle_owner.GetMuzzleID();
11090 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11091
11092 if (WPOF_array)
11093 {
11094 for (int i = 0; i < WPOF_array.Count(); i++)
11095 {
11096 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11097
11098 if (WPOF)
11099 {
11100 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11101 }
11102 }
11103 }
11104 }
11105
11106
11108 {
11109 int id = muzzle_owner.GetMuzzleID();
11111
11112 if (WPOBE_array)
11113 {
11114 for (int i = 0; i < WPOBE_array.Count(); i++)
11115 {
11116 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11117
11118 if (WPOBE)
11119 {
11120 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11121 }
11122 }
11123 }
11124 }
11125
11126
11128 {
11129 int id = muzzle_owner.GetMuzzleID();
11130 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11131
11132 if (WPOOH_array)
11133 {
11134 for (int i = 0; i < WPOOH_array.Count(); i++)
11135 {
11136 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11137
11138 if (WPOOH)
11139 {
11140 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11141 }
11142 }
11143 }
11144 }
11145
11146
11148 {
11149 int id = muzzle_owner.GetMuzzleID();
11150 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11151
11152 if (WPOOH_array)
11153 {
11154 for (int i = 0; i < WPOOH_array.Count(); i++)
11155 {
11156 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11157
11158 if (WPOOH)
11159 {
11160 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11161 }
11162 }
11163 }
11164 }
11165
11166
11168 {
11169 int id = muzzle_owner.GetMuzzleID();
11170 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11171
11172 if (WPOOH_array)
11173 {
11174 for (int i = 0; i < WPOOH_array.Count(); i++)
11175 {
11176 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11177
11178 if (WPOOH)
11179 {
11180 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11181 }
11182 }
11183 }
11184 }
11185
11186
11187
11189 {
11191 {
11192 return true;
11193 }
11194
11195 return false;
11196 }
11197
11199 {
11201 {
11202 return true;
11203 }
11204
11205 return false;
11206 }
11207
11209 {
11211 {
11212 return true;
11213 }
11214
11215 return false;
11216 }
11217
11219 {
11220 return false;
11221 }
11222
11225 {
11226 return UATimeSpent.DEFAULT_DEPLOY;
11227 }
11228
11229
11230
11231
11233 {
11235 SetSynchDirty();
11236 }
11237
11239 {
11241 }
11242
11243
11245 {
11246 return false;
11247 }
11248
11251 {
11252 string att_type = "None";
11253
11254 if (ConfigIsExisting("soundAttType"))
11255 {
11256 att_type = ConfigGetString("soundAttType");
11257 }
11258
11260 }
11261
11263 {
11265 }
11266
11267
11268
11269
11270
11276
11278 {
11281
11283 }
11284
11285
11287 {
11289 return;
11290
11292
11295
11298
11299 SoundParameters params = new SoundParameters();
11303 }
11304
11305
11307 {
11309 return;
11310
11312 SetSynchDirty();
11313
11316 }
11317
11318
11320 {
11322 return;
11323
11325 SetSynchDirty();
11326
11329 }
11330
11332 {
11334 }
11335
11337 {
11339 }
11340
11343 {
11344 if (!
GetGame().IsDedicatedServer())
11345 {
11346 if (ConfigIsExisting("attachSoundSet"))
11347 {
11348 string cfg_path = "";
11349 string soundset = "";
11350 string type_name =
GetType();
11351
11354 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11355 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11356
11357 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11358 {
11359 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11360 {
11361 if (cfg_slot_array[i] == slot_type)
11362 {
11363 soundset = cfg_soundset_array[i];
11364 break;
11365 }
11366 }
11367 }
11368
11369 if (soundset != "")
11370 {
11371 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11373 }
11374 }
11375 }
11376 }
11377
11379 {
11380
11381 }
11382
11383 void OnApply(PlayerBase player);
11384
11386 {
11387 return 1.0;
11388 };
11389
11391 {
11393 }
11394
11396 {
11398 }
11399
11401
11403 {
11404 SetDynamicPhysicsLifeTime(0.01);
11406 }
11407
11409 {
11410 array<string> zone_names = new array<string>;
11411 GetDamageZones(zone_names);
11412 for (int i = 0; i < zone_names.Count(); i++)
11413 {
11414 SetHealthMax(zone_names.Get(i),"Health");
11415 }
11416 SetHealthMax("","Health");
11417 }
11418
11421 {
11422 float global_health = GetHealth01("","Health");
11423 array<string> zones = new array<string>;
11424 GetDamageZones(zones);
11425
11426 for (int i = 0; i < zones.Count(); i++)
11427 {
11428 SetHealth01(zones.Get(i),"Health",global_health);
11429 }
11430 }
11431
11434 {
11435 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11436 }
11437
11439 {
11440 if (!hasRootAsPlayer)
11441 {
11442 if (refParentIB)
11443 {
11444
11445 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11446 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11447
11448 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11449 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11450
11453 }
11454 else
11455 {
11456
11459 }
11460 }
11461 }
11462
11464 {
11466 {
11467 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11468 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11469 {
11470 float heatPermCoef = 1.0;
11472 while (ent)
11473 {
11474 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11475 ent = ent.GetHierarchyParent();
11476 }
11477
11478 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11479 }
11480 }
11481 }
11482
11484 {
11485
11486 EntityAI parent = GetHierarchyParent();
11487 if (!parent)
11488 {
11489 hasParent = false;
11490 hasRootAsPlayer = false;
11491 }
11492 else
11493 {
11494 hasParent = true;
11495 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11496 refParentIB =
ItemBase.Cast(parent);
11497 }
11498 }
11499
11500 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11501 {
11502
11503 }
11504
11506 {
11507
11508 return false;
11509 }
11510
11512 {
11513
11514
11515 return false;
11516 }
11517
11519 {
11520
11521 return false;
11522 }
11523
11526 {
11527 return !GetIsFrozen() &&
IsOpen();
11528 }
11529
11531 {
11532 bool hasParent = false, hasRootAsPlayer = false;
11534
11535 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11536 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11537
11538 if (wwtu || foodDecay)
11539 {
11543
11544 if (processWetness || processTemperature || processDecay)
11545 {
11547
11548 if (processWetness)
11549 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11550
11551 if (processTemperature)
11553
11554 if (processDecay)
11555 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11556 }
11557 }
11558 }
11559
11562 {
11564 }
11565
11567 {
11570
11571 return super.GetTemperatureFreezeThreshold();
11572 }
11573
11575 {
11578
11579 return super.GetTemperatureThawThreshold();
11580 }
11581
11583 {
11586
11587 return super.GetItemOverheatThreshold();
11588 }
11589
11591 {
11593 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11594
11595 return super.GetTemperatureFreezeTime();
11596 }
11597
11599 {
11601 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11602
11603 return super.GetTemperatureThawTime();
11604 }
11605
11610
11612 {
11613 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11614 }
11615
11617 {
11618 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11619 }
11620
11623 {
11625 }
11626
11628 {
11630 }
11631
11633 {
11635 }
11636
11639 {
11640 return null;
11641 }
11642
11645 {
11646 return false;
11647 }
11648
11650 {
11652 {
11655 if (!trg)
11656 {
11658 explosive = this;
11659 }
11660
11661 explosive.PairRemote(trg);
11663
11664 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11665 trg.SetPersistentPairID(persistentID);
11666 explosive.SetPersistentPairID(persistentID);
11667
11668 return true;
11669 }
11670 return false;
11671 }
11672
11675 {
11676 float ret = 1.0;
11679 ret *= GetHealth01();
11680
11681 return ret;
11682 }
11683
11684 #ifdef DEVELOPER
11685 override void SetDebugItem()
11686 {
11687 super.SetDebugItem();
11688 _itemBase = this;
11689 }
11690
11692 {
11693 string text = super.GetDebugText();
11694
11696 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11697
11698 return text;
11699 }
11700 #endif
11701
11703 {
11704 return true;
11705 }
11706
11708
11710
11712 {
11715 }
11716
11717
11725
11741}
11742
11744{
11746 if (entity)
11747 {
11748 bool is_item = entity.IsInherited(
ItemBase);
11749 if (is_item && full_quantity)
11750 {
11753 }
11754 }
11755 else
11756 {
11758 return NULL;
11759 }
11760 return entity;
11761}
11762
11764{
11765 if (item)
11766 {
11767 if (health > 0)
11768 item.SetHealth("", "", health);
11769
11770 if (item.CanHaveTemperature())
11771 {
11773 if (item.CanFreeze())
11774 item.SetFrozen(false);
11775 }
11776
11777 if (item.HasEnergyManager())
11778 {
11779 if (quantity >= 0)
11780 {
11781 item.GetCompEM().SetEnergy0To1(quantity);
11782 }
11783 else
11784 {
11786 }
11787 }
11788 else if (item.IsMagazine())
11789 {
11790 Magazine mag = Magazine.Cast(item);
11791 if (quantity >= 0)
11792 {
11793 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11794 }
11795 else
11796 {
11798 }
11799
11800 }
11801 else
11802 {
11803 if (quantity >= 0)
11804 {
11805 item.SetQuantityNormalized(quantity, false);
11806 }
11807 else
11808 {
11810 }
11811
11812 }
11813 }
11814}
11815
11816#ifdef DEVELOPER
11818#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.