Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first when overriding this event.
6869{
6871 {
6872 return true;
6873 }
6874};
6875
6876
6877
6879{
6883
6885
6888
6889
6890
6891
6892
6901
6907
6912
6917
6938 protected bool m_IsResultOfSplit
6939
6941
6946
6947
6948
6950
6954
6955
6956
6958
6961
6962
6963
6969
6970
6978
6981
6982
6984
6985
6987
6988
6993
6994
6999
7000
7002
7003
7005 {
7010
7011 if (!
GetGame().IsDedicatedServer())
7012 {
7014 {
7016
7018 {
7020 }
7021 }
7022
7025 }
7026
7027 m_OldLocation = null;
7028
7030 {
7032 }
7033
7034 if (ConfigIsExisting("headSelectionsToHide"))
7035 {
7038 }
7039
7041 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7042 {
7044 }
7045
7047
7048 m_IsResultOfSplit = false;
7049
7051 }
7052
7054 {
7055 super.InitItemVariables();
7056
7062 m_Count = ConfigGetInt(
"count");
7063
7066
7071
7074
7079
7091
7095
7096
7099 if (ConfigIsExisting("canBeSplit"))
7100 {
7103 }
7104
7106 if (ConfigIsExisting("itemBehaviour"))
7108
7109
7112 RegisterNetSyncVariableInt("m_VarLiquidType");
7113 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7114
7115 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7116 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7117 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7118
7119 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7120 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7121 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7122 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7123
7124 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7125 RegisterNetSyncVariableBool("m_IsTakeable");
7126 RegisterNetSyncVariableBool("m_IsHologram");
7127
7130 {
7133 }
7134
7136
7138 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7140
7141 }
7142
7144 {
7146 }
7147
7149 {
7152 {
7157 }
7158 }
7159
7160 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7161 {
7163 {
7166 }
7167
7169 }
7170
7172 {
7178 }
7179
7181
7183 {
7185
7186 if (!action)
7187 {
7188 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7189 return;
7190 }
7191
7193 if (!ai)
7194 {
7196 return;
7197 }
7198
7200 if (!action_array)
7201 {
7202 action_array = new array<ActionBase_Basic>;
7204 }
7205 if (LogManager.IsActionLogEnable())
7206 {
7207 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7208 }
7209
7210 if (action_array.Find(action) != -1)
7211 {
7212 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7213 }
7214 else
7215 {
7216 action_array.Insert(action);
7217 }
7218 }
7219
7221 {
7223 ActionBase action = player.GetActionManager().GetAction(actionName);
7226
7227 if (action_array)
7228 {
7229 action_array.RemoveItem(action);
7230 }
7231 }
7232
7233
7234
7236 {
7237 ActionOverrideData overrideData = new ActionOverrideData();
7241
7243 if (!actionMap)
7244 {
7247 }
7248
7249 actionMap.Insert(this.
Type(), overrideData);
7250
7251 }
7252
7254
7256
7257
7259 {
7262
7265
7266 string config_to_search = "CfgVehicles";
7267 string muzzle_owner_config;
7268
7270 {
7271 if (IsInherited(Weapon))
7272 config_to_search = "CfgWeapons";
7273
7274 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7275
7276 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7277
7279
7280 if (config_OnFire_subclass_count > 0)
7281 {
7282 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7283
7284 for (int i = 0; i < config_OnFire_subclass_count; i++)
7285 {
7286 string particle_class = "";
7288 string config_OnFire_entry = config_OnFire_class + particle_class;
7289 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7290 WPOF_array.Insert(WPOF);
7291 }
7292
7293
7295 }
7296 }
7297
7299 {
7300 config_to_search = "CfgWeapons";
7301 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7302
7303 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7304
7306
7307 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7308 {
7309 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7310
7311 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7312 {
7313 string particle_class2 = "";
7315 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7316 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7317 WPOBE_array.Insert(WPOBE);
7318 }
7319
7320
7322 }
7323 }
7324 }
7325
7326
7328 {
7331
7333 {
7334 string config_to_search = "CfgVehicles";
7335
7336 if (IsInherited(Weapon))
7337 config_to_search = "CfgWeapons";
7338
7339 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7340 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7341
7342 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
7343 {
7344
7346
7348 {
7350 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7352 return;
7353 }
7354
7357
7358
7359
7361 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7362
7363 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7364 {
7365 string particle_class = "";
7367 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7369
7370 if (entry_type == CT_CLASS)
7371 {
7372 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7373 WPOOH_array.Insert(WPOF);
7374 }
7375 }
7376
7377
7379 }
7380 }
7381 }
7382
7384 {
7386 }
7387
7389 {
7391 {
7393
7396
7399
7400 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7401 }
7402 }
7403
7405 {
7407 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7408
7410 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7411
7413 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7414
7416 {
7418 }
7419 }
7420
7422 {
7424 }
7425
7427 {
7430 else
7432
7434 {
7437 }
7438 else
7439 {
7442
7445 }
7446
7448 }
7449
7451 {
7453 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7454 }
7455
7457 {
7459 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7461 }
7462
7464 {
7466 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7467 }
7468
7470 {
7473
7474 OverheatingParticle OP = new OverheatingParticle();
7479
7481 }
7482
7484 {
7487
7488 return -1;
7489 }
7490
7492 {
7494 {
7497
7498 for (int i = count; i > 0; --i)
7499 {
7500 int id = i - 1;
7503
7506
7507 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7508 {
7509 if (p)
7510 {
7513 }
7514 }
7515 }
7516 }
7517 }
7518
7520 {
7522 {
7524 {
7525 int id = i - 1;
7527
7528 if (OP)
7529 {
7531
7532 if (p)
7533 {
7535 }
7536
7537 delete OP;
7538 }
7539 }
7540
7543 }
7544 }
7545
7548 {
7549 return 0.0;
7550 }
7551
7552
7554 {
7555 return 250;
7556 }
7557
7559 {
7560 return 0;
7561 }
7562
7565 {
7567 return true;
7568
7569 return false;
7570 }
7571
7574 {
7577
7579 {
7581 }
7582 else
7583 {
7584
7586 }
7587
7589 }
7590
7597 {
7598 return -1;
7599 }
7600
7601
7602
7603
7605 {
7607 {
7609 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7610
7611 if (r_index >= 0)
7612 {
7613 InventoryLocation r_il = new InventoryLocation;
7614 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7615
7616 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7619 {
7620 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7621 }
7623 {
7624 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7625 }
7626
7627 }
7628
7629 player.GetHumanInventory().ClearUserReservedLocation(this);
7630 }
7631
7634 }
7635
7636
7637
7638
7640 {
7641 return ItemBase.m_DebugActionsMask;
7642 }
7643
7645 {
7646 return ItemBase.m_DebugActionsMask & mask;
7647 }
7648
7650 {
7651 ItemBase.m_DebugActionsMask = mask;
7652 }
7653
7655 {
7656 ItemBase.m_DebugActionsMask |= mask;
7657 }
7658
7660 {
7661 ItemBase.m_DebugActionsMask &= ~mask;
7662 }
7663
7665 {
7667 {
7669 }
7670 else
7671 {
7673 }
7674 }
7675
7676
7678 {
7679 if (GetEconomyProfile())
7680 {
7681 float q_max = GetEconomyProfile().GetQuantityMax();
7682 if (q_max > 0)
7683 {
7684 float q_min = GetEconomyProfile().GetQuantityMin();
7685 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7686
7688 {
7689 ComponentEnergyManager comp = GetCompEM();
7691 {
7693 }
7694 }
7696 {
7698
7699 }
7700
7701 }
7702 }
7703 }
7704
7707 {
7708 EntityAI parent = GetHierarchyParent();
7709
7710 if (parent)
7711 {
7712 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7713 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7714 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7715 }
7716 }
7717
7720 {
7721 EntityAI parent = GetHierarchyParent();
7722
7723 if (parent)
7724 {
7725 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7726 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7727 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7728 }
7729 }
7730
7732 {
7733
7734
7735
7736
7738
7740 {
7741 if (ScriptInputUserData.CanStoreInputUserData())
7742 {
7743 ScriptInputUserData ctx = new ScriptInputUserData;
7749 ctx.
Write(use_stack_max);
7752
7754 {
7755 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7756 }
7757 }
7758 }
7759 else if (!
GetGame().IsMultiplayer())
7760 {
7762 }
7763 }
7764
7766 {
7768 }
7769
7771 {
7773 }
7774
7776 {
7778 }
7779
7781 {
7782
7783 return false;
7784 }
7785
7787 {
7788 return false;
7789 }
7790
7794 {
7795 return false;
7796 }
7797
7799 {
7800 return "";
7801 }
7802
7804
7806 {
7807 return false;
7808 }
7809
7811 {
7812 return true;
7813 }
7814
7815
7816
7818 {
7819 return true;
7820 }
7821
7823 {
7824 return true;
7825 }
7826
7828 {
7829 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7831 }
7832
7834 {
7836 }
7837
7839 {
7841 if (!is_being_placed)
7843 SetSynchDirty();
7844 }
7845
7846
7848
7850 {
7852 }
7853
7855 {
7857 }
7858
7860 {
7861 return 1;
7862 }
7863
7865 {
7866 return false;
7867 }
7868
7870 {
7872 SetSynchDirty();
7873 }
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7910 {
7911 super.OnMovedInsideCargo(container);
7912
7913 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7914 }
7915
7916 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7917 {
7918 super.EEItemLocationChanged(oldLoc,newLoc);
7919
7920 PlayerBase new_player = null;
7921 PlayerBase old_player = null;
7922
7923 if (newLoc.GetParent())
7924 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7925
7926 if (oldLoc.GetParent())
7927 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7928
7930 {
7931 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7932
7933 if (r_index >= 0)
7934 {
7935 InventoryLocation r_il = new InventoryLocation;
7936 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7937
7938 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7941 {
7942 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7943 }
7945 {
7946 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7947 }
7948
7949 }
7950 }
7951
7953 {
7954 if (new_player)
7955 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7956
7957 if (new_player == old_player)
7958 {
7959
7960 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7961 {
7963 {
7964 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7965 {
7966 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7967 }
7968 }
7969 else
7970 {
7971 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7972 }
7973 }
7974
7975 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7976 {
7977 int type = oldLoc.GetType();
7979 {
7980 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7981 }
7983 {
7984 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7985 }
7986 }
7987 if (!m_OldLocation)
7988 {
7989 m_OldLocation = new InventoryLocation;
7990 }
7991 m_OldLocation.Copy(oldLoc);
7992 }
7993 else
7994 {
7995 if (m_OldLocation)
7996 {
7997 m_OldLocation.Reset();
7998 }
7999 }
8000
8002 }
8003 else
8004 {
8005 if (new_player)
8006 {
8007 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8008 if (res_index >= 0)
8009 {
8010 InventoryLocation il = new InventoryLocation;
8011 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
8013 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
8016 {
8017 il.
GetParent().GetOnReleaseLock().Invoke(it);
8018 }
8020 {
8022 }
8023
8024 }
8025 }
8027 {
8028
8030 }
8031
8032 if (m_OldLocation)
8033 {
8034 m_OldLocation.Reset();
8035 }
8036 }
8037 }
8038
8039 override void EOnContact(IEntity other, Contact extra)
8040 {
8042 {
8043 int liquidType = -1;
8045 if (impactSpeed > 0.0)
8046 {
8048 #ifndef SERVER
8050 #else
8052 SetSynchDirty();
8053 #endif
8055 }
8056 }
8057
8058 #ifdef SERVER
8059 if (GetCompEM() && GetCompEM().IsPlugged())
8060 {
8061 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8062 GetCompEM().UnplugThis();
8063 }
8064 #endif
8065 }
8066
8068
8070 {
8072 }
8073
8075 {
8076
8077 }
8078
8080 {
8081 super.OnItemLocationChanged(old_owner, new_owner);
8082
8083 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8084 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8085
8086 if (!relatedPlayer && playerNew)
8087 relatedPlayer = playerNew;
8088
8089 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8090 {
8092 if (actionMgr)
8093 {
8094 ActionBase currentAction = actionMgr.GetRunningAction();
8095 if (currentAction)
8097 }
8098 }
8099
8100 Man ownerPlayerOld = null;
8101 Man ownerPlayerNew = null;
8102
8103 if (old_owner)
8104 {
8105 if (old_owner.
IsMan())
8106 {
8107 ownerPlayerOld = Man.Cast(old_owner);
8108 }
8109 else
8110 {
8111 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8112 }
8113 }
8114 else
8115 {
8117 {
8119
8120 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8121 {
8122 GetCompEM().UnplugThis();
8123 }
8124 }
8125 }
8126
8127 if (new_owner)
8128 {
8129 if (new_owner.
IsMan())
8130 {
8131 ownerPlayerNew = Man.Cast(new_owner);
8132 }
8133 else
8134 {
8135 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8136 }
8137 }
8138
8139 if (ownerPlayerOld != ownerPlayerNew)
8140 {
8141 if (ownerPlayerOld)
8142 {
8143 array<EntityAI> subItemsExit = new array<EntityAI>;
8145 for (int i = 0; i < subItemsExit.Count(); i++)
8146 {
8149 }
8150 }
8151
8152 if (ownerPlayerNew)
8153 {
8154 array<EntityAI> subItemsEnter = new array<EntityAI>;
8156 for (int j = 0; j < subItemsEnter.Count(); j++)
8157 {
8160 }
8161 }
8162 }
8163 else if (ownerPlayerNew != null)
8164 {
8165 PlayerBase nplayer;
8166 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8167 {
8168 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8170 for (int k = 0; k < subItemsUpdate.Count(); k++)
8171 {
8173 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8174 }
8175 }
8176 }
8177
8178 if (old_owner)
8179 old_owner.OnChildItemRemoved(this);
8180 if (new_owner)
8181 new_owner.OnChildItemReceived(this);
8182 }
8183
8184
8186 {
8187 super.EEDelete(parent);
8188 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8189 if (player)
8190 {
8192
8193 if (player.IsAlive())
8194 {
8195 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8196 if (r_index >= 0)
8197 {
8198 InventoryLocation r_il = new InventoryLocation;
8199 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8200
8201 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8204 {
8205 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8206 }
8208 {
8209 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8210 }
8211
8212 }
8213
8214 player.RemoveQuickBarEntityShortcut(this);
8215 }
8216 }
8217 }
8218
8220 {
8221 super.EEKilled(killer);
8222
8225 {
8226 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8227 {
8228 if (IsMagazine())
8229 {
8230 if (Magazine.Cast(this).GetAmmoCount() > 0)
8231 {
8233 }
8234 }
8235 else
8236 {
8238 }
8239 }
8240 }
8241 }
8242
8244 {
8245 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8246
8247 super.OnWasAttached(parent, slot_id);
8248
8251
8253 }
8254
8256 {
8257 super.OnWasDetached(parent, slot_id);
8258
8261 }
8262
8264 {
8265 int idx;
8268
8269 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8270 if (inventory_slots.Count() < 1)
8271 {
8272 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8273 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8274 }
8275 else
8276 {
8277 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8278 }
8279
8280 idx = inventory_slots.Find(slot);
8281 if (idx < 0)
8282 return "";
8283
8284 return attach_types.Get(idx);
8285 }
8286
8288 {
8289 int idx = -1;
8290 string slot;
8291
8294
8295 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8296 if (inventory_slots.Count() < 1)
8297 {
8298 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8299 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8300 }
8301 else
8302 {
8303 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8304 if (detach_types.Count() < 1)
8305 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8306 }
8307
8308 for (int i = 0; i < inventory_slots.Count(); i++)
8309 {
8310 slot = inventory_slots.Get(i);
8311 }
8312
8313 if (slot != "")
8314 {
8315 if (detach_types.Count() == 1)
8316 idx = 0;
8317 else
8318 idx = inventory_slots.Find(slot);
8319 }
8320 if (idx < 0)
8321 return "";
8322
8323 return detach_types.Get(idx);
8324 }
8325
8327 {
8328
8330
8331
8332 float min_time = 1;
8333 float max_time = 3;
8334 float delay = Math.RandomFloat(min_time, max_time);
8335
8336 explode_timer.Run(delay, this, "DoAmmoExplosion");
8337 }
8338
8340 {
8341 Magazine magazine = Magazine.Cast(this);
8342 int pop_sounds_count = 6;
8343 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8344
8345
8346 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8347 string sound_name = pop_sounds[ sound_idx ];
8349
8350
8351 magazine.ServerAddAmmoCount(-1);
8352
8353
8354 float min_temp_to_explode = 100;
8355
8356 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8357 {
8359 }
8360 }
8361
8362
8363 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8364 {
8365 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8366
8367 const int CHANCE_DAMAGE_CARGO = 4;
8368 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8369 const int CHANCE_DAMAGE_NOTHING = 2;
8370
8372 {
8373 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8374 int chances;
8375 int rnd;
8376
8377 if (GetInventory().GetCargo())
8378 {
8379 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8380 rnd = Math.RandomInt(0,chances);
8381
8382 if (rnd < CHANCE_DAMAGE_CARGO)
8383 {
8385 }
8386 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8387 {
8389 }
8390 }
8391 else
8392 {
8393 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8394 rnd = Math.RandomInt(0,chances);
8395
8396 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8397 {
8399 }
8400 }
8401 }
8402 }
8403
8405 {
8406 if (GetInventory().GetCargo())
8407 {
8408 int item_count = GetInventory().GetCargo().GetItemCount();
8409 if (item_count > 0)
8410 {
8411 int random_pick = Math.RandomInt(0, item_count);
8413 if (!item.IsExplosive())
8414 {
8415 item.AddHealth("","",damage);
8416 return true;
8417 }
8418 }
8419 }
8420 return false;
8421 }
8422
8424 {
8425 int attachment_count = GetInventory().AttachmentCount();
8426 if (attachment_count > 0)
8427 {
8428 int random_pick = Math.RandomInt(0, attachment_count);
8429 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8430 if (!attachment.IsExplosive())
8431 {
8432 attachment.AddHealth("","",damage);
8433 return true;
8434 }
8435 }
8436 return false;
8437 }
8438
8440 {
8442 }
8443
8445 {
8447 return GetInventory().CanRemoveEntity();
8448
8449 return false;
8450 }
8451
8453 {
8454
8456 return false;
8457
8458
8460 return false;
8461
8462
8463
8465 if (delta == 0)
8466 return false;
8467
8468
8469 return true;
8470 }
8471
8473 {
8475 {
8476 if (ScriptInputUserData.CanStoreInputUserData())
8477 {
8478 ScriptInputUserData ctx = new ScriptInputUserData;
8483 ctx.
Write(destination_entity);
8487 }
8488 }
8489 else if (!
GetGame().IsMultiplayer())
8490 {
8492 }
8493 }
8494
8496 {
8497 float split_quantity_new;
8501 InventoryLocation loc = new InventoryLocation;
8502
8503 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8504 {
8506 split_quantity_new = stack_max;
8507 else
8509
8511 {
8512 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8513 if (new_item)
8514 {
8515 new_item.SetResultOfSplit(true);
8516 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8518 new_item.
SetQuantity(split_quantity_new,
false,
true);
8519 }
8520 }
8521 }
8522 else if (destination_entity && slot_id == -1)
8523 {
8524 if (quantity > stack_max)
8525 split_quantity_new = stack_max;
8526 else
8527 split_quantity_new = quantity;
8528
8530 {
8532 {
8535 }
8536
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
8547 {
8548 if (stack_max != 0)
8549 {
8551 {
8553 }
8554
8555 if (split_quantity_new == 0)
8556 {
8557 if (!
GetGame().IsMultiplayer())
8558 player.PhysicalPredictiveDropItem(this);
8559 else
8560 player.ServerDropEntity(this);
8561 return;
8562 }
8563
8565 {
8567
8568 if (new_item)
8569 {
8570 new_item.SetResultOfSplit(true);
8571 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8574 new_item.PlaceOnSurface();
8575 }
8576 }
8577 }
8578 }
8579 }
8580
8582 {
8583 float split_quantity_new;
8587 InventoryLocation loc = new InventoryLocation;
8588
8589 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8590 {
8592 split_quantity_new = stack_max;
8593 else
8595
8597 {
8598 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8599 if (new_item)
8600 {
8601 new_item.SetResultOfSplit(true);
8602 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8604 new_item.
SetQuantity(split_quantity_new,
false,
true);
8605 }
8606 }
8607 }
8608 else if (destination_entity && slot_id == -1)
8609 {
8610 if (quantity > stack_max)
8611 split_quantity_new = stack_max;
8612 else
8613 split_quantity_new = quantity;
8614
8616 {
8618 {
8621 }
8622
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
8633 {
8634 if (stack_max != 0)
8635 {
8637 {
8639 }
8640
8642 {
8644
8645 if (new_item)
8646 {
8647 new_item.SetResultOfSplit(true);
8648 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8651 new_item.PlaceOnSurface();
8652 }
8653 }
8654 }
8655 }
8656 }
8657
8659 {
8661 {
8662 if (ScriptInputUserData.CanStoreInputUserData())
8663 {
8664 ScriptInputUserData ctx = new ScriptInputUserData;
8669 dst.WriteToContext(ctx);
8671 }
8672 }
8673 else if (!
GetGame().IsMultiplayer())
8674 {
8676 }
8677 }
8678
8680 {
8682 {
8683 if (ScriptInputUserData.CanStoreInputUserData())
8684 {
8685 ScriptInputUserData ctx = new ScriptInputUserData;
8690 ctx.
Write(destination_entity);
8696 }
8697 }
8698 else if (!
GetGame().IsMultiplayer())
8699 {
8701 }
8702 }
8703
8705 {
8707 }
8708
8710 {
8712 float split_quantity_new;
8714 if (dst.IsValid())
8715 {
8716 int slot_id = dst.GetSlot();
8718
8719 if (quantity > stack_max)
8720 split_quantity_new = stack_max;
8721 else
8722 split_quantity_new = quantity;
8723
8725 {
8727
8728 if (new_item)
8729 {
8730 new_item.SetResultOfSplit(true);
8731 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8733 new_item.
SetQuantity(split_quantity_new,
false,
true);
8734 }
8735
8736 return new_item;
8737 }
8738 }
8739
8740 return null;
8741 }
8742
8744 {
8746 float split_quantity_new;
8748 if (destination_entity)
8749 {
8751 if (quantity > stackable)
8752 split_quantity_new = stackable;
8753 else
8754 split_quantity_new = quantity;
8755
8757 {
8758 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8759 if (new_item)
8760 {
8761 new_item.SetResultOfSplit(true);
8762 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8764 new_item.
SetQuantity(split_quantity_new,
false,
true);
8765 }
8766 }
8767 }
8768 }
8769
8771 {
8773 {
8774 if (ScriptInputUserData.CanStoreInputUserData())
8775 {
8776 ScriptInputUserData ctx = new ScriptInputUserData;
8781 ItemBase destination_entity =
this;
8782 ctx.
Write(destination_entity);
8786 }
8787 }
8788 else if (!
GetGame().IsMultiplayer())
8789 {
8791 }
8792 }
8793
8795 {
8797 float split_quantity_new;
8799 if (player)
8800 {
8802 if (quantity > stackable)
8803 split_quantity_new = stackable;
8804 else
8805 split_quantity_new = quantity;
8806
8808 {
8809 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8810 new_item =
ItemBase.Cast(in_hands);
8811 if (new_item)
8812 {
8813 new_item.SetResultOfSplit(true);
8814 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8816 new_item.SetQuantity(split_quantity_new, false, true);
8817 }
8818 }
8819 }
8820 }
8821
8823 {
8825 float split_quantity_new = Math.Floor(quantity * 0.5);
8826
8828 return;
8829
8831
8832 if (new_item)
8833 {
8834 if (new_item.GetQuantityMax() < split_quantity_new)
8835 {
8836 split_quantity_new = new_item.GetQuantityMax();
8837 }
8838
8839 new_item.SetResultOfSplit(true);
8840 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8841
8843 {
8846 }
8847 else
8848 {
8850 new_item.
SetQuantity(split_quantity_new,
false,
true);
8851 }
8852 }
8853 }
8854
8856 {
8858 float split_quantity_new = Math.Floor(quantity / 2);
8859
8861 return;
8862
8863 InventoryLocation invloc = new InventoryLocation;
8865
8867 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8868
8869 if (new_item)
8870 {
8871 if (new_item.GetQuantityMax() < split_quantity_new)
8872 {
8873 split_quantity_new = new_item.GetQuantityMax();
8874 }
8876 {
8879 }
8880 else if (split_quantity_new > 1)
8881 {
8883 new_item.
SetQuantity(split_quantity_new,
false,
true);
8884 }
8885 }
8886 }
8887
8890 {
8891 SetWeightDirty();
8893
8894 if (parent)
8895 parent.OnAttachmentQuantityChangedEx(this, delta);
8896
8898 {
8900 {
8902 }
8904 {
8905 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8907 }
8908 }
8909
8910 }
8911
8914 {
8915
8916 }
8917
8920 {
8922 }
8923
8925 {
8926 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8927
8929 {
8930 if (newLevel == GameConstants.STATE_RUINED)
8931 {
8933 EntityAI parent = GetHierarchyParent();
8934 if (parent && parent.IsFireplace())
8935 {
8936 CargoBase cargo = GetInventory().GetCargo();
8937 if (cargo)
8938 {
8940 {
8942 }
8943 }
8944 }
8945 }
8946
8948 {
8949
8951 return;
8952 }
8953
8954 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8955 {
8957 }
8958 }
8959 }
8960
8961
8963 {
8964 super.OnRightClick();
8965
8967 {
8969 {
8970 if (ScriptInputUserData.CanStoreInputUserData())
8971 {
8972 EntityAI root = GetHierarchyRoot();
8973 Man playerOwner = GetHierarchyRootPlayer();
8974 InventoryLocation dst = new InventoryLocation;
8975
8976
8977 if (!playerOwner && root && root == this)
8978 {
8980 }
8981 else
8982 {
8983
8984 GetInventory().GetCurrentInventoryLocation(dst);
8986 {
8989 {
8991 }
8992 else
8993 {
8995
8996
8997 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8998 {
9000 }
9001 else
9002 {
9003 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9004 }
9005 }
9006 }
9007 }
9008
9009 ScriptInputUserData ctx = new ScriptInputUserData;
9017 }
9018 }
9019 else if (!
GetGame().IsMultiplayer())
9020 {
9022 }
9023 }
9024 }
9025
9027 {
9028 if (root)
9029 {
9030 vector m4[4];
9031 root.GetTransform(m4);
9032 dst.SetGround(this, m4);
9033 }
9034 else
9035 {
9036 GetInventory().GetCurrentInventoryLocation(dst);
9037 }
9038 }
9039
9040 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9041 {
9042
9043 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9044 return false;
9045
9046 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9047 return false;
9048
9049
9051 return false;
9052
9053
9054 Magazine mag = Magazine.Cast(this);
9055 if (mag)
9056 {
9057 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9058 return false;
9059
9060 if (stack_max_limit)
9061 {
9062 Magazine other_mag = Magazine.Cast(other_item);
9063 if (other_item)
9064 {
9065 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9066 return false;
9067 }
9068
9069 }
9070 }
9071 else
9072 {
9073
9075 return false;
9076
9078 return false;
9079 }
9080
9081 PlayerBase player = null;
9082 if (CastTo(player, GetHierarchyRootPlayer()))
9083 {
9084 if (player.GetInventory().HasAttachment(this))
9085 return false;
9086
9087 if (player.IsItemsToDelete())
9088 return false;
9089 }
9090
9091 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9092 return false;
9093
9094 int slotID;
9096 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9097 return false;
9098
9099 return true;
9100 }
9101
9103 {
9105 }
9106
9108 {
9109 return m_IsResultOfSplit;
9110 }
9111
9113 {
9114 m_IsResultOfSplit = value;
9115 }
9116
9118 {
9120 }
9121
9123 {
9124 float other_item_quantity = other_item.GetQuantity();
9125 float this_free_space;
9126
9128
9130
9131 if (other_item_quantity > this_free_space)
9132 {
9133 return this_free_space;
9134 }
9135 else
9136 {
9137 return other_item_quantity;
9138 }
9139 }
9140
9142 {
9144 }
9145
9147 {
9149 return;
9150
9151 if (!IsMagazine() && other_item)
9152 {
9154 if (quantity_used != 0)
9155 {
9156 float hp1 = GetHealth01("","");
9157 float hp2 = other_item.GetHealth01("","");
9158 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9159 hpResult = hpResult / (
GetQuantity() + quantity_used);
9160
9161 hpResult *= GetMaxHealth();
9162 Math.Round(hpResult);
9163 SetHealth("", "Health", hpResult);
9164
9166 other_item.AddQuantity(-quantity_used);
9167 }
9168 }
9170 }
9171
9173 {
9174 #ifdef SERVER
9175 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9176 GetHierarchyParent().IncreaseLifetimeUp();
9177 #endif
9178 };
9179
9181 {
9182 PlayerBase p = PlayerBase.Cast(player);
9183
9184 array<int> recipesIds = p.m_Recipes;
9185 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9186 if (moduleRecipesManager)
9187 {
9188 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9189 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9190 }
9191
9192 for (int i = 0;i < recipesIds.Count(); i++)
9193 {
9194 int key = recipesIds.Get(i);
9195 string recipeName = moduleRecipesManager.GetRecipeName(key);
9197 }
9198 }
9199
9200
9201 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9202 {
9203 super.GetDebugActions(outputList);
9204
9205
9211
9212
9217
9222
9223
9227
9228
9230 {
9234 }
9235
9238
9239
9243
9245
9246 InventoryLocation loc = new InventoryLocation();
9247 GetInventory().GetCurrentInventoryLocation(loc);
9249 {
9250 if (Gizmo_IsSupported())
9253 }
9254
9256 }
9257
9258
9259
9260
9262 {
9263 super.OnAction(action_id, player, ctx);
9264
9266 {
9267 switch (action_id)
9268 {
9271 return true;
9274 return true;
9275 }
9276 }
9277
9279 {
9280 switch (action_id)
9281 {
9283 Delete();
9284 return true;
9285 }
9286 }
9287
9288 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9289 {
9290 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9291 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9292 PlayerBase p = PlayerBase.Cast(player);
9293 if (
EActions.RECIPES_RANGE_START < 1000)
9294 {
9295 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9296 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9297 }
9298 }
9299 #ifndef SERVER
9300 else if (action_id ==
EActions.WATCH_PLAYER)
9301 {
9302 PluginDeveloper.SetDeveloperItemClientEx(player);
9303 }
9304 #endif
9306 {
9307 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9308 {
9309 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9310 OnDebugButtonPressServer(id + 1);
9311 }
9312
9313 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9314 {
9315 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9317 }
9318
9319 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9320 {
9321 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9323 }
9324
9325 else if (action_id ==
EActions.ADD_QUANTITY)
9326 {
9327 if (IsMagazine())
9328 {
9329 Magazine mag = Magazine.Cast(this);
9330 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9331 }
9332 else
9333 {
9335 }
9336
9337 if (m_EM)
9338 {
9339 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9340 }
9341
9342 }
9343
9344 else if (action_id ==
EActions.REMOVE_QUANTITY)
9345 {
9346 if (IsMagazine())
9347 {
9348 Magazine mag2 = Magazine.Cast(this);
9349 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9350 }
9351 else
9352 {
9354 }
9355 if (m_EM)
9356 {
9357 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9358 }
9359
9360 }
9361
9362 else if (action_id ==
EActions.SET_QUANTITY_0)
9363 {
9365
9366 if (m_EM)
9367 {
9368 m_EM.SetEnergy(0);
9369 }
9370 }
9371
9372 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9373 {
9375
9376 if (m_EM)
9377 {
9378 m_EM.SetEnergy(m_EM.GetEnergyMax());
9379 }
9380 }
9381
9382 else if (action_id ==
EActions.ADD_HEALTH)
9383 {
9384 AddHealth("","",GetMaxHealth("","Health")/5);
9385 }
9386 else if (action_id ==
EActions.REMOVE_HEALTH)
9387 {
9388 AddHealth("","",-GetMaxHealth("","Health")/5);
9389 }
9390 else if (action_id ==
EActions.DESTROY_HEALTH)
9391 {
9392 SetHealth01("","",0);
9393 }
9394 else if (action_id ==
EActions.WATCH_ITEM)
9395 {
9397 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9398 #ifdef DEVELOPER
9399 SetDebugDeveloper_item(this);
9400 #endif
9401 }
9402
9403 else if (action_id ==
EActions.ADD_TEMPERATURE)
9404 {
9405 AddTemperature(20);
9406
9407 }
9408
9409 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9410 {
9411 AddTemperature(-20);
9412
9413 }
9414
9415 else if (action_id ==
EActions.FLIP_FROZEN)
9416 {
9417 SetFrozen(!GetIsFrozen());
9418
9419 }
9420
9421 else if (action_id ==
EActions.ADD_WETNESS)
9422 {
9424
9425 }
9426
9427 else if (action_id ==
EActions.REMOVE_WETNESS)
9428 {
9430
9431 }
9432
9433 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9434 {
9437
9438
9439 }
9440
9441 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9442 {
9445 }
9446
9447 else if (action_id ==
EActions.MAKE_SPECIAL)
9448 {
9449 auto debugParams = DebugSpawnParams.WithPlayer(player);
9450 OnDebugSpawnEx(debugParams);
9451 }
9452
9453 }
9454
9455
9456 return false;
9457 }
9458
9459
9460
9461
9465
9468
9469
9470
9472 {
9473 return false;
9474 }
9475
9476
9478 {
9479 return true;
9480 }
9481
9482
9484 {
9485 return true;
9486 }
9487
9488
9489
9491 {
9492 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9494 }
9495
9498 {
9499 return null;
9500 }
9501
9503 {
9504 return false;
9505 }
9506
9508 {
9509 return false;
9510 }
9511
9515
9516
9518 {
9519 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9520 return module_repairing.CanRepair(this, item_repair_kit);
9521 }
9522
9523
9524 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9525 {
9526 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9527 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9528 }
9529
9530
9532 {
9533
9534
9535
9536
9537
9538
9539
9540
9541 return 1;
9542 }
9543
9544
9545
9547 {
9549 }
9550
9551
9552
9554 {
9556 }
9557
9558
9567 {
9568 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9569
9570 if (player)
9571 {
9572 player.MessageStatus(text);
9573 }
9574 }
9575
9576
9585 {
9586 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9587
9588 if (player)
9589 {
9590 player.MessageAction(text);
9591 }
9592 }
9593
9594
9603 {
9604 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9605
9606 if (player)
9607 {
9608 player.MessageFriendly(text);
9609 }
9610 }
9611
9612
9621 {
9622 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9623
9624 if (player)
9625 {
9626 player.MessageImportant(text);
9627 }
9628 }
9629
9631 {
9632 return true;
9633 }
9634
9635
9636 override bool KindOf(
string tag)
9637 {
9638 bool found = false;
9639 string item_name = this.
GetType();
9642
9643 int array_size = item_tag_array.Count();
9644 for (int i = 0; i < array_size; i++)
9645 {
9646 if (item_tag_array.Get(i) == tag)
9647 {
9648 found = true;
9649 break;
9650 }
9651 }
9652 return found;
9653 }
9654
9655
9657 {
9658
9659 super.OnRPC(sender, rpc_type,ctx);
9660
9661
9662 switch (rpc_type)
9663 {
9664 #ifndef SERVER
9665 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9666 Param2<bool, string> p = new Param2<bool, string>(false, "");
9667
9669 return;
9670
9671 bool play = p.param1;
9672 string soundSet = p.param2;
9673
9674 if (play)
9675 {
9677 {
9679 {
9681 }
9682 }
9683 else
9684 {
9686 }
9687 }
9688 else
9689 {
9691 }
9692
9693 break;
9694 #endif
9695
9696 }
9697
9699 {
9701 }
9702 }
9703
9704
9705
9706
9708 {
9709 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9710 return plugin.GetID(
name);
9711 }
9712
9714 {
9715 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9716 return plugin.GetName(id);
9717 }
9718
9721 {
9722
9723
9724 int varFlags;
9725 if (!ctx.
Read(varFlags))
9726 return;
9727
9728 if (varFlags & ItemVariableFlags.FLOAT)
9729 {
9731 }
9732 }
9733
9735 {
9736
9737 super.SerializeNumericalVars(floats_out);
9738
9739
9740
9742 {
9744 }
9745
9747 {
9749 }
9750
9752 {
9754 }
9755
9757 {
9762 }
9763
9765 {
9767 }
9768 }
9769
9771 {
9772
9773 super.DeSerializeNumericalVars(floats);
9774
9775
9776 int index = 0;
9777 int mask = Math.Round(floats.Get(index));
9778
9779 index++;
9780
9782 {
9784 {
9786 }
9787 else
9788 {
9789 float quantity = floats.Get(index);
9791 }
9792 index++;
9793 }
9794
9796 {
9797 float wet = floats.Get(index);
9799 index++;
9800 }
9801
9803 {
9804 int liquidtype = Math.Round(floats.Get(index));
9806 index++;
9807 }
9808
9810 {
9812 index++;
9814 index++;
9816 index++;
9818 index++;
9819 }
9820
9822 {
9823 int cleanness = Math.Round(floats.Get(index));
9825 index++;
9826 }
9827 }
9828
9830 {
9831 super.WriteVarsToCTX(ctx);
9832
9833
9835 {
9837 }
9838
9840 {
9842 }
9843
9845 {
9847 }
9848
9850 {
9851 int r,g,b,a;
9857 }
9858
9860 {
9862 }
9863 }
9864
9866 {
9867 if (!super.ReadVarsFromCTX(ctx,version))
9868 return false;
9869
9870 int intValue;
9871 float value;
9872
9873 if (version < 140)
9874 {
9875 if (!ctx.
Read(intValue))
9876 return false;
9877
9878 m_VariablesMask = intValue;
9879 }
9880
9882 {
9883 if (!ctx.
Read(value))
9884 return false;
9885
9887 {
9889 }
9890 else
9891 {
9893 }
9894 }
9895
9896 if (version < 140)
9897 {
9899 {
9900 if (!ctx.
Read(value))
9901 return false;
9902 SetTemperatureDirect(value);
9903 }
9904 }
9905
9907 {
9908 if (!ctx.
Read(value))
9909 return false;
9911 }
9912
9914 {
9915 if (!ctx.
Read(intValue))
9916 return false;
9918 }
9919
9921 {
9922 int r,g,b,a;
9924 return false;
9926 return false;
9928 return false;
9930 return false;
9931
9933 }
9934
9936 {
9937 if (!ctx.
Read(intValue))
9938 return false;
9940 }
9941
9942 if (version >= 138 && version < 140)
9943 {
9945 {
9946 if (!ctx.
Read(intValue))
9947 return false;
9948 SetFrozen(intValue);
9949 }
9950 }
9951
9952 return true;
9953 }
9954
9955
9957 {
9960 {
9962 }
9963
9964 if (!super.OnStoreLoad(ctx, version))
9965 {
9967 return false;
9968 }
9969
9970 if (version >= 114)
9971 {
9972 bool hasQuickBarIndexSaved;
9973
9974 if (!ctx.
Read(hasQuickBarIndexSaved))
9975 {
9977 return false;
9978 }
9979
9980 if (hasQuickBarIndexSaved)
9981 {
9982 int itmQBIndex;
9983
9984
9985 if (!ctx.
Read(itmQBIndex))
9986 {
9988 return false;
9989 }
9990
9991 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9992 if (itmQBIndex != -1 && parentPlayer)
9993 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9994 }
9995 }
9996 else
9997 {
9998
9999 PlayerBase player;
10000 int itemQBIndex;
10001 if (version ==
int.
MAX)
10002 {
10003 if (!ctx.
Read(itemQBIndex))
10004 {
10006 return false;
10007 }
10008 }
10009 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10010 {
10011
10012 if (!ctx.
Read(itemQBIndex))
10013 {
10015 return false;
10016 }
10017 if (itemQBIndex != -1 && player)
10018 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10019 }
10020 }
10021
10022 if (version < 140)
10023 {
10024
10025 if (!LoadVariables(ctx, version))
10026 {
10028 return false;
10029 }
10030 }
10031
10032
10034 {
10036 return false;
10037 }
10038 if (version >= 132)
10039 {
10041 if (raib)
10042 {
10044 {
10046 return false;
10047 }
10048 }
10049 }
10050
10052 return true;
10053 }
10054
10055
10056
10058 {
10059 super.OnStoreSave(ctx);
10060
10061 PlayerBase player;
10062 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10063 {
10065
10066 int itemQBIndex = -1;
10067 itemQBIndex = player.FindQuickBarEntityIndex(this);
10068 ctx.
Write(itemQBIndex);
10069 }
10070 else
10071 {
10073 }
10074
10076
10078 if (raib)
10079 {
10081 }
10082 }
10083
10084
10086 {
10087 super.AfterStoreLoad();
10088
10090 {
10092 }
10093
10095 {
10098 }
10099 }
10100
10102 {
10103 super.EEOnAfterLoad();
10104
10106 {
10108 }
10109
10112 }
10113
10115 {
10116 return false;
10117 }
10118
10119
10120
10122 {
10124 {
10125 #ifdef PLATFORM_CONSOLE
10126
10128 {
10130 if (menu)
10131 {
10133 }
10134 }
10135 #endif
10136 }
10137
10139 {
10142 }
10143
10145 {
10146 SetWeightDirty();
10148 }
10150 {
10153 }
10154
10156 {
10159 }
10161 {
10164 }
10165
10166 super.OnVariablesSynchronized();
10167 }
10168
10169
10170
10172 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10173 {
10174 if (!IsServerCheck(allow_client))
10175 return false;
10176
10178 return false;
10179
10182
10183 if (value <= (min + 0.001))
10184 value = min;
10185
10186 if (value == min)
10187 {
10188 if (destroy_config)
10189 {
10190 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10191 if (dstr)
10192 {
10194 this.Delete();
10195 return true;
10196 }
10197 }
10198 else if (destroy_forced)
10199 {
10201 this.Delete();
10202 return true;
10203 }
10204
10206 }
10207
10210
10212 {
10214
10215 if (delta)
10217 }
10218
10220
10221 return false;
10222 }
10223
10224
10226 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10227 {
10229 }
10230
10232 {
10235 }
10236
10238 {
10241 }
10242
10244 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10245 {
10246 float value_clamped = Math.Clamp(value, 0, 1);
10248 SetQuantity(result, destroy_config, destroy_forced);
10249 }
10250
10251
10254 {
10256 }
10257
10259 {
10261 }
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10273 {
10274 int slot = -1;
10275 if (GetInventory())
10276 {
10277 InventoryLocation il = new InventoryLocation;
10278 GetInventory().GetCurrentInventoryLocation(il);
10280 }
10281
10283 }
10284
10286 {
10287 float quantity_max = 0;
10288
10290 {
10291 if (attSlotID != -1)
10292 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10293
10294 if (quantity_max <= 0)
10296 }
10297
10298 if (quantity_max <= 0)
10300
10301 return quantity_max;
10302 }
10303
10305 {
10307 }
10308
10310 {
10312 }
10313
10314
10316 {
10318 }
10319
10321 {
10323 }
10324
10326 {
10328 }
10329
10330
10332 {
10333
10334 float weightEx = GetWeightEx();
10335 float special = GetInventoryAndCargoWeight();
10336 return weightEx - special;
10337 }
10338
10339
10341 {
10343 }
10344
10346 {
10348 {
10349 #ifdef DEVELOPER
10350 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10351 {
10352 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10354 }
10355 #endif
10356
10357 return GetQuantity() * GetConfigWeightModified();
10358 }
10359 else if (HasEnergyManager())
10360 {
10361 #ifdef DEVELOPER
10362 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10363 {
10364 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10365 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10366 }
10367 #endif
10368 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10369 }
10370 else
10371 {
10372 #ifdef DEVELOPER
10373 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10374 {
10375 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10376 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10377 }
10378 #endif
10379 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10380 }
10381 }
10382
10385 {
10386 int item_count = 0;
10388
10389 if (GetInventory().GetCargo() != NULL)
10390 {
10391 item_count = GetInventory().GetCargo().GetItemCount();
10392 }
10393
10394 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10395 {
10396 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10397 if (item)
10398 item_count += item.GetNumberOfItems();
10399 }
10400 return item_count;
10401 }
10402
10405 {
10406 float weight = 0;
10407 float wetness = 1;
10408 if (include_wetness)
10411 {
10412 weight = wetness * m_ConfigWeight;
10413 }
10415 {
10416 weight = 1;
10417 }
10418 return weight;
10419 }
10420
10421
10422
10424 {
10425 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
10426 {
10427 GameInventory inv = GetInventory();
10428 array<EntityAI> items = new array<EntityAI>;
10430 for (int i = 0; i < items.Count(); i++)
10431 {
10433 if (item)
10434 {
10436 }
10437 }
10438 }
10439 }
10440
10441
10442
10443
10445 {
10446 float energy = 0;
10447 if (HasEnergyManager())
10448 {
10449 energy = GetCompEM().GetEnergy();
10450 }
10451 return energy;
10452 }
10453
10454
10456 {
10457 super.OnEnergyConsumed();
10458
10460 }
10461
10463 {
10464 super.OnEnergyAdded();
10465
10467 }
10468
10469
10471 {
10472 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10473 {
10475 {
10476 float energy_0to1 = GetCompEM().GetEnergy0To1();
10478 }
10479 }
10480 }
10481
10482
10484 {
10485 return ConfigGetFloat("heatIsolation");
10486 }
10487
10489 {
10491 }
10492
10494 {
10495 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10496 if (
GetGame().ConfigIsExisting(paramPath))
10498
10499 return 0.0;
10500 }
10501
10503 {
10504 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10505 if (
GetGame().ConfigIsExisting(paramPath))
10507
10508 return 0.0;
10509 }
10510
10511 override void SetWet(
float value,
bool allow_client =
false)
10512 {
10513 if (!IsServerCheck(allow_client))
10514 return;
10515
10518
10520
10521 m_VarWet = Math.Clamp(value, min, max);
10522
10524 {
10527 }
10528 }
10529
10530 override void AddWet(
float value)
10531 {
10533 }
10534
10536 {
10538 }
10539
10541 {
10543 }
10544
10546 {
10548 }
10549
10551 {
10553 }
10554
10556 {
10558 }
10559
10560 override void OnWetChanged(
float newVal,
float oldVal)
10561 {
10564 if (newLevel != oldLevel)
10565 {
10567 }
10568 }
10569
10571 {
10572 SetWeightDirty();
10573 }
10574
10576 {
10577 return GetWetLevelInternal(
m_VarWet);
10578 }
10579
10580
10581
10583 {
10585 }
10586
10588 {
10590 }
10591
10593 {
10595 }
10596
10598 {
10600 }
10601
10602
10603
10605 {
10606 if (ConfigIsExisting("itemModelLength"))
10607 {
10608 return ConfigGetFloat("itemModelLength");
10609 }
10610 return 0;
10611 }
10612
10614 {
10615 if (ConfigIsExisting("itemAttachOffset"))
10616 {
10617 return ConfigGetFloat("itemAttachOffset");
10618 }
10619 return 0;
10620 }
10621
10622 override void SetCleanness(
int value,
bool allow_client =
false)
10623 {
10624 if (!IsServerCheck(allow_client))
10625 return;
10626
10628
10630
10633 }
10634
10636 {
10638 }
10639
10641 {
10642 return true;
10643 }
10644
10645
10646
10647
10649 {
10651 }
10652
10654 {
10656 }
10657
10658
10659
10660
10661 override void SetColor(
int r,
int g,
int b,
int a)
10662 {
10668 }
10670 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10671 {
10676 }
10677
10679 {
10681 }
10682
10685 {
10686 int r,g,b,a;
10688 r = r/255;
10689 g = g/255;
10690 b = b/255;
10691 a = a/255;
10692 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10693 }
10694
10695
10696
10697 override void SetLiquidType(
int value,
bool allow_client =
false)
10698 {
10699 if (!IsServerCheck(allow_client))
10700 return;
10701
10706 }
10707
10709 {
10710 return ConfigGetInt("varLiquidTypeInit");
10711 }
10712
10714 {
10716 }
10717
10719 {
10721 SetFrozen(false);
10722 }
10723
10726 {
10727 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10728 }
10729
10730
10733 {
10734 PlayerBase nplayer;
10735 if (PlayerBase.CastTo(nplayer, player))
10736 {
10738
10739 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10740 }
10741 }
10742
10743
10746 {
10747 PlayerBase nplayer;
10748 if (PlayerBase.CastTo(nplayer,player))
10749 {
10750
10751 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10752
10753 }
10754
10755
10756 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10757
10758
10759 if (HasEnergyManager())
10760 {
10761 GetCompEM().UpdatePlugState();
10762 }
10763 }
10764
10765
10767 {
10768 super.OnPlacementStarted(player);
10769
10771 }
10772
10773 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10774 {
10776 {
10777 m_AdminLog.OnPlacementComplete(player,
this);
10778 }
10779
10780 super.OnPlacementComplete(player, position, orientation);
10781 }
10782
10783
10784
10785
10786
10788 {
10790 {
10791 return true;
10792 }
10793 else
10794 {
10795 return false;
10796 }
10797 }
10798
10799
10801 {
10803 {
10805 }
10806 }
10807
10808
10810 {
10812 }
10813
10815 {
10817 }
10818
10819 override void InsertAgent(
int agent,
float count = 1)
10820 {
10821 if (count < 1)
10822 return;
10823
10825 }
10826
10829 {
10831 }
10832
10833
10835 {
10837 }
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10881 {
10883 return false;
10884 return true;
10885 }
10886
10888 {
10889
10891 }
10892
10893
10896 {
10897 super.CheckForRoofLimited(timeTresholdMS);
10898
10900 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10901 {
10902 m_PreviousRoofTestTime = time;
10903 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10904 }
10905 }
10906
10907
10909 {
10911 {
10912 return 0;
10913 }
10914
10915 if (GetInventory().GetAttachmentSlotsCount() != 0)
10916 {
10917 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10918 if (filter)
10919 return filter.GetProtectionLevel(type, false, system);
10920 else
10921 return 0;
10922 }
10923
10924 string subclassPath, entryName;
10925
10926 switch (type)
10927 {
10929 entryName = "biological";
10930 break;
10932 entryName = "chemical";
10933 break;
10934 default:
10935 entryName = "biological";
10936 break;
10937 }
10938
10939 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10940
10942 }
10943
10944
10945
10948 {
10949 if (!IsMagazine())
10951
10953 }
10954
10955
10956
10957
10958
10963 {
10964 return true;
10965 }
10966
10968 {
10970 }
10971
10972
10973
10974
10975
10977 {
10978 if (parent)
10979 {
10980 if (parent.IsInherited(DayZInfected))
10981 return true;
10982
10983 if (!parent.IsRuined())
10984 return true;
10985 }
10986
10987 return true;
10988 }
10989
10991 {
10992 if (!super.CanPutAsAttachment(parent))
10993 {
10994 return false;
10995 }
10996
10997 if (!IsRuined() && !parent.IsRuined())
10998 {
10999 return true;
11000 }
11001
11002 return false;
11003 }
11004
11006 {
11007
11008
11009
11010
11011 return super.CanReceiveItemIntoCargo(item);
11012 }
11013
11015 {
11016
11017
11018
11019
11020 GameInventory attachmentInv = attachment.GetInventory();
11022 {
11023 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11024 return false;
11025 }
11026
11027 InventoryLocation loc = new InventoryLocation();
11028 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11029 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11030 return false;
11031
11032 return super.CanReceiveAttachment(attachment, slotId);
11033 }
11034
11036 {
11037 if (!super.CanReleaseAttachment(attachment))
11038 return false;
11039
11040 return GetInventory().AreChildrenAccessible();
11041 }
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11064 {
11065 int id = muzzle_owner.GetMuzzleID();
11066 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11067
11068 if (WPOF_array)
11069 {
11070 for (int i = 0; i < WPOF_array.Count(); i++)
11071 {
11072 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11073
11074 if (WPOF)
11075 {
11076 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11077 }
11078 }
11079 }
11080 }
11081
11082
11084 {
11085 int id = muzzle_owner.GetMuzzleID();
11087
11088 if (WPOBE_array)
11089 {
11090 for (int i = 0; i < WPOBE_array.Count(); i++)
11091 {
11092 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11093
11094 if (WPOBE)
11095 {
11096 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11097 }
11098 }
11099 }
11100 }
11101
11102
11104 {
11105 int id = muzzle_owner.GetMuzzleID();
11106 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11107
11108 if (WPOOH_array)
11109 {
11110 for (int i = 0; i < WPOOH_array.Count(); i++)
11111 {
11112 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11113
11114 if (WPOOH)
11115 {
11116 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11117 }
11118 }
11119 }
11120 }
11121
11122
11124 {
11125 int id = muzzle_owner.GetMuzzleID();
11126 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11127
11128 if (WPOOH_array)
11129 {
11130 for (int i = 0; i < WPOOH_array.Count(); i++)
11131 {
11132 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11133
11134 if (WPOOH)
11135 {
11136 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11137 }
11138 }
11139 }
11140 }
11141
11142
11144 {
11145 int id = muzzle_owner.GetMuzzleID();
11146 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11147
11148 if (WPOOH_array)
11149 {
11150 for (int i = 0; i < WPOOH_array.Count(); i++)
11151 {
11152 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11153
11154 if (WPOOH)
11155 {
11156 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11157 }
11158 }
11159 }
11160 }
11161
11162
11163
11165 {
11167 {
11168 return true;
11169 }
11170
11171 return false;
11172 }
11173
11175 {
11177 {
11178 return true;
11179 }
11180
11181 return false;
11182 }
11183
11185 {
11187 {
11188 return true;
11189 }
11190
11191 return false;
11192 }
11193
11195 {
11196 return false;
11197 }
11198
11201 {
11202 return UATimeSpent.DEFAULT_DEPLOY;
11203 }
11204
11205
11206
11207
11209 {
11211 SetSynchDirty();
11212 }
11213
11215 {
11217 }
11218
11219
11221 {
11222 return false;
11223 }
11224
11227 {
11228 string att_type = "None";
11229
11230 if (ConfigIsExisting("soundAttType"))
11231 {
11232 att_type = ConfigGetString("soundAttType");
11233 }
11234
11236 }
11237
11239 {
11241 }
11242
11243
11244
11245
11246
11252
11254 {
11257
11259 }
11260
11261
11263 {
11265 return;
11266
11268
11271
11274
11275 SoundParameters params = new SoundParameters();
11279 }
11280
11281
11283 {
11285 return;
11286
11288 SetSynchDirty();
11289
11292 }
11293
11294
11296 {
11298 return;
11299
11301 SetSynchDirty();
11302
11305 }
11306
11308 {
11310 }
11311
11313 {
11315 }
11316
11319 {
11320 if (!
GetGame().IsDedicatedServer())
11321 {
11322 if (ConfigIsExisting("attachSoundSet"))
11323 {
11324 string cfg_path = "";
11325 string soundset = "";
11326 string type_name =
GetType();
11327
11330 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11331 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11332
11333 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11334 {
11335 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11336 {
11337 if (cfg_slot_array[i] == slot_type)
11338 {
11339 soundset = cfg_soundset_array[i];
11340 break;
11341 }
11342 }
11343 }
11344
11345 if (soundset != "")
11346 {
11347 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11349 }
11350 }
11351 }
11352 }
11353
11355 {
11356
11357 }
11358
11359 void OnApply(PlayerBase player);
11360
11362 {
11363 return 1.0;
11364 };
11365
11367 {
11369 }
11370
11372 {
11374 }
11375
11377
11379 {
11380 SetDynamicPhysicsLifeTime(0.01);
11382 }
11383
11385 {
11386 array<string> zone_names = new array<string>;
11387 GetDamageZones(zone_names);
11388 for (int i = 0; i < zone_names.Count(); i++)
11389 {
11390 SetHealthMax(zone_names.Get(i),"Health");
11391 }
11392 SetHealthMax("","Health");
11393 }
11394
11397 {
11398 float global_health = GetHealth01("","Health");
11399 array<string> zones = new array<string>;
11400 GetDamageZones(zones);
11401
11402 for (int i = 0; i < zones.Count(); i++)
11403 {
11404 SetHealth01(zones.Get(i),"Health",global_health);
11405 }
11406 }
11407
11410 {
11411 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11412 }
11413
11415 {
11416 if (!hasRootAsPlayer)
11417 {
11418 if (refParentIB)
11419 {
11420
11421 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11422 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11423
11424 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11425 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11426
11429 }
11430 else
11431 {
11432
11435 }
11436 }
11437 }
11438
11440 {
11442 {
11443 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11444 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11445 {
11446 float heatPermCoef = 1.0;
11448 while (ent)
11449 {
11450 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11451 ent = ent.GetHierarchyParent();
11452 }
11453
11454 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11455 }
11456 }
11457 }
11458
11460 {
11461
11462 EntityAI parent = GetHierarchyParent();
11463 if (!parent)
11464 {
11465 hasParent = false;
11466 hasRootAsPlayer = false;
11467 }
11468 else
11469 {
11470 hasParent = true;
11471 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11472 refParentIB =
ItemBase.Cast(parent);
11473 }
11474 }
11475
11476 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11477 {
11478
11479 }
11480
11482 {
11483
11484 return false;
11485 }
11486
11488 {
11489
11490
11491 return false;
11492 }
11493
11495 {
11496
11497 return false;
11498 }
11499
11502 {
11503 return !GetIsFrozen() &&
IsOpen();
11504 }
11505
11507 {
11508 bool hasParent = false, hasRootAsPlayer = false;
11510
11511 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11512 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11513
11514 if (wwtu || foodDecay)
11515 {
11519
11520 if (processWetness || processTemperature || processDecay)
11521 {
11523
11524 if (processWetness)
11525 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11526
11527 if (processTemperature)
11529
11530 if (processDecay)
11531 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11532 }
11533 }
11534 }
11535
11538 {
11540 }
11541
11543 {
11546
11547 return super.GetTemperatureFreezeThreshold();
11548 }
11549
11551 {
11554
11555 return super.GetTemperatureThawThreshold();
11556 }
11557
11559 {
11562
11563 return super.GetItemOverheatThreshold();
11564 }
11565
11567 {
11569 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11570
11571 return super.GetTemperatureFreezeTime();
11572 }
11573
11575 {
11577 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11578
11579 return super.GetTemperatureThawTime();
11580 }
11581
11586
11588 {
11589 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11590 }
11591
11593 {
11594 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11595 }
11596
11599 {
11601 }
11602
11604 {
11606 }
11607
11609 {
11611 }
11612
11615 {
11616 return null;
11617 }
11618
11621 {
11622 return false;
11623 }
11624
11626 {
11628 {
11631 if (!trg)
11632 {
11634 explosive = this;
11635 }
11636
11637 explosive.PairRemote(trg);
11639
11640 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11641 trg.SetPersistentPairID(persistentID);
11642 explosive.SetPersistentPairID(persistentID);
11643
11644 return true;
11645 }
11646 return false;
11647 }
11648
11651 {
11652 float ret = 1.0;
11655 ret *= GetHealth01();
11656
11657 return ret;
11658 }
11659
11660 #ifdef DEVELOPER
11661 override void SetDebugItem()
11662 {
11663 super.SetDebugItem();
11664 _itemBase = this;
11665 }
11666
11668 {
11669 string text = super.GetDebugText();
11670
11672 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11673
11674 return text;
11675 }
11676 #endif
11677
11679 {
11680 return true;
11681 }
11682
11684
11686
11688 {
11691 }
11692
11693
11701
11717}
11718
11720{
11722 if (entity)
11723 {
11724 bool is_item = entity.IsInherited(
ItemBase);
11725 if (is_item && full_quantity)
11726 {
11729 }
11730 }
11731 else
11732 {
11734 return NULL;
11735 }
11736 return entity;
11737}
11738
11740{
11741 if (item)
11742 {
11743 if (health > 0)
11744 item.SetHealth("", "", health);
11745
11746 if (item.CanHaveTemperature())
11747 {
11749 if (item.CanFreeze())
11750 item.SetFrozen(false);
11751 }
11752
11753 if (item.HasEnergyManager())
11754 {
11755 if (quantity >= 0)
11756 {
11757 item.GetCompEM().SetEnergy0To1(quantity);
11758 }
11759 else
11760 {
11762 }
11763 }
11764 else if (item.IsMagazine())
11765 {
11766 Magazine mag = Magazine.Cast(item);
11767 if (quantity >= 0)
11768 {
11769 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11770 }
11771 else
11772 {
11774 }
11775
11776 }
11777 else
11778 {
11779 if (quantity >= 0)
11780 {
11781 item.SetQuantityNormalized(quantity, false);
11782 }
11783 else
11784 {
11786 }
11787
11788 }
11789 }
11790}
11791
11792#ifdef DEVELOPER
11794#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.