7229{
7231 {
7232 return true;
7233 }
7234};
7235
7237{
7238
7239};
7240
7241
7242
7244{
7248
7250
7253
7254
7255
7256
7257
7266
7272
7277
7282
7303 protected bool m_IsResultOfSplit
7304
7306
7311
7312
7313
7315
7319
7320
7321
7323
7326
7327
7328
7334
7335
7343
7346
7347
7349
7350
7352
7353
7358
7359
7364
7366
7367
7369
7370
7372 {
7377
7378 if (!
g_Game.IsDedicatedServer())
7379 {
7381 {
7383
7385 {
7387 }
7388 }
7389
7392 }
7393
7394 m_OldLocation = null;
7395
7397 {
7399 }
7400
7401 if (ConfigIsExisting("headSelectionsToHide"))
7402 {
7405 }
7406
7408 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7409 {
7411 }
7412
7414
7415 m_IsResultOfSplit = false;
7416
7418 }
7419
7421 {
7422 super.InitItemVariables();
7423
7429 m_Count = ConfigGetInt(
"count");
7430
7433
7438
7441
7446
7458
7462
7463
7466 if (ConfigIsExisting("canBeSplit"))
7467 {
7470 }
7471
7473 if (ConfigIsExisting("itemBehaviour"))
7475
7476
7479 RegisterNetSyncVariableInt("m_VarLiquidType");
7480 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7481
7482 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7483 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7484 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7485
7486 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7487 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7488 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7489 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7490
7491 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7492 RegisterNetSyncVariableBool("m_IsTakeable");
7493 RegisterNetSyncVariableBool("m_IsHologram");
7494
7497 {
7500 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7501 }
7502
7504
7506 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7508
7510 }
7511
7513 {
7515 }
7516
7518 {
7521 {
7526 }
7527 }
7528
7529 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7530 {
7532 {
7535 }
7536
7538 }
7539
7541 {
7547 }
7548
7550
7552 {
7554
7555 if (!action)
7556 {
7557 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7558 return;
7559 }
7560
7562 if (!ai)
7563 {
7565 return;
7566 }
7567
7569 if (!action_array)
7570 {
7571 action_array = new array<ActionBase_Basic>;
7573 }
7574 if (LogManager.IsActionLogEnable())
7575 {
7576 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7577 }
7578
7579 if (action_array.Find(action) != -1)
7580 {
7581 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7582 }
7583 else
7584 {
7585 action_array.Insert(action);
7586 }
7587 }
7588
7590 {
7591 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7592 ActionBase action = player.GetActionManager().GetAction(actionName);
7595
7596 if (action_array)
7597 {
7598 action_array.RemoveItem(action);
7599 }
7600 }
7601
7602
7603
7605 {
7606 ActionOverrideData overrideData = new ActionOverrideData();
7610
7612 if (!actionMap)
7613 {
7616 }
7617
7618 actionMap.Insert(this.
Type(), overrideData);
7619
7620 }
7621
7623
7625
7626
7628 {
7631
7634
7635 string config_to_search = "CfgVehicles";
7636 string muzzle_owner_config;
7637
7639 {
7640 if (IsInherited(Weapon))
7641 config_to_search = "CfgWeapons";
7642
7643 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7644
7645 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7646
7647 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7648
7649 if (config_OnFire_subclass_count > 0)
7650 {
7651 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7652
7653 for (int i = 0; i < config_OnFire_subclass_count; i++)
7654 {
7655 string particle_class = "";
7656 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7657 string config_OnFire_entry = config_OnFire_class + particle_class;
7658 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7659 WPOF_array.Insert(WPOF);
7660 }
7661
7662
7664 }
7665 }
7666
7668 {
7669 config_to_search = "CfgWeapons";
7670 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7671
7672 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7673
7674 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7675
7676 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7677 {
7678 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7679
7680 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7681 {
7682 string particle_class2 = "";
7683 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7684 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7685 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7686 WPOBE_array.Insert(WPOBE);
7687 }
7688
7689
7691 }
7692 }
7693 }
7694
7695
7697 {
7700
7702 {
7703 string config_to_search = "CfgVehicles";
7704
7705 if (IsInherited(Weapon))
7706 config_to_search = "CfgWeapons";
7707
7708 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7709 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7710
7711 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7712 {
7713
7715
7717 {
7719 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7721 return;
7722 }
7723
7726
7727
7728
7729 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7730 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7731
7732 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7733 {
7734 string particle_class = "";
7735 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7736 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7737 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7738
7739 if (entry_type == CT_CLASS)
7740 {
7741 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7742 WPOOH_array.Insert(WPOF);
7743 }
7744 }
7745
7746
7748 }
7749 }
7750 }
7751
7753 {
7755 }
7756
7758 {
7760 {
7762
7765
7768
7769 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7770 }
7771 }
7772
7774 {
7776 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7777
7779 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7780
7782 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7783
7785 {
7787 }
7788 }
7789
7791 {
7793 }
7794
7796 {
7799 else
7801
7803 {
7806 }
7807 else
7808 {
7811
7814 }
7815
7817 }
7818
7820 {
7822 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7823 }
7824
7826 {
7828 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7830 }
7831
7833 {
7835 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7836 }
7837
7839 {
7842
7843 OverheatingParticle OP = new OverheatingParticle();
7848
7850 }
7851
7853 {
7856
7857 return -1;
7858 }
7859
7861 {
7863 {
7866
7867 for (int i = count; i > 0; --i)
7868 {
7869 int id = i - 1;
7872
7875
7876 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7877 {
7878 if (p)
7879 {
7882 }
7883 }
7884 }
7885 }
7886 }
7887
7889 {
7891 {
7893 {
7894 int id = i - 1;
7896
7897 if (OP)
7898 {
7900
7901 if (p)
7902 {
7904 }
7905
7906 delete OP;
7907 }
7908 }
7909
7912 }
7913 }
7914
7917 {
7918 return 0.0;
7919 }
7920
7921
7923 {
7924 return 250;
7925 }
7926
7928 {
7929 return 0;
7930 }
7931
7934 {
7936 return true;
7937
7938 return false;
7939 }
7940
7943 {
7946
7948 {
7950 }
7951 else
7952 {
7953
7955 }
7956
7958 }
7959
7966 {
7967 return -1;
7968 }
7969
7970
7971
7972
7974 {
7976 {
7977 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7978 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7979
7980 if (r_index >= 0)
7981 {
7982 InventoryLocation r_il = new InventoryLocation;
7983 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7984
7985 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7988 {
7989 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7990 }
7992 {
7993 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7994 }
7995
7996 }
7997
7998 player.GetHumanInventory().ClearUserReservedLocation(this);
7999 }
8000
8003 }
8004
8005
8006
8007
8009 {
8010 return ItemBase.m_DebugActionsMask;
8011 }
8012
8014 {
8015 return ItemBase.m_DebugActionsMask & mask;
8016 }
8017
8019 {
8020 ItemBase.m_DebugActionsMask = mask;
8021 }
8022
8024 {
8025 ItemBase.m_DebugActionsMask |= mask;
8026 }
8027
8029 {
8030 ItemBase.m_DebugActionsMask &= ~mask;
8031 }
8032
8034 {
8036 {
8038 }
8039 else
8040 {
8042 }
8043 }
8044
8045
8047 {
8048 if (GetEconomyProfile())
8049 {
8050 float q_max = GetEconomyProfile().GetQuantityMax();
8051 if (q_max > 0)
8052 {
8053 float q_min = GetEconomyProfile().GetQuantityMin();
8054 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8055
8057 {
8058 ComponentEnergyManager comp = GetCompEM();
8060 {
8062 }
8063 }
8065 {
8067
8068 }
8069
8070 }
8071 }
8072 }
8073
8076 {
8077 EntityAI parent = GetHierarchyParent();
8078
8079 if (parent)
8080 {
8081 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8082 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8083 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8084 }
8085 }
8086
8089 {
8090 EntityAI parent = GetHierarchyParent();
8091
8092 if (parent)
8093 {
8094 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8095 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8096 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8097 }
8098 }
8099
8101 {
8102
8103
8104
8105
8107
8109 {
8110 if (ScriptInputUserData.CanStoreInputUserData())
8111 {
8112 ScriptInputUserData ctx = new ScriptInputUserData;
8118 ctx.
Write(use_stack_max);
8121
8123 {
8124 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8125 }
8126 }
8127 }
8128 else if (!
g_Game.IsMultiplayer())
8129 {
8131 }
8132 }
8133
8135 {
8137 }
8138
8140 {
8142 }
8143
8145 {
8147 }
8148
8150 {
8151
8152 return false;
8153 }
8154
8156 {
8157 return false;
8158 }
8159
8163 {
8164 return false;
8165 }
8166
8168 {
8169 return "";
8170 }
8171
8173
8175 {
8176 return false;
8177 }
8178
8180 {
8181 return true;
8182 }
8183
8184
8185
8187 {
8188 return true;
8189 }
8190
8192 {
8193 return true;
8194 }
8195
8197 {
8198 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8200 }
8201
8203 {
8205 }
8206
8208 {
8210 if (!is_being_placed)
8212 SetSynchDirty();
8213 }
8214
8215
8217
8219 {
8221 }
8222
8224 {
8226 }
8227
8229 {
8230 return 1;
8231 }
8232
8234 {
8235 return false;
8236 }
8237
8239 {
8241 SetSynchDirty();
8242 }
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8279 {
8280 super.OnMovedInsideCargo(container);
8281
8282 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8283 }
8284
8285 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8286 {
8287 super.EEItemLocationChanged(oldLoc, newLoc);
8288
8289 PlayerBase newPlayer = null;
8290 PlayerBase oldPlayer = null;
8291
8292 if (newLoc.GetParent())
8293 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8294
8295 if (oldLoc.GetParent())
8296 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8297
8299 {
8300 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8301
8302 if (rIndex >= 0)
8303 {
8304 InventoryLocation rIl = new InventoryLocation;
8305 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8306
8307 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8310 {
8311 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8312 }
8314 {
8316 }
8317
8318 }
8319 }
8320
8322 {
8323 if (newPlayer)
8324 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8325
8326 if (newPlayer == oldPlayer)
8327 {
8328 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8329 {
8331 {
8332 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8333 {
8334 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8335 }
8336 }
8337 else
8338 {
8339 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8340 }
8341 }
8342
8343 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8344 {
8345 int type = oldLoc.GetType();
8347 {
8348 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8349 }
8351 {
8352 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8353 }
8354 }
8355 if (!m_OldLocation)
8356 {
8357 m_OldLocation = new InventoryLocation;
8358 }
8359 m_OldLocation.Copy(oldLoc);
8360 }
8361 else
8362 {
8363 if (m_OldLocation)
8364 {
8365 m_OldLocation.Reset();
8366 }
8367 }
8368
8369 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8370 }
8371 else
8372 {
8373 if (newPlayer)
8374 {
8375 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8376 if (resIndex >= 0)
8377 {
8378 InventoryLocation il = new InventoryLocation;
8379 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8381 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8384 {
8385 il.
GetParent().GetOnReleaseLock().Invoke(it);
8386 }
8388 {
8390 }
8391
8392 }
8393 }
8395 {
8396
8398 }
8399
8400 if (m_OldLocation)
8401 {
8402 m_OldLocation.Reset();
8403 }
8404 }
8405
8407 {
8408 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8409 }
8410
8412 {
8413 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8414 }
8415 }
8416
8417 override void EOnContact(IEntity other, Contact extra)
8418 {
8420 {
8421 int liquidType = -1;
8423 if (impactSpeed > 0.0)
8424 {
8426 #ifndef SERVER
8428 #else
8430 SetSynchDirty();
8431 #endif
8433 }
8434 }
8435
8436 #ifdef SERVER
8437 if (GetCompEM() && GetCompEM().IsPlugged())
8438 {
8439 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8440 GetCompEM().UnplugThis();
8441 }
8442 #endif
8443 }
8444
8446
8448 {
8450 }
8451
8453 {
8454
8455 }
8456
8458 {
8459 super.OnItemLocationChanged(old_owner, new_owner);
8460
8461 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8462 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8463
8464 if (!relatedPlayer && playerNew)
8465 relatedPlayer = playerNew;
8466
8467 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8468 {
8470 if (actionMgr)
8471 {
8472 ActionBase currentAction = actionMgr.GetRunningAction();
8473 if (currentAction)
8475 }
8476 }
8477
8478 Man ownerPlayerOld = null;
8479 Man ownerPlayerNew = null;
8480
8481 if (old_owner)
8482 {
8483 if (old_owner.
IsMan())
8484 {
8485 ownerPlayerOld = Man.Cast(old_owner);
8486 }
8487 else
8488 {
8489 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8490 }
8491 }
8492 else
8493 {
8495 {
8497
8498 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8499 {
8500 GetCompEM().UnplugThis();
8501 }
8502 }
8503 }
8504
8505 if (new_owner)
8506 {
8507 if (new_owner.
IsMan())
8508 {
8509 ownerPlayerNew = Man.Cast(new_owner);
8510 }
8511 else
8512 {
8513 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8514 }
8515 }
8516
8517 if (ownerPlayerOld != ownerPlayerNew)
8518 {
8519 if (ownerPlayerOld)
8520 {
8521 array<EntityAI> subItemsExit = new array<EntityAI>;
8523 for (int i = 0; i < subItemsExit.Count(); i++)
8524 {
8527 }
8528 }
8529
8530 if (ownerPlayerNew)
8531 {
8532 array<EntityAI> subItemsEnter = new array<EntityAI>;
8534 for (int j = 0; j < subItemsEnter.Count(); j++)
8535 {
8538 }
8539 }
8540 }
8541 else if (ownerPlayerNew != null)
8542 {
8543 PlayerBase nplayer;
8544 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8545 {
8546 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8548 for (int k = 0; k < subItemsUpdate.Count(); k++)
8549 {
8551 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8552 }
8553 }
8554 }
8555
8556 if (old_owner)
8557 old_owner.OnChildItemRemoved(this);
8558 if (new_owner)
8559 new_owner.OnChildItemReceived(this);
8560 }
8561
8562
8564 {
8565 super.EEDelete(parent);
8566 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8567 if (player)
8568 {
8570
8571 if (player.IsAlive())
8572 {
8573 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8574 if (r_index >= 0)
8575 {
8576 InventoryLocation r_il = new InventoryLocation;
8577 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8578
8579 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8582 {
8583 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8584 }
8586 {
8587 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8588 }
8589
8590 }
8591
8592 player.RemoveQuickBarEntityShortcut(this);
8593 }
8594 }
8595 }
8596
8598 {
8599 super.EEKilled(killer);
8600
8603 {
8604 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8605 {
8606 if (IsMagazine())
8607 {
8608 if (Magazine.Cast(this).GetAmmoCount() > 0)
8609 {
8611 }
8612 }
8613 else
8614 {
8616 }
8617 }
8618 }
8619 }
8620
8622 {
8623 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8624
8625 super.OnWasAttached(parent, slot_id);
8626
8629
8632 }
8633
8635 {
8636 super.OnWasDetached(parent, slot_id);
8637
8640
8643 }
8644
8646 {
8647 int idx;
8650
8651 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8652 if (inventory_slots.Count() < 1)
8653 {
8654 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8655 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8656 }
8657 else
8658 {
8659 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8660 }
8661
8662 idx = inventory_slots.Find(slot);
8663 if (idx < 0)
8664 return "";
8665
8666 return attach_types.Get(idx);
8667 }
8668
8670 {
8671 int idx = -1;
8672 string slot;
8673
8676
8677 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8678 if (inventory_slots.Count() < 1)
8679 {
8680 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8681 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8682 }
8683 else
8684 {
8685 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8686 if (detach_types.Count() < 1)
8687 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8688 }
8689
8690 for (int i = 0; i < inventory_slots.Count(); i++)
8691 {
8692 slot = inventory_slots.Get(i);
8693 }
8694
8695 if (slot != "")
8696 {
8697 if (detach_types.Count() == 1)
8698 idx = 0;
8699 else
8700 idx = inventory_slots.Find(slot);
8701 }
8702 if (idx < 0)
8703 return "";
8704
8705 return detach_types.Get(idx);
8706 }
8707
8709 {
8710
8712
8713
8714 float min_time = 1;
8715 float max_time = 3;
8716 float delay = Math.RandomFloat(min_time, max_time);
8717
8718 explode_timer.Run(delay, this, "DoAmmoExplosion");
8719 }
8720
8722 {
8723 Magazine magazine = Magazine.Cast(this);
8724 int pop_sounds_count = 6;
8725 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8726
8727
8728 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8729 string sound_name = pop_sounds[ sound_idx ];
8730 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8731
8732
8733 magazine.ServerAddAmmoCount(-1);
8734
8735
8736 float min_temp_to_explode = 100;
8737
8738 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8739 {
8741 }
8742 }
8743
8744
8745 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8746 {
8747 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8748
8749 const int CHANCE_DAMAGE_CARGO = 4;
8750 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8751 const int CHANCE_DAMAGE_NOTHING = 2;
8752
8754 {
8755 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8756 int chances;
8757 int rnd;
8758
8759 if (GetInventory().GetCargo())
8760 {
8761 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8762 rnd = Math.RandomInt(0,chances);
8763
8764 if (rnd < CHANCE_DAMAGE_CARGO)
8765 {
8767 }
8768 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8769 {
8771 }
8772 }
8773 else
8774 {
8775 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8776 rnd = Math.RandomInt(0,chances);
8777
8778 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8779 {
8781 }
8782 }
8783 }
8784 }
8785
8787 {
8788 CargoBase cargo = GetInventory().GetCargo();
8789 if (cargo)
8790 {
8792 if (item_count > 0)
8793 {
8794 int random_pick = Math.RandomInt(0, item_count);
8796 if (!item.IsExplosive())
8797 {
8798 item.AddHealth("","",damage);
8799 return true;
8800 }
8801 }
8802 }
8803 return false;
8804 }
8805
8807 {
8808 GameInventory inventory = GetInventory();
8810 if (attachment_count > 0)
8811 {
8812 int random_pick = Math.RandomInt(0, attachment_count);
8814 if (!attachment.IsExplosive())
8815 {
8816 attachment.AddHealth("","",damage);
8817 return true;
8818 }
8819 }
8820 return false;
8821 }
8822
8824 {
8826 }
8827
8829 {
8831 return GetInventory().CanRemoveEntity();
8832
8833 return false;
8834 }
8835
8837 {
8838
8840 return false;
8841
8842
8844 return false;
8845
8846
8847
8849 if (delta == 0)
8850 return false;
8851
8852
8853 return true;
8854 }
8855
8857 {
8859 {
8860 if (ScriptInputUserData.CanStoreInputUserData())
8861 {
8862 ScriptInputUserData ctx = new ScriptInputUserData;
8867 ctx.
Write(destination_entity);
8871 }
8872 }
8873 else if (!
g_Game.IsMultiplayer())
8874 {
8876 }
8877 }
8878
8880 {
8881 float split_quantity_new;
8885 InventoryLocation loc = new InventoryLocation;
8886
8887 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8888 {
8890 split_quantity_new = stack_max;
8891 else
8893
8895 {
8896 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8897 if (new_item)
8898 {
8899 new_item.SetResultOfSplit(true);
8900 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8902 new_item.
SetQuantity(split_quantity_new,
false,
true);
8903 }
8904 }
8905 }
8906 else if (destination_entity && slot_id == -1)
8907 {
8908 if (quantity > stack_max)
8909 split_quantity_new = stack_max;
8910 else
8911 split_quantity_new = quantity;
8912
8914 {
8915 GameInventory destinationInventory = destination_entity.GetInventory();
8917 {
8920 }
8921
8922 if (new_item)
8923 {
8924 new_item.SetResultOfSplit(true);
8925 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8927 new_item.
SetQuantity(split_quantity_new,
false,
true);
8928 }
8929 }
8930 }
8931 else
8932 {
8933 if (stack_max != 0)
8934 {
8936 {
8938 }
8939
8940 if (split_quantity_new == 0)
8941 {
8942 if (!
g_Game.IsMultiplayer())
8943 player.PhysicalPredictiveDropItem(this);
8944 else
8945 player.ServerDropEntity(this);
8946 return;
8947 }
8948
8950 {
8952
8953 if (new_item)
8954 {
8955 new_item.SetResultOfSplit(true);
8956 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8959 new_item.PlaceOnSurface();
8960 }
8961 }
8962 }
8963 }
8964 }
8965
8967 {
8968 float split_quantity_new;
8972 InventoryLocation loc = new InventoryLocation;
8973
8974 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8975 {
8977 split_quantity_new = stack_max;
8978 else
8980
8982 {
8983 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8984 if (new_item)
8985 {
8986 new_item.SetResultOfSplit(true);
8987 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8989 new_item.
SetQuantity(split_quantity_new,
false,
true);
8990 }
8991 }
8992 }
8993 else if (destination_entity && slot_id == -1)
8994 {
8995 if (quantity > stack_max)
8996 split_quantity_new = stack_max;
8997 else
8998 split_quantity_new = quantity;
8999
9001 {
9002 GameInventory destinationInventory = destination_entity.GetInventory();
9004 {
9007 }
9008
9009 if (new_item)
9010 {
9011 new_item.SetResultOfSplit(true);
9012 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9014 new_item.
SetQuantity(split_quantity_new,
false,
true);
9015 }
9016 }
9017 }
9018 else
9019 {
9020 if (stack_max != 0)
9021 {
9023 {
9025 }
9026
9028 {
9030
9031 if (new_item)
9032 {
9033 new_item.SetResultOfSplit(true);
9034 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9037 new_item.PlaceOnSurface();
9038 }
9039 }
9040 }
9041 }
9042 }
9043
9045 {
9047 {
9048 if (ScriptInputUserData.CanStoreInputUserData())
9049 {
9050 ScriptInputUserData ctx = new ScriptInputUserData;
9055 dst.WriteToContext(ctx);
9057 }
9058 }
9059 else if (!
g_Game.IsMultiplayer())
9060 {
9062 }
9063 }
9064
9066 {
9068 {
9069 if (ScriptInputUserData.CanStoreInputUserData())
9070 {
9071 ScriptInputUserData ctx = new ScriptInputUserData;
9076 ctx.
Write(destination_entity);
9082 }
9083 }
9084 else if (!
g_Game.IsMultiplayer())
9085 {
9087 }
9088 }
9089
9091 {
9093 }
9094
9096 {
9098 float split_quantity_new;
9100 if (dst.IsValid())
9101 {
9102 int slot_id = dst.GetSlot();
9104
9105 if (quantity > stack_max)
9106 split_quantity_new = stack_max;
9107 else
9108 split_quantity_new = quantity;
9109
9111 {
9113
9114 if (new_item)
9115 {
9116 new_item.SetResultOfSplit(true);
9117 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9119 new_item.
SetQuantity(split_quantity_new,
false,
true);
9120 }
9121
9122 return new_item;
9123 }
9124 }
9125
9126 return null;
9127 }
9128
9130 {
9132 float split_quantity_new;
9134 if (destination_entity)
9135 {
9137 if (quantity > stackable)
9138 split_quantity_new = stackable;
9139 else
9140 split_quantity_new = quantity;
9141
9143 {
9144 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9145 if (new_item)
9146 {
9147 new_item.SetResultOfSplit(true);
9148 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9150 new_item.
SetQuantity(split_quantity_new,
false,
true);
9151 }
9152 }
9153 }
9154 }
9155
9157 {
9159 {
9160 if (ScriptInputUserData.CanStoreInputUserData())
9161 {
9162 ScriptInputUserData ctx = new ScriptInputUserData;
9167 ItemBase destination_entity =
this;
9168 ctx.
Write(destination_entity);
9172 }
9173 }
9174 else if (!
g_Game.IsMultiplayer())
9175 {
9177 }
9178 }
9179
9181 {
9183 float split_quantity_new;
9185 if (player)
9186 {
9188 if (quantity > stackable)
9189 split_quantity_new = stackable;
9190 else
9191 split_quantity_new = quantity;
9192
9194 {
9195 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9196 new_item =
ItemBase.Cast(in_hands);
9197 if (new_item)
9198 {
9199 new_item.SetResultOfSplit(true);
9200 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9202 new_item.SetQuantity(split_quantity_new, false, true);
9203 }
9204 }
9205 }
9206 }
9207
9209 {
9211 float split_quantity_new = Math.Floor(quantity * 0.5);
9212
9214 return;
9215
9217
9218 if (new_item)
9219 {
9220 if (new_item.GetQuantityMax() < split_quantity_new)
9221 {
9222 split_quantity_new = new_item.GetQuantityMax();
9223 }
9224
9225 new_item.SetResultOfSplit(true);
9226 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9227
9229 {
9232 }
9233 else
9234 {
9236 new_item.
SetQuantity(split_quantity_new,
false,
true);
9237 }
9238 }
9239 }
9240
9242 {
9244 float split_quantity_new = Math.Floor(quantity / 2);
9245
9247 return;
9248
9249 InventoryLocation invloc = new InventoryLocation;
9251
9253 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9254
9255 if (new_item)
9256 {
9257 if (new_item.GetQuantityMax() < split_quantity_new)
9258 {
9259 split_quantity_new = new_item.GetQuantityMax();
9260 }
9262 {
9265 }
9266 else if (split_quantity_new > 1)
9267 {
9269 new_item.
SetQuantity(split_quantity_new,
false,
true);
9270 }
9271 }
9272 }
9273
9276 {
9277 SetWeightDirty();
9279
9280 if (parent)
9281 parent.OnAttachmentQuantityChangedEx(this, delta);
9282
9284 {
9286 {
9288 }
9290 {
9291 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9293 }
9294 }
9295 }
9296
9299 {
9300
9301 }
9302
9305 {
9307 }
9308
9310 {
9311 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9312
9314 {
9315 if (newLevel == GameConstants.STATE_RUINED)
9316 {
9318 EntityAI parent = GetHierarchyParent();
9319 if (parent && parent.IsFireplace())
9320 {
9321 CargoBase cargo = GetInventory().GetCargo();
9322 if (cargo)
9323 {
9325 {
9327 }
9328 }
9329 }
9330 }
9331
9333 {
9334
9336 return;
9337 }
9338
9339 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9340 {
9342 }
9343 }
9344 }
9345
9346
9348 {
9349 super.OnRightClick();
9350
9352 {
9354 {
9355 if (ScriptInputUserData.CanStoreInputUserData())
9356 {
9357 EntityAI root = GetHierarchyRoot();
9358 Man playerOwner = GetHierarchyRootPlayer();
9359 InventoryLocation dst = new InventoryLocation;
9360
9361
9362 if (!playerOwner && root && root == this)
9363 {
9365 }
9366 else
9367 {
9368
9369 GetInventory().GetCurrentInventoryLocation(dst);
9371 {
9372 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9374 {
9376 }
9377 else
9378 {
9380
9381
9382 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9383 {
9385 }
9386 else
9387 {
9388 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9389 }
9390 }
9391 }
9392 }
9393
9394 ScriptInputUserData ctx = new ScriptInputUserData;
9402 }
9403 }
9404 else if (!
g_Game.IsMultiplayer())
9405 {
9407 }
9408 }
9409 }
9410
9412 {
9413 if (root)
9414 {
9415 vector m4[4];
9416 root.GetTransform(m4);
9417 dst.SetGround(this, m4);
9418 }
9419 else
9420 {
9421 GetInventory().GetCurrentInventoryLocation(dst);
9422 }
9423 }
9424
9425 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9426 {
9427
9428 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9429 return false;
9430
9431 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9432 return false;
9433
9434
9436 return false;
9437
9438
9439 Magazine mag = Magazine.Cast(this);
9440 if (mag)
9441 {
9442 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9443 return false;
9444
9445 if (stack_max_limit)
9446 {
9447 Magazine other_mag = Magazine.Cast(other_item);
9448 if (other_item)
9449 {
9450 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9451 return false;
9452 }
9453
9454 }
9455 }
9456 else
9457 {
9458
9460 return false;
9461
9463 return false;
9464 }
9465
9466 PlayerBase player = null;
9467 if (CastTo(player, GetHierarchyRootPlayer()))
9468 {
9469 if (player.GetInventory().HasAttachment(this))
9470 return false;
9471
9472 if (player.IsItemsToDelete())
9473 return false;
9474 }
9475
9476 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9477 return false;
9478
9479 int slotID;
9481 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9482 return false;
9483
9484 return true;
9485 }
9486
9488 {
9490 }
9491
9493 {
9494 return m_IsResultOfSplit;
9495 }
9496
9498 {
9499 m_IsResultOfSplit = value;
9500 }
9501
9503 {
9505 }
9506
9508 {
9509 float other_item_quantity = other_item.GetQuantity();
9510 float this_free_space;
9511
9513
9515
9516 if (other_item_quantity > this_free_space)
9517 {
9518 return this_free_space;
9519 }
9520 else
9521 {
9522 return other_item_quantity;
9523 }
9524 }
9525
9527 {
9529 }
9530
9532 {
9534 return;
9535
9536 if (!IsMagazine() && other_item)
9537 {
9539 if (quantity_used != 0)
9540 {
9541 float hp1 = GetHealth01("","");
9542 float hp2 = other_item.GetHealth01("","");
9543 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9544 hpResult = hpResult / (
GetQuantity() + quantity_used);
9545
9546 hpResult *= GetMaxHealth();
9547 Math.Round(hpResult);
9548 SetHealth("", "Health", hpResult);
9549
9551 other_item.AddQuantity(-quantity_used);
9552 }
9553 }
9555 }
9556
9558 {
9559 #ifdef SERVER
9560 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9561 GetHierarchyParent().IncreaseLifetimeUp();
9562 #endif
9563 };
9564
9566 {
9567 PlayerBase p = PlayerBase.Cast(player);
9568
9569 array<int> recipesIds = p.m_Recipes;
9570 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9571 if (moduleRecipesManager)
9572 {
9573 EntityAI itemInHands = player.GetEntityInHands();
9574 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9575 }
9576
9577 for (int i = 0;i < recipesIds.Count(); i++)
9578 {
9579 int key = recipesIds.Get(i);
9580 string recipeName = moduleRecipesManager.GetRecipeName(key);
9582 }
9583 }
9584
9585
9586 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9587 {
9588 super.GetDebugActions(outputList);
9589
9590
9596
9597
9602
9607
9608
9612
9613
9615 {
9619 }
9620
9623
9624
9628
9630
9631 InventoryLocation loc = new InventoryLocation();
9632 GetInventory().GetCurrentInventoryLocation(loc);
9634 {
9635 if (Gizmo_IsSupported())
9638 }
9639
9641 }
9642
9643
9644
9645
9647 {
9648 super.OnAction(action_id, player, ctx);
9649
9651 {
9652 switch (action_id)
9653 {
9657 return true;
9661 return true;
9662 }
9663 }
9664
9666 {
9667 switch (action_id)
9668 {
9670 Delete();
9671 return true;
9672 }
9673 }
9674
9675 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9676 {
9677 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9678 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9679 PlayerBase p = PlayerBase.Cast(player);
9680 if (
EActions.RECIPES_RANGE_START < 1000)
9681 {
9682 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9683 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9684 }
9685 }
9686 #ifndef SERVER
9687 else if (action_id ==
EActions.WATCH_PLAYER)
9688 {
9689 PluginDeveloper.SetDeveloperItemClientEx(player);
9690 }
9691 #endif
9693 {
9694 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9695 {
9696 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9697 OnDebugButtonPressServer(id + 1);
9698 }
9699
9700 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9701 {
9702 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9704 }
9705
9706 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9707 {
9708 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9710 }
9711
9712 else if (action_id ==
EActions.ADD_QUANTITY)
9713 {
9714 if (IsMagazine())
9715 {
9716 Magazine mag = Magazine.Cast(this);
9717 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9718 }
9719 else
9720 {
9722 }
9723
9724 if (m_EM)
9725 {
9726 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9727 }
9728
9729 }
9730
9731 else if (action_id ==
EActions.REMOVE_QUANTITY)
9732 {
9733 if (IsMagazine())
9734 {
9735 Magazine mag2 = Magazine.Cast(this);
9736 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9737 }
9738 else
9739 {
9741 }
9742 if (m_EM)
9743 {
9744 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9745 }
9746
9747 }
9748
9749 else if (action_id ==
EActions.SET_QUANTITY_0)
9750 {
9752
9753 if (m_EM)
9754 {
9755 m_EM.SetEnergy(0);
9756 }
9757 }
9758
9759 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9760 {
9762
9763 if (m_EM)
9764 {
9765 m_EM.SetEnergy(m_EM.GetEnergyMax());
9766 }
9767 }
9768
9769 else if (action_id ==
EActions.ADD_HEALTH)
9770 {
9771 AddHealth("","",GetMaxHealth("","Health")/5);
9772 }
9773 else if (action_id ==
EActions.REMOVE_HEALTH)
9774 {
9775 AddHealth("","",-GetMaxHealth("","Health")/5);
9776 }
9777 else if (action_id ==
EActions.DESTROY_HEALTH)
9778 {
9779 SetHealth01("","",0);
9780 }
9781 else if (action_id ==
EActions.WATCH_ITEM)
9782 {
9784 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9785 #ifdef DEVELOPER
9786 SetDebugDeveloper_item(this);
9787 #endif
9788 }
9789
9790 else if (action_id ==
EActions.ADD_TEMPERATURE)
9791 {
9792 AddTemperature(20);
9793
9794 }
9795
9796 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9797 {
9798 AddTemperature(-20);
9799
9800 }
9801
9802 else if (action_id ==
EActions.FLIP_FROZEN)
9803 {
9804 SetFrozen(!GetIsFrozen());
9805
9806 }
9807
9808 else if (action_id ==
EActions.ADD_WETNESS)
9809 {
9811
9812 }
9813
9814 else if (action_id ==
EActions.REMOVE_WETNESS)
9815 {
9817
9818 }
9819
9820 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9821 {
9824
9825
9826 }
9827
9828 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9829 {
9832 }
9833
9834 else if (action_id ==
EActions.MAKE_SPECIAL)
9835 {
9836 auto debugParams = DebugSpawnParams.WithPlayer(player);
9837 OnDebugSpawnEx(debugParams);
9838 }
9839
9840 }
9841
9842
9843 return false;
9844 }
9845
9846
9847
9848
9852
9855
9856
9857
9859 {
9860 return false;
9861 }
9862
9863
9865 {
9866 return true;
9867 }
9868
9869
9871 {
9872 return true;
9873 }
9874
9875
9876
9878 {
9879 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9880 return g_Game.ConfigIsExisting(config_path);
9881 }
9882
9885 {
9886 return null;
9887 }
9888
9890 {
9891 return false;
9892 }
9893
9895 {
9896 return false;
9897 }
9898
9902
9903
9905 {
9906 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9907 return module_repairing.CanRepair(this, item_repair_kit);
9908 }
9909
9910
9911 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9912 {
9913 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9914 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9915 }
9916
9917
9919 {
9920
9921
9922
9923
9924
9925
9926
9927
9928 return 1;
9929 }
9930
9931
9932
9934 {
9936 }
9937
9938
9939
9941 {
9943 }
9944
9945
9954 {
9955 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9956
9957 if (player)
9958 {
9959 player.MessageStatus(text);
9960 }
9961 }
9962
9963
9972 {
9973 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9974
9975 if (player)
9976 {
9977 player.MessageAction(text);
9978 }
9979 }
9980
9981
9990 {
9991 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9992
9993 if (player)
9994 {
9995 player.MessageFriendly(text);
9996 }
9997 }
9998
9999
10008 {
10009 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10010
10011 if (player)
10012 {
10013 player.MessageImportant(text);
10014 }
10015 }
10016
10018 {
10019 return true;
10020 }
10021
10022
10023 override bool KindOf(
string tag)
10024 {
10025 bool found = false;
10026 string item_name = this.
GetType();
10028 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10029
10030 int array_size = item_tag_array.Count();
10031 for (int i = 0; i < array_size; i++)
10032 {
10033 if (item_tag_array.Get(i) == tag)
10034 {
10035 found = true;
10036 break;
10037 }
10038 }
10039 return found;
10040 }
10041
10042
10044 {
10045
10046 super.OnRPC(sender, rpc_type,ctx);
10047
10048
10049 switch (rpc_type)
10050 {
10051 #ifndef SERVER
10052 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10053 Param2<bool, string> p = new Param2<bool, string>(false, "");
10054
10056 return;
10057
10058 bool play = p.param1;
10059 string soundSet = p.param2;
10060
10061 if (play)
10062 {
10064 {
10066 {
10068 }
10069 }
10070 else
10071 {
10073 }
10074 }
10075 else
10076 {
10078 }
10079
10080 break;
10081 #endif
10082
10083 }
10084
10086 {
10088 }
10089 }
10090
10091
10092
10093
10095 {
10096 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10097 return plugin.GetID(
name);
10098 }
10099
10101 {
10102 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10103 return plugin.GetName(id);
10104 }
10105
10108 {
10109
10110
10111 int varFlags;
10112 if (!ctx.
Read(varFlags))
10113 return;
10114
10115 if (varFlags & ItemVariableFlags.FLOAT)
10116 {
10118 }
10119 }
10120
10122 {
10123
10124 super.SerializeNumericalVars(floats_out);
10125
10126
10127
10129 {
10131 }
10132
10134 {
10136 }
10137
10139 {
10141 }
10142
10144 {
10149 }
10150
10152 {
10154 }
10155 }
10156
10158 {
10159
10160 super.DeSerializeNumericalVars(floats);
10161
10162
10163 int index = 0;
10164 int mask = Math.Round(floats.Get(index));
10165
10166 index++;
10167
10169 {
10171 {
10173 }
10174 else
10175 {
10176 float quantity = floats.Get(index);
10177 SetQuantity(quantity,
true,
false,
false,
false);
10178 }
10179 index++;
10180 }
10181
10183 {
10184 float wet = floats.Get(index);
10186 index++;
10187 }
10188
10190 {
10191 int liquidtype = Math.Round(floats.Get(index));
10193 index++;
10194 }
10195
10197 {
10199 index++;
10201 index++;
10203 index++;
10205 index++;
10206 }
10207
10209 {
10210 int cleanness = Math.Round(floats.Get(index));
10212 index++;
10213 }
10214 }
10215
10217 {
10218 super.WriteVarsToCTX(ctx);
10219
10220
10222 {
10224 }
10225
10227 {
10229 }
10230
10232 {
10234 }
10235
10237 {
10238 int r,g,b,a;
10244 }
10245
10247 {
10249 }
10250 }
10251
10253 {
10254 if (!super.ReadVarsFromCTX(ctx,version))
10255 return false;
10256
10257 int intValue;
10258 float value;
10259
10260 if (version < 140)
10261 {
10262 if (!ctx.
Read(intValue))
10263 return false;
10264
10265 m_VariablesMask = intValue;
10266 }
10267
10269 {
10270 if (!ctx.
Read(value))
10271 return false;
10272
10274 {
10276 }
10277 else
10278 {
10280 }
10281 }
10282
10283 if (version < 140)
10284 {
10286 {
10287 if (!ctx.
Read(value))
10288 return false;
10289 SetTemperatureDirect(value);
10290 }
10291 }
10292
10294 {
10295 if (!ctx.
Read(value))
10296 return false;
10298 }
10299
10301 {
10302 if (!ctx.
Read(intValue))
10303 return false;
10305 }
10306
10308 {
10309 int r,g,b,a;
10311 return false;
10313 return false;
10315 return false;
10317 return false;
10318
10320 }
10321
10323 {
10324 if (!ctx.
Read(intValue))
10325 return false;
10327 }
10328
10329 if (version >= 138 && version < 140)
10330 {
10332 {
10333 if (!ctx.
Read(intValue))
10334 return false;
10335 SetFrozen(intValue);
10336 }
10337 }
10338
10339 return true;
10340 }
10341
10342
10344 {
10347 {
10349 }
10350
10351 if (!super.OnStoreLoad(ctx, version))
10352 {
10354 return false;
10355 }
10356
10357 if (version >= 114)
10358 {
10359 bool hasQuickBarIndexSaved;
10360
10361 if (!ctx.
Read(hasQuickBarIndexSaved))
10362 {
10364 return false;
10365 }
10366
10367 if (hasQuickBarIndexSaved)
10368 {
10369 int itmQBIndex;
10370
10371
10372 if (!ctx.
Read(itmQBIndex))
10373 {
10375 return false;
10376 }
10377
10378 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10379 if (itmQBIndex != -1 && parentPlayer)
10380 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10381 }
10382 }
10383 else
10384 {
10385
10386 PlayerBase player;
10387 int itemQBIndex;
10388 if (version ==
int.
MAX)
10389 {
10390 if (!ctx.
Read(itemQBIndex))
10391 {
10393 return false;
10394 }
10395 }
10396 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10397 {
10398
10399 if (!ctx.
Read(itemQBIndex))
10400 {
10402 return false;
10403 }
10404 if (itemQBIndex != -1 && player)
10405 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10406 }
10407 }
10408
10409 if (version < 140)
10410 {
10411
10412 if (!LoadVariables(ctx, version))
10413 {
10415 return false;
10416 }
10417 }
10418
10419
10421 {
10423 return false;
10424 }
10425 if (version >= 132)
10426 {
10428 if (raib)
10429 {
10431 {
10433 return false;
10434 }
10435 }
10436 }
10437
10439 return true;
10440 }
10441
10442
10443
10445 {
10446 super.OnStoreSave(ctx);
10447
10448 PlayerBase player;
10449 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10450 {
10452
10453 int itemQBIndex = -1;
10454 itemQBIndex = player.FindQuickBarEntityIndex(this);
10455 ctx.
Write(itemQBIndex);
10456 }
10457 else
10458 {
10460 }
10461
10463
10465 if (raib)
10466 {
10468 }
10469 }
10470
10471
10473 {
10474 super.AfterStoreLoad();
10475
10477 {
10479 }
10480
10482 {
10485 }
10486 }
10487
10489 {
10490 super.EEOnAfterLoad();
10491
10493 {
10495 }
10496
10499 }
10500
10502 {
10503 return false;
10504 }
10505
10506
10507
10509 {
10511 {
10512 #ifdef PLATFORM_CONSOLE
10513
10515 {
10517 if (menu)
10518 {
10520 }
10521 }
10522 #endif
10523 }
10524
10526 {
10529 }
10530
10532 {
10533 SetWeightDirty();
10535 }
10537 {
10540 }
10541
10543 {
10546
10549 }
10551 {
10555 }
10556
10557 super.OnVariablesSynchronized();
10558 }
10559
10560
10561
10563 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10564 {
10565 if (!IsServerCheck(allow_client))
10566 return false;
10567
10569 return false;
10570
10573
10574 if (value <= (min + 0.001))
10575 value = min;
10576
10577 if (value == min)
10578 {
10579 if (destroy_config)
10580 {
10581 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10582 if (dstr)
10583 {
10585 this.Delete();
10586 return true;
10587 }
10588 }
10589 else if (destroy_forced)
10590 {
10592 this.Delete();
10593 return true;
10594 }
10595
10597 }
10598
10601
10603 {
10604 EntityAI parent = GetHierarchyRoot();
10605 InventoryLocation iLoc = new InventoryLocation();
10606 GetInventory().GetCurrentInventoryLocation(iLoc);
10608 {
10609 int iLocSlot = iLoc.
GetSlot();
10611 {
10613 }
10615 {
10617 }
10618 }
10619 }
10620
10622 {
10624
10625 if (delta)
10627 }
10628
10630
10631 return false;
10632 }
10633
10634
10636 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10637 {
10639 }
10640
10642 {
10645 }
10646
10648 {
10651 }
10652
10654 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10655 {
10656 float value_clamped = Math.Clamp(value, 0, 1);
10658 SetQuantity(result, destroy_config, destroy_forced);
10659 }
10660
10661
10664 {
10666 }
10667
10669 {
10671 }
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10683 {
10684 int slot = -1;
10685 GameInventory inventory = GetInventory();
10686 if (inventory)
10687 {
10688 InventoryLocation il = new InventoryLocation;
10691 }
10692
10694 }
10695
10697 {
10698 float quantity_max = 0;
10699
10701 {
10702 if (attSlotID != -1)
10703 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10704
10705 if (quantity_max <= 0)
10707 }
10708
10709 if (quantity_max <= 0)
10711
10712 return quantity_max;
10713 }
10714
10716 {
10718 }
10719
10721 {
10723 }
10724
10725
10727 {
10729 }
10730
10732 {
10734 }
10735
10737 {
10739 }
10740
10741
10743 {
10744
10745 float weightEx = GetWeightEx();
10746 float special = GetInventoryAndCargoWeight();
10747 return weightEx - special;
10748 }
10749
10750
10752 {
10754 }
10755
10757 {
10759 {
10760 #ifdef DEVELOPER
10761 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10762 {
10763 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10765 }
10766 #endif
10767
10768 return GetQuantity() * GetConfigWeightModified();
10769 }
10770 else if (HasEnergyManager())
10771 {
10772 #ifdef DEVELOPER
10773 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10774 {
10775 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10776 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10777 }
10778 #endif
10779 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10780 }
10781 else
10782 {
10783 #ifdef DEVELOPER
10784 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10785 {
10786 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10787 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10788 }
10789 #endif
10790 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10791 }
10792 }
10793
10796 {
10797 int item_count = 0;
10799
10800 GameInventory inventory = GetInventory();
10801 CargoBase cargo = inventory.
GetCargo();
10802 if (cargo != NULL)
10803 {
10805 }
10806
10808 for (int i = 0; i < nAttachments; ++i)
10809 {
10811 if (item)
10812 item_count += item.GetNumberOfItems();
10813 }
10814 return item_count;
10815 }
10816
10819 {
10820 float weight = 0;
10821 float wetness = 1;
10822 if (include_wetness)
10825 {
10826 weight = wetness * m_ConfigWeight;
10827 }
10829 {
10830 weight = 1;
10831 }
10832 return weight;
10833 }
10834
10835
10836
10838 {
10839 GameInventory inventory = GetInventory();
10840 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10841 {
10842 array<EntityAI> items = new array<EntityAI>;
10844 for (int i = 0; i < items.Count(); ++i)
10845 {
10847 if (item)
10848 {
10849 g_Game.ObjectDelete(item);
10850 }
10851 }
10852 }
10853 }
10854
10855
10856
10857
10859 {
10860 float energy = 0;
10861 if (HasEnergyManager())
10862 {
10863 energy = GetCompEM().GetEnergy();
10864 }
10865 return energy;
10866 }
10867
10868
10870 {
10871 super.OnEnergyConsumed();
10872
10874 }
10875
10877 {
10878 super.OnEnergyAdded();
10879
10881 }
10882
10883
10885 {
10886 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10887 {
10889 {
10890 float energy_0to1 = GetCompEM().GetEnergy0To1();
10892 }
10893 }
10894 }
10895
10896
10898 {
10899 return ConfigGetFloat("heatIsolation");
10900 }
10901
10903 {
10905 }
10906
10908 {
10909 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10910 if (
g_Game.ConfigIsExisting(paramPath))
10911 return g_Game.ConfigGetFloat(paramPath);
10912
10913 return 0.0;
10914 }
10915
10917 {
10918 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10919 if (
g_Game.ConfigIsExisting(paramPath))
10920 return g_Game.ConfigGetFloat(paramPath);
10921
10922 return 0.0;
10923 }
10924
10925 override void SetWet(
float value,
bool allow_client =
false)
10926 {
10927 if (!IsServerCheck(allow_client))
10928 return;
10929
10932
10934
10935 m_VarWet = Math.Clamp(value, min, max);
10936
10938 {
10941 }
10942 }
10943
10944 override void AddWet(
float value)
10945 {
10947 }
10948
10950 {
10952 }
10953
10955 {
10957 }
10958
10960 {
10962 }
10963
10965 {
10967 }
10968
10970 {
10972 }
10973
10974 override void OnWetChanged(
float newVal,
float oldVal)
10975 {
10978 if (newLevel != oldLevel)
10979 {
10981 }
10982 }
10983
10985 {
10986 SetWeightDirty();
10987 }
10988
10990 {
10991 return GetWetLevelInternal(
m_VarWet);
10992 }
10993
10994
10995
10997 {
10999 }
11000
11002 {
11004 }
11005
11007 {
11009 }
11010
11012 {
11014 }
11015
11016
11017
11019 {
11020 if (ConfigIsExisting("itemModelLength"))
11021 {
11022 return ConfigGetFloat("itemModelLength");
11023 }
11024 return 0;
11025 }
11026
11028 {
11029 if (ConfigIsExisting("itemAttachOffset"))
11030 {
11031 return ConfigGetFloat("itemAttachOffset");
11032 }
11033 return 0;
11034 }
11035
11036 override void SetCleanness(
int value,
bool allow_client =
false)
11037 {
11038 if (!IsServerCheck(allow_client))
11039 return;
11040
11042
11044
11047 }
11048
11050 {
11052 }
11053
11055 {
11056 return true;
11057 }
11058
11059
11060
11061
11063 {
11065 }
11066
11068 {
11070 }
11071
11072
11073
11074
11075 override void SetColor(
int r,
int g,
int b,
int a)
11076 {
11082 }
11084 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11085 {
11090 }
11091
11093 {
11095 }
11096
11099 {
11100 int r,g,b,a;
11102 r = r/255;
11103 g = g/255;
11104 b = b/255;
11105 a = a/255;
11106 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11107 }
11108
11109
11110
11111 override void SetLiquidType(
int value,
bool allow_client =
false)
11112 {
11113 if (!IsServerCheck(allow_client))
11114 return;
11115
11120 }
11121
11123 {
11124 return ConfigGetInt("varLiquidTypeInit");
11125 }
11126
11128 {
11130 }
11131
11133 {
11135 SetFrozen(false);
11136 }
11137
11140 {
11141 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11142 }
11143
11144
11147 {
11148 PlayerBase nplayer;
11149 if (PlayerBase.CastTo(nplayer, player))
11150 {
11152 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11153 }
11154 }
11155
11156
11159 {
11160 PlayerBase nplayer;
11161 if (PlayerBase.CastTo(nplayer,player))
11162 {
11163 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11164 }
11165
11166 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11167
11168 if (HasEnergyManager())
11169 {
11170 GetCompEM().UpdatePlugState();
11171 }
11172 }
11173
11174
11176 {
11177 super.OnPlacementStarted(player);
11178
11180 }
11181
11182 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11183 {
11185 {
11186 m_AdminLog.OnPlacementComplete(player,
this);
11187 }
11188
11189 super.OnPlacementComplete(player, position, orientation);
11190 }
11191
11192
11193
11194
11195
11197 {
11199 {
11200 return true;
11201 }
11202 else
11203 {
11204 return false;
11205 }
11206 }
11207
11208
11210 {
11212 {
11214 }
11215 }
11216
11217
11219 {
11221 }
11222
11224 {
11226 }
11227
11228 override void InsertAgent(
int agent,
float count = 1)
11229 {
11230 if (count < 1)
11231 return;
11232
11234 }
11235
11238 {
11240 }
11241
11242
11244 {
11246 }
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11290 {
11292 return false;
11293 return true;
11294 }
11295
11297 {
11298
11300 }
11301
11302
11305 {
11306 super.CheckForRoofLimited(timeTresholdMS);
11307
11308 float time =
g_Game.GetTime();
11309 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11310 {
11311 m_PreviousRoofTestTime = time;
11312 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11313 }
11314 }
11315
11316
11318 {
11320 {
11321 return 0;
11322 }
11323
11324 if (GetInventory().GetAttachmentSlotsCount() != 0)
11325 {
11326 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11327 if (filter)
11328 return filter.GetProtectionLevel(type, false, system);
11329 else
11330 return 0;
11331 }
11332
11333 string subclassPath, entryName;
11334
11335 switch (type)
11336 {
11338 entryName = "biological";
11339 break;
11341 entryName = "chemical";
11342 break;
11343 default:
11344 entryName = "biological";
11345 break;
11346 }
11347
11348 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11349
11350 return g_Game.ConfigGetFloat(subclassPath + entryName);
11351 }
11352
11353
11354
11357 {
11358 if (!IsMagazine())
11360
11362 }
11363
11364
11365
11366
11367
11372 {
11373 return true;
11374 }
11375
11377 {
11379 }
11380
11381
11382
11383
11384
11386 {
11387 if (parent)
11388 {
11389 if (parent.IsInherited(DayZInfected))
11390 return true;
11391
11392 if (!parent.IsRuined())
11393 return true;
11394 }
11395
11396 return true;
11397 }
11398
11400 {
11401 if (!super.CanPutAsAttachment(parent))
11402 {
11403 return false;
11404 }
11405
11406 if (!IsRuined() && !parent.IsRuined())
11407 {
11408 return true;
11409 }
11410
11411 return false;
11412 }
11413
11415 {
11416
11417
11418
11419
11420 return super.CanReceiveItemIntoCargo(item);
11421 }
11422
11424 {
11425
11426
11427
11428
11429 GameInventory attachmentInv = attachment.GetInventory();
11431 {
11432 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11433 return false;
11434 }
11435
11436 InventoryLocation loc = new InventoryLocation();
11437 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11438 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11439 return false;
11440
11441 return super.CanReceiveAttachment(attachment, slotId);
11442 }
11443
11445 {
11446 if (!super.CanReleaseAttachment(attachment))
11447 return false;
11448
11449 return GetInventory().AreChildrenAccessible();
11450 }
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11473 {
11474 int id = muzzle_owner.GetMuzzleID();
11475 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11476
11477 if (WPOF_array)
11478 {
11479 for (int i = 0; i < WPOF_array.Count(); i++)
11480 {
11481 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11482
11483 if (WPOF)
11484 {
11485 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11486 }
11487 }
11488 }
11489 }
11490
11491
11493 {
11494 int id = muzzle_owner.GetMuzzleID();
11496
11497 if (WPOBE_array)
11498 {
11499 for (int i = 0; i < WPOBE_array.Count(); i++)
11500 {
11501 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11502
11503 if (WPOBE)
11504 {
11505 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11506 }
11507 }
11508 }
11509 }
11510
11511
11513 {
11514 int id = muzzle_owner.GetMuzzleID();
11515 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11516
11517 if (WPOOH_array)
11518 {
11519 for (int i = 0; i < WPOOH_array.Count(); i++)
11520 {
11521 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11522
11523 if (WPOOH)
11524 {
11525 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11526 }
11527 }
11528 }
11529 }
11530
11531
11533 {
11534 int id = muzzle_owner.GetMuzzleID();
11535 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11536
11537 if (WPOOH_array)
11538 {
11539 for (int i = 0; i < WPOOH_array.Count(); i++)
11540 {
11541 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11542
11543 if (WPOOH)
11544 {
11545 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11546 }
11547 }
11548 }
11549 }
11550
11551
11553 {
11554 int id = muzzle_owner.GetMuzzleID();
11555 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11556
11557 if (WPOOH_array)
11558 {
11559 for (int i = 0; i < WPOOH_array.Count(); i++)
11560 {
11561 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11562
11563 if (WPOOH)
11564 {
11565 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11566 }
11567 }
11568 }
11569 }
11570
11571
11572
11574 {
11576 {
11577 return true;
11578 }
11579
11580 return false;
11581 }
11582
11584 {
11586 {
11587 return true;
11588 }
11589
11590 return false;
11591 }
11592
11594 {
11596 {
11597 return true;
11598 }
11599
11600 return false;
11601 }
11602
11604 {
11605 return false;
11606 }
11607
11610 {
11611 return UATimeSpent.DEFAULT_DEPLOY;
11612 }
11613
11614
11615
11616
11618 {
11620 SetSynchDirty();
11621 }
11622
11624 {
11626 }
11627
11628
11630 {
11631 return false;
11632 }
11633
11636 {
11637 string att_type = "None";
11638
11639 if (ConfigIsExisting("soundAttType"))
11640 {
11641 att_type = ConfigGetString("soundAttType");
11642 }
11643
11645 }
11646
11648 {
11650 }
11651
11652
11653
11654
11655
11661
11663 {
11666
11668 }
11669
11670
11672 {
11674 return;
11675
11677
11680
11683
11684 SoundParameters params = new SoundParameters();
11688 }
11689
11690
11692 {
11694 {
11697
11698 SetSynchDirty();
11699
11702 }
11703 }
11704
11706 {
11708 }
11709
11710
11712 {
11714 return;
11715
11717 SetSynchDirty();
11718
11721 }
11722
11724 {
11727 }
11728
11730 {
11732 }
11733
11734 void OnApply(PlayerBase player);
11735
11737 {
11738 return 1.0;
11739 };
11740
11742 {
11744 }
11745
11747 {
11749 }
11750
11752
11754 {
11755 SetDynamicPhysicsLifeTime(0.01);
11757 }
11758
11760 {
11761 array<string> zone_names = new array<string>;
11762 GetDamageZones(zone_names);
11763 for (int i = 0; i < zone_names.Count(); i++)
11764 {
11765 SetHealthMax(zone_names.Get(i),"Health");
11766 }
11767 SetHealthMax("","Health");
11768 }
11769
11772 {
11773 float global_health = GetHealth01("","Health");
11774 array<string> zones = new array<string>;
11775 GetDamageZones(zones);
11776
11777 for (int i = 0; i < zones.Count(); i++)
11778 {
11779 SetHealth01(zones.Get(i),"Health",global_health);
11780 }
11781 }
11782
11785 {
11786 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11787 }
11788
11790 {
11791 if (!hasRootAsPlayer)
11792 {
11793 if (refParentIB)
11794 {
11795
11796 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11797 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11798
11799 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11800 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11801
11804 }
11805 else
11806 {
11807
11810 }
11811 }
11812 }
11813
11815 {
11817 {
11818 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11819 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11820 {
11821 float heatPermCoef = 1.0;
11823 while (ent)
11824 {
11825 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11826 ent = ent.GetHierarchyParent();
11827 }
11828
11829 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11830 }
11831 }
11832 }
11833
11835 {
11836
11837 EntityAI parent = GetHierarchyParent();
11838 if (!parent)
11839 {
11840 hasParent = false;
11841 hasRootAsPlayer = false;
11842 }
11843 else
11844 {
11845 hasParent = true;
11846 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11847 refParentIB =
ItemBase.Cast(parent);
11848 }
11849 }
11850
11851 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11852 {
11853
11854 }
11855
11857 {
11858
11859 return false;
11860 }
11861
11863 {
11864
11865
11866 return false;
11867 }
11868
11870 {
11871
11872 return false;
11873 }
11874
11877 {
11878 return !GetIsFrozen() &&
IsOpen();
11879 }
11880
11882 {
11883 bool hasParent = false, hasRootAsPlayer = false;
11885
11886 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11887 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11888
11889 if (wwtu || foodDecay)
11890 {
11894
11895 if (processWetness || processTemperature || processDecay)
11896 {
11898
11899 if (processWetness)
11900 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11901
11902 if (processTemperature)
11904
11905 if (processDecay)
11906 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11907 }
11908 }
11909 }
11910
11913 {
11915 }
11916
11918 {
11921
11922 return super.GetTemperatureFreezeThreshold();
11923 }
11924
11926 {
11929
11930 return super.GetTemperatureThawThreshold();
11931 }
11932
11934 {
11937
11938 return super.GetItemOverheatThreshold();
11939 }
11940
11942 {
11944 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11945
11946 return super.GetTemperatureFreezeTime();
11947 }
11948
11950 {
11952 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11953
11954 return super.GetTemperatureThawTime();
11955 }
11956
11961
11963 {
11964 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11965 }
11966
11968 {
11969 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11970 }
11971
11974 {
11976 }
11977
11979 {
11981 }
11982
11984 {
11986 }
11987
11990 {
11991 return null;
11992 }
11993
11996 {
11997 return false;
11998 }
11999
12001 {
12003 {
12006 if (!trg)
12007 {
12009 explosive = this;
12010 }
12011
12012 explosive.PairRemote(trg);
12014
12015 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12016 trg.SetPersistentPairID(persistentID);
12017 explosive.SetPersistentPairID(persistentID);
12018
12019 return true;
12020 }
12021 return false;
12022 }
12023
12026 {
12027 float ret = 1.0;
12030 ret *= GetHealth01();
12031
12032 return ret;
12033 }
12034
12035 #ifdef DEVELOPER
12036 override void SetDebugItem()
12037 {
12038 super.SetDebugItem();
12039 _itemBase = this;
12040 }
12041
12043 {
12044 string text = super.GetDebugText();
12045
12047 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12048
12049 return text;
12050 }
12051 #endif
12052
12054 {
12055 return true;
12056 }
12057
12059
12061
12063 {
12066 }
12067
12068
12076
12092
12093 [
Obsolete(
"Use ItemSoundHandler instead")]
12096 {
12097 if (!
g_Game.IsDedicatedServer())
12098 {
12099 if (ConfigIsExisting("attachSoundSet"))
12100 {
12101 string cfg_path = "";
12102 string soundset = "";
12103 string type_name =
GetType();
12104
12107 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12108 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12109
12110 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12111 {
12112 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12113 {
12114 if (cfg_slot_array[i] == slot_type)
12115 {
12116 soundset = cfg_soundset_array[i];
12117 break;
12118 }
12119 }
12120 }
12121
12122 if (soundset != "")
12123 {
12124 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12126 }
12127 }
12128 }
12129 }
12130
12132}
12133
12135{
12137 if (entity)
12138 {
12139 bool is_item = entity.IsInherited(
ItemBase);
12140 if (is_item && full_quantity)
12141 {
12144 }
12145 }
12146 else
12147 {
12149 return NULL;
12150 }
12151 return entity;
12152}
12153
12155{
12156 if (item)
12157 {
12158 if (health > 0)
12159 item.SetHealth("", "", health);
12160
12161 if (item.CanHaveTemperature())
12162 {
12164 if (item.CanFreeze())
12165 item.SetFrozen(false);
12166 }
12167
12168 if (item.HasEnergyManager())
12169 {
12170 if (quantity >= 0)
12171 {
12172 item.GetCompEM().SetEnergy0To1(quantity);
12173 }
12174 else
12175 {
12177 }
12178 }
12179 else if (item.IsMagazine())
12180 {
12181 Magazine mag = Magazine.Cast(item);
12182 if (quantity >= 0)
12183 {
12184 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12185 }
12186 else
12187 {
12189 }
12190
12191 }
12192 else
12193 {
12194 if (quantity >= 0)
12195 {
12196 item.SetQuantityNormalized(quantity, false);
12197 }
12198 else
12199 {
12201 }
12202
12203 }
12204 }
12205}
12206
12207#ifdef DEVELOPER
12209#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.