Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChanged(item); first when overriding this event.
6970{
6972 {
6973 return true;
6974 }
6975};
6976
6978{
6979
6980};
6981
6982
6983
6985{
6989
6991
6994
6995
6996
6997
6998
7007
7013
7018
7023
7044 protected bool m_IsResultOfSplit
7045
7047
7052
7053
7054
7056
7060
7061
7062
7064
7067
7068
7069
7075
7076
7084
7087
7088
7090
7091
7093
7094
7099
7100
7105
7107
7108
7110
7111
7113 {
7118
7119 if (!
g_Game.IsDedicatedServer())
7120 {
7122 {
7124
7126 {
7128 }
7129 }
7130
7133 }
7134
7135 m_OldLocation = null;
7136
7138 {
7140 }
7141
7142 if (ConfigIsExisting("headSelectionsToHide"))
7143 {
7146 }
7147
7149 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7150 {
7152 }
7153
7155
7156 m_IsResultOfSplit = false;
7157
7159 }
7160
7162 {
7163 super.InitItemVariables();
7164
7170 m_Count = ConfigGetInt(
"count");
7171
7174
7179
7182
7187
7199
7203
7204
7207 if (ConfigIsExisting("canBeSplit"))
7208 {
7211 }
7212
7214 if (ConfigIsExisting("itemBehaviour"))
7216
7217
7220 RegisterNetSyncVariableInt("m_VarLiquidType");
7221 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7222
7223 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7224 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7225 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7226
7227 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7228 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7229 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7230 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7231
7232 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7233 RegisterNetSyncVariableBool("m_IsTakeable");
7234 RegisterNetSyncVariableBool("m_IsHologram");
7235
7238 {
7241 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7242 }
7243
7245
7247 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7249
7251 }
7252
7254 {
7256 }
7257
7259 {
7262 {
7267 }
7268 }
7269
7270 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7271 {
7273 {
7276 }
7277
7279 }
7280
7282 {
7288 }
7289
7291
7293 {
7295
7296 if (!action)
7297 {
7298 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7299 return;
7300 }
7301
7303 if (!ai)
7304 {
7306 return;
7307 }
7308
7310 if (!action_array)
7311 {
7312 action_array = new array<ActionBase_Basic>;
7314 }
7315 if (LogManager.IsActionLogEnable())
7316 {
7317 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7318 }
7319
7320 if (action_array.Find(action) != -1)
7321 {
7322 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7323 }
7324 else
7325 {
7326 action_array.Insert(action);
7327 }
7328 }
7329
7331 {
7332 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7333 ActionBase action = player.GetActionManager().GetAction(actionName);
7336
7337 if (action_array)
7338 {
7339 action_array.RemoveItem(action);
7340 }
7341 }
7342
7343
7344
7346 {
7347 ActionOverrideData overrideData = new ActionOverrideData();
7351
7353 if (!actionMap)
7354 {
7357 }
7358
7359 actionMap.Insert(this.
Type(), overrideData);
7360
7361 }
7362
7364
7366
7367
7369 {
7372
7375
7376 string config_to_search = "CfgVehicles";
7377 string muzzle_owner_config;
7378
7380 {
7381 if (IsInherited(Weapon))
7382 config_to_search = "CfgWeapons";
7383
7384 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7385
7386 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7387
7388 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7389
7390 if (config_OnFire_subclass_count > 0)
7391 {
7392 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7393
7394 for (int i = 0; i < config_OnFire_subclass_count; i++)
7395 {
7396 string particle_class = "";
7397 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7398 string config_OnFire_entry = config_OnFire_class + particle_class;
7399 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7400 WPOF_array.Insert(WPOF);
7401 }
7402
7403
7405 }
7406 }
7407
7409 {
7410 config_to_search = "CfgWeapons";
7411 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7412
7413 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7414
7415 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7416
7417 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7418 {
7419 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7420
7421 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7422 {
7423 string particle_class2 = "";
7424 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7425 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7426 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7427 WPOBE_array.Insert(WPOBE);
7428 }
7429
7430
7432 }
7433 }
7434 }
7435
7436
7438 {
7441
7443 {
7444 string config_to_search = "CfgVehicles";
7445
7446 if (IsInherited(Weapon))
7447 config_to_search = "CfgWeapons";
7448
7449 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7450 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7451
7452 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7453 {
7454
7456
7458 {
7460 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7462 return;
7463 }
7464
7467
7468
7469
7470 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7471 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7472
7473 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7474 {
7475 string particle_class = "";
7476 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7477 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7478 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7479
7480 if (entry_type == CT_CLASS)
7481 {
7482 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7483 WPOOH_array.Insert(WPOF);
7484 }
7485 }
7486
7487
7489 }
7490 }
7491 }
7492
7494 {
7496 }
7497
7499 {
7501 {
7503
7506
7509
7510 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7511 }
7512 }
7513
7515 {
7517 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7518
7520 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7521
7523 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7524
7526 {
7528 }
7529 }
7530
7532 {
7534 }
7535
7537 {
7540 else
7542
7544 {
7547 }
7548 else
7549 {
7552
7555 }
7556
7558 }
7559
7561 {
7563 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7564 }
7565
7567 {
7569 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7571 }
7572
7574 {
7576 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7577 }
7578
7580 {
7583
7584 OverheatingParticle OP = new OverheatingParticle();
7589
7591 }
7592
7594 {
7597
7598 return -1;
7599 }
7600
7602 {
7604 {
7607
7608 for (int i = count; i > 0; --i)
7609 {
7610 int id = i - 1;
7613
7616
7617 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7618 {
7619 if (p)
7620 {
7623 }
7624 }
7625 }
7626 }
7627 }
7628
7630 {
7632 {
7634 {
7635 int id = i - 1;
7637
7638 if (OP)
7639 {
7641
7642 if (p)
7643 {
7645 }
7646
7647 delete OP;
7648 }
7649 }
7650
7653 }
7654 }
7655
7658 {
7659 return 0.0;
7660 }
7661
7662
7664 {
7665 return 250;
7666 }
7667
7669 {
7670 return 0;
7671 }
7672
7675 {
7677 return true;
7678
7679 return false;
7680 }
7681
7684 {
7687
7689 {
7691 }
7692 else
7693 {
7694
7696 }
7697
7699 }
7700
7707 {
7708 return -1;
7709 }
7710
7711
7712
7713
7715 {
7717 {
7718 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7719 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7720
7721 if (r_index >= 0)
7722 {
7723 InventoryLocation r_il = new InventoryLocation;
7724 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7725
7726 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7729 {
7730 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7731 }
7733 {
7734 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7735 }
7736
7737 }
7738
7739 player.GetHumanInventory().ClearUserReservedLocation(this);
7740 }
7741
7744 }
7745
7746
7747
7748
7750 {
7751 return ItemBase.m_DebugActionsMask;
7752 }
7753
7755 {
7756 return ItemBase.m_DebugActionsMask & mask;
7757 }
7758
7760 {
7761 ItemBase.m_DebugActionsMask = mask;
7762 }
7763
7765 {
7766 ItemBase.m_DebugActionsMask |= mask;
7767 }
7768
7770 {
7771 ItemBase.m_DebugActionsMask &= ~mask;
7772 }
7773
7775 {
7777 {
7779 }
7780 else
7781 {
7783 }
7784 }
7785
7786
7788 {
7789 if (GetEconomyProfile())
7790 {
7791 float q_max = GetEconomyProfile().GetQuantityMax();
7792 if (q_max > 0)
7793 {
7794 float q_min = GetEconomyProfile().GetQuantityMin();
7795 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7796
7798 {
7799 ComponentEnergyManager comp = GetCompEM();
7801 {
7803 }
7804 }
7806 {
7808
7809 }
7810
7811 }
7812 }
7813 }
7814
7817 {
7818 EntityAI parent = GetHierarchyParent();
7819
7820 if (parent)
7821 {
7822 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7823 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7824 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7825 }
7826 }
7827
7830 {
7831 EntityAI parent = GetHierarchyParent();
7832
7833 if (parent)
7834 {
7835 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7836 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7837 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7838 }
7839 }
7840
7842 {
7843
7844
7845
7846
7848
7850 {
7851 if (ScriptInputUserData.CanStoreInputUserData())
7852 {
7853 ScriptInputUserData ctx = new ScriptInputUserData;
7859 ctx.
Write(use_stack_max);
7862
7864 {
7865 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7866 }
7867 }
7868 }
7869 else if (!
g_Game.IsMultiplayer())
7870 {
7872 }
7873 }
7874
7876 {
7878 }
7879
7881 {
7883 }
7884
7886 {
7888 }
7889
7891 {
7892
7893 return false;
7894 }
7895
7897 {
7898 return false;
7899 }
7900
7904 {
7905 return false;
7906 }
7907
7909 {
7910 return "";
7911 }
7912
7914
7916 {
7917 return false;
7918 }
7919
7921 {
7922 return true;
7923 }
7924
7925
7926
7928 {
7929 return true;
7930 }
7931
7933 {
7934 return true;
7935 }
7936
7938 {
7939 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7941 }
7942
7944 {
7946 }
7947
7949 {
7951 if (!is_being_placed)
7953 SetSynchDirty();
7954 }
7955
7956
7958
7960 {
7962 }
7963
7965 {
7967 }
7968
7970 {
7971 return 1;
7972 }
7973
7975 {
7976 return false;
7977 }
7978
7980 {
7982 SetSynchDirty();
7983 }
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8020 {
8021 super.OnMovedInsideCargo(container);
8022
8023 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8024 }
8025
8026 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8027 {
8028 super.EEItemLocationChanged(oldLoc, newLoc);
8029
8030 PlayerBase newPlayer = null;
8031 PlayerBase oldPlayer = null;
8032
8033 if (newLoc.GetParent())
8034 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8035
8036 if (oldLoc.GetParent())
8037 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8038
8040 {
8041 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8042
8043 if (rIndex >= 0)
8044 {
8045 InventoryLocation rIl = new InventoryLocation;
8046 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8047
8048 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8051 {
8052 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8053 }
8055 {
8057 }
8058
8059 }
8060 }
8061
8063 {
8064 if (newPlayer)
8065 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8066
8067 if (newPlayer == oldPlayer)
8068 {
8069 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8070 {
8072 {
8073 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8074 {
8075 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8076 }
8077 }
8078 else
8079 {
8080 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8081 }
8082 }
8083
8084 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8085 {
8086 int type = oldLoc.GetType();
8088 {
8089 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8090 }
8092 {
8093 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8094 }
8095 }
8096 if (!m_OldLocation)
8097 {
8098 m_OldLocation = new InventoryLocation;
8099 }
8100 m_OldLocation.Copy(oldLoc);
8101 }
8102 else
8103 {
8104 if (m_OldLocation)
8105 {
8106 m_OldLocation.Reset();
8107 }
8108 }
8109
8110 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8111 }
8112 else
8113 {
8114 if (newPlayer)
8115 {
8116 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8117 if (resIndex >= 0)
8118 {
8119 InventoryLocation il = new InventoryLocation;
8120 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8122 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8125 {
8126 il.
GetParent().GetOnReleaseLock().Invoke(it);
8127 }
8129 {
8131 }
8132
8133 }
8134 }
8136 {
8137
8139 }
8140
8141 if (m_OldLocation)
8142 {
8143 m_OldLocation.Reset();
8144 }
8145 }
8146
8148 {
8149 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8150 }
8151
8153 {
8154 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8155 }
8156 }
8157
8158 override void EOnContact(IEntity other, Contact extra)
8159 {
8161 {
8162 int liquidType = -1;
8164 if (impactSpeed > 0.0)
8165 {
8167 #ifndef SERVER
8169 #else
8171 SetSynchDirty();
8172 #endif
8174 }
8175 }
8176
8177 #ifdef SERVER
8178 if (GetCompEM() && GetCompEM().IsPlugged())
8179 {
8180 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8181 GetCompEM().UnplugThis();
8182 }
8183 #endif
8184 }
8185
8187
8189 {
8191 }
8192
8194 {
8195
8196 }
8197
8199 {
8200 super.OnItemLocationChanged(old_owner, new_owner);
8201
8202 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8203 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8204
8205 if (!relatedPlayer && playerNew)
8206 relatedPlayer = playerNew;
8207
8208 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8209 {
8211 if (actionMgr)
8212 {
8213 ActionBase currentAction = actionMgr.GetRunningAction();
8214 if (currentAction)
8216 }
8217 }
8218
8219 Man ownerPlayerOld = null;
8220 Man ownerPlayerNew = null;
8221
8222 if (old_owner)
8223 {
8224 if (old_owner.
IsMan())
8225 {
8226 ownerPlayerOld = Man.Cast(old_owner);
8227 }
8228 else
8229 {
8230 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8231 }
8232 }
8233 else
8234 {
8236 {
8238
8239 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8240 {
8241 GetCompEM().UnplugThis();
8242 }
8243 }
8244 }
8245
8246 if (new_owner)
8247 {
8248 if (new_owner.
IsMan())
8249 {
8250 ownerPlayerNew = Man.Cast(new_owner);
8251 }
8252 else
8253 {
8254 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8255 }
8256 }
8257
8258 if (ownerPlayerOld != ownerPlayerNew)
8259 {
8260 if (ownerPlayerOld)
8261 {
8262 array<EntityAI> subItemsExit = new array<EntityAI>;
8264 for (int i = 0; i < subItemsExit.Count(); i++)
8265 {
8268 }
8269 }
8270
8271 if (ownerPlayerNew)
8272 {
8273 array<EntityAI> subItemsEnter = new array<EntityAI>;
8275 for (int j = 0; j < subItemsEnter.Count(); j++)
8276 {
8279 }
8280 }
8281 }
8282 else if (ownerPlayerNew != null)
8283 {
8284 PlayerBase nplayer;
8285 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8286 {
8287 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8289 for (int k = 0; k < subItemsUpdate.Count(); k++)
8290 {
8292 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8293 }
8294 }
8295 }
8296
8297 if (old_owner)
8298 old_owner.OnChildItemRemoved(this);
8299 if (new_owner)
8300 new_owner.OnChildItemReceived(this);
8301 }
8302
8303
8305 {
8306 super.EEDelete(parent);
8307 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8308 if (player)
8309 {
8311
8312 if (player.IsAlive())
8313 {
8314 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8315 if (r_index >= 0)
8316 {
8317 InventoryLocation r_il = new InventoryLocation;
8318 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8319
8320 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8323 {
8324 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8325 }
8327 {
8328 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8329 }
8330
8331 }
8332
8333 player.RemoveQuickBarEntityShortcut(this);
8334 }
8335 }
8336 }
8337
8339 {
8340 super.EEKilled(killer);
8341
8344 {
8345 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8346 {
8347 if (IsMagazine())
8348 {
8349 if (Magazine.Cast(this).GetAmmoCount() > 0)
8350 {
8352 }
8353 }
8354 else
8355 {
8357 }
8358 }
8359 }
8360 }
8361
8363 {
8364 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8365
8366 super.OnWasAttached(parent, slot_id);
8367
8370
8373 }
8374
8376 {
8377 super.OnWasDetached(parent, slot_id);
8378
8381
8384 }
8385
8387 {
8388 int idx;
8391
8392 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8393 if (inventory_slots.Count() < 1)
8394 {
8395 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8396 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8397 }
8398 else
8399 {
8400 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8401 }
8402
8403 idx = inventory_slots.Find(slot);
8404 if (idx < 0)
8405 return "";
8406
8407 return attach_types.Get(idx);
8408 }
8409
8411 {
8412 int idx = -1;
8413 string slot;
8414
8417
8418 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8419 if (inventory_slots.Count() < 1)
8420 {
8421 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8422 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8423 }
8424 else
8425 {
8426 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8427 if (detach_types.Count() < 1)
8428 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8429 }
8430
8431 for (int i = 0; i < inventory_slots.Count(); i++)
8432 {
8433 slot = inventory_slots.Get(i);
8434 }
8435
8436 if (slot != "")
8437 {
8438 if (detach_types.Count() == 1)
8439 idx = 0;
8440 else
8441 idx = inventory_slots.Find(slot);
8442 }
8443 if (idx < 0)
8444 return "";
8445
8446 return detach_types.Get(idx);
8447 }
8448
8450 {
8451
8453
8454
8455 float min_time = 1;
8456 float max_time = 3;
8457 float delay = Math.RandomFloat(min_time, max_time);
8458
8459 explode_timer.Run(delay, this, "DoAmmoExplosion");
8460 }
8461
8463 {
8464 Magazine magazine = Magazine.Cast(this);
8465 int pop_sounds_count = 6;
8466 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8467
8468
8469 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8470 string sound_name = pop_sounds[ sound_idx ];
8471 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8472
8473
8474 magazine.ServerAddAmmoCount(-1);
8475
8476
8477 float min_temp_to_explode = 100;
8478
8479 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8480 {
8482 }
8483 }
8484
8485
8486 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8487 {
8488 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8489
8490 const int CHANCE_DAMAGE_CARGO = 4;
8491 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8492 const int CHANCE_DAMAGE_NOTHING = 2;
8493
8495 {
8496 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8497 int chances;
8498 int rnd;
8499
8500 if (GetInventory().GetCargo())
8501 {
8502 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8503 rnd = Math.RandomInt(0,chances);
8504
8505 if (rnd < CHANCE_DAMAGE_CARGO)
8506 {
8508 }
8509 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8510 {
8512 }
8513 }
8514 else
8515 {
8516 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8517 rnd = Math.RandomInt(0,chances);
8518
8519 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8520 {
8522 }
8523 }
8524 }
8525 }
8526
8528 {
8529 CargoBase cargo = GetInventory().GetCargo();
8530 if (cargo)
8531 {
8533 if (item_count > 0)
8534 {
8535 int random_pick = Math.RandomInt(0, item_count);
8537 if (!item.IsExplosive())
8538 {
8539 item.AddHealth("","",damage);
8540 return true;
8541 }
8542 }
8543 }
8544 return false;
8545 }
8546
8548 {
8549 GameInventory inventory = GetInventory();
8551 if (attachment_count > 0)
8552 {
8553 int random_pick = Math.RandomInt(0, attachment_count);
8555 if (!attachment.IsExplosive())
8556 {
8557 attachment.AddHealth("","",damage);
8558 return true;
8559 }
8560 }
8561 return false;
8562 }
8563
8565 {
8567 }
8568
8570 {
8572 return GetInventory().CanRemoveEntity();
8573
8574 return false;
8575 }
8576
8578 {
8579
8581 return false;
8582
8583
8585 return false;
8586
8587
8588
8590 if (delta == 0)
8591 return false;
8592
8593
8594 return true;
8595 }
8596
8598 {
8600 {
8601 if (ScriptInputUserData.CanStoreInputUserData())
8602 {
8603 ScriptInputUserData ctx = new ScriptInputUserData;
8608 ctx.
Write(destination_entity);
8612 }
8613 }
8614 else if (!
g_Game.IsMultiplayer())
8615 {
8617 }
8618 }
8619
8621 {
8622 float split_quantity_new;
8626 InventoryLocation loc = new InventoryLocation;
8627
8628 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8629 {
8631 split_quantity_new = stack_max;
8632 else
8634
8636 {
8637 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8638 if (new_item)
8639 {
8640 new_item.SetResultOfSplit(true);
8641 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8643 new_item.
SetQuantity(split_quantity_new,
false,
true);
8644 }
8645 }
8646 }
8647 else if (destination_entity && slot_id == -1)
8648 {
8649 if (quantity > stack_max)
8650 split_quantity_new = stack_max;
8651 else
8652 split_quantity_new = quantity;
8653
8655 {
8656 GameInventory destinationInventory = destination_entity.GetInventory();
8658 {
8661 }
8662
8663 if (new_item)
8664 {
8665 new_item.SetResultOfSplit(true);
8666 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8668 new_item.
SetQuantity(split_quantity_new,
false,
true);
8669 }
8670 }
8671 }
8672 else
8673 {
8674 if (stack_max != 0)
8675 {
8677 {
8679 }
8680
8681 if (split_quantity_new == 0)
8682 {
8683 if (!
g_Game.IsMultiplayer())
8684 player.PhysicalPredictiveDropItem(this);
8685 else
8686 player.ServerDropEntity(this);
8687 return;
8688 }
8689
8691 {
8693
8694 if (new_item)
8695 {
8696 new_item.SetResultOfSplit(true);
8697 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8700 new_item.PlaceOnSurface();
8701 }
8702 }
8703 }
8704 }
8705 }
8706
8708 {
8709 float split_quantity_new;
8713 InventoryLocation loc = new InventoryLocation;
8714
8715 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8716 {
8718 split_quantity_new = stack_max;
8719 else
8721
8723 {
8724 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8725 if (new_item)
8726 {
8727 new_item.SetResultOfSplit(true);
8728 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8730 new_item.
SetQuantity(split_quantity_new,
false,
true);
8731 }
8732 }
8733 }
8734 else if (destination_entity && slot_id == -1)
8735 {
8736 if (quantity > stack_max)
8737 split_quantity_new = stack_max;
8738 else
8739 split_quantity_new = quantity;
8740
8742 {
8743 GameInventory destinationInventory = destination_entity.GetInventory();
8745 {
8748 }
8749
8750 if (new_item)
8751 {
8752 new_item.SetResultOfSplit(true);
8753 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8755 new_item.
SetQuantity(split_quantity_new,
false,
true);
8756 }
8757 }
8758 }
8759 else
8760 {
8761 if (stack_max != 0)
8762 {
8764 {
8766 }
8767
8769 {
8771
8772 if (new_item)
8773 {
8774 new_item.SetResultOfSplit(true);
8775 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8778 new_item.PlaceOnSurface();
8779 }
8780 }
8781 }
8782 }
8783 }
8784
8786 {
8788 {
8789 if (ScriptInputUserData.CanStoreInputUserData())
8790 {
8791 ScriptInputUserData ctx = new ScriptInputUserData;
8796 dst.WriteToContext(ctx);
8798 }
8799 }
8800 else if (!
g_Game.IsMultiplayer())
8801 {
8803 }
8804 }
8805
8807 {
8809 {
8810 if (ScriptInputUserData.CanStoreInputUserData())
8811 {
8812 ScriptInputUserData ctx = new ScriptInputUserData;
8817 ctx.
Write(destination_entity);
8823 }
8824 }
8825 else if (!
g_Game.IsMultiplayer())
8826 {
8828 }
8829 }
8830
8832 {
8834 }
8835
8837 {
8839 float split_quantity_new;
8841 if (dst.IsValid())
8842 {
8843 int slot_id = dst.GetSlot();
8845
8846 if (quantity > stack_max)
8847 split_quantity_new = stack_max;
8848 else
8849 split_quantity_new = quantity;
8850
8852 {
8854
8855 if (new_item)
8856 {
8857 new_item.SetResultOfSplit(true);
8858 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8860 new_item.
SetQuantity(split_quantity_new,
false,
true);
8861 }
8862
8863 return new_item;
8864 }
8865 }
8866
8867 return null;
8868 }
8869
8871 {
8873 float split_quantity_new;
8875 if (destination_entity)
8876 {
8878 if (quantity > stackable)
8879 split_quantity_new = stackable;
8880 else
8881 split_quantity_new = quantity;
8882
8884 {
8885 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8886 if (new_item)
8887 {
8888 new_item.SetResultOfSplit(true);
8889 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8891 new_item.
SetQuantity(split_quantity_new,
false,
true);
8892 }
8893 }
8894 }
8895 }
8896
8898 {
8900 {
8901 if (ScriptInputUserData.CanStoreInputUserData())
8902 {
8903 ScriptInputUserData ctx = new ScriptInputUserData;
8908 ItemBase destination_entity =
this;
8909 ctx.
Write(destination_entity);
8913 }
8914 }
8915 else if (!
g_Game.IsMultiplayer())
8916 {
8918 }
8919 }
8920
8922 {
8924 float split_quantity_new;
8926 if (player)
8927 {
8929 if (quantity > stackable)
8930 split_quantity_new = stackable;
8931 else
8932 split_quantity_new = quantity;
8933
8935 {
8936 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8937 new_item =
ItemBase.Cast(in_hands);
8938 if (new_item)
8939 {
8940 new_item.SetResultOfSplit(true);
8941 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8943 new_item.SetQuantity(split_quantity_new, false, true);
8944 }
8945 }
8946 }
8947 }
8948
8950 {
8952 float split_quantity_new = Math.Floor(quantity * 0.5);
8953
8955 return;
8956
8958
8959 if (new_item)
8960 {
8961 if (new_item.GetQuantityMax() < split_quantity_new)
8962 {
8963 split_quantity_new = new_item.GetQuantityMax();
8964 }
8965
8966 new_item.SetResultOfSplit(true);
8967 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8968
8970 {
8973 }
8974 else
8975 {
8977 new_item.
SetQuantity(split_quantity_new,
false,
true);
8978 }
8979 }
8980 }
8981
8983 {
8985 float split_quantity_new = Math.Floor(quantity / 2);
8986
8988 return;
8989
8990 InventoryLocation invloc = new InventoryLocation;
8992
8994 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8995
8996 if (new_item)
8997 {
8998 if (new_item.GetQuantityMax() < split_quantity_new)
8999 {
9000 split_quantity_new = new_item.GetQuantityMax();
9001 }
9003 {
9006 }
9007 else if (split_quantity_new > 1)
9008 {
9010 new_item.
SetQuantity(split_quantity_new,
false,
true);
9011 }
9012 }
9013 }
9014
9017 {
9018 SetWeightDirty();
9020
9021 if (parent)
9022 parent.OnAttachmentQuantityChangedEx(this, delta);
9023
9025 {
9027 {
9029 }
9031 {
9032 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9034 }
9035 }
9036 }
9037
9040 {
9041
9042 }
9043
9046 {
9048 }
9049
9051 {
9052 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9053
9055 {
9056 if (newLevel == GameConstants.STATE_RUINED)
9057 {
9059 EntityAI parent = GetHierarchyParent();
9060 if (parent && parent.IsFireplace())
9061 {
9062 CargoBase cargo = GetInventory().GetCargo();
9063 if (cargo)
9064 {
9066 {
9068 }
9069 }
9070 }
9071 }
9072
9074 {
9075
9077 return;
9078 }
9079
9080 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9081 {
9083 }
9084 }
9085 }
9086
9087
9089 {
9090 super.OnRightClick();
9091
9093 {
9095 {
9096 if (ScriptInputUserData.CanStoreInputUserData())
9097 {
9098 EntityAI root = GetHierarchyRoot();
9099 Man playerOwner = GetHierarchyRootPlayer();
9100 InventoryLocation dst = new InventoryLocation;
9101
9102
9103 if (!playerOwner && root && root == this)
9104 {
9106 }
9107 else
9108 {
9109
9110 GetInventory().GetCurrentInventoryLocation(dst);
9112 {
9113 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9115 {
9117 }
9118 else
9119 {
9121
9122
9123 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9124 {
9126 }
9127 else
9128 {
9129 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9130 }
9131 }
9132 }
9133 }
9134
9135 ScriptInputUserData ctx = new ScriptInputUserData;
9143 }
9144 }
9145 else if (!
g_Game.IsMultiplayer())
9146 {
9148 }
9149 }
9150 }
9151
9153 {
9154 if (root)
9155 {
9156 vector m4[4];
9157 root.GetTransform(m4);
9158 dst.SetGround(this, m4);
9159 }
9160 else
9161 {
9162 GetInventory().GetCurrentInventoryLocation(dst);
9163 }
9164 }
9165
9166 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9167 {
9168
9169 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9170 return false;
9171
9172 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9173 return false;
9174
9175
9177 return false;
9178
9179
9180 Magazine mag = Magazine.Cast(this);
9181 if (mag)
9182 {
9183 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9184 return false;
9185
9186 if (stack_max_limit)
9187 {
9188 Magazine other_mag = Magazine.Cast(other_item);
9189 if (other_item)
9190 {
9191 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9192 return false;
9193 }
9194
9195 }
9196 }
9197 else
9198 {
9199
9201 return false;
9202
9204 return false;
9205 }
9206
9207 PlayerBase player = null;
9208 if (CastTo(player, GetHierarchyRootPlayer()))
9209 {
9210 if (player.GetInventory().HasAttachment(this))
9211 return false;
9212
9213 if (player.IsItemsToDelete())
9214 return false;
9215 }
9216
9217 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9218 return false;
9219
9220 int slotID;
9222 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9223 return false;
9224
9225 return true;
9226 }
9227
9229 {
9231 }
9232
9234 {
9235 return m_IsResultOfSplit;
9236 }
9237
9239 {
9240 m_IsResultOfSplit = value;
9241 }
9242
9244 {
9246 }
9247
9249 {
9250 float other_item_quantity = other_item.GetQuantity();
9251 float this_free_space;
9252
9254
9256
9257 if (other_item_quantity > this_free_space)
9258 {
9259 return this_free_space;
9260 }
9261 else
9262 {
9263 return other_item_quantity;
9264 }
9265 }
9266
9268 {
9270 }
9271
9273 {
9275 return;
9276
9277 if (!IsMagazine() && other_item)
9278 {
9280 if (quantity_used != 0)
9281 {
9282 float hp1 = GetHealth01("","");
9283 float hp2 = other_item.GetHealth01("","");
9284 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9285 hpResult = hpResult / (
GetQuantity() + quantity_used);
9286
9287 hpResult *= GetMaxHealth();
9288 Math.Round(hpResult);
9289 SetHealth("", "Health", hpResult);
9290
9292 other_item.AddQuantity(-quantity_used);
9293 }
9294 }
9296 }
9297
9299 {
9300 #ifdef SERVER
9301 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9302 GetHierarchyParent().IncreaseLifetimeUp();
9303 #endif
9304 };
9305
9307 {
9308 PlayerBase p = PlayerBase.Cast(player);
9309
9310 array<int> recipesIds = p.m_Recipes;
9311 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9312 if (moduleRecipesManager)
9313 {
9314 EntityAI itemInHands = player.GetEntityInHands();
9315 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9316 }
9317
9318 for (int i = 0;i < recipesIds.Count(); i++)
9319 {
9320 int key = recipesIds.Get(i);
9321 string recipeName = moduleRecipesManager.GetRecipeName(key);
9323 }
9324 }
9325
9326
9327 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9328 {
9329 super.GetDebugActions(outputList);
9330
9331
9337
9338
9343
9348
9349
9353
9354
9356 {
9360 }
9361
9364
9365
9369
9371
9372 InventoryLocation loc = new InventoryLocation();
9373 GetInventory().GetCurrentInventoryLocation(loc);
9375 {
9376 if (Gizmo_IsSupported())
9379 }
9380
9382 }
9383
9384
9385
9386
9388 {
9389 super.OnAction(action_id, player, ctx);
9390
9392 {
9393 switch (action_id)
9394 {
9398 return true;
9402 return true;
9403 }
9404 }
9405
9407 {
9408 switch (action_id)
9409 {
9411 Delete();
9412 return true;
9413 }
9414 }
9415
9416 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9417 {
9418 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9419 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9420 PlayerBase p = PlayerBase.Cast(player);
9421 if (
EActions.RECIPES_RANGE_START < 1000)
9422 {
9423 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9424 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9425 }
9426 }
9427 #ifndef SERVER
9428 else if (action_id ==
EActions.WATCH_PLAYER)
9429 {
9430 PluginDeveloper.SetDeveloperItemClientEx(player);
9431 }
9432 #endif
9434 {
9435 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9436 {
9437 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9438 OnDebugButtonPressServer(id + 1);
9439 }
9440
9441 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9442 {
9443 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9445 }
9446
9447 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9448 {
9449 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9451 }
9452
9453 else if (action_id ==
EActions.ADD_QUANTITY)
9454 {
9455 if (IsMagazine())
9456 {
9457 Magazine mag = Magazine.Cast(this);
9458 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9459 }
9460 else
9461 {
9463 }
9464
9465 if (m_EM)
9466 {
9467 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9468 }
9469
9470 }
9471
9472 else if (action_id ==
EActions.REMOVE_QUANTITY)
9473 {
9474 if (IsMagazine())
9475 {
9476 Magazine mag2 = Magazine.Cast(this);
9477 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9478 }
9479 else
9480 {
9482 }
9483 if (m_EM)
9484 {
9485 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9486 }
9487
9488 }
9489
9490 else if (action_id ==
EActions.SET_QUANTITY_0)
9491 {
9493
9494 if (m_EM)
9495 {
9496 m_EM.SetEnergy(0);
9497 }
9498 }
9499
9500 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9501 {
9503
9504 if (m_EM)
9505 {
9506 m_EM.SetEnergy(m_EM.GetEnergyMax());
9507 }
9508 }
9509
9510 else if (action_id ==
EActions.ADD_HEALTH)
9511 {
9512 AddHealth("","",GetMaxHealth("","Health")/5);
9513 }
9514 else if (action_id ==
EActions.REMOVE_HEALTH)
9515 {
9516 AddHealth("","",-GetMaxHealth("","Health")/5);
9517 }
9518 else if (action_id ==
EActions.DESTROY_HEALTH)
9519 {
9520 SetHealth01("","",0);
9521 }
9522 else if (action_id ==
EActions.WATCH_ITEM)
9523 {
9525 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9526 #ifdef DEVELOPER
9527 SetDebugDeveloper_item(this);
9528 #endif
9529 }
9530
9531 else if (action_id ==
EActions.ADD_TEMPERATURE)
9532 {
9533 AddTemperature(20);
9534
9535 }
9536
9537 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9538 {
9539 AddTemperature(-20);
9540
9541 }
9542
9543 else if (action_id ==
EActions.FLIP_FROZEN)
9544 {
9545 SetFrozen(!GetIsFrozen());
9546
9547 }
9548
9549 else if (action_id ==
EActions.ADD_WETNESS)
9550 {
9552
9553 }
9554
9555 else if (action_id ==
EActions.REMOVE_WETNESS)
9556 {
9558
9559 }
9560
9561 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9562 {
9565
9566
9567 }
9568
9569 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9570 {
9573 }
9574
9575 else if (action_id ==
EActions.MAKE_SPECIAL)
9576 {
9577 auto debugParams = DebugSpawnParams.WithPlayer(player);
9578 OnDebugSpawnEx(debugParams);
9579 }
9580
9581 }
9582
9583
9584 return false;
9585 }
9586
9587
9588
9589
9593
9596
9597
9598
9600 {
9601 return false;
9602 }
9603
9604
9606 {
9607 return true;
9608 }
9609
9610
9612 {
9613 return true;
9614 }
9615
9616
9617
9619 {
9620 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9621 return g_Game.ConfigIsExisting(config_path);
9622 }
9623
9626 {
9627 return null;
9628 }
9629
9631 {
9632 return false;
9633 }
9634
9636 {
9637 return false;
9638 }
9639
9643
9644
9646 {
9647 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9648 return module_repairing.CanRepair(this, item_repair_kit);
9649 }
9650
9651
9652 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9653 {
9654 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9655 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9656 }
9657
9658
9660 {
9661
9662
9663
9664
9665
9666
9667
9668
9669 return 1;
9670 }
9671
9672
9673
9675 {
9677 }
9678
9679
9680
9682 {
9684 }
9685
9686
9695 {
9696 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9697
9698 if (player)
9699 {
9700 player.MessageStatus(text);
9701 }
9702 }
9703
9704
9713 {
9714 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9715
9716 if (player)
9717 {
9718 player.MessageAction(text);
9719 }
9720 }
9721
9722
9731 {
9732 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9733
9734 if (player)
9735 {
9736 player.MessageFriendly(text);
9737 }
9738 }
9739
9740
9749 {
9750 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9751
9752 if (player)
9753 {
9754 player.MessageImportant(text);
9755 }
9756 }
9757
9759 {
9760 return true;
9761 }
9762
9763
9764 override bool KindOf(
string tag)
9765 {
9766 bool found = false;
9767 string item_name = this.
GetType();
9769 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9770
9771 int array_size = item_tag_array.Count();
9772 for (int i = 0; i < array_size; i++)
9773 {
9774 if (item_tag_array.Get(i) == tag)
9775 {
9776 found = true;
9777 break;
9778 }
9779 }
9780 return found;
9781 }
9782
9783
9785 {
9786
9787 super.OnRPC(sender, rpc_type,ctx);
9788
9789
9790 switch (rpc_type)
9791 {
9792 #ifndef SERVER
9793 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9794 Param2<bool, string> p = new Param2<bool, string>(false, "");
9795
9797 return;
9798
9799 bool play = p.param1;
9800 string soundSet = p.param2;
9801
9802 if (play)
9803 {
9805 {
9807 {
9809 }
9810 }
9811 else
9812 {
9814 }
9815 }
9816 else
9817 {
9819 }
9820
9821 break;
9822 #endif
9823
9824 }
9825
9827 {
9829 }
9830 }
9831
9832
9833
9834
9836 {
9837 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9838 return plugin.GetID(
name);
9839 }
9840
9842 {
9843 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9844 return plugin.GetName(id);
9845 }
9846
9849 {
9850
9851
9852 int varFlags;
9853 if (!ctx.
Read(varFlags))
9854 return;
9855
9856 if (varFlags & ItemVariableFlags.FLOAT)
9857 {
9859 }
9860 }
9861
9863 {
9864
9865 super.SerializeNumericalVars(floats_out);
9866
9867
9868
9870 {
9872 }
9873
9875 {
9877 }
9878
9880 {
9882 }
9883
9885 {
9890 }
9891
9893 {
9895 }
9896 }
9897
9899 {
9900
9901 super.DeSerializeNumericalVars(floats);
9902
9903
9904 int index = 0;
9905 int mask = Math.Round(floats.Get(index));
9906
9907 index++;
9908
9910 {
9912 {
9914 }
9915 else
9916 {
9917 float quantity = floats.Get(index);
9919 }
9920 index++;
9921 }
9922
9924 {
9925 float wet = floats.Get(index);
9927 index++;
9928 }
9929
9931 {
9932 int liquidtype = Math.Round(floats.Get(index));
9934 index++;
9935 }
9936
9938 {
9940 index++;
9942 index++;
9944 index++;
9946 index++;
9947 }
9948
9950 {
9951 int cleanness = Math.Round(floats.Get(index));
9953 index++;
9954 }
9955 }
9956
9958 {
9959 super.WriteVarsToCTX(ctx);
9960
9961
9963 {
9965 }
9966
9968 {
9970 }
9971
9973 {
9975 }
9976
9978 {
9979 int r,g,b,a;
9985 }
9986
9988 {
9990 }
9991 }
9992
9994 {
9995 if (!super.ReadVarsFromCTX(ctx,version))
9996 return false;
9997
9998 int intValue;
9999 float value;
10000
10001 if (version < 140)
10002 {
10003 if (!ctx.
Read(intValue))
10004 return false;
10005
10006 m_VariablesMask = intValue;
10007 }
10008
10010 {
10011 if (!ctx.
Read(value))
10012 return false;
10013
10015 {
10017 }
10018 else
10019 {
10021 }
10022 }
10023
10024 if (version < 140)
10025 {
10027 {
10028 if (!ctx.
Read(value))
10029 return false;
10030 SetTemperatureDirect(value);
10031 }
10032 }
10033
10035 {
10036 if (!ctx.
Read(value))
10037 return false;
10039 }
10040
10042 {
10043 if (!ctx.
Read(intValue))
10044 return false;
10046 }
10047
10049 {
10050 int r,g,b,a;
10052 return false;
10054 return false;
10056 return false;
10058 return false;
10059
10061 }
10062
10064 {
10065 if (!ctx.
Read(intValue))
10066 return false;
10068 }
10069
10070 if (version >= 138 && version < 140)
10071 {
10073 {
10074 if (!ctx.
Read(intValue))
10075 return false;
10076 SetFrozen(intValue);
10077 }
10078 }
10079
10080 return true;
10081 }
10082
10083
10085 {
10088 {
10090 }
10091
10092 if (!super.OnStoreLoad(ctx, version))
10093 {
10095 return false;
10096 }
10097
10098 if (version >= 114)
10099 {
10100 bool hasQuickBarIndexSaved;
10101
10102 if (!ctx.
Read(hasQuickBarIndexSaved))
10103 {
10105 return false;
10106 }
10107
10108 if (hasQuickBarIndexSaved)
10109 {
10110 int itmQBIndex;
10111
10112
10113 if (!ctx.
Read(itmQBIndex))
10114 {
10116 return false;
10117 }
10118
10119 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10120 if (itmQBIndex != -1 && parentPlayer)
10121 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10122 }
10123 }
10124 else
10125 {
10126
10127 PlayerBase player;
10128 int itemQBIndex;
10129 if (version ==
int.
MAX)
10130 {
10131 if (!ctx.
Read(itemQBIndex))
10132 {
10134 return false;
10135 }
10136 }
10137 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10138 {
10139
10140 if (!ctx.
Read(itemQBIndex))
10141 {
10143 return false;
10144 }
10145 if (itemQBIndex != -1 && player)
10146 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10147 }
10148 }
10149
10150 if (version < 140)
10151 {
10152
10153 if (!LoadVariables(ctx, version))
10154 {
10156 return false;
10157 }
10158 }
10159
10160
10162 {
10164 return false;
10165 }
10166 if (version >= 132)
10167 {
10169 if (raib)
10170 {
10172 {
10174 return false;
10175 }
10176 }
10177 }
10178
10180 return true;
10181 }
10182
10183
10184
10186 {
10187 super.OnStoreSave(ctx);
10188
10189 PlayerBase player;
10190 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10191 {
10193
10194 int itemQBIndex = -1;
10195 itemQBIndex = player.FindQuickBarEntityIndex(this);
10196 ctx.
Write(itemQBIndex);
10197 }
10198 else
10199 {
10201 }
10202
10204
10206 if (raib)
10207 {
10209 }
10210 }
10211
10212
10214 {
10215 super.AfterStoreLoad();
10216
10218 {
10220 }
10221
10223 {
10226 }
10227 }
10228
10230 {
10231 super.EEOnAfterLoad();
10232
10234 {
10236 }
10237
10240 }
10241
10243 {
10244 return false;
10245 }
10246
10247
10248
10250 {
10252 {
10253 #ifdef PLATFORM_CONSOLE
10254
10256 {
10258 if (menu)
10259 {
10261 }
10262 }
10263 #endif
10264 }
10265
10267 {
10270 }
10271
10273 {
10274 SetWeightDirty();
10276 }
10278 {
10281 }
10282
10284 {
10287
10290 }
10292 {
10296 }
10297
10298 super.OnVariablesSynchronized();
10299 }
10300
10301
10302
10304 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10305 {
10306 if (!IsServerCheck(allow_client))
10307 return false;
10308
10310 return false;
10311
10314
10315 if (value <= (min + 0.001))
10316 value = min;
10317
10318 if (value == min)
10319 {
10320 if (destroy_config)
10321 {
10322 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10323 if (dstr)
10324 {
10326 this.Delete();
10327 return true;
10328 }
10329 }
10330 else if (destroy_forced)
10331 {
10333 this.Delete();
10334 return true;
10335 }
10336
10338 }
10339
10342
10344 {
10345 EntityAI parent = GetHierarchyRoot();
10346 InventoryLocation iLoc = new InventoryLocation();
10347 GetInventory().GetCurrentInventoryLocation(iLoc);
10349 {
10350 int iLocSlot = iLoc.
GetSlot();
10352 {
10354 }
10356 {
10358 }
10359 }
10360 }
10361
10363 {
10365
10366 if (delta)
10368 }
10369
10371
10372 return false;
10373 }
10374
10375
10377 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10378 {
10380 }
10381
10383 {
10386 }
10387
10389 {
10392 }
10393
10395 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10396 {
10397 float value_clamped = Math.Clamp(value, 0, 1);
10399 SetQuantity(result, destroy_config, destroy_forced);
10400 }
10401
10402
10405 {
10407 }
10408
10410 {
10412 }
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10424 {
10425 int slot = -1;
10426 GameInventory inventory = GetInventory();
10427 if (inventory)
10428 {
10429 InventoryLocation il = new InventoryLocation;
10432 }
10433
10435 }
10436
10438 {
10439 float quantity_max = 0;
10440
10442 {
10443 if (attSlotID != -1)
10444 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10445
10446 if (quantity_max <= 0)
10448 }
10449
10450 if (quantity_max <= 0)
10452
10453 return quantity_max;
10454 }
10455
10457 {
10459 }
10460
10462 {
10464 }
10465
10466
10468 {
10470 }
10471
10473 {
10475 }
10476
10478 {
10480 }
10481
10482
10484 {
10485
10486 float weightEx = GetWeightEx();
10487 float special = GetInventoryAndCargoWeight();
10488 return weightEx - special;
10489 }
10490
10491
10493 {
10495 }
10496
10498 {
10500 {
10501 #ifdef DEVELOPER
10502 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10503 {
10504 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10506 }
10507 #endif
10508
10509 return GetQuantity() * GetConfigWeightModified();
10510 }
10511 else if (HasEnergyManager())
10512 {
10513 #ifdef DEVELOPER
10514 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10515 {
10516 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10517 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10518 }
10519 #endif
10520 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10521 }
10522 else
10523 {
10524 #ifdef DEVELOPER
10525 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10526 {
10527 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10528 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10529 }
10530 #endif
10531 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10532 }
10533 }
10534
10537 {
10538 int item_count = 0;
10540
10541 GameInventory inventory = GetInventory();
10542 CargoBase cargo = inventory.
GetCargo();
10543 if (cargo != NULL)
10544 {
10546 }
10547
10549 for (int i = 0; i < nAttachments; ++i)
10550 {
10552 if (item)
10553 item_count += item.GetNumberOfItems();
10554 }
10555 return item_count;
10556 }
10557
10560 {
10561 float weight = 0;
10562 float wetness = 1;
10563 if (include_wetness)
10566 {
10567 weight = wetness * m_ConfigWeight;
10568 }
10570 {
10571 weight = 1;
10572 }
10573 return weight;
10574 }
10575
10576
10577
10579 {
10580 GameInventory inventory = GetInventory();
10581 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10582 {
10583 array<EntityAI> items = new array<EntityAI>;
10585 for (int i = 0; i < items.Count(); ++i)
10586 {
10588 if (item)
10589 {
10590 g_Game.ObjectDelete(item);
10591 }
10592 }
10593 }
10594 }
10595
10596
10597
10598
10600 {
10601 float energy = 0;
10602 if (HasEnergyManager())
10603 {
10604 energy = GetCompEM().GetEnergy();
10605 }
10606 return energy;
10607 }
10608
10609
10611 {
10612 super.OnEnergyConsumed();
10613
10615 }
10616
10618 {
10619 super.OnEnergyAdded();
10620
10622 }
10623
10624
10626 {
10627 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10628 {
10630 {
10631 float energy_0to1 = GetCompEM().GetEnergy0To1();
10633 }
10634 }
10635 }
10636
10637
10639 {
10640 return ConfigGetFloat("heatIsolation");
10641 }
10642
10644 {
10646 }
10647
10649 {
10650 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10651 if (
g_Game.ConfigIsExisting(paramPath))
10652 return g_Game.ConfigGetFloat(paramPath);
10653
10654 return 0.0;
10655 }
10656
10658 {
10659 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10660 if (
g_Game.ConfigIsExisting(paramPath))
10661 return g_Game.ConfigGetFloat(paramPath);
10662
10663 return 0.0;
10664 }
10665
10666 override void SetWet(
float value,
bool allow_client =
false)
10667 {
10668 if (!IsServerCheck(allow_client))
10669 return;
10670
10673
10675
10676 m_VarWet = Math.Clamp(value, min, max);
10677
10679 {
10682 }
10683 }
10684
10685 override void AddWet(
float value)
10686 {
10688 }
10689
10691 {
10693 }
10694
10696 {
10698 }
10699
10701 {
10703 }
10704
10706 {
10708 }
10709
10711 {
10713 }
10714
10715 override void OnWetChanged(
float newVal,
float oldVal)
10716 {
10719 if (newLevel != oldLevel)
10720 {
10722 }
10723 }
10724
10726 {
10727 SetWeightDirty();
10728 }
10729
10731 {
10732 return GetWetLevelInternal(
m_VarWet);
10733 }
10734
10735
10736
10738 {
10740 }
10741
10743 {
10745 }
10746
10748 {
10750 }
10751
10753 {
10755 }
10756
10757
10758
10760 {
10761 if (ConfigIsExisting("itemModelLength"))
10762 {
10763 return ConfigGetFloat("itemModelLength");
10764 }
10765 return 0;
10766 }
10767
10769 {
10770 if (ConfigIsExisting("itemAttachOffset"))
10771 {
10772 return ConfigGetFloat("itemAttachOffset");
10773 }
10774 return 0;
10775 }
10776
10777 override void SetCleanness(
int value,
bool allow_client =
false)
10778 {
10779 if (!IsServerCheck(allow_client))
10780 return;
10781
10783
10785
10788 }
10789
10791 {
10793 }
10794
10796 {
10797 return true;
10798 }
10799
10800
10801
10802
10804 {
10806 }
10807
10809 {
10811 }
10812
10813
10814
10815
10816 override void SetColor(
int r,
int g,
int b,
int a)
10817 {
10823 }
10825 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10826 {
10831 }
10832
10834 {
10836 }
10837
10840 {
10841 int r,g,b,a;
10843 r = r/255;
10844 g = g/255;
10845 b = b/255;
10846 a = a/255;
10847 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10848 }
10849
10850
10851
10852 override void SetLiquidType(
int value,
bool allow_client =
false)
10853 {
10854 if (!IsServerCheck(allow_client))
10855 return;
10856
10861 }
10862
10864 {
10865 return ConfigGetInt("varLiquidTypeInit");
10866 }
10867
10869 {
10871 }
10872
10874 {
10876 SetFrozen(false);
10877 }
10878
10881 {
10882 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10883 }
10884
10885
10888 {
10889 PlayerBase nplayer;
10890 if (PlayerBase.CastTo(nplayer, player))
10891 {
10893 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10894 }
10895 }
10896
10897
10900 {
10901 PlayerBase nplayer;
10902 if (PlayerBase.CastTo(nplayer,player))
10903 {
10904 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10905 }
10906
10907 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10908
10909 if (HasEnergyManager())
10910 {
10911 GetCompEM().UpdatePlugState();
10912 }
10913 }
10914
10915
10917 {
10918 super.OnPlacementStarted(player);
10919
10921 }
10922
10923 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10924 {
10926 {
10927 m_AdminLog.OnPlacementComplete(player,
this);
10928 }
10929
10930 super.OnPlacementComplete(player, position, orientation);
10931 }
10932
10933
10934
10935
10936
10938 {
10940 {
10941 return true;
10942 }
10943 else
10944 {
10945 return false;
10946 }
10947 }
10948
10949
10951 {
10953 {
10955 }
10956 }
10957
10958
10960 {
10962 }
10963
10965 {
10967 }
10968
10969 override void InsertAgent(
int agent,
float count = 1)
10970 {
10971 if (count < 1)
10972 return;
10973
10975 }
10976
10979 {
10981 }
10982
10983
10985 {
10987 }
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11031 {
11033 return false;
11034 return true;
11035 }
11036
11038 {
11039
11041 }
11042
11043
11046 {
11047 super.CheckForRoofLimited(timeTresholdMS);
11048
11049 float time =
g_Game.GetTime();
11050 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11051 {
11052 m_PreviousRoofTestTime = time;
11053 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11054 }
11055 }
11056
11057
11059 {
11061 {
11062 return 0;
11063 }
11064
11065 if (GetInventory().GetAttachmentSlotsCount() != 0)
11066 {
11067 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11068 if (filter)
11069 return filter.GetProtectionLevel(type, false, system);
11070 else
11071 return 0;
11072 }
11073
11074 string subclassPath, entryName;
11075
11076 switch (type)
11077 {
11079 entryName = "biological";
11080 break;
11082 entryName = "chemical";
11083 break;
11084 default:
11085 entryName = "biological";
11086 break;
11087 }
11088
11089 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11090
11091 return g_Game.ConfigGetFloat(subclassPath + entryName);
11092 }
11093
11094
11095
11098 {
11099 if (!IsMagazine())
11101
11103 }
11104
11105
11106
11107
11108
11113 {
11114 return true;
11115 }
11116
11118 {
11120 }
11121
11122
11123
11124
11125
11127 {
11128 if (parent)
11129 {
11130 if (parent.IsInherited(DayZInfected))
11131 return true;
11132
11133 if (!parent.IsRuined())
11134 return true;
11135 }
11136
11137 return true;
11138 }
11139
11141 {
11142 if (!super.CanPutAsAttachment(parent))
11143 {
11144 return false;
11145 }
11146
11147 if (!IsRuined() && !parent.IsRuined())
11148 {
11149 return true;
11150 }
11151
11152 return false;
11153 }
11154
11156 {
11157
11158
11159
11160
11161 return super.CanReceiveItemIntoCargo(item);
11162 }
11163
11165 {
11166
11167
11168
11169
11170 GameInventory attachmentInv = attachment.GetInventory();
11172 {
11173 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11174 return false;
11175 }
11176
11177 InventoryLocation loc = new InventoryLocation();
11178 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11179 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11180 return false;
11181
11182 return super.CanReceiveAttachment(attachment, slotId);
11183 }
11184
11186 {
11187 if (!super.CanReleaseAttachment(attachment))
11188 return false;
11189
11190 return GetInventory().AreChildrenAccessible();
11191 }
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11214 {
11215 int id = muzzle_owner.GetMuzzleID();
11216 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11217
11218 if (WPOF_array)
11219 {
11220 for (int i = 0; i < WPOF_array.Count(); i++)
11221 {
11222 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11223
11224 if (WPOF)
11225 {
11226 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11227 }
11228 }
11229 }
11230 }
11231
11232
11234 {
11235 int id = muzzle_owner.GetMuzzleID();
11237
11238 if (WPOBE_array)
11239 {
11240 for (int i = 0; i < WPOBE_array.Count(); i++)
11241 {
11242 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11243
11244 if (WPOBE)
11245 {
11246 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11247 }
11248 }
11249 }
11250 }
11251
11252
11254 {
11255 int id = muzzle_owner.GetMuzzleID();
11256 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11257
11258 if (WPOOH_array)
11259 {
11260 for (int i = 0; i < WPOOH_array.Count(); i++)
11261 {
11262 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11263
11264 if (WPOOH)
11265 {
11266 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11267 }
11268 }
11269 }
11270 }
11271
11272
11274 {
11275 int id = muzzle_owner.GetMuzzleID();
11276 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11277
11278 if (WPOOH_array)
11279 {
11280 for (int i = 0; i < WPOOH_array.Count(); i++)
11281 {
11282 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11283
11284 if (WPOOH)
11285 {
11286 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11287 }
11288 }
11289 }
11290 }
11291
11292
11294 {
11295 int id = muzzle_owner.GetMuzzleID();
11296 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11297
11298 if (WPOOH_array)
11299 {
11300 for (int i = 0; i < WPOOH_array.Count(); i++)
11301 {
11302 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11303
11304 if (WPOOH)
11305 {
11306 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11307 }
11308 }
11309 }
11310 }
11311
11312
11313
11315 {
11317 {
11318 return true;
11319 }
11320
11321 return false;
11322 }
11323
11325 {
11327 {
11328 return true;
11329 }
11330
11331 return false;
11332 }
11333
11335 {
11337 {
11338 return true;
11339 }
11340
11341 return false;
11342 }
11343
11345 {
11346 return false;
11347 }
11348
11351 {
11352 return UATimeSpent.DEFAULT_DEPLOY;
11353 }
11354
11355
11356
11357
11359 {
11361 SetSynchDirty();
11362 }
11363
11365 {
11367 }
11368
11369
11371 {
11372 return false;
11373 }
11374
11377 {
11378 string att_type = "None";
11379
11380 if (ConfigIsExisting("soundAttType"))
11381 {
11382 att_type = ConfigGetString("soundAttType");
11383 }
11384
11386 }
11387
11389 {
11391 }
11392
11393
11394
11395
11396
11402
11404 {
11407
11409 }
11410
11411
11413 {
11415 return;
11416
11418
11421
11424
11425 SoundParameters params = new SoundParameters();
11429 }
11430
11431
11433 {
11435 {
11438
11439 SetSynchDirty();
11440
11443 }
11444 }
11445
11447 {
11449 }
11450
11451
11453 {
11455 return;
11456
11458 SetSynchDirty();
11459
11462 }
11463
11465 {
11468 }
11469
11471 {
11473 }
11474
11475 void OnApply(PlayerBase player);
11476
11478 {
11479 return 1.0;
11480 };
11481
11483 {
11485 }
11486
11488 {
11490 }
11491
11493
11495 {
11496 SetDynamicPhysicsLifeTime(0.01);
11498 }
11499
11501 {
11502 array<string> zone_names = new array<string>;
11503 GetDamageZones(zone_names);
11504 for (int i = 0; i < zone_names.Count(); i++)
11505 {
11506 SetHealthMax(zone_names.Get(i),"Health");
11507 }
11508 SetHealthMax("","Health");
11509 }
11510
11513 {
11514 float global_health = GetHealth01("","Health");
11515 array<string> zones = new array<string>;
11516 GetDamageZones(zones);
11517
11518 for (int i = 0; i < zones.Count(); i++)
11519 {
11520 SetHealth01(zones.Get(i),"Health",global_health);
11521 }
11522 }
11523
11526 {
11527 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11528 }
11529
11531 {
11532 if (!hasRootAsPlayer)
11533 {
11534 if (refParentIB)
11535 {
11536
11537 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11538 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11539
11540 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11541 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11542
11545 }
11546 else
11547 {
11548
11551 }
11552 }
11553 }
11554
11556 {
11558 {
11559 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11560 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11561 {
11562 float heatPermCoef = 1.0;
11564 while (ent)
11565 {
11566 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11567 ent = ent.GetHierarchyParent();
11568 }
11569
11570 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11571 }
11572 }
11573 }
11574
11576 {
11577
11578 EntityAI parent = GetHierarchyParent();
11579 if (!parent)
11580 {
11581 hasParent = false;
11582 hasRootAsPlayer = false;
11583 }
11584 else
11585 {
11586 hasParent = true;
11587 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11588 refParentIB =
ItemBase.Cast(parent);
11589 }
11590 }
11591
11592 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11593 {
11594
11595 }
11596
11598 {
11599
11600 return false;
11601 }
11602
11604 {
11605
11606
11607 return false;
11608 }
11609
11611 {
11612
11613 return false;
11614 }
11615
11618 {
11619 return !GetIsFrozen() &&
IsOpen();
11620 }
11621
11623 {
11624 bool hasParent = false, hasRootAsPlayer = false;
11626
11627 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11628 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11629
11630 if (wwtu || foodDecay)
11631 {
11635
11636 if (processWetness || processTemperature || processDecay)
11637 {
11639
11640 if (processWetness)
11641 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11642
11643 if (processTemperature)
11645
11646 if (processDecay)
11647 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11648 }
11649 }
11650 }
11651
11654 {
11656 }
11657
11659 {
11662
11663 return super.GetTemperatureFreezeThreshold();
11664 }
11665
11667 {
11670
11671 return super.GetTemperatureThawThreshold();
11672 }
11673
11675 {
11678
11679 return super.GetItemOverheatThreshold();
11680 }
11681
11683 {
11685 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11686
11687 return super.GetTemperatureFreezeTime();
11688 }
11689
11691 {
11693 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11694
11695 return super.GetTemperatureThawTime();
11696 }
11697
11702
11704 {
11705 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11706 }
11707
11709 {
11710 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11711 }
11712
11715 {
11717 }
11718
11720 {
11722 }
11723
11725 {
11727 }
11728
11731 {
11732 return null;
11733 }
11734
11737 {
11738 return false;
11739 }
11740
11742 {
11744 {
11747 if (!trg)
11748 {
11750 explosive = this;
11751 }
11752
11753 explosive.PairRemote(trg);
11755
11756 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11757 trg.SetPersistentPairID(persistentID);
11758 explosive.SetPersistentPairID(persistentID);
11759
11760 return true;
11761 }
11762 return false;
11763 }
11764
11767 {
11768 float ret = 1.0;
11771 ret *= GetHealth01();
11772
11773 return ret;
11774 }
11775
11776 #ifdef DEVELOPER
11777 override void SetDebugItem()
11778 {
11779 super.SetDebugItem();
11780 _itemBase = this;
11781 }
11782
11784 {
11785 string text = super.GetDebugText();
11786
11788 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11789
11790 return text;
11791 }
11792 #endif
11793
11795 {
11796 return true;
11797 }
11798
11800
11802
11804 {
11807 }
11808
11809
11817
11833
11834 [
Obsolete(
"Use ItemSoundHandler instead")]
11837 {
11838 if (!
g_Game.IsDedicatedServer())
11839 {
11840 if (ConfigIsExisting("attachSoundSet"))
11841 {
11842 string cfg_path = "";
11843 string soundset = "";
11844 string type_name =
GetType();
11845
11848 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11849 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11850
11851 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11852 {
11853 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11854 {
11855 if (cfg_slot_array[i] == slot_type)
11856 {
11857 soundset = cfg_soundset_array[i];
11858 break;
11859 }
11860 }
11861 }
11862
11863 if (soundset != "")
11864 {
11865 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11867 }
11868 }
11869 }
11870 }
11871
11873}
11874
11876{
11878 if (entity)
11879 {
11880 bool is_item = entity.IsInherited(
ItemBase);
11881 if (is_item && full_quantity)
11882 {
11885 }
11886 }
11887 else
11888 {
11890 return NULL;
11891 }
11892 return entity;
11893}
11894
11896{
11897 if (item)
11898 {
11899 if (health > 0)
11900 item.SetHealth("", "", health);
11901
11902 if (item.CanHaveTemperature())
11903 {
11905 if (item.CanFreeze())
11906 item.SetFrozen(false);
11907 }
11908
11909 if (item.HasEnergyManager())
11910 {
11911 if (quantity >= 0)
11912 {
11913 item.GetCompEM().SetEnergy0To1(quantity);
11914 }
11915 else
11916 {
11918 }
11919 }
11920 else if (item.IsMagazine())
11921 {
11922 Magazine mag = Magazine.Cast(item);
11923 if (quantity >= 0)
11924 {
11925 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11926 }
11927 else
11928 {
11930 }
11931
11932 }
11933 else
11934 {
11935 if (quantity >= 0)
11936 {
11937 item.SetQuantityNormalized(quantity, false);
11938 }
11939 else
11940 {
11942 }
11943
11944 }
11945 }
11946}
11947
11948#ifdef DEVELOPER
11950#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
bool SetAttachSoundEvent()
bool SetDetachSoundEvent()
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 IsPrepareToDelete()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
proto GizmoApi GetGizmoApi()
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
void StartItemSoundServer(int id, int slotId)
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)
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()
override int GetLiquidType()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnEnergyAdded()
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
EffectSound m_DeployLoopSoundEx
override void DeSerializeNumericalVars(array< float > floats)
void StopItemDynamicPhysics()
override void SetStoreLoad(bool value)
float GetOverheatingValue()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
override void EOnContact(IEntity other, Contact extra)
void SplitIntoStackMaxHands(PlayerBase player)
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override void SetStoreLoadedQuantity(float value)
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void OnLiquidTypeChanged(int oldType, int newType)
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void PlayDeployFinishSound()
bool AllowFoodConsumption()
bool m_IsOverheatingEffectActive
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
bool PairWithDevice(notnull ItemBase otherDevice)
static void RemoveDebugActionsMask(int mask)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void PerformDamageSystemReinit()
override void ClearInventory()
static int m_LastRegisteredWeaponID
ItemBase GetLightSourceItem()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
override float GetItemOverheatThreshold()
void StopDeployLoopSoundEx()
override void SerializeNumericalVars(array< float > floats_out)
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)
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 EntityAI GetAttachmentFromIndex(int index)
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
proto native int AttachmentCount()
Returns count of attachments attached to this item.
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
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 bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
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
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
void Obsolete(string msg="")
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
vector GetPosition()
Get the world position of the Effect.
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.