7169{
7171 {
7172 return true;
7173 }
7174};
7175
7177{
7178
7179};
7180
7181
7182
7184{
7188
7190
7193
7194
7195
7196
7197
7206
7212
7217
7222
7243 protected bool m_IsResultOfSplit
7244
7246
7251
7252
7253
7255
7259
7260
7261
7263
7266
7267
7268
7274
7275
7283
7286
7287
7289
7290
7292
7293
7298
7299
7304
7306
7307
7309
7310
7312 {
7317
7318 if (!
g_Game.IsDedicatedServer())
7319 {
7321 {
7323
7325 {
7327 }
7328 }
7329
7332 }
7333
7334 m_OldLocation = null;
7335
7337 {
7339 }
7340
7341 if (ConfigIsExisting("headSelectionsToHide"))
7342 {
7345 }
7346
7348 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7349 {
7351 }
7352
7354
7355 m_IsResultOfSplit = false;
7356
7358 }
7359
7361 {
7362 super.InitItemVariables();
7363
7369 m_Count = ConfigGetInt(
"count");
7370
7373
7378
7381
7386
7398
7402
7403
7406 if (ConfigIsExisting("canBeSplit"))
7407 {
7410 }
7411
7413 if (ConfigIsExisting("itemBehaviour"))
7415
7416
7419 RegisterNetSyncVariableInt("m_VarLiquidType");
7420 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7421
7422 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7423 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7424 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7425
7426 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7427 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7428 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7429 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7430
7431 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7432 RegisterNetSyncVariableBool("m_IsTakeable");
7433 RegisterNetSyncVariableBool("m_IsHologram");
7434
7437 {
7440 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7441 }
7442
7444
7446 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7448
7450 }
7451
7453 {
7455 }
7456
7458 {
7461 {
7466 }
7467 }
7468
7469 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7470 {
7472 {
7475 }
7476
7478 }
7479
7481 {
7487 }
7488
7490
7492 {
7494
7495 if (!action)
7496 {
7497 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7498 return;
7499 }
7500
7502 if (!ai)
7503 {
7505 return;
7506 }
7507
7509 if (!action_array)
7510 {
7511 action_array = new array<ActionBase_Basic>;
7513 }
7514 if (LogManager.IsActionLogEnable())
7515 {
7516 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7517 }
7518
7519 if (action_array.Find(action) != -1)
7520 {
7521 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7522 }
7523 else
7524 {
7525 action_array.Insert(action);
7526 }
7527 }
7528
7530 {
7531 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7532 ActionBase action = player.GetActionManager().GetAction(actionName);
7535
7536 if (action_array)
7537 {
7538 action_array.RemoveItem(action);
7539 }
7540 }
7541
7542
7543
7545 {
7546 ActionOverrideData overrideData = new ActionOverrideData();
7550
7552 if (!actionMap)
7553 {
7556 }
7557
7558 actionMap.Insert(this.
Type(), overrideData);
7559
7560 }
7561
7563
7565
7566
7568 {
7571
7574
7575 string config_to_search = "CfgVehicles";
7576 string muzzle_owner_config;
7577
7579 {
7580 if (IsInherited(Weapon))
7581 config_to_search = "CfgWeapons";
7582
7583 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7584
7585 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7586
7587 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7588
7589 if (config_OnFire_subclass_count > 0)
7590 {
7591 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7592
7593 for (int i = 0; i < config_OnFire_subclass_count; i++)
7594 {
7595 string particle_class = "";
7596 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7597 string config_OnFire_entry = config_OnFire_class + particle_class;
7598 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7599 WPOF_array.Insert(WPOF);
7600 }
7601
7602
7604 }
7605 }
7606
7608 {
7609 config_to_search = "CfgWeapons";
7610 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7611
7612 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7613
7614 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7615
7616 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7617 {
7618 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7619
7620 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7621 {
7622 string particle_class2 = "";
7623 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7624 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7625 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7626 WPOBE_array.Insert(WPOBE);
7627 }
7628
7629
7631 }
7632 }
7633 }
7634
7635
7637 {
7640
7642 {
7643 string config_to_search = "CfgVehicles";
7644
7645 if (IsInherited(Weapon))
7646 config_to_search = "CfgWeapons";
7647
7648 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7649 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7650
7651 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7652 {
7653
7655
7657 {
7659 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7661 return;
7662 }
7663
7666
7667
7668
7669 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7670 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7671
7672 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7673 {
7674 string particle_class = "";
7675 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7676 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7677 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7678
7679 if (entry_type == CT_CLASS)
7680 {
7681 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7682 WPOOH_array.Insert(WPOF);
7683 }
7684 }
7685
7686
7688 }
7689 }
7690 }
7691
7693 {
7695 }
7696
7698 {
7700 {
7702
7705
7708
7709 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7710 }
7711 }
7712
7714 {
7716 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7717
7719 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7720
7722 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7723
7725 {
7727 }
7728 }
7729
7731 {
7733 }
7734
7736 {
7739 else
7741
7743 {
7746 }
7747 else
7748 {
7751
7754 }
7755
7757 }
7758
7760 {
7762 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7763 }
7764
7766 {
7768 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7770 }
7771
7773 {
7775 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7776 }
7777
7779 {
7782
7783 OverheatingParticle OP = new OverheatingParticle();
7788
7790 }
7791
7793 {
7796
7797 return -1;
7798 }
7799
7801 {
7803 {
7806
7807 for (int i = count; i > 0; --i)
7808 {
7809 int id = i - 1;
7812
7815
7816 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7817 {
7818 if (p)
7819 {
7822 }
7823 }
7824 }
7825 }
7826 }
7827
7829 {
7831 {
7833 {
7834 int id = i - 1;
7836
7837 if (OP)
7838 {
7840
7841 if (p)
7842 {
7844 }
7845
7846 delete OP;
7847 }
7848 }
7849
7852 }
7853 }
7854
7857 {
7858 return 0.0;
7859 }
7860
7861
7863 {
7864 return 250;
7865 }
7866
7868 {
7869 return 0;
7870 }
7871
7874 {
7876 return true;
7877
7878 return false;
7879 }
7880
7883 {
7886
7888 {
7890 }
7891 else
7892 {
7893
7895 }
7896
7898 }
7899
7906 {
7907 return -1;
7908 }
7909
7910
7911
7912
7914 {
7916 {
7917 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7918 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7919
7920 if (r_index >= 0)
7921 {
7922 InventoryLocation r_il = new InventoryLocation;
7923 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7924
7925 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7928 {
7929 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7930 }
7932 {
7933 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7934 }
7935
7936 }
7937
7938 player.GetHumanInventory().ClearUserReservedLocation(this);
7939 }
7940
7943 }
7944
7945
7946
7947
7949 {
7950 return ItemBase.m_DebugActionsMask;
7951 }
7952
7954 {
7955 return ItemBase.m_DebugActionsMask & mask;
7956 }
7957
7959 {
7960 ItemBase.m_DebugActionsMask = mask;
7961 }
7962
7964 {
7965 ItemBase.m_DebugActionsMask |= mask;
7966 }
7967
7969 {
7970 ItemBase.m_DebugActionsMask &= ~mask;
7971 }
7972
7974 {
7976 {
7978 }
7979 else
7980 {
7982 }
7983 }
7984
7985
7987 {
7988 if (GetEconomyProfile())
7989 {
7990 float q_max = GetEconomyProfile().GetQuantityMax();
7991 if (q_max > 0)
7992 {
7993 float q_min = GetEconomyProfile().GetQuantityMin();
7994 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7995
7997 {
7998 ComponentEnergyManager comp = GetCompEM();
8000 {
8002 }
8003 }
8005 {
8007
8008 }
8009
8010 }
8011 }
8012 }
8013
8016 {
8017 EntityAI parent = GetHierarchyParent();
8018
8019 if (parent)
8020 {
8021 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8022 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8023 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8024 }
8025 }
8026
8029 {
8030 EntityAI parent = GetHierarchyParent();
8031
8032 if (parent)
8033 {
8034 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8035 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8036 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8037 }
8038 }
8039
8041 {
8042
8043
8044
8045
8047
8049 {
8050 if (ScriptInputUserData.CanStoreInputUserData())
8051 {
8052 ScriptInputUserData ctx = new ScriptInputUserData;
8058 ctx.
Write(use_stack_max);
8061
8063 {
8064 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8065 }
8066 }
8067 }
8068 else if (!
g_Game.IsMultiplayer())
8069 {
8071 }
8072 }
8073
8075 {
8077 }
8078
8080 {
8082 }
8083
8085 {
8087 }
8088
8090 {
8091
8092 return false;
8093 }
8094
8096 {
8097 return false;
8098 }
8099
8103 {
8104 return false;
8105 }
8106
8108 {
8109 return "";
8110 }
8111
8113
8115 {
8116 return false;
8117 }
8118
8120 {
8121 return true;
8122 }
8123
8124
8125
8127 {
8128 return true;
8129 }
8130
8132 {
8133 return true;
8134 }
8135
8137 {
8138 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8140 }
8141
8143 {
8145 }
8146
8148 {
8150 if (!is_being_placed)
8152 SetSynchDirty();
8153 }
8154
8155
8157
8159 {
8161 }
8162
8164 {
8166 }
8167
8169 {
8170 return 1;
8171 }
8172
8174 {
8175 return false;
8176 }
8177
8179 {
8181 SetSynchDirty();
8182 }
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8219 {
8220 super.OnMovedInsideCargo(container);
8221
8222 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8223 }
8224
8225 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8226 {
8227 super.EEItemLocationChanged(oldLoc, newLoc);
8228
8229 PlayerBase newPlayer = null;
8230 PlayerBase oldPlayer = null;
8231
8232 if (newLoc.GetParent())
8233 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8234
8235 if (oldLoc.GetParent())
8236 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8237
8239 {
8240 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8241
8242 if (rIndex >= 0)
8243 {
8244 InventoryLocation rIl = new InventoryLocation;
8245 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8246
8247 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8250 {
8251 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8252 }
8254 {
8256 }
8257
8258 }
8259 }
8260
8262 {
8263 if (newPlayer)
8264 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8265
8266 if (newPlayer == oldPlayer)
8267 {
8268 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8269 {
8271 {
8272 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8273 {
8274 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8275 }
8276 }
8277 else
8278 {
8279 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8280 }
8281 }
8282
8283 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8284 {
8285 int type = oldLoc.GetType();
8287 {
8288 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8289 }
8291 {
8292 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8293 }
8294 }
8295 if (!m_OldLocation)
8296 {
8297 m_OldLocation = new InventoryLocation;
8298 }
8299 m_OldLocation.Copy(oldLoc);
8300 }
8301 else
8302 {
8303 if (m_OldLocation)
8304 {
8305 m_OldLocation.Reset();
8306 }
8307 }
8308
8309 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8310 }
8311 else
8312 {
8313 if (newPlayer)
8314 {
8315 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8316 if (resIndex >= 0)
8317 {
8318 InventoryLocation il = new InventoryLocation;
8319 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8321 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8324 {
8325 il.
GetParent().GetOnReleaseLock().Invoke(it);
8326 }
8328 {
8330 }
8331
8332 }
8333 }
8335 {
8336
8338 }
8339
8340 if (m_OldLocation)
8341 {
8342 m_OldLocation.Reset();
8343 }
8344 }
8345
8347 {
8348 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8349 }
8350
8352 {
8353 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8354 }
8355 }
8356
8357 override void EOnContact(IEntity other, Contact extra)
8358 {
8360 {
8361 int liquidType = -1;
8363 if (impactSpeed > 0.0)
8364 {
8366 #ifndef SERVER
8368 #else
8370 SetSynchDirty();
8371 #endif
8373 }
8374 }
8375
8376 #ifdef SERVER
8377 if (GetCompEM() && GetCompEM().IsPlugged())
8378 {
8379 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8380 GetCompEM().UnplugThis();
8381 }
8382 #endif
8383 }
8384
8386
8388 {
8390 }
8391
8393 {
8394
8395 }
8396
8398 {
8399 super.OnItemLocationChanged(old_owner, new_owner);
8400
8401 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8402 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8403
8404 if (!relatedPlayer && playerNew)
8405 relatedPlayer = playerNew;
8406
8407 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8408 {
8410 if (actionMgr)
8411 {
8412 ActionBase currentAction = actionMgr.GetRunningAction();
8413 if (currentAction)
8415 }
8416 }
8417
8418 Man ownerPlayerOld = null;
8419 Man ownerPlayerNew = null;
8420
8421 if (old_owner)
8422 {
8423 if (old_owner.
IsMan())
8424 {
8425 ownerPlayerOld = Man.Cast(old_owner);
8426 }
8427 else
8428 {
8429 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8430 }
8431 }
8432 else
8433 {
8435 {
8437
8438 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8439 {
8440 GetCompEM().UnplugThis();
8441 }
8442 }
8443 }
8444
8445 if (new_owner)
8446 {
8447 if (new_owner.
IsMan())
8448 {
8449 ownerPlayerNew = Man.Cast(new_owner);
8450 }
8451 else
8452 {
8453 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8454 }
8455 }
8456
8457 if (ownerPlayerOld != ownerPlayerNew)
8458 {
8459 if (ownerPlayerOld)
8460 {
8461 array<EntityAI> subItemsExit = new array<EntityAI>;
8463 for (int i = 0; i < subItemsExit.Count(); i++)
8464 {
8467 }
8468 }
8469
8470 if (ownerPlayerNew)
8471 {
8472 array<EntityAI> subItemsEnter = new array<EntityAI>;
8474 for (int j = 0; j < subItemsEnter.Count(); j++)
8475 {
8478 }
8479 }
8480 }
8481 else if (ownerPlayerNew != null)
8482 {
8483 PlayerBase nplayer;
8484 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8485 {
8486 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8488 for (int k = 0; k < subItemsUpdate.Count(); k++)
8489 {
8491 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8492 }
8493 }
8494 }
8495
8496 if (old_owner)
8497 old_owner.OnChildItemRemoved(this);
8498 if (new_owner)
8499 new_owner.OnChildItemReceived(this);
8500 }
8501
8502
8504 {
8505 super.EEDelete(parent);
8506 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8507 if (player)
8508 {
8510
8511 if (player.IsAlive())
8512 {
8513 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8514 if (r_index >= 0)
8515 {
8516 InventoryLocation r_il = new InventoryLocation;
8517 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8518
8519 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8522 {
8523 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8524 }
8526 {
8527 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8528 }
8529
8530 }
8531
8532 player.RemoveQuickBarEntityShortcut(this);
8533 }
8534 }
8535 }
8536
8538 {
8539 super.EEKilled(killer);
8540
8543 {
8544 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8545 {
8546 if (IsMagazine())
8547 {
8548 if (Magazine.Cast(this).GetAmmoCount() > 0)
8549 {
8551 }
8552 }
8553 else
8554 {
8556 }
8557 }
8558 }
8559 }
8560
8562 {
8563 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8564
8565 super.OnWasAttached(parent, slot_id);
8566
8569
8572 }
8573
8575 {
8576 super.OnWasDetached(parent, slot_id);
8577
8580
8583 }
8584
8586 {
8587 int idx;
8590
8591 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8592 if (inventory_slots.Count() < 1)
8593 {
8594 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8595 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8596 }
8597 else
8598 {
8599 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8600 }
8601
8602 idx = inventory_slots.Find(slot);
8603 if (idx < 0)
8604 return "";
8605
8606 return attach_types.Get(idx);
8607 }
8608
8610 {
8611 int idx = -1;
8612 string slot;
8613
8616
8617 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8618 if (inventory_slots.Count() < 1)
8619 {
8620 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8621 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8622 }
8623 else
8624 {
8625 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8626 if (detach_types.Count() < 1)
8627 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8628 }
8629
8630 for (int i = 0; i < inventory_slots.Count(); i++)
8631 {
8632 slot = inventory_slots.Get(i);
8633 }
8634
8635 if (slot != "")
8636 {
8637 if (detach_types.Count() == 1)
8638 idx = 0;
8639 else
8640 idx = inventory_slots.Find(slot);
8641 }
8642 if (idx < 0)
8643 return "";
8644
8645 return detach_types.Get(idx);
8646 }
8647
8649 {
8650
8652
8653
8654 float min_time = 1;
8655 float max_time = 3;
8656 float delay = Math.RandomFloat(min_time, max_time);
8657
8658 explode_timer.Run(delay, this, "DoAmmoExplosion");
8659 }
8660
8662 {
8663 Magazine magazine = Magazine.Cast(this);
8664 int pop_sounds_count = 6;
8665 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8666
8667
8668 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8669 string sound_name = pop_sounds[ sound_idx ];
8670 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8671
8672
8673 magazine.ServerAddAmmoCount(-1);
8674
8675
8676 float min_temp_to_explode = 100;
8677
8678 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8679 {
8681 }
8682 }
8683
8684
8685 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8686 {
8687 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8688
8689 const int CHANCE_DAMAGE_CARGO = 4;
8690 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8691 const int CHANCE_DAMAGE_NOTHING = 2;
8692
8694 {
8695 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8696 int chances;
8697 int rnd;
8698
8699 if (GetInventory().GetCargo())
8700 {
8701 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8702 rnd = Math.RandomInt(0,chances);
8703
8704 if (rnd < CHANCE_DAMAGE_CARGO)
8705 {
8707 }
8708 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8709 {
8711 }
8712 }
8713 else
8714 {
8715 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8716 rnd = Math.RandomInt(0,chances);
8717
8718 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8719 {
8721 }
8722 }
8723 }
8724 }
8725
8727 {
8728 CargoBase cargo = GetInventory().GetCargo();
8729 if (cargo)
8730 {
8732 if (item_count > 0)
8733 {
8734 int random_pick = Math.RandomInt(0, item_count);
8736 if (!item.IsExplosive())
8737 {
8738 item.AddHealth("","",damage);
8739 return true;
8740 }
8741 }
8742 }
8743 return false;
8744 }
8745
8747 {
8748 GameInventory inventory = GetInventory();
8750 if (attachment_count > 0)
8751 {
8752 int random_pick = Math.RandomInt(0, attachment_count);
8754 if (!attachment.IsExplosive())
8755 {
8756 attachment.AddHealth("","",damage);
8757 return true;
8758 }
8759 }
8760 return false;
8761 }
8762
8764 {
8766 }
8767
8769 {
8771 return GetInventory().CanRemoveEntity();
8772
8773 return false;
8774 }
8775
8777 {
8778
8780 return false;
8781
8782
8784 return false;
8785
8786
8787
8789 if (delta == 0)
8790 return false;
8791
8792
8793 return true;
8794 }
8795
8797 {
8799 {
8800 if (ScriptInputUserData.CanStoreInputUserData())
8801 {
8802 ScriptInputUserData ctx = new ScriptInputUserData;
8807 ctx.
Write(destination_entity);
8811 }
8812 }
8813 else if (!
g_Game.IsMultiplayer())
8814 {
8816 }
8817 }
8818
8820 {
8821 float split_quantity_new;
8825 InventoryLocation loc = new InventoryLocation;
8826
8827 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8828 {
8830 split_quantity_new = stack_max;
8831 else
8833
8835 {
8836 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8837 if (new_item)
8838 {
8839 new_item.SetResultOfSplit(true);
8840 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8842 new_item.
SetQuantity(split_quantity_new,
false,
true);
8843 }
8844 }
8845 }
8846 else if (destination_entity && slot_id == -1)
8847 {
8848 if (quantity > stack_max)
8849 split_quantity_new = stack_max;
8850 else
8851 split_quantity_new = quantity;
8852
8854 {
8855 GameInventory destinationInventory = destination_entity.GetInventory();
8857 {
8860 }
8861
8862 if (new_item)
8863 {
8864 new_item.SetResultOfSplit(true);
8865 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8867 new_item.
SetQuantity(split_quantity_new,
false,
true);
8868 }
8869 }
8870 }
8871 else
8872 {
8873 if (stack_max != 0)
8874 {
8876 {
8878 }
8879
8880 if (split_quantity_new == 0)
8881 {
8882 if (!
g_Game.IsMultiplayer())
8883 player.PhysicalPredictiveDropItem(this);
8884 else
8885 player.ServerDropEntity(this);
8886 return;
8887 }
8888
8890 {
8892
8893 if (new_item)
8894 {
8895 new_item.SetResultOfSplit(true);
8896 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8899 new_item.PlaceOnSurface();
8900 }
8901 }
8902 }
8903 }
8904 }
8905
8907 {
8908 float split_quantity_new;
8912 InventoryLocation loc = new InventoryLocation;
8913
8914 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8915 {
8917 split_quantity_new = stack_max;
8918 else
8920
8922 {
8923 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8924 if (new_item)
8925 {
8926 new_item.SetResultOfSplit(true);
8927 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8929 new_item.
SetQuantity(split_quantity_new,
false,
true);
8930 }
8931 }
8932 }
8933 else if (destination_entity && slot_id == -1)
8934 {
8935 if (quantity > stack_max)
8936 split_quantity_new = stack_max;
8937 else
8938 split_quantity_new = quantity;
8939
8941 {
8942 GameInventory destinationInventory = destination_entity.GetInventory();
8944 {
8947 }
8948
8949 if (new_item)
8950 {
8951 new_item.SetResultOfSplit(true);
8952 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8954 new_item.
SetQuantity(split_quantity_new,
false,
true);
8955 }
8956 }
8957 }
8958 else
8959 {
8960 if (stack_max != 0)
8961 {
8963 {
8965 }
8966
8968 {
8970
8971 if (new_item)
8972 {
8973 new_item.SetResultOfSplit(true);
8974 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8977 new_item.PlaceOnSurface();
8978 }
8979 }
8980 }
8981 }
8982 }
8983
8985 {
8987 {
8988 if (ScriptInputUserData.CanStoreInputUserData())
8989 {
8990 ScriptInputUserData ctx = new ScriptInputUserData;
8995 dst.WriteToContext(ctx);
8997 }
8998 }
8999 else if (!
g_Game.IsMultiplayer())
9000 {
9002 }
9003 }
9004
9006 {
9008 {
9009 if (ScriptInputUserData.CanStoreInputUserData())
9010 {
9011 ScriptInputUserData ctx = new ScriptInputUserData;
9016 ctx.
Write(destination_entity);
9022 }
9023 }
9024 else if (!
g_Game.IsMultiplayer())
9025 {
9027 }
9028 }
9029
9031 {
9033 }
9034
9036 {
9038 float split_quantity_new;
9040 if (dst.IsValid())
9041 {
9042 int slot_id = dst.GetSlot();
9044
9045 if (quantity > stack_max)
9046 split_quantity_new = stack_max;
9047 else
9048 split_quantity_new = quantity;
9049
9051 {
9053
9054 if (new_item)
9055 {
9056 new_item.SetResultOfSplit(true);
9057 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9059 new_item.
SetQuantity(split_quantity_new,
false,
true);
9060 }
9061
9062 return new_item;
9063 }
9064 }
9065
9066 return null;
9067 }
9068
9070 {
9072 float split_quantity_new;
9074 if (destination_entity)
9075 {
9077 if (quantity > stackable)
9078 split_quantity_new = stackable;
9079 else
9080 split_quantity_new = quantity;
9081
9083 {
9084 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9085 if (new_item)
9086 {
9087 new_item.SetResultOfSplit(true);
9088 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9090 new_item.
SetQuantity(split_quantity_new,
false,
true);
9091 }
9092 }
9093 }
9094 }
9095
9097 {
9099 {
9100 if (ScriptInputUserData.CanStoreInputUserData())
9101 {
9102 ScriptInputUserData ctx = new ScriptInputUserData;
9107 ItemBase destination_entity =
this;
9108 ctx.
Write(destination_entity);
9112 }
9113 }
9114 else if (!
g_Game.IsMultiplayer())
9115 {
9117 }
9118 }
9119
9121 {
9123 float split_quantity_new;
9125 if (player)
9126 {
9128 if (quantity > stackable)
9129 split_quantity_new = stackable;
9130 else
9131 split_quantity_new = quantity;
9132
9134 {
9135 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9136 new_item =
ItemBase.Cast(in_hands);
9137 if (new_item)
9138 {
9139 new_item.SetResultOfSplit(true);
9140 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9142 new_item.SetQuantity(split_quantity_new, false, true);
9143 }
9144 }
9145 }
9146 }
9147
9149 {
9151 float split_quantity_new = Math.Floor(quantity * 0.5);
9152
9154 return;
9155
9157
9158 if (new_item)
9159 {
9160 if (new_item.GetQuantityMax() < split_quantity_new)
9161 {
9162 split_quantity_new = new_item.GetQuantityMax();
9163 }
9164
9165 new_item.SetResultOfSplit(true);
9166 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9167
9169 {
9172 }
9173 else
9174 {
9176 new_item.
SetQuantity(split_quantity_new,
false,
true);
9177 }
9178 }
9179 }
9180
9182 {
9184 float split_quantity_new = Math.Floor(quantity / 2);
9185
9187 return;
9188
9189 InventoryLocation invloc = new InventoryLocation;
9191
9193 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9194
9195 if (new_item)
9196 {
9197 if (new_item.GetQuantityMax() < split_quantity_new)
9198 {
9199 split_quantity_new = new_item.GetQuantityMax();
9200 }
9202 {
9205 }
9206 else if (split_quantity_new > 1)
9207 {
9209 new_item.
SetQuantity(split_quantity_new,
false,
true);
9210 }
9211 }
9212 }
9213
9216 {
9217 SetWeightDirty();
9219
9220 if (parent)
9221 parent.OnAttachmentQuantityChangedEx(this, delta);
9222
9224 {
9226 {
9228 }
9230 {
9231 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9233 }
9234 }
9235 }
9236
9239 {
9240
9241 }
9242
9245 {
9247 }
9248
9250 {
9251 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9252
9254 {
9255 if (newLevel == GameConstants.STATE_RUINED)
9256 {
9258 EntityAI parent = GetHierarchyParent();
9259 if (parent && parent.IsFireplace())
9260 {
9261 CargoBase cargo = GetInventory().GetCargo();
9262 if (cargo)
9263 {
9265 {
9267 }
9268 }
9269 }
9270 }
9271
9273 {
9274
9276 return;
9277 }
9278
9279 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9280 {
9282 }
9283 }
9284 }
9285
9286
9288 {
9289 super.OnRightClick();
9290
9292 {
9294 {
9295 if (ScriptInputUserData.CanStoreInputUserData())
9296 {
9297 EntityAI root = GetHierarchyRoot();
9298 Man playerOwner = GetHierarchyRootPlayer();
9299 InventoryLocation dst = new InventoryLocation;
9300
9301
9302 if (!playerOwner && root && root == this)
9303 {
9305 }
9306 else
9307 {
9308
9309 GetInventory().GetCurrentInventoryLocation(dst);
9311 {
9312 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9314 {
9316 }
9317 else
9318 {
9320
9321
9322 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9323 {
9325 }
9326 else
9327 {
9328 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9329 }
9330 }
9331 }
9332 }
9333
9334 ScriptInputUserData ctx = new ScriptInputUserData;
9342 }
9343 }
9344 else if (!
g_Game.IsMultiplayer())
9345 {
9347 }
9348 }
9349 }
9350
9352 {
9353 if (root)
9354 {
9355 vector m4[4];
9356 root.GetTransform(m4);
9357 dst.SetGround(this, m4);
9358 }
9359 else
9360 {
9361 GetInventory().GetCurrentInventoryLocation(dst);
9362 }
9363 }
9364
9365 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9366 {
9367
9368 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9369 return false;
9370
9371 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9372 return false;
9373
9374
9376 return false;
9377
9378
9379 Magazine mag = Magazine.Cast(this);
9380 if (mag)
9381 {
9382 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9383 return false;
9384
9385 if (stack_max_limit)
9386 {
9387 Magazine other_mag = Magazine.Cast(other_item);
9388 if (other_item)
9389 {
9390 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9391 return false;
9392 }
9393
9394 }
9395 }
9396 else
9397 {
9398
9400 return false;
9401
9403 return false;
9404 }
9405
9406 PlayerBase player = null;
9407 if (CastTo(player, GetHierarchyRootPlayer()))
9408 {
9409 if (player.GetInventory().HasAttachment(this))
9410 return false;
9411
9412 if (player.IsItemsToDelete())
9413 return false;
9414 }
9415
9416 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9417 return false;
9418
9419 int slotID;
9421 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9422 return false;
9423
9424 return true;
9425 }
9426
9428 {
9430 }
9431
9433 {
9434 return m_IsResultOfSplit;
9435 }
9436
9438 {
9439 m_IsResultOfSplit = value;
9440 }
9441
9443 {
9445 }
9446
9448 {
9449 float other_item_quantity = other_item.GetQuantity();
9450 float this_free_space;
9451
9453
9455
9456 if (other_item_quantity > this_free_space)
9457 {
9458 return this_free_space;
9459 }
9460 else
9461 {
9462 return other_item_quantity;
9463 }
9464 }
9465
9467 {
9469 }
9470
9472 {
9474 return;
9475
9476 if (!IsMagazine() && other_item)
9477 {
9479 if (quantity_used != 0)
9480 {
9481 float hp1 = GetHealth01("","");
9482 float hp2 = other_item.GetHealth01("","");
9483 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9484 hpResult = hpResult / (
GetQuantity() + quantity_used);
9485
9486 hpResult *= GetMaxHealth();
9487 Math.Round(hpResult);
9488 SetHealth("", "Health", hpResult);
9489
9491 other_item.AddQuantity(-quantity_used);
9492 }
9493 }
9495 }
9496
9498 {
9499 #ifdef SERVER
9500 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9501 GetHierarchyParent().IncreaseLifetimeUp();
9502 #endif
9503 };
9504
9506 {
9507 PlayerBase p = PlayerBase.Cast(player);
9508
9509 array<int> recipesIds = p.m_Recipes;
9510 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9511 if (moduleRecipesManager)
9512 {
9513 EntityAI itemInHands = player.GetEntityInHands();
9514 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9515 }
9516
9517 for (int i = 0;i < recipesIds.Count(); i++)
9518 {
9519 int key = recipesIds.Get(i);
9520 string recipeName = moduleRecipesManager.GetRecipeName(key);
9522 }
9523 }
9524
9525
9526 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9527 {
9528 super.GetDebugActions(outputList);
9529
9530
9536
9537
9542
9547
9548
9552
9553
9555 {
9559 }
9560
9563
9564
9568
9570
9571 InventoryLocation loc = new InventoryLocation();
9572 GetInventory().GetCurrentInventoryLocation(loc);
9574 {
9575 if (Gizmo_IsSupported())
9578 }
9579
9581 }
9582
9583
9584
9585
9587 {
9588 super.OnAction(action_id, player, ctx);
9589
9591 {
9592 switch (action_id)
9593 {
9597 return true;
9601 return true;
9602 }
9603 }
9604
9606 {
9607 switch (action_id)
9608 {
9610 Delete();
9611 return true;
9612 }
9613 }
9614
9615 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9616 {
9617 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9618 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9619 PlayerBase p = PlayerBase.Cast(player);
9620 if (
EActions.RECIPES_RANGE_START < 1000)
9621 {
9622 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9623 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9624 }
9625 }
9626 #ifndef SERVER
9627 else if (action_id ==
EActions.WATCH_PLAYER)
9628 {
9629 PluginDeveloper.SetDeveloperItemClientEx(player);
9630 }
9631 #endif
9633 {
9634 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9635 {
9636 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9637 OnDebugButtonPressServer(id + 1);
9638 }
9639
9640 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9641 {
9642 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9644 }
9645
9646 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9647 {
9648 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9650 }
9651
9652 else if (action_id ==
EActions.ADD_QUANTITY)
9653 {
9654 if (IsMagazine())
9655 {
9656 Magazine mag = Magazine.Cast(this);
9657 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9658 }
9659 else
9660 {
9662 }
9663
9664 if (m_EM)
9665 {
9666 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9667 }
9668
9669 }
9670
9671 else if (action_id ==
EActions.REMOVE_QUANTITY)
9672 {
9673 if (IsMagazine())
9674 {
9675 Magazine mag2 = Magazine.Cast(this);
9676 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9677 }
9678 else
9679 {
9681 }
9682 if (m_EM)
9683 {
9684 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9685 }
9686
9687 }
9688
9689 else if (action_id ==
EActions.SET_QUANTITY_0)
9690 {
9692
9693 if (m_EM)
9694 {
9695 m_EM.SetEnergy(0);
9696 }
9697 }
9698
9699 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9700 {
9702
9703 if (m_EM)
9704 {
9705 m_EM.SetEnergy(m_EM.GetEnergyMax());
9706 }
9707 }
9708
9709 else if (action_id ==
EActions.ADD_HEALTH)
9710 {
9711 AddHealth("","",GetMaxHealth("","Health")/5);
9712 }
9713 else if (action_id ==
EActions.REMOVE_HEALTH)
9714 {
9715 AddHealth("","",-GetMaxHealth("","Health")/5);
9716 }
9717 else if (action_id ==
EActions.DESTROY_HEALTH)
9718 {
9719 SetHealth01("","",0);
9720 }
9721 else if (action_id ==
EActions.WATCH_ITEM)
9722 {
9724 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9725 #ifdef DEVELOPER
9726 SetDebugDeveloper_item(this);
9727 #endif
9728 }
9729
9730 else if (action_id ==
EActions.ADD_TEMPERATURE)
9731 {
9732 AddTemperature(20);
9733
9734 }
9735
9736 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9737 {
9738 AddTemperature(-20);
9739
9740 }
9741
9742 else if (action_id ==
EActions.FLIP_FROZEN)
9743 {
9744 SetFrozen(!GetIsFrozen());
9745
9746 }
9747
9748 else if (action_id ==
EActions.ADD_WETNESS)
9749 {
9751
9752 }
9753
9754 else if (action_id ==
EActions.REMOVE_WETNESS)
9755 {
9757
9758 }
9759
9760 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9761 {
9764
9765
9766 }
9767
9768 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9769 {
9772 }
9773
9774 else if (action_id ==
EActions.MAKE_SPECIAL)
9775 {
9776 auto debugParams = DebugSpawnParams.WithPlayer(player);
9777 OnDebugSpawnEx(debugParams);
9778 }
9779
9780 }
9781
9782
9783 return false;
9784 }
9785
9786
9787
9788
9792
9795
9796
9797
9799 {
9800 return false;
9801 }
9802
9803
9805 {
9806 return true;
9807 }
9808
9809
9811 {
9812 return true;
9813 }
9814
9815
9816
9818 {
9819 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9820 return g_Game.ConfigIsExisting(config_path);
9821 }
9822
9825 {
9826 return null;
9827 }
9828
9830 {
9831 return false;
9832 }
9833
9835 {
9836 return false;
9837 }
9838
9842
9843
9845 {
9846 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9847 return module_repairing.CanRepair(this, item_repair_kit);
9848 }
9849
9850
9851 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9852 {
9853 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9854 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9855 }
9856
9857
9859 {
9860
9861
9862
9863
9864
9865
9866
9867
9868 return 1;
9869 }
9870
9871
9872
9874 {
9876 }
9877
9878
9879
9881 {
9883 }
9884
9885
9894 {
9895 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9896
9897 if (player)
9898 {
9899 player.MessageStatus(text);
9900 }
9901 }
9902
9903
9912 {
9913 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9914
9915 if (player)
9916 {
9917 player.MessageAction(text);
9918 }
9919 }
9920
9921
9930 {
9931 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9932
9933 if (player)
9934 {
9935 player.MessageFriendly(text);
9936 }
9937 }
9938
9939
9948 {
9949 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9950
9951 if (player)
9952 {
9953 player.MessageImportant(text);
9954 }
9955 }
9956
9958 {
9959 return true;
9960 }
9961
9962
9963 override bool KindOf(
string tag)
9964 {
9965 bool found = false;
9966 string item_name = this.
GetType();
9968 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9969
9970 int array_size = item_tag_array.Count();
9971 for (int i = 0; i < array_size; i++)
9972 {
9973 if (item_tag_array.Get(i) == tag)
9974 {
9975 found = true;
9976 break;
9977 }
9978 }
9979 return found;
9980 }
9981
9982
9984 {
9985
9986 super.OnRPC(sender, rpc_type,ctx);
9987
9988
9989 switch (rpc_type)
9990 {
9991 #ifndef SERVER
9992 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9993 Param2<bool, string> p = new Param2<bool, string>(false, "");
9994
9996 return;
9997
9998 bool play = p.param1;
9999 string soundSet = p.param2;
10000
10001 if (play)
10002 {
10004 {
10006 {
10008 }
10009 }
10010 else
10011 {
10013 }
10014 }
10015 else
10016 {
10018 }
10019
10020 break;
10021 #endif
10022
10023 }
10024
10026 {
10028 }
10029 }
10030
10031
10032
10033
10035 {
10036 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10037 return plugin.GetID(
name);
10038 }
10039
10041 {
10042 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10043 return plugin.GetName(id);
10044 }
10045
10048 {
10049
10050
10051 int varFlags;
10052 if (!ctx.
Read(varFlags))
10053 return;
10054
10055 if (varFlags & ItemVariableFlags.FLOAT)
10056 {
10058 }
10059 }
10060
10062 {
10063
10064 super.SerializeNumericalVars(floats_out);
10065
10066
10067
10069 {
10071 }
10072
10074 {
10076 }
10077
10079 {
10081 }
10082
10084 {
10089 }
10090
10092 {
10094 }
10095 }
10096
10098 {
10099
10100 super.DeSerializeNumericalVars(floats);
10101
10102
10103 int index = 0;
10104 int mask = Math.Round(floats.Get(index));
10105
10106 index++;
10107
10109 {
10111 {
10113 }
10114 else
10115 {
10116 float quantity = floats.Get(index);
10117 SetQuantity(quantity,
true,
false,
false,
false);
10118 }
10119 index++;
10120 }
10121
10123 {
10124 float wet = floats.Get(index);
10126 index++;
10127 }
10128
10130 {
10131 int liquidtype = Math.Round(floats.Get(index));
10133 index++;
10134 }
10135
10137 {
10139 index++;
10141 index++;
10143 index++;
10145 index++;
10146 }
10147
10149 {
10150 int cleanness = Math.Round(floats.Get(index));
10152 index++;
10153 }
10154 }
10155
10157 {
10158 super.WriteVarsToCTX(ctx);
10159
10160
10162 {
10164 }
10165
10167 {
10169 }
10170
10172 {
10174 }
10175
10177 {
10178 int r,g,b,a;
10184 }
10185
10187 {
10189 }
10190 }
10191
10193 {
10194 if (!super.ReadVarsFromCTX(ctx,version))
10195 return false;
10196
10197 int intValue;
10198 float value;
10199
10200 if (version < 140)
10201 {
10202 if (!ctx.
Read(intValue))
10203 return false;
10204
10205 m_VariablesMask = intValue;
10206 }
10207
10209 {
10210 if (!ctx.
Read(value))
10211 return false;
10212
10214 {
10216 }
10217 else
10218 {
10220 }
10221 }
10222
10223 if (version < 140)
10224 {
10226 {
10227 if (!ctx.
Read(value))
10228 return false;
10229 SetTemperatureDirect(value);
10230 }
10231 }
10232
10234 {
10235 if (!ctx.
Read(value))
10236 return false;
10238 }
10239
10241 {
10242 if (!ctx.
Read(intValue))
10243 return false;
10245 }
10246
10248 {
10249 int r,g,b,a;
10251 return false;
10253 return false;
10255 return false;
10257 return false;
10258
10260 }
10261
10263 {
10264 if (!ctx.
Read(intValue))
10265 return false;
10267 }
10268
10269 if (version >= 138 && version < 140)
10270 {
10272 {
10273 if (!ctx.
Read(intValue))
10274 return false;
10275 SetFrozen(intValue);
10276 }
10277 }
10278
10279 return true;
10280 }
10281
10282
10284 {
10287 {
10289 }
10290
10291 if (!super.OnStoreLoad(ctx, version))
10292 {
10294 return false;
10295 }
10296
10297 if (version >= 114)
10298 {
10299 bool hasQuickBarIndexSaved;
10300
10301 if (!ctx.
Read(hasQuickBarIndexSaved))
10302 {
10304 return false;
10305 }
10306
10307 if (hasQuickBarIndexSaved)
10308 {
10309 int itmQBIndex;
10310
10311
10312 if (!ctx.
Read(itmQBIndex))
10313 {
10315 return false;
10316 }
10317
10318 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10319 if (itmQBIndex != -1 && parentPlayer)
10320 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10321 }
10322 }
10323 else
10324 {
10325
10326 PlayerBase player;
10327 int itemQBIndex;
10328 if (version ==
int.
MAX)
10329 {
10330 if (!ctx.
Read(itemQBIndex))
10331 {
10333 return false;
10334 }
10335 }
10336 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10337 {
10338
10339 if (!ctx.
Read(itemQBIndex))
10340 {
10342 return false;
10343 }
10344 if (itemQBIndex != -1 && player)
10345 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10346 }
10347 }
10348
10349 if (version < 140)
10350 {
10351
10352 if (!LoadVariables(ctx, version))
10353 {
10355 return false;
10356 }
10357 }
10358
10359
10361 {
10363 return false;
10364 }
10365 if (version >= 132)
10366 {
10368 if (raib)
10369 {
10371 {
10373 return false;
10374 }
10375 }
10376 }
10377
10379 return true;
10380 }
10381
10382
10383
10385 {
10386 super.OnStoreSave(ctx);
10387
10388 PlayerBase player;
10389 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10390 {
10392
10393 int itemQBIndex = -1;
10394 itemQBIndex = player.FindQuickBarEntityIndex(this);
10395 ctx.
Write(itemQBIndex);
10396 }
10397 else
10398 {
10400 }
10401
10403
10405 if (raib)
10406 {
10408 }
10409 }
10410
10411
10413 {
10414 super.AfterStoreLoad();
10415
10417 {
10419 }
10420
10422 {
10425 }
10426 }
10427
10429 {
10430 super.EEOnAfterLoad();
10431
10433 {
10435 }
10436
10439 }
10440
10442 {
10443 return false;
10444 }
10445
10446
10447
10449 {
10451 {
10452 #ifdef PLATFORM_CONSOLE
10453
10455 {
10457 if (menu)
10458 {
10460 }
10461 }
10462 #endif
10463 }
10464
10466 {
10469 }
10470
10472 {
10473 SetWeightDirty();
10475 }
10477 {
10480 }
10481
10483 {
10486
10489 }
10491 {
10495 }
10496
10497 super.OnVariablesSynchronized();
10498 }
10499
10500
10501
10503 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10504 {
10505 if (!IsServerCheck(allow_client))
10506 return false;
10507
10509 return false;
10510
10513
10514 if (value <= (min + 0.001))
10515 value = min;
10516
10517 if (value == min)
10518 {
10519 if (destroy_config)
10520 {
10521 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10522 if (dstr)
10523 {
10525 this.Delete();
10526 return true;
10527 }
10528 }
10529 else if (destroy_forced)
10530 {
10532 this.Delete();
10533 return true;
10534 }
10535
10537 }
10538
10541
10543 {
10544 EntityAI parent = GetHierarchyRoot();
10545 InventoryLocation iLoc = new InventoryLocation();
10546 GetInventory().GetCurrentInventoryLocation(iLoc);
10548 {
10549 int iLocSlot = iLoc.
GetSlot();
10551 {
10553 }
10555 {
10557 }
10558 }
10559 }
10560
10562 {
10564
10565 if (delta)
10567 }
10568
10570
10571 return false;
10572 }
10573
10574
10576 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10577 {
10579 }
10580
10582 {
10585 }
10586
10588 {
10591 }
10592
10594 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10595 {
10596 float value_clamped = Math.Clamp(value, 0, 1);
10598 SetQuantity(result, destroy_config, destroy_forced);
10599 }
10600
10601
10604 {
10606 }
10607
10609 {
10611 }
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10623 {
10624 int slot = -1;
10625 GameInventory inventory = GetInventory();
10626 if (inventory)
10627 {
10628 InventoryLocation il = new InventoryLocation;
10631 }
10632
10634 }
10635
10637 {
10638 float quantity_max = 0;
10639
10641 {
10642 if (attSlotID != -1)
10643 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10644
10645 if (quantity_max <= 0)
10647 }
10648
10649 if (quantity_max <= 0)
10651
10652 return quantity_max;
10653 }
10654
10656 {
10658 }
10659
10661 {
10663 }
10664
10665
10667 {
10669 }
10670
10672 {
10674 }
10675
10677 {
10679 }
10680
10681
10683 {
10684
10685 float weightEx = GetWeightEx();
10686 float special = GetInventoryAndCargoWeight();
10687 return weightEx - special;
10688 }
10689
10690
10692 {
10694 }
10695
10697 {
10699 {
10700 #ifdef DEVELOPER
10701 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10702 {
10703 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10705 }
10706 #endif
10707
10708 return GetQuantity() * GetConfigWeightModified();
10709 }
10710 else if (HasEnergyManager())
10711 {
10712 #ifdef DEVELOPER
10713 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10714 {
10715 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10716 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10717 }
10718 #endif
10719 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10720 }
10721 else
10722 {
10723 #ifdef DEVELOPER
10724 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10725 {
10726 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10727 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10728 }
10729 #endif
10730 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10731 }
10732 }
10733
10736 {
10737 int item_count = 0;
10739
10740 GameInventory inventory = GetInventory();
10741 CargoBase cargo = inventory.
GetCargo();
10742 if (cargo != NULL)
10743 {
10745 }
10746
10748 for (int i = 0; i < nAttachments; ++i)
10749 {
10751 if (item)
10752 item_count += item.GetNumberOfItems();
10753 }
10754 return item_count;
10755 }
10756
10759 {
10760 float weight = 0;
10761 float wetness = 1;
10762 if (include_wetness)
10765 {
10766 weight = wetness * m_ConfigWeight;
10767 }
10769 {
10770 weight = 1;
10771 }
10772 return weight;
10773 }
10774
10775
10776
10778 {
10779 GameInventory inventory = GetInventory();
10780 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10781 {
10782 array<EntityAI> items = new array<EntityAI>;
10784 for (int i = 0; i < items.Count(); ++i)
10785 {
10787 if (item)
10788 {
10789 g_Game.ObjectDelete(item);
10790 }
10791 }
10792 }
10793 }
10794
10795
10796
10797
10799 {
10800 float energy = 0;
10801 if (HasEnergyManager())
10802 {
10803 energy = GetCompEM().GetEnergy();
10804 }
10805 return energy;
10806 }
10807
10808
10810 {
10811 super.OnEnergyConsumed();
10812
10814 }
10815
10817 {
10818 super.OnEnergyAdded();
10819
10821 }
10822
10823
10825 {
10826 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10827 {
10829 {
10830 float energy_0to1 = GetCompEM().GetEnergy0To1();
10832 }
10833 }
10834 }
10835
10836
10838 {
10839 return ConfigGetFloat("heatIsolation");
10840 }
10841
10843 {
10845 }
10846
10848 {
10849 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10850 if (
g_Game.ConfigIsExisting(paramPath))
10851 return g_Game.ConfigGetFloat(paramPath);
10852
10853 return 0.0;
10854 }
10855
10857 {
10858 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10859 if (
g_Game.ConfigIsExisting(paramPath))
10860 return g_Game.ConfigGetFloat(paramPath);
10861
10862 return 0.0;
10863 }
10864
10865 override void SetWet(
float value,
bool allow_client =
false)
10866 {
10867 if (!IsServerCheck(allow_client))
10868 return;
10869
10872
10874
10875 m_VarWet = Math.Clamp(value, min, max);
10876
10878 {
10881 }
10882 }
10883
10884 override void AddWet(
float value)
10885 {
10887 }
10888
10890 {
10892 }
10893
10895 {
10897 }
10898
10900 {
10902 }
10903
10905 {
10907 }
10908
10910 {
10912 }
10913
10914 override void OnWetChanged(
float newVal,
float oldVal)
10915 {
10918 if (newLevel != oldLevel)
10919 {
10921 }
10922 }
10923
10925 {
10926 SetWeightDirty();
10927 }
10928
10930 {
10931 return GetWetLevelInternal(
m_VarWet);
10932 }
10933
10934
10935
10937 {
10939 }
10940
10942 {
10944 }
10945
10947 {
10949 }
10950
10952 {
10954 }
10955
10956
10957
10959 {
10960 if (ConfigIsExisting("itemModelLength"))
10961 {
10962 return ConfigGetFloat("itemModelLength");
10963 }
10964 return 0;
10965 }
10966
10968 {
10969 if (ConfigIsExisting("itemAttachOffset"))
10970 {
10971 return ConfigGetFloat("itemAttachOffset");
10972 }
10973 return 0;
10974 }
10975
10976 override void SetCleanness(
int value,
bool allow_client =
false)
10977 {
10978 if (!IsServerCheck(allow_client))
10979 return;
10980
10982
10984
10987 }
10988
10990 {
10992 }
10993
10995 {
10996 return true;
10997 }
10998
10999
11000
11001
11003 {
11005 }
11006
11008 {
11010 }
11011
11012
11013
11014
11015 override void SetColor(
int r,
int g,
int b,
int a)
11016 {
11022 }
11024 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11025 {
11030 }
11031
11033 {
11035 }
11036
11039 {
11040 int r,g,b,a;
11042 r = r/255;
11043 g = g/255;
11044 b = b/255;
11045 a = a/255;
11046 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11047 }
11048
11049
11050
11051 override void SetLiquidType(
int value,
bool allow_client =
false)
11052 {
11053 if (!IsServerCheck(allow_client))
11054 return;
11055
11060 }
11061
11063 {
11064 return ConfigGetInt("varLiquidTypeInit");
11065 }
11066
11068 {
11070 }
11071
11073 {
11075 SetFrozen(false);
11076 }
11077
11080 {
11081 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11082 }
11083
11084
11087 {
11088 PlayerBase nplayer;
11089 if (PlayerBase.CastTo(nplayer, player))
11090 {
11092 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11093 }
11094 }
11095
11096
11099 {
11100 PlayerBase nplayer;
11101 if (PlayerBase.CastTo(nplayer,player))
11102 {
11103 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11104 }
11105
11106 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11107
11108 if (HasEnergyManager())
11109 {
11110 GetCompEM().UpdatePlugState();
11111 }
11112 }
11113
11114
11116 {
11117 super.OnPlacementStarted(player);
11118
11120 }
11121
11122 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11123 {
11125 {
11126 m_AdminLog.OnPlacementComplete(player,
this);
11127 }
11128
11129 super.OnPlacementComplete(player, position, orientation);
11130 }
11131
11132
11133
11134
11135
11137 {
11139 {
11140 return true;
11141 }
11142 else
11143 {
11144 return false;
11145 }
11146 }
11147
11148
11150 {
11152 {
11154 }
11155 }
11156
11157
11159 {
11161 }
11162
11164 {
11166 }
11167
11168 override void InsertAgent(
int agent,
float count = 1)
11169 {
11170 if (count < 1)
11171 return;
11172
11174 }
11175
11178 {
11180 }
11181
11182
11184 {
11186 }
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11230 {
11232 return false;
11233 return true;
11234 }
11235
11237 {
11238
11240 }
11241
11242
11245 {
11246 super.CheckForRoofLimited(timeTresholdMS);
11247
11248 float time =
g_Game.GetTime();
11249 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11250 {
11251 m_PreviousRoofTestTime = time;
11252 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11253 }
11254 }
11255
11256
11258 {
11260 {
11261 return 0;
11262 }
11263
11264 if (GetInventory().GetAttachmentSlotsCount() != 0)
11265 {
11266 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11267 if (filter)
11268 return filter.GetProtectionLevel(type, false, system);
11269 else
11270 return 0;
11271 }
11272
11273 string subclassPath, entryName;
11274
11275 switch (type)
11276 {
11278 entryName = "biological";
11279 break;
11281 entryName = "chemical";
11282 break;
11283 default:
11284 entryName = "biological";
11285 break;
11286 }
11287
11288 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11289
11290 return g_Game.ConfigGetFloat(subclassPath + entryName);
11291 }
11292
11293
11294
11297 {
11298 if (!IsMagazine())
11300
11302 }
11303
11304
11305
11306
11307
11312 {
11313 return true;
11314 }
11315
11317 {
11319 }
11320
11321
11322
11323
11324
11326 {
11327 if (parent)
11328 {
11329 if (parent.IsInherited(DayZInfected))
11330 return true;
11331
11332 if (!parent.IsRuined())
11333 return true;
11334 }
11335
11336 return true;
11337 }
11338
11340 {
11341 if (!super.CanPutAsAttachment(parent))
11342 {
11343 return false;
11344 }
11345
11346 if (!IsRuined() && !parent.IsRuined())
11347 {
11348 return true;
11349 }
11350
11351 return false;
11352 }
11353
11355 {
11356
11357
11358
11359
11360 return super.CanReceiveItemIntoCargo(item);
11361 }
11362
11364 {
11365
11366
11367
11368
11369 GameInventory attachmentInv = attachment.GetInventory();
11371 {
11372 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11373 return false;
11374 }
11375
11376 InventoryLocation loc = new InventoryLocation();
11377 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11378 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11379 return false;
11380
11381 return super.CanReceiveAttachment(attachment, slotId);
11382 }
11383
11385 {
11386 if (!super.CanReleaseAttachment(attachment))
11387 return false;
11388
11389 return GetInventory().AreChildrenAccessible();
11390 }
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11413 {
11414 int id = muzzle_owner.GetMuzzleID();
11415 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11416
11417 if (WPOF_array)
11418 {
11419 for (int i = 0; i < WPOF_array.Count(); i++)
11420 {
11421 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11422
11423 if (WPOF)
11424 {
11425 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11426 }
11427 }
11428 }
11429 }
11430
11431
11433 {
11434 int id = muzzle_owner.GetMuzzleID();
11436
11437 if (WPOBE_array)
11438 {
11439 for (int i = 0; i < WPOBE_array.Count(); i++)
11440 {
11441 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11442
11443 if (WPOBE)
11444 {
11445 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11446 }
11447 }
11448 }
11449 }
11450
11451
11453 {
11454 int id = muzzle_owner.GetMuzzleID();
11455 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11456
11457 if (WPOOH_array)
11458 {
11459 for (int i = 0; i < WPOOH_array.Count(); i++)
11460 {
11461 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11462
11463 if (WPOOH)
11464 {
11465 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11466 }
11467 }
11468 }
11469 }
11470
11471
11473 {
11474 int id = muzzle_owner.GetMuzzleID();
11475 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11476
11477 if (WPOOH_array)
11478 {
11479 for (int i = 0; i < WPOOH_array.Count(); i++)
11480 {
11481 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11482
11483 if (WPOOH)
11484 {
11485 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11486 }
11487 }
11488 }
11489 }
11490
11491
11493 {
11494 int id = muzzle_owner.GetMuzzleID();
11495 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11496
11497 if (WPOOH_array)
11498 {
11499 for (int i = 0; i < WPOOH_array.Count(); i++)
11500 {
11501 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11502
11503 if (WPOOH)
11504 {
11505 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11506 }
11507 }
11508 }
11509 }
11510
11511
11512
11514 {
11516 {
11517 return true;
11518 }
11519
11520 return false;
11521 }
11522
11524 {
11526 {
11527 return true;
11528 }
11529
11530 return false;
11531 }
11532
11534 {
11536 {
11537 return true;
11538 }
11539
11540 return false;
11541 }
11542
11544 {
11545 return false;
11546 }
11547
11550 {
11551 return UATimeSpent.DEFAULT_DEPLOY;
11552 }
11553
11554
11555
11556
11558 {
11560 SetSynchDirty();
11561 }
11562
11564 {
11566 }
11567
11568
11570 {
11571 return false;
11572 }
11573
11576 {
11577 string att_type = "None";
11578
11579 if (ConfigIsExisting("soundAttType"))
11580 {
11581 att_type = ConfigGetString("soundAttType");
11582 }
11583
11585 }
11586
11588 {
11590 }
11591
11592
11593
11594
11595
11601
11603 {
11606
11608 }
11609
11610
11612 {
11614 return;
11615
11617
11620
11623
11624 SoundParameters params = new SoundParameters();
11628 }
11629
11630
11632 {
11634 {
11637
11638 SetSynchDirty();
11639
11642 }
11643 }
11644
11646 {
11648 }
11649
11650
11652 {
11654 return;
11655
11657 SetSynchDirty();
11658
11661 }
11662
11664 {
11667 }
11668
11670 {
11672 }
11673
11674 void OnApply(PlayerBase player);
11675
11677 {
11678 return 1.0;
11679 };
11680
11682 {
11684 }
11685
11687 {
11689 }
11690
11692
11694 {
11695 SetDynamicPhysicsLifeTime(0.01);
11697 }
11698
11700 {
11701 array<string> zone_names = new array<string>;
11702 GetDamageZones(zone_names);
11703 for (int i = 0; i < zone_names.Count(); i++)
11704 {
11705 SetHealthMax(zone_names.Get(i),"Health");
11706 }
11707 SetHealthMax("","Health");
11708 }
11709
11712 {
11713 float global_health = GetHealth01("","Health");
11714 array<string> zones = new array<string>;
11715 GetDamageZones(zones);
11716
11717 for (int i = 0; i < zones.Count(); i++)
11718 {
11719 SetHealth01(zones.Get(i),"Health",global_health);
11720 }
11721 }
11722
11725 {
11726 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11727 }
11728
11730 {
11731 if (!hasRootAsPlayer)
11732 {
11733 if (refParentIB)
11734 {
11735
11736 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11737 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11738
11739 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11740 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11741
11744 }
11745 else
11746 {
11747
11750 }
11751 }
11752 }
11753
11755 {
11757 {
11758 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11759 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11760 {
11761 float heatPermCoef = 1.0;
11763 while (ent)
11764 {
11765 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11766 ent = ent.GetHierarchyParent();
11767 }
11768
11769 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11770 }
11771 }
11772 }
11773
11775 {
11776
11777 EntityAI parent = GetHierarchyParent();
11778 if (!parent)
11779 {
11780 hasParent = false;
11781 hasRootAsPlayer = false;
11782 }
11783 else
11784 {
11785 hasParent = true;
11786 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11787 refParentIB =
ItemBase.Cast(parent);
11788 }
11789 }
11790
11791 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11792 {
11793
11794 }
11795
11797 {
11798
11799 return false;
11800 }
11801
11803 {
11804
11805
11806 return false;
11807 }
11808
11810 {
11811
11812 return false;
11813 }
11814
11817 {
11818 return !GetIsFrozen() &&
IsOpen();
11819 }
11820
11822 {
11823 bool hasParent = false, hasRootAsPlayer = false;
11825
11826 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11827 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11828
11829 if (wwtu || foodDecay)
11830 {
11834
11835 if (processWetness || processTemperature || processDecay)
11836 {
11838
11839 if (processWetness)
11840 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11841
11842 if (processTemperature)
11844
11845 if (processDecay)
11846 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11847 }
11848 }
11849 }
11850
11853 {
11855 }
11856
11858 {
11861
11862 return super.GetTemperatureFreezeThreshold();
11863 }
11864
11866 {
11869
11870 return super.GetTemperatureThawThreshold();
11871 }
11872
11874 {
11877
11878 return super.GetItemOverheatThreshold();
11879 }
11880
11882 {
11884 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11885
11886 return super.GetTemperatureFreezeTime();
11887 }
11888
11890 {
11892 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11893
11894 return super.GetTemperatureThawTime();
11895 }
11896
11901
11903 {
11904 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11905 }
11906
11908 {
11909 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11910 }
11911
11914 {
11916 }
11917
11919 {
11921 }
11922
11924 {
11926 }
11927
11930 {
11931 return null;
11932 }
11933
11936 {
11937 return false;
11938 }
11939
11941 {
11943 {
11946 if (!trg)
11947 {
11949 explosive = this;
11950 }
11951
11952 explosive.PairRemote(trg);
11954
11955 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11956 trg.SetPersistentPairID(persistentID);
11957 explosive.SetPersistentPairID(persistentID);
11958
11959 return true;
11960 }
11961 return false;
11962 }
11963
11966 {
11967 float ret = 1.0;
11970 ret *= GetHealth01();
11971
11972 return ret;
11973 }
11974
11975 #ifdef DEVELOPER
11976 override void SetDebugItem()
11977 {
11978 super.SetDebugItem();
11979 _itemBase = this;
11980 }
11981
11983 {
11984 string text = super.GetDebugText();
11985
11987 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11988
11989 return text;
11990 }
11991 #endif
11992
11994 {
11995 return true;
11996 }
11997
11999
12001
12003 {
12006 }
12007
12008
12016
12032
12033 [
Obsolete(
"Use ItemSoundHandler instead")]
12036 {
12037 if (!
g_Game.IsDedicatedServer())
12038 {
12039 if (ConfigIsExisting("attachSoundSet"))
12040 {
12041 string cfg_path = "";
12042 string soundset = "";
12043 string type_name =
GetType();
12044
12047 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12048 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12049
12050 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12051 {
12052 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12053 {
12054 if (cfg_slot_array[i] == slot_type)
12055 {
12056 soundset = cfg_soundset_array[i];
12057 break;
12058 }
12059 }
12060 }
12061
12062 if (soundset != "")
12063 {
12064 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12066 }
12067 }
12068 }
12069 }
12070
12072}
12073
12075{
12077 if (entity)
12078 {
12079 bool is_item = entity.IsInherited(
ItemBase);
12080 if (is_item && full_quantity)
12081 {
12084 }
12085 }
12086 else
12087 {
12089 return NULL;
12090 }
12091 return entity;
12092}
12093
12095{
12096 if (item)
12097 {
12098 if (health > 0)
12099 item.SetHealth("", "", health);
12100
12101 if (item.CanHaveTemperature())
12102 {
12104 if (item.CanFreeze())
12105 item.SetFrozen(false);
12106 }
12107
12108 if (item.HasEnergyManager())
12109 {
12110 if (quantity >= 0)
12111 {
12112 item.GetCompEM().SetEnergy0To1(quantity);
12113 }
12114 else
12115 {
12117 }
12118 }
12119 else if (item.IsMagazine())
12120 {
12121 Magazine mag = Magazine.Cast(item);
12122 if (quantity >= 0)
12123 {
12124 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12125 }
12126 else
12127 {
12129 }
12130
12131 }
12132 else
12133 {
12134 if (quantity >= 0)
12135 {
12136 item.SetQuantityNormalized(quantity, false);
12137 }
12138 else
12139 {
12141 }
12142
12143 }
12144 }
12145}
12146
12147#ifdef DEVELOPER
12149#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.