7318{
7320 {
7321 return true;
7322 }
7323};
7324
7326{
7327
7328};
7329
7330
7331
7333{
7337
7339
7342
7343
7344
7345
7346
7355
7361
7366
7371
7392 protected bool m_IsResultOfSplit
7393
7395
7400
7401
7402
7404
7408
7409
7410
7412
7415
7416
7417
7423
7424
7432
7435
7436
7438
7439
7441
7442
7447
7448
7453
7455
7456
7458
7459
7461 {
7466
7467 if (!
g_Game.IsDedicatedServer())
7468 {
7470 {
7472
7474 {
7476 }
7477 }
7478
7481 }
7482
7483 m_OldLocation = null;
7484
7486 {
7488 }
7489
7490 if (ConfigIsExisting("headSelectionsToHide"))
7491 {
7494 }
7495
7497 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7498 {
7500 }
7501
7503
7504 m_IsResultOfSplit = false;
7505
7507 }
7508
7510 {
7511 super.InitItemVariables();
7512
7518 m_Count = ConfigGetInt(
"count");
7519
7522
7527
7530
7535
7547
7551
7552
7555 if (ConfigIsExisting("canBeSplit"))
7556 {
7559 }
7560
7562 if (ConfigIsExisting("itemBehaviour"))
7564
7565
7568 RegisterNetSyncVariableInt("m_VarLiquidType");
7569 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7570
7571 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7572 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7573 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7574
7575 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7576 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7577 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7578 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7579
7580 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7581 RegisterNetSyncVariableBool("m_IsTakeable");
7582 RegisterNetSyncVariableBool("m_IsHologram");
7583
7586 {
7589 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7590 }
7591
7593
7595 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7597
7599 }
7600
7602 {
7604 }
7605
7607 {
7610 {
7615 }
7616 }
7617
7618 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7619 {
7621 {
7624 }
7625
7627 }
7628
7630 {
7636 }
7637
7639
7641 {
7643
7644 if (!action)
7645 {
7646 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7647 return;
7648 }
7649
7651 if (!ai)
7652 {
7654 return;
7655 }
7656
7658 if (!action_array)
7659 {
7660 action_array = new array<ActionBase_Basic>;
7662 }
7663 if (LogManager.IsActionLogEnable())
7664 {
7665 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7666 }
7667
7668 if (action_array.Find(action) != -1)
7669 {
7670 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7671 }
7672 else
7673 {
7674 action_array.Insert(action);
7675 }
7676 }
7677
7679 {
7680 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7681 ActionBase action = player.GetActionManager().GetAction(actionName);
7684
7685 if (action_array)
7686 {
7687 action_array.RemoveItem(action);
7688 }
7689 }
7690
7691
7692
7694 {
7695 ActionOverrideData overrideData = new ActionOverrideData();
7699
7701 if (!actionMap)
7702 {
7705 }
7706
7707 actionMap.Insert(this.
Type(), overrideData);
7708
7709 }
7710
7712
7714
7715
7717 {
7720
7723
7724 string config_to_search = "CfgVehicles";
7725 string muzzle_owner_config;
7726
7728 {
7729 if (IsInherited(Weapon))
7730 config_to_search = "CfgWeapons";
7731
7732 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7733
7734 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7735
7736 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7737
7738 if (config_OnFire_subclass_count > 0)
7739 {
7740 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7741
7742 for (int i = 0; i < config_OnFire_subclass_count; i++)
7743 {
7744 string particle_class = "";
7745 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7746 string config_OnFire_entry = config_OnFire_class + particle_class;
7747 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7748 WPOF_array.Insert(WPOF);
7749 }
7750
7751
7753 }
7754 }
7755
7757 {
7758 config_to_search = "CfgWeapons";
7759 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7760
7761 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7762
7763 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7764
7765 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7766 {
7767 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7768
7769 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7770 {
7771 string particle_class2 = "";
7772 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7773 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7774 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7775 WPOBE_array.Insert(WPOBE);
7776 }
7777
7778
7780 }
7781 }
7782 }
7783
7784
7786 {
7789
7791 {
7792 string config_to_search = "CfgVehicles";
7793
7794 if (IsInherited(Weapon))
7795 config_to_search = "CfgWeapons";
7796
7797 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7798 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7799
7800 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7801 {
7802
7804
7806 {
7808 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7810 return;
7811 }
7812
7815
7816
7817
7818 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7819 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7820
7821 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7822 {
7823 string particle_class = "";
7824 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7825 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7826 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7827
7828 if (entry_type == CT_CLASS)
7829 {
7830 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7831 WPOOH_array.Insert(WPOF);
7832 }
7833 }
7834
7835
7837 }
7838 }
7839 }
7840
7842 {
7844 }
7845
7847 {
7849 {
7851
7854
7857
7858 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7859 }
7860 }
7861
7863 {
7865 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7866
7868 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7869
7871 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7872
7874 {
7876 }
7877 }
7878
7880 {
7882 }
7883
7885 {
7888 else
7890
7892 {
7895 }
7896 else
7897 {
7900
7903 }
7904
7906 }
7907
7909 {
7911 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7912 }
7913
7915 {
7917 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7919 }
7920
7922 {
7924 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7925 }
7926
7928 {
7931
7932 OverheatingParticle OP = new OverheatingParticle();
7937
7939 }
7940
7942 {
7945
7946 return -1;
7947 }
7948
7950 {
7952 {
7955
7956 for (int i = count; i > 0; --i)
7957 {
7958 int id = i - 1;
7961
7964
7965 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7966 {
7967 if (p)
7968 {
7971 }
7972 }
7973 }
7974 }
7975 }
7976
7978 {
7980 {
7982 {
7983 int id = i - 1;
7985
7986 if (OP)
7987 {
7989
7990 if (p)
7991 {
7993 }
7994
7995 delete OP;
7996 }
7997 }
7998
8001 }
8002 }
8003
8006 {
8007 return 0.0;
8008 }
8009
8010
8012 {
8013 return 250;
8014 }
8015
8017 {
8018 return 0;
8019 }
8020
8023 {
8025 return true;
8026
8027 return false;
8028 }
8029
8032 {
8035
8037 {
8039 }
8040 else
8041 {
8042
8044 }
8045
8047 }
8048
8055 {
8056 return -1;
8057 }
8058
8059
8060
8061
8063 {
8065 {
8066 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8067 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8068
8069 if (r_index >= 0)
8070 {
8071 InventoryLocation r_il = new InventoryLocation;
8072 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8073
8074 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8077 {
8078 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8079 }
8081 {
8082 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8083 }
8084
8085 }
8086
8087 player.GetHumanInventory().ClearUserReservedLocation(this);
8088 }
8089
8092 }
8093
8094
8095
8096
8098 {
8099 return ItemBase.m_DebugActionsMask;
8100 }
8101
8103 {
8104 return ItemBase.m_DebugActionsMask & mask;
8105 }
8106
8108 {
8109 ItemBase.m_DebugActionsMask = mask;
8110 }
8111
8113 {
8114 ItemBase.m_DebugActionsMask |= mask;
8115 }
8116
8118 {
8119 ItemBase.m_DebugActionsMask &= ~mask;
8120 }
8121
8123 {
8125 {
8127 }
8128 else
8129 {
8131 }
8132 }
8133
8134
8136 {
8137 if (GetEconomyProfile())
8138 {
8139 float q_max = GetEconomyProfile().GetQuantityMax();
8140 if (q_max > 0)
8141 {
8142 float q_min = GetEconomyProfile().GetQuantityMin();
8143 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8144
8146 {
8147 ComponentEnergyManager comp = GetCompEM();
8149 {
8151 }
8152 }
8154 {
8156
8157 }
8158
8159 }
8160 }
8161 }
8162
8165 {
8166 EntityAI parent = GetHierarchyParent();
8167
8168 if (parent)
8169 {
8170 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8171 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8172 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8173 }
8174 }
8175
8178 {
8179 EntityAI parent = GetHierarchyParent();
8180
8181 if (parent)
8182 {
8183 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8184 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8185 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8186 }
8187 }
8188
8190 {
8191
8192
8193
8194
8196
8198 {
8199 if (ScriptInputUserData.CanStoreInputUserData())
8200 {
8201 ScriptInputUserData ctx = new ScriptInputUserData;
8207 ctx.
Write(use_stack_max);
8210
8212 {
8213 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8214 }
8215 }
8216 }
8217 else if (!
g_Game.IsMultiplayer())
8218 {
8220 }
8221 }
8222
8224 {
8226 }
8227
8229 {
8231 }
8232
8234 {
8236 }
8237
8239 {
8240
8241 return false;
8242 }
8243
8245 {
8246 return false;
8247 }
8248
8252 {
8253 return false;
8254 }
8255
8257 {
8258 return "";
8259 }
8260
8262
8264 {
8265 return false;
8266 }
8267
8269 {
8270 return true;
8271 }
8272
8273
8274
8276 {
8277 return true;
8278 }
8279
8281 {
8282 return true;
8283 }
8284
8286 {
8287 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8289 }
8290
8292 {
8294 }
8295
8297 {
8299 if (!is_being_placed)
8301 SetSynchDirty();
8302 }
8303
8304
8306
8308 {
8310 }
8311
8313 {
8315 }
8316
8318 {
8319 return 1;
8320 }
8321
8323 {
8324 return false;
8325 }
8326
8328 {
8330 SetSynchDirty();
8331 }
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8368 {
8369 super.OnMovedInsideCargo(container);
8370
8371 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8372 }
8373
8374 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8375 {
8376 super.EEItemLocationChanged(oldLoc, newLoc);
8377
8378 PlayerBase newPlayer = null;
8379 PlayerBase oldPlayer = null;
8380
8381 if (newLoc.GetParent())
8382 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8383
8384 if (oldLoc.GetParent())
8385 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8386
8388 {
8389 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8390
8391 if (rIndex >= 0)
8392 {
8393 InventoryLocation rIl = new InventoryLocation;
8394 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8395
8396 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8399 {
8400 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8401 }
8403 {
8405 }
8406
8407 }
8408 }
8409
8411 {
8412 if (newPlayer)
8413 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8414
8415 if (newPlayer == oldPlayer)
8416 {
8417 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8418 {
8420 {
8421 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8422 {
8423 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8424 }
8425 }
8426 else
8427 {
8428 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8429 }
8430 }
8431
8432 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8433 {
8434 int type = oldLoc.GetType();
8436 {
8437 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8438 }
8440 {
8441 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8442 }
8443 }
8444 if (!m_OldLocation)
8445 {
8446 m_OldLocation = new InventoryLocation;
8447 }
8448 m_OldLocation.Copy(oldLoc);
8449 }
8450 else
8451 {
8452 if (m_OldLocation)
8453 {
8454 m_OldLocation.Reset();
8455 }
8456 }
8457
8458 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8459 }
8460 else
8461 {
8462 if (newPlayer)
8463 {
8464 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8465 if (resIndex >= 0)
8466 {
8467 InventoryLocation il = new InventoryLocation;
8468 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8470 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8473 {
8474 il.
GetParent().GetOnReleaseLock().Invoke(it);
8475 }
8477 {
8479 }
8480
8481 }
8482 }
8484 {
8485
8487 }
8488
8489 if (m_OldLocation)
8490 {
8491 m_OldLocation.Reset();
8492 }
8493 }
8494
8496 {
8497 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8498 }
8499
8501 {
8502 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8503 }
8504 }
8505
8506 override void EOnContact(IEntity other, Contact extra)
8507 {
8509 {
8510 int liquidType = -1;
8512 if (impactSpeed > 0.0)
8513 {
8515 #ifndef SERVER
8517 #else
8519 SetSynchDirty();
8520 #endif
8522 }
8523 }
8524
8525 #ifdef SERVER
8526 if (GetCompEM() && GetCompEM().IsPlugged())
8527 {
8528 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8529 GetCompEM().UnplugThis();
8530 }
8531 #endif
8532 }
8533
8535
8537 {
8539 }
8540
8542 {
8543
8544 }
8545
8547 {
8548 super.OnItemLocationChanged(old_owner, new_owner);
8549
8550 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8551 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8552
8553 if (!relatedPlayer && playerNew)
8554 relatedPlayer = playerNew;
8555
8556 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8557 {
8559 if (actionMgr)
8560 {
8561 ActionBase currentAction = actionMgr.GetRunningAction();
8562 if (currentAction)
8564 }
8565 }
8566
8567 Man ownerPlayerOld = null;
8568 Man ownerPlayerNew = null;
8569
8570 if (old_owner)
8571 {
8572 if (old_owner.
IsMan())
8573 {
8574 ownerPlayerOld = Man.Cast(old_owner);
8575 }
8576 else
8577 {
8578 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8579 }
8580 }
8581 else
8582 {
8584 {
8586
8587 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8588 {
8589 GetCompEM().UnplugThis();
8590 }
8591 }
8592 }
8593
8594 if (new_owner)
8595 {
8596 if (new_owner.
IsMan())
8597 {
8598 ownerPlayerNew = Man.Cast(new_owner);
8599 }
8600 else
8601 {
8602 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8603 }
8604 }
8605
8606 if (ownerPlayerOld != ownerPlayerNew)
8607 {
8608 if (ownerPlayerOld)
8609 {
8610 array<EntityAI> subItemsExit = new array<EntityAI>;
8612 for (int i = 0; i < subItemsExit.Count(); i++)
8613 {
8616 }
8617 }
8618
8619 if (ownerPlayerNew)
8620 {
8621 array<EntityAI> subItemsEnter = new array<EntityAI>;
8623 for (int j = 0; j < subItemsEnter.Count(); j++)
8624 {
8627 }
8628 }
8629 }
8630 else if (ownerPlayerNew != null)
8631 {
8632 PlayerBase nplayer;
8633 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8634 {
8635 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8637 for (int k = 0; k < subItemsUpdate.Count(); k++)
8638 {
8640 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8641 }
8642 }
8643 }
8644
8645 if (old_owner)
8646 old_owner.OnChildItemRemoved(this);
8647 if (new_owner)
8648 new_owner.OnChildItemReceived(this);
8649 }
8650
8651
8653 {
8654 super.EEDelete(parent);
8655 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8656 if (player)
8657 {
8659
8660 if (player.IsAlive())
8661 {
8662 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8663 if (r_index >= 0)
8664 {
8665 InventoryLocation r_il = new InventoryLocation;
8666 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8667
8668 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8671 {
8672 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8673 }
8675 {
8676 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8677 }
8678
8679 }
8680
8681 player.RemoveQuickBarEntityShortcut(this);
8682 }
8683 }
8684 }
8685
8687 {
8688 super.EEKilled(killer);
8689
8692 {
8693 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8694 {
8695 if (IsMagazine())
8696 {
8697 if (Magazine.Cast(this).GetAmmoCount() > 0)
8698 {
8700 }
8701 }
8702 else
8703 {
8705 }
8706 }
8707 }
8708 }
8709
8711 {
8712 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8713
8714 super.OnWasAttached(parent, slot_id);
8715
8718
8721 }
8722
8724 {
8725 super.OnWasDetached(parent, slot_id);
8726
8729
8732 }
8733
8735 {
8736 int idx;
8739
8740 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8741 if (inventory_slots.Count() < 1)
8742 {
8743 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8744 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8745 }
8746 else
8747 {
8748 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8749 }
8750
8751 idx = inventory_slots.Find(slot);
8752 if (idx < 0)
8753 return "";
8754
8755 return attach_types.Get(idx);
8756 }
8757
8759 {
8760 int idx = -1;
8761 string slot;
8762
8765
8766 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8767 if (inventory_slots.Count() < 1)
8768 {
8769 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8770 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8771 }
8772 else
8773 {
8774 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8775 if (detach_types.Count() < 1)
8776 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8777 }
8778
8779 for (int i = 0; i < inventory_slots.Count(); i++)
8780 {
8781 slot = inventory_slots.Get(i);
8782 }
8783
8784 if (slot != "")
8785 {
8786 if (detach_types.Count() == 1)
8787 idx = 0;
8788 else
8789 idx = inventory_slots.Find(slot);
8790 }
8791 if (idx < 0)
8792 return "";
8793
8794 return detach_types.Get(idx);
8795 }
8796
8798 {
8799
8801
8802
8803 float min_time = 1;
8804 float max_time = 3;
8805 float delay = Math.RandomFloat(min_time, max_time);
8806
8807 explode_timer.Run(delay, this, "DoAmmoExplosion");
8808 }
8809
8811 {
8812 Magazine magazine = Magazine.Cast(this);
8813 int pop_sounds_count = 6;
8814 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8815
8816
8817 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8818 string sound_name = pop_sounds[ sound_idx ];
8819 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8820
8821
8822 magazine.ServerAddAmmoCount(-1);
8823
8824
8825 float min_temp_to_explode = 100;
8826
8827 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8828 {
8830 }
8831 }
8832
8833
8834 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8835 {
8836 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8837
8838 const int CHANCE_DAMAGE_CARGO = 4;
8839 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8840 const int CHANCE_DAMAGE_NOTHING = 2;
8841
8843 {
8844 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8845 int chances;
8846 int rnd;
8847
8848 if (GetInventory().GetCargo())
8849 {
8850 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8851 rnd = Math.RandomInt(0,chances);
8852
8853 if (rnd < CHANCE_DAMAGE_CARGO)
8854 {
8856 }
8857 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8858 {
8860 }
8861 }
8862 else
8863 {
8864 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8865 rnd = Math.RandomInt(0,chances);
8866
8867 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8868 {
8870 }
8871 }
8872 }
8873 }
8874
8876 {
8877 CargoBase cargo = GetInventory().GetCargo();
8878 if (cargo)
8879 {
8881 if (item_count > 0)
8882 {
8883 int random_pick = Math.RandomInt(0, item_count);
8885 if (!item.IsExplosive())
8886 {
8887 item.AddHealth("","",damage);
8888 return true;
8889 }
8890 }
8891 }
8892 return false;
8893 }
8894
8896 {
8897 GameInventory inventory = GetInventory();
8899 if (attachment_count > 0)
8900 {
8901 int random_pick = Math.RandomInt(0, attachment_count);
8903 if (!attachment.IsExplosive())
8904 {
8905 attachment.AddHealth("","",damage);
8906 return true;
8907 }
8908 }
8909 return false;
8910 }
8911
8913 {
8915 }
8916
8918 {
8920 return GetInventory().CanRemoveEntity();
8921
8922 return false;
8923 }
8924
8926 {
8927
8929 return false;
8930
8931
8933 return false;
8934
8935
8936
8938 if (delta == 0)
8939 return false;
8940
8941
8942 return true;
8943 }
8944
8946 {
8948 {
8949 if (ScriptInputUserData.CanStoreInputUserData())
8950 {
8951 ScriptInputUserData ctx = new ScriptInputUserData;
8956 ctx.
Write(destination_entity);
8960 }
8961 }
8962 else if (!
g_Game.IsMultiplayer())
8963 {
8965 }
8966 }
8967
8969 {
8970 float split_quantity_new;
8974 InventoryLocation loc = new InventoryLocation;
8975
8976 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8977 {
8979 split_quantity_new = stack_max;
8980 else
8982
8984 {
8985 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8986 if (new_item)
8987 {
8988 new_item.SetResultOfSplit(true);
8989 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8991 new_item.
SetQuantity(split_quantity_new,
false,
true);
8992 }
8993 }
8994 }
8995 else if (destination_entity && slot_id == -1)
8996 {
8997 if (quantity > stack_max)
8998 split_quantity_new = stack_max;
8999 else
9000 split_quantity_new = quantity;
9001
9003 {
9004 GameInventory destinationInventory = destination_entity.GetInventory();
9006 {
9009 }
9010
9011 if (new_item)
9012 {
9013 new_item.SetResultOfSplit(true);
9014 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9016 new_item.
SetQuantity(split_quantity_new,
false,
true);
9017 }
9018 }
9019 }
9020 else
9021 {
9022 if (stack_max != 0)
9023 {
9025 {
9027 }
9028
9029 if (split_quantity_new == 0)
9030 {
9031 if (!
g_Game.IsMultiplayer())
9032 player.PhysicalPredictiveDropItem(this);
9033 else
9034 player.ServerDropEntity(this);
9035 return;
9036 }
9037
9039 {
9041
9042 if (new_item)
9043 {
9044 new_item.SetResultOfSplit(true);
9045 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9048 new_item.PlaceOnSurface();
9049 }
9050 }
9051 }
9052 }
9053 }
9054
9056 {
9057 float split_quantity_new;
9061 InventoryLocation loc = new InventoryLocation;
9062
9063 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9064 {
9066 split_quantity_new = stack_max;
9067 else
9069
9071 {
9072 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9073 if (new_item)
9074 {
9075 new_item.SetResultOfSplit(true);
9076 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9078 new_item.
SetQuantity(split_quantity_new,
false,
true);
9079 }
9080 }
9081 }
9082 else if (destination_entity && slot_id == -1)
9083 {
9084 if (quantity > stack_max)
9085 split_quantity_new = stack_max;
9086 else
9087 split_quantity_new = quantity;
9088
9090 {
9091 GameInventory destinationInventory = destination_entity.GetInventory();
9093 {
9096 }
9097
9098 if (new_item)
9099 {
9100 new_item.SetResultOfSplit(true);
9101 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9103 new_item.
SetQuantity(split_quantity_new,
false,
true);
9104 }
9105 }
9106 }
9107 else
9108 {
9109 if (stack_max != 0)
9110 {
9112 {
9114 }
9115
9117 {
9119
9120 if (new_item)
9121 {
9122 new_item.SetResultOfSplit(true);
9123 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9126 new_item.PlaceOnSurface();
9127 }
9128 }
9129 }
9130 }
9131 }
9132
9134 {
9136 {
9137 if (ScriptInputUserData.CanStoreInputUserData())
9138 {
9139 ScriptInputUserData ctx = new ScriptInputUserData;
9144 dst.WriteToContext(ctx);
9146 }
9147 }
9148 else if (!
g_Game.IsMultiplayer())
9149 {
9151 }
9152 }
9153
9155 {
9157 {
9158 if (ScriptInputUserData.CanStoreInputUserData())
9159 {
9160 ScriptInputUserData ctx = new ScriptInputUserData;
9165 ctx.
Write(destination_entity);
9171 }
9172 }
9173 else if (!
g_Game.IsMultiplayer())
9174 {
9176 }
9177 }
9178
9180 {
9182 }
9183
9185 {
9187 float split_quantity_new;
9189 if (dst.IsValid())
9190 {
9191 int slot_id = dst.GetSlot();
9193
9194 if (quantity > stack_max)
9195 split_quantity_new = stack_max;
9196 else
9197 split_quantity_new = quantity;
9198
9200 {
9202
9203 if (new_item)
9204 {
9205 new_item.SetResultOfSplit(true);
9206 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9208 new_item.
SetQuantity(split_quantity_new,
false,
true);
9209 }
9210
9211 return new_item;
9212 }
9213 }
9214
9215 return null;
9216 }
9217
9219 {
9221 float split_quantity_new;
9223 if (destination_entity)
9224 {
9226 if (quantity > stackable)
9227 split_quantity_new = stackable;
9228 else
9229 split_quantity_new = quantity;
9230
9232 {
9233 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9234 if (new_item)
9235 {
9236 new_item.SetResultOfSplit(true);
9237 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9239 new_item.
SetQuantity(split_quantity_new,
false,
true);
9240 }
9241 }
9242 }
9243 }
9244
9246 {
9248 {
9249 if (ScriptInputUserData.CanStoreInputUserData())
9250 {
9251 ScriptInputUserData ctx = new ScriptInputUserData;
9256 ItemBase destination_entity =
this;
9257 ctx.
Write(destination_entity);
9261 }
9262 }
9263 else if (!
g_Game.IsMultiplayer())
9264 {
9266 }
9267 }
9268
9270 {
9272 float split_quantity_new;
9274 if (player)
9275 {
9277 if (quantity > stackable)
9278 split_quantity_new = stackable;
9279 else
9280 split_quantity_new = quantity;
9281
9283 {
9284 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9285 new_item =
ItemBase.Cast(in_hands);
9286 if (new_item)
9287 {
9288 new_item.SetResultOfSplit(true);
9289 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9291 new_item.SetQuantity(split_quantity_new, false, true);
9292 }
9293 }
9294 }
9295 }
9296
9298 {
9300 float split_quantity_new = Math.Floor(quantity * 0.5);
9301
9303 return;
9304
9306
9307 if (new_item)
9308 {
9309 if (new_item.GetQuantityMax() < split_quantity_new)
9310 {
9311 split_quantity_new = new_item.GetQuantityMax();
9312 }
9313
9314 new_item.SetResultOfSplit(true);
9315 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9316
9318 {
9321 }
9322 else
9323 {
9325 new_item.
SetQuantity(split_quantity_new,
false,
true);
9326 }
9327 }
9328 }
9329
9331 {
9333 float split_quantity_new = Math.Floor(quantity / 2);
9334
9336 return;
9337
9338 InventoryLocation invloc = new InventoryLocation;
9340
9342 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9343
9344 if (new_item)
9345 {
9346 if (new_item.GetQuantityMax() < split_quantity_new)
9347 {
9348 split_quantity_new = new_item.GetQuantityMax();
9349 }
9351 {
9354 }
9355 else if (split_quantity_new > 1)
9356 {
9358 new_item.
SetQuantity(split_quantity_new,
false,
true);
9359 }
9360 }
9361 }
9362
9365 {
9366 SetWeightDirty();
9368
9369 if (parent)
9370 parent.OnAttachmentQuantityChangedEx(this, delta);
9371
9373 {
9375 {
9377 }
9379 {
9380 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9382 }
9383 }
9384 }
9385
9388 {
9389
9390 }
9391
9394 {
9396 }
9397
9399 {
9400 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9401
9403 {
9404 if (newLevel == GameConstants.STATE_RUINED)
9405 {
9407 EntityAI parent = GetHierarchyParent();
9408 if (parent && parent.IsFireplace())
9409 {
9410 CargoBase cargo = GetInventory().GetCargo();
9411 if (cargo)
9412 {
9414 {
9416 }
9417 }
9418 }
9419 }
9420
9422 {
9423
9425 return;
9426 }
9427
9428 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9429 {
9431 }
9432 }
9433 }
9434
9435
9437 {
9438 super.OnRightClick();
9439
9441 {
9443 {
9444 if (ScriptInputUserData.CanStoreInputUserData())
9445 {
9446 EntityAI root = GetHierarchyRoot();
9447 Man playerOwner = GetHierarchyRootPlayer();
9448 InventoryLocation dst = new InventoryLocation;
9449
9450
9451 if (!playerOwner && root && root == this)
9452 {
9454 }
9455 else
9456 {
9457
9458 GetInventory().GetCurrentInventoryLocation(dst);
9460 {
9461 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9463 {
9465 }
9466 else
9467 {
9469
9470
9471 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9472 {
9474 }
9475 else
9476 {
9477 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9478 }
9479 }
9480 }
9481 }
9482
9483 ScriptInputUserData ctx = new ScriptInputUserData;
9491 }
9492 }
9493 else if (!
g_Game.IsMultiplayer())
9494 {
9496 }
9497 }
9498 }
9499
9501 {
9502 if (root)
9503 {
9504 vector m4[4];
9505 root.GetTransform(m4);
9506 dst.SetGround(this, m4);
9507 }
9508 else
9509 {
9510 GetInventory().GetCurrentInventoryLocation(dst);
9511 }
9512 }
9513
9514 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9515 {
9516
9517 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9518 return false;
9519
9520 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9521 return false;
9522
9523
9525 return false;
9526
9527
9528 Magazine mag = Magazine.Cast(this);
9529 if (mag)
9530 {
9531 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9532 return false;
9533
9534 if (stack_max_limit)
9535 {
9536 Magazine other_mag = Magazine.Cast(other_item);
9537 if (other_item)
9538 {
9539 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9540 return false;
9541 }
9542
9543 }
9544 }
9545 else
9546 {
9547
9549 return false;
9550
9552 return false;
9553 }
9554
9555 PlayerBase player = null;
9556 if (CastTo(player, GetHierarchyRootPlayer()))
9557 {
9558 if (player.GetInventory().HasAttachment(this))
9559 return false;
9560
9561 if (player.IsItemsToDelete())
9562 return false;
9563 }
9564
9565 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9566 return false;
9567
9568 int slotID;
9570 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9571 return false;
9572
9573 return true;
9574 }
9575
9577 {
9579 }
9580
9582 {
9583 return m_IsResultOfSplit;
9584 }
9585
9587 {
9588 m_IsResultOfSplit = value;
9589 }
9590
9592 {
9594 }
9595
9597 {
9598 float other_item_quantity = other_item.GetQuantity();
9599 float this_free_space;
9600
9602
9604
9605 if (other_item_quantity > this_free_space)
9606 {
9607 return this_free_space;
9608 }
9609 else
9610 {
9611 return other_item_quantity;
9612 }
9613 }
9614
9616 {
9618 }
9619
9621 {
9623 return;
9624
9625 if (!IsMagazine() && other_item)
9626 {
9628 if (quantity_used != 0)
9629 {
9630 float hp1 = GetHealth01("","");
9631 float hp2 = other_item.GetHealth01("","");
9632 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9633 hpResult = hpResult / (
GetQuantity() + quantity_used);
9634
9635 hpResult *= GetMaxHealth();
9636 Math.Round(hpResult);
9637 SetHealth("", "Health", hpResult);
9638
9640 other_item.AddQuantity(-quantity_used);
9641 }
9642 }
9644 }
9645
9647 {
9648 #ifdef SERVER
9649 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9650 GetHierarchyParent().IncreaseLifetimeUp();
9651 #endif
9652 };
9653
9655 {
9656 PlayerBase p = PlayerBase.Cast(player);
9657
9658 array<int> recipesIds = p.m_Recipes;
9659 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9660 if (moduleRecipesManager)
9661 {
9662 EntityAI itemInHands = player.GetEntityInHands();
9663 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9664 }
9665
9666 for (int i = 0;i < recipesIds.Count(); i++)
9667 {
9668 int key = recipesIds.Get(i);
9669 string recipeName = moduleRecipesManager.GetRecipeName(key);
9671 }
9672 }
9673
9674
9675 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9676 {
9677 super.GetDebugActions(outputList);
9678
9679
9685
9686
9691
9696
9697
9701
9702
9704 {
9708 }
9709
9712
9713
9717
9719
9720 InventoryLocation loc = new InventoryLocation();
9721 GetInventory().GetCurrentInventoryLocation(loc);
9723 {
9724 if (Gizmo_IsSupported())
9727 }
9728
9730 }
9731
9732
9733
9734
9736 {
9737 super.OnAction(action_id, player, ctx);
9738
9740 {
9741 switch (action_id)
9742 {
9746 return true;
9750 return true;
9751 }
9752 }
9753
9755 {
9756 switch (action_id)
9757 {
9759 Delete();
9760 return true;
9761 }
9762 }
9763
9764 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9765 {
9766 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9767 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9768 PlayerBase p = PlayerBase.Cast(player);
9769 if (
EActions.RECIPES_RANGE_START < 1000)
9770 {
9771 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9772 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9773 }
9774 }
9775 #ifndef SERVER
9776 else if (action_id ==
EActions.WATCH_PLAYER)
9777 {
9778 PluginDeveloper.SetDeveloperItemClientEx(player);
9779 }
9780 #endif
9782 {
9783 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9784 {
9785 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9786 OnDebugButtonPressServer(id + 1);
9787 }
9788
9789 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9790 {
9791 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9793 }
9794
9795 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9796 {
9797 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9799 }
9800
9801 else if (action_id ==
EActions.ADD_QUANTITY)
9802 {
9803 if (IsMagazine())
9804 {
9805 Magazine mag = Magazine.Cast(this);
9806 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9807 }
9808 else
9809 {
9811 }
9812
9813 if (m_EM)
9814 {
9815 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9816 }
9817
9818 }
9819
9820 else if (action_id ==
EActions.REMOVE_QUANTITY)
9821 {
9822 if (IsMagazine())
9823 {
9824 Magazine mag2 = Magazine.Cast(this);
9825 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9826 }
9827 else
9828 {
9830 }
9831 if (m_EM)
9832 {
9833 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9834 }
9835
9836 }
9837
9838 else if (action_id ==
EActions.SET_QUANTITY_0)
9839 {
9841
9842 if (m_EM)
9843 {
9844 m_EM.SetEnergy(0);
9845 }
9846 }
9847
9848 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9849 {
9851
9852 if (m_EM)
9853 {
9854 m_EM.SetEnergy(m_EM.GetEnergyMax());
9855 }
9856 }
9857
9858 else if (action_id ==
EActions.ADD_HEALTH)
9859 {
9860 AddHealth("","",GetMaxHealth("","Health")/5);
9861 }
9862 else if (action_id ==
EActions.REMOVE_HEALTH)
9863 {
9864 AddHealth("","",-GetMaxHealth("","Health")/5);
9865 }
9866 else if (action_id ==
EActions.DESTROY_HEALTH)
9867 {
9868 SetHealth01("","",0);
9869 }
9870 else if (action_id ==
EActions.WATCH_ITEM)
9871 {
9873 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9874 #ifdef DEVELOPER
9875 SetDebugDeveloper_item(this);
9876 #endif
9877 }
9878
9879 else if (action_id ==
EActions.ADD_TEMPERATURE)
9880 {
9881 AddTemperature(20);
9882
9883 }
9884
9885 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9886 {
9887 AddTemperature(-20);
9888
9889 }
9890
9891 else if (action_id ==
EActions.FLIP_FROZEN)
9892 {
9893 SetFrozen(!GetIsFrozen());
9894
9895 }
9896
9897 else if (action_id ==
EActions.ADD_WETNESS)
9898 {
9900
9901 }
9902
9903 else if (action_id ==
EActions.REMOVE_WETNESS)
9904 {
9906
9907 }
9908
9909 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9910 {
9913
9914
9915 }
9916
9917 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9918 {
9921 }
9922
9923 else if (action_id ==
EActions.MAKE_SPECIAL)
9924 {
9925 auto debugParams = DebugSpawnParams.WithPlayer(player);
9926 OnDebugSpawnEx(debugParams);
9927 }
9928
9929 }
9930
9931
9932 return false;
9933 }
9934
9935
9936
9937
9941
9944
9945
9946
9948 {
9949 return false;
9950 }
9951
9952
9954 {
9955 return true;
9956 }
9957
9958
9960 {
9961 return true;
9962 }
9963
9964
9965
9967 {
9968 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9969 return g_Game.ConfigIsExisting(config_path);
9970 }
9971
9974 {
9975 return null;
9976 }
9977
9979 {
9980 return false;
9981 }
9982
9984 {
9985 return false;
9986 }
9987
9991
9992
9994 {
9995 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9996 return module_repairing.CanRepair(this, item_repair_kit);
9997 }
9998
9999
10000 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10001 {
10002 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10003 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10004 }
10005
10006
10008 {
10009
10010
10011
10012
10013
10014
10015
10016
10017 return 1;
10018 }
10019
10020
10021
10023 {
10025 }
10026
10027
10028
10030 {
10032 }
10033
10034
10043 {
10044 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10045
10046 if (player)
10047 {
10048 player.MessageStatus(text);
10049 }
10050 }
10051
10052
10061 {
10062 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10063
10064 if (player)
10065 {
10066 player.MessageAction(text);
10067 }
10068 }
10069
10070
10079 {
10080 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10081
10082 if (player)
10083 {
10084 player.MessageFriendly(text);
10085 }
10086 }
10087
10088
10097 {
10098 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10099
10100 if (player)
10101 {
10102 player.MessageImportant(text);
10103 }
10104 }
10105
10107 {
10108 return true;
10109 }
10110
10111
10112 override bool KindOf(
string tag)
10113 {
10114 bool found = false;
10115 string item_name = this.
GetType();
10117 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10118
10119 int array_size = item_tag_array.Count();
10120 for (int i = 0; i < array_size; i++)
10121 {
10122 if (item_tag_array.Get(i) == tag)
10123 {
10124 found = true;
10125 break;
10126 }
10127 }
10128 return found;
10129 }
10130
10131
10133 {
10134
10135 super.OnRPC(sender, rpc_type,ctx);
10136
10137
10138 switch (rpc_type)
10139 {
10140 #ifndef SERVER
10141 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10142 Param2<bool, string> p = new Param2<bool, string>(false, "");
10143
10145 return;
10146
10147 bool play = p.param1;
10148 string soundSet = p.param2;
10149
10150 if (play)
10151 {
10153 {
10155 {
10157 }
10158 }
10159 else
10160 {
10162 }
10163 }
10164 else
10165 {
10167 }
10168
10169 break;
10170 #endif
10171
10172 }
10173
10175 {
10177 }
10178 }
10179
10180
10181
10182
10184 {
10185 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10186 return plugin.GetID(
name);
10187 }
10188
10190 {
10191 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10192 return plugin.GetName(id);
10193 }
10194
10197 {
10198
10199
10200 int varFlags;
10201 if (!ctx.
Read(varFlags))
10202 return;
10203
10204 if (varFlags & ItemVariableFlags.FLOAT)
10205 {
10207 }
10208 }
10209
10211 {
10212
10213 super.SerializeNumericalVars(floats_out);
10214
10215
10216
10218 {
10220 }
10221
10223 {
10225 }
10226
10228 {
10230 }
10231
10233 {
10238 }
10239
10241 {
10243 }
10244 }
10245
10247 {
10248
10249 super.DeSerializeNumericalVars(floats);
10250
10251
10252 int index = 0;
10253 int mask = Math.Round(floats.Get(index));
10254
10255 index++;
10256
10258 {
10260 {
10262 }
10263 else
10264 {
10265 float quantity = floats.Get(index);
10266 SetQuantity(quantity,
true,
false,
false,
false);
10267 }
10268 index++;
10269 }
10270
10272 {
10273 float wet = floats.Get(index);
10275 index++;
10276 }
10277
10279 {
10280 int liquidtype = Math.Round(floats.Get(index));
10282 index++;
10283 }
10284
10286 {
10288 index++;
10290 index++;
10292 index++;
10294 index++;
10295 }
10296
10298 {
10299 int cleanness = Math.Round(floats.Get(index));
10301 index++;
10302 }
10303 }
10304
10306 {
10307 super.WriteVarsToCTX(ctx);
10308
10309
10311 {
10313 }
10314
10316 {
10318 }
10319
10321 {
10323 }
10324
10326 {
10327 int r,g,b,a;
10333 }
10334
10336 {
10338 }
10339 }
10340
10342 {
10343 if (!super.ReadVarsFromCTX(ctx,version))
10344 return false;
10345
10346 int intValue;
10347 float value;
10348
10349 if (version < 140)
10350 {
10351 if (!ctx.
Read(intValue))
10352 return false;
10353
10354 m_VariablesMask = intValue;
10355 }
10356
10358 {
10359 if (!ctx.
Read(value))
10360 return false;
10361
10363 {
10365 }
10366 else
10367 {
10369 }
10370 }
10371
10372 if (version < 140)
10373 {
10375 {
10376 if (!ctx.
Read(value))
10377 return false;
10378 SetTemperatureDirect(value);
10379 }
10380 }
10381
10383 {
10384 if (!ctx.
Read(value))
10385 return false;
10387 }
10388
10390 {
10391 if (!ctx.
Read(intValue))
10392 return false;
10394 }
10395
10397 {
10398 int r,g,b,a;
10400 return false;
10402 return false;
10404 return false;
10406 return false;
10407
10409 }
10410
10412 {
10413 if (!ctx.
Read(intValue))
10414 return false;
10416 }
10417
10418 if (version >= 138 && version < 140)
10419 {
10421 {
10422 if (!ctx.
Read(intValue))
10423 return false;
10424 SetFrozen(intValue);
10425 }
10426 }
10427
10428 return true;
10429 }
10430
10431
10433 {
10436 {
10438 }
10439
10440 if (!super.OnStoreLoad(ctx, version))
10441 {
10443 return false;
10444 }
10445
10446 if (version >= 114)
10447 {
10448 bool hasQuickBarIndexSaved;
10449
10450 if (!ctx.
Read(hasQuickBarIndexSaved))
10451 {
10453 return false;
10454 }
10455
10456 if (hasQuickBarIndexSaved)
10457 {
10458 int itmQBIndex;
10459
10460
10461 if (!ctx.
Read(itmQBIndex))
10462 {
10464 return false;
10465 }
10466
10467 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10468 if (itmQBIndex != -1 && parentPlayer)
10469 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10470 }
10471 }
10472 else
10473 {
10474
10475 PlayerBase player;
10476 int itemQBIndex;
10477 if (version ==
int.
MAX)
10478 {
10479 if (!ctx.
Read(itemQBIndex))
10480 {
10482 return false;
10483 }
10484 }
10485 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10486 {
10487
10488 if (!ctx.
Read(itemQBIndex))
10489 {
10491 return false;
10492 }
10493 if (itemQBIndex != -1 && player)
10494 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10495 }
10496 }
10497
10498 if (version < 140)
10499 {
10500
10501 if (!LoadVariables(ctx, version))
10502 {
10504 return false;
10505 }
10506 }
10507
10508
10510 {
10512 return false;
10513 }
10514 if (version >= 132)
10515 {
10517 if (raib)
10518 {
10520 {
10522 return false;
10523 }
10524 }
10525 }
10526
10528 return true;
10529 }
10530
10531
10532
10534 {
10535 super.OnStoreSave(ctx);
10536
10537 PlayerBase player;
10538 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10539 {
10541
10542 int itemQBIndex = -1;
10543 itemQBIndex = player.FindQuickBarEntityIndex(this);
10544 ctx.
Write(itemQBIndex);
10545 }
10546 else
10547 {
10549 }
10550
10552
10554 if (raib)
10555 {
10557 }
10558 }
10559
10560
10562 {
10563 super.AfterStoreLoad();
10564
10566 {
10568 }
10569
10571 {
10574 }
10575 }
10576
10578 {
10579 super.EEOnAfterLoad();
10580
10582 {
10584 }
10585
10588 }
10589
10591 {
10592 return false;
10593 }
10594
10595
10596
10598 {
10600 {
10601 #ifdef PLATFORM_CONSOLE
10602
10604 {
10606 if (menu)
10607 {
10609 }
10610 }
10611 #endif
10612 }
10613
10615 {
10618 }
10619
10621 {
10622 SetWeightDirty();
10624 }
10626 {
10629 }
10630
10632 {
10635
10638 }
10640 {
10644 }
10645
10646 super.OnVariablesSynchronized();
10647 }
10648
10649
10650
10652 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10653 {
10654 if (!IsServerCheck(allow_client))
10655 return false;
10656
10658 return false;
10659
10662
10663 if (value <= (min + 0.001))
10664 value = min;
10665
10666 if (value == min)
10667 {
10668 if (destroy_config)
10669 {
10670 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10671 if (dstr)
10672 {
10674 this.Delete();
10675 return true;
10676 }
10677 }
10678 else if (destroy_forced)
10679 {
10681 this.Delete();
10682 return true;
10683 }
10684
10686 }
10687
10690
10692 {
10693 EntityAI parent = GetHierarchyRoot();
10694 InventoryLocation iLoc = new InventoryLocation();
10695 GetInventory().GetCurrentInventoryLocation(iLoc);
10697 {
10698 int iLocSlot = iLoc.
GetSlot();
10700 {
10702 }
10704 {
10706 }
10707 }
10708 }
10709
10711 {
10713
10714 if (delta)
10716 }
10717
10719
10720 return false;
10721 }
10722
10723
10725 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10726 {
10728 }
10729
10731 {
10734 }
10735
10737 {
10740 }
10741
10743 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10744 {
10745 float value_clamped = Math.Clamp(value, 0, 1);
10747 SetQuantity(result, destroy_config, destroy_forced);
10748 }
10749
10750
10753 {
10755 }
10756
10758 {
10760 }
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10772 {
10773 int slot = -1;
10774 GameInventory inventory = GetInventory();
10775 if (inventory)
10776 {
10777 InventoryLocation il = new InventoryLocation;
10780 }
10781
10783 }
10784
10786 {
10787 float quantity_max = 0;
10788
10790 {
10791 if (attSlotID != -1)
10792 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10793
10794 if (quantity_max <= 0)
10796 }
10797
10798 if (quantity_max <= 0)
10800
10801 return quantity_max;
10802 }
10803
10805 {
10807 }
10808
10810 {
10812 }
10813
10814
10816 {
10818 }
10819
10821 {
10823 }
10824
10826 {
10828 }
10829
10830
10832 {
10833
10834 float weightEx = GetWeightEx();
10835 float special = GetInventoryAndCargoWeight();
10836 return weightEx - special;
10837 }
10838
10839
10841 {
10843 }
10844
10846 {
10848 {
10849 #ifdef DEVELOPER
10850 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10851 {
10852 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10854 }
10855 #endif
10856
10857 return GetQuantity() * GetConfigWeightModified();
10858 }
10859 else if (HasEnergyManager())
10860 {
10861 #ifdef DEVELOPER
10862 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10863 {
10864 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10865 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10866 }
10867 #endif
10868 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10869 }
10870 else
10871 {
10872 #ifdef DEVELOPER
10873 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10874 {
10875 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10876 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10877 }
10878 #endif
10879 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10880 }
10881 }
10882
10885 {
10886 int item_count = 0;
10888
10889 GameInventory inventory = GetInventory();
10890 CargoBase cargo = inventory.
GetCargo();
10891 if (cargo != NULL)
10892 {
10894 }
10895
10897 for (int i = 0; i < nAttachments; ++i)
10898 {
10900 if (item)
10901 item_count += item.GetNumberOfItems();
10902 }
10903 return item_count;
10904 }
10905
10908 {
10909 float weight = 0;
10910 float wetness = 1;
10911 if (include_wetness)
10914 {
10915 weight = wetness * m_ConfigWeight;
10916 }
10918 {
10919 weight = 1;
10920 }
10921 return weight;
10922 }
10923
10924
10925
10927 {
10928 GameInventory inventory = GetInventory();
10929 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10930 {
10931 array<EntityAI> items = new array<EntityAI>;
10933 for (int i = 0; i < items.Count(); ++i)
10934 {
10936 if (item)
10937 {
10938 g_Game.ObjectDelete(item);
10939 }
10940 }
10941 }
10942 }
10943
10944
10945
10946
10948 {
10949 float energy = 0;
10950 if (HasEnergyManager())
10951 {
10952 energy = GetCompEM().GetEnergy();
10953 }
10954 return energy;
10955 }
10956
10957
10959 {
10960 super.OnEnergyConsumed();
10961
10963 }
10964
10966 {
10967 super.OnEnergyAdded();
10968
10970 }
10971
10972
10974 {
10975 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10976 {
10978 {
10979 float energy_0to1 = GetCompEM().GetEnergy0To1();
10981 }
10982 }
10983 }
10984
10985
10987 {
10988 return ConfigGetFloat("heatIsolation");
10989 }
10990
10992 {
10994 }
10995
10997 {
10998 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10999 if (
g_Game.ConfigIsExisting(paramPath))
11000 return g_Game.ConfigGetFloat(paramPath);
11001
11002 return 0.0;
11003 }
11004
11006 {
11007 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11008 if (
g_Game.ConfigIsExisting(paramPath))
11009 return g_Game.ConfigGetFloat(paramPath);
11010
11011 return 0.0;
11012 }
11013
11014 override void SetWet(
float value,
bool allow_client =
false)
11015 {
11016 if (!IsServerCheck(allow_client))
11017 return;
11018
11021
11023
11024 m_VarWet = Math.Clamp(value, min, max);
11025
11027 {
11030 }
11031 }
11032
11033 override void AddWet(
float value)
11034 {
11036 }
11037
11039 {
11041 }
11042
11044 {
11046 }
11047
11049 {
11051 }
11052
11054 {
11056 }
11057
11059 {
11061 }
11062
11063 override void OnWetChanged(
float newVal,
float oldVal)
11064 {
11067 if (newLevel != oldLevel)
11068 {
11070 }
11071 }
11072
11074 {
11075 SetWeightDirty();
11076 }
11077
11079 {
11080 return GetWetLevelInternal(
m_VarWet);
11081 }
11082
11083
11084
11086 {
11088 }
11089
11091 {
11093 }
11094
11096 {
11098 }
11099
11101 {
11103 }
11104
11105
11106
11108 {
11109 if (ConfigIsExisting("itemModelLength"))
11110 {
11111 return ConfigGetFloat("itemModelLength");
11112 }
11113 return 0;
11114 }
11115
11117 {
11118 if (ConfigIsExisting("itemAttachOffset"))
11119 {
11120 return ConfigGetFloat("itemAttachOffset");
11121 }
11122 return 0;
11123 }
11124
11125 override void SetCleanness(
int value,
bool allow_client =
false)
11126 {
11127 if (!IsServerCheck(allow_client))
11128 return;
11129
11131
11133
11136 }
11137
11139 {
11141 }
11142
11144 {
11145 return true;
11146 }
11147
11148
11149
11150
11152 {
11154 }
11155
11157 {
11159 }
11160
11161
11162
11163
11164 override void SetColor(
int r,
int g,
int b,
int a)
11165 {
11171 }
11173 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11174 {
11179 }
11180
11182 {
11184 }
11185
11188 {
11189 int r,g,b,a;
11191 r = r/255;
11192 g = g/255;
11193 b = b/255;
11194 a = a/255;
11195 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11196 }
11197
11198
11199
11200 override void SetLiquidType(
int value,
bool allow_client =
false)
11201 {
11202 if (!IsServerCheck(allow_client))
11203 return;
11204
11209 }
11210
11212 {
11213 return ConfigGetInt("varLiquidTypeInit");
11214 }
11215
11217 {
11219 }
11220
11222 {
11224 SetFrozen(false);
11225 }
11226
11229 {
11230 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11231 }
11232
11233
11236 {
11237 PlayerBase nplayer;
11238 if (PlayerBase.CastTo(nplayer, player))
11239 {
11241 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11242 }
11243 }
11244
11245
11248 {
11249 PlayerBase nplayer;
11250 if (PlayerBase.CastTo(nplayer,player))
11251 {
11252 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11253 }
11254
11255 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11256
11257 if (HasEnergyManager())
11258 {
11259 GetCompEM().UpdatePlugState();
11260 }
11261 }
11262
11263
11265 {
11266 super.OnPlacementStarted(player);
11267
11269 }
11270
11271 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11272 {
11274 {
11275 m_AdminLog.OnPlacementComplete(player,
this);
11276 }
11277
11278 super.OnPlacementComplete(player, position, orientation);
11279 }
11280
11281
11282
11283
11284
11286 {
11288 {
11289 return true;
11290 }
11291 else
11292 {
11293 return false;
11294 }
11295 }
11296
11297
11299 {
11301 {
11303 }
11304 }
11305
11306
11308 {
11310 }
11311
11313 {
11315 }
11316
11317 override void InsertAgent(
int agent,
float count = 1)
11318 {
11319 if (count < 1)
11320 return;
11321
11323 }
11324
11327 {
11329 }
11330
11331
11333 {
11335 }
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11379 {
11381 return false;
11382 return true;
11383 }
11384
11386 {
11387
11389 }
11390
11391
11394 {
11395 super.CheckForRoofLimited(timeTresholdMS);
11396
11397 float time =
g_Game.GetTime();
11398 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11399 {
11400 m_PreviousRoofTestTime = time;
11401 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11402 }
11403 }
11404
11405
11407 {
11409 {
11410 return 0;
11411 }
11412
11413 if (GetInventory().GetAttachmentSlotsCount() != 0)
11414 {
11415 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11416 if (filter)
11417 return filter.GetProtectionLevel(type, false, system);
11418 else
11419 return 0;
11420 }
11421
11422 string subclassPath, entryName;
11423
11424 switch (type)
11425 {
11427 entryName = "biological";
11428 break;
11430 entryName = "chemical";
11431 break;
11432 default:
11433 entryName = "biological";
11434 break;
11435 }
11436
11437 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11438
11439 return g_Game.ConfigGetFloat(subclassPath + entryName);
11440 }
11441
11442
11443
11446 {
11447 if (!IsMagazine())
11449
11451 }
11452
11453
11454
11455
11456
11461 {
11462 return true;
11463 }
11464
11466 {
11468 }
11469
11470
11471
11472
11473
11475 {
11476 if (parent)
11477 {
11478 if (parent.IsInherited(DayZInfected))
11479 return true;
11480
11481 if (!parent.IsRuined())
11482 return true;
11483 }
11484
11485 return true;
11486 }
11487
11489 {
11490 if (!super.CanPutAsAttachment(parent))
11491 {
11492 return false;
11493 }
11494
11495 if (!IsRuined() && !parent.IsRuined())
11496 {
11497 return true;
11498 }
11499
11500 return false;
11501 }
11502
11504 {
11505
11506
11507
11508
11509 return super.CanReceiveItemIntoCargo(item);
11510 }
11511
11513 {
11514
11515
11516
11517
11518 GameInventory attachmentInv = attachment.GetInventory();
11520 {
11521 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11522 return false;
11523 }
11524
11525 InventoryLocation loc = new InventoryLocation();
11526 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11527 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11528 return false;
11529
11530 return super.CanReceiveAttachment(attachment, slotId);
11531 }
11532
11534 {
11535 if (!super.CanReleaseAttachment(attachment))
11536 return false;
11537
11538 return GetInventory().AreChildrenAccessible();
11539 }
11540
11541
11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11562 {
11563 int id = muzzle_owner.GetMuzzleID();
11564 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11565
11566 if (WPOF_array)
11567 {
11568 for (int i = 0; i < WPOF_array.Count(); i++)
11569 {
11570 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11571
11572 if (WPOF)
11573 {
11574 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11575 }
11576 }
11577 }
11578 }
11579
11580
11582 {
11583 int id = muzzle_owner.GetMuzzleID();
11585
11586 if (WPOBE_array)
11587 {
11588 for (int i = 0; i < WPOBE_array.Count(); i++)
11589 {
11590 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11591
11592 if (WPOBE)
11593 {
11594 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11595 }
11596 }
11597 }
11598 }
11599
11600
11602 {
11603 int id = muzzle_owner.GetMuzzleID();
11604 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11605
11606 if (WPOOH_array)
11607 {
11608 for (int i = 0; i < WPOOH_array.Count(); i++)
11609 {
11610 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11611
11612 if (WPOOH)
11613 {
11614 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11615 }
11616 }
11617 }
11618 }
11619
11620
11622 {
11623 int id = muzzle_owner.GetMuzzleID();
11624 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11625
11626 if (WPOOH_array)
11627 {
11628 for (int i = 0; i < WPOOH_array.Count(); i++)
11629 {
11630 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11631
11632 if (WPOOH)
11633 {
11634 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11635 }
11636 }
11637 }
11638 }
11639
11640
11642 {
11643 int id = muzzle_owner.GetMuzzleID();
11644 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11645
11646 if (WPOOH_array)
11647 {
11648 for (int i = 0; i < WPOOH_array.Count(); i++)
11649 {
11650 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11651
11652 if (WPOOH)
11653 {
11654 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11655 }
11656 }
11657 }
11658 }
11659
11660
11661
11663 {
11665 {
11666 return true;
11667 }
11668
11669 return false;
11670 }
11671
11673 {
11675 {
11676 return true;
11677 }
11678
11679 return false;
11680 }
11681
11683 {
11685 {
11686 return true;
11687 }
11688
11689 return false;
11690 }
11691
11693 {
11694 return false;
11695 }
11696
11699 {
11700 return UATimeSpent.DEFAULT_DEPLOY;
11701 }
11702
11703
11704
11705
11707 {
11709 SetSynchDirty();
11710 }
11711
11713 {
11715 }
11716
11717
11719 {
11720 return false;
11721 }
11722
11725 {
11726 string att_type = "None";
11727
11728 if (ConfigIsExisting("soundAttType"))
11729 {
11730 att_type = ConfigGetString("soundAttType");
11731 }
11732
11734 }
11735
11737 {
11739 }
11740
11741
11742
11743
11744
11750
11752 {
11755
11757 }
11758
11759
11761 {
11763 return;
11764
11766
11769
11772
11773 SoundParameters params = new SoundParameters();
11777 }
11778
11779
11781 {
11783 {
11786
11787 SetSynchDirty();
11788
11791 }
11792 }
11793
11795 {
11797 }
11798
11799
11801 {
11803 return;
11804
11806 SetSynchDirty();
11807
11810 }
11811
11813 {
11816 }
11817
11819 {
11821 }
11822
11823 void OnApply(PlayerBase player);
11824
11826 {
11827 return 1.0;
11828 };
11829
11831 {
11833 }
11834
11836 {
11838 }
11839
11841
11843 {
11844 SetDynamicPhysicsLifeTime(0.01);
11846 }
11847
11849 {
11850 array<string> zone_names = new array<string>;
11851 GetDamageZones(zone_names);
11852 for (int i = 0; i < zone_names.Count(); i++)
11853 {
11854 SetHealthMax(zone_names.Get(i),"Health");
11855 }
11856 SetHealthMax("","Health");
11857 }
11858
11861 {
11862 float global_health = GetHealth01("","Health");
11863 array<string> zones = new array<string>;
11864 GetDamageZones(zones);
11865
11866 for (int i = 0; i < zones.Count(); i++)
11867 {
11868 SetHealth01(zones.Get(i),"Health",global_health);
11869 }
11870 }
11871
11874 {
11875 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11876 }
11877
11879 {
11880 if (!hasRootAsPlayer)
11881 {
11882 if (refParentIB)
11883 {
11884
11885 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11886 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11887
11888 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11889 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11890
11893 }
11894 else
11895 {
11896
11899 }
11900 }
11901 }
11902
11904 {
11906 {
11907 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11908 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11909 {
11910 float heatPermCoef = 1.0;
11912 while (ent)
11913 {
11914 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11915 ent = ent.GetHierarchyParent();
11916 }
11917
11918 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11919 }
11920 }
11921 }
11922
11924 {
11925
11926 EntityAI parent = GetHierarchyParent();
11927 if (!parent)
11928 {
11929 hasParent = false;
11930 hasRootAsPlayer = false;
11931 }
11932 else
11933 {
11934 hasParent = true;
11935 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11936 refParentIB =
ItemBase.Cast(parent);
11937 }
11938 }
11939
11940 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11941 {
11942
11943 }
11944
11946 {
11947
11948 return false;
11949 }
11950
11952 {
11953
11954
11955 return false;
11956 }
11957
11959 {
11960
11961 return false;
11962 }
11963
11966 {
11967 return !GetIsFrozen() &&
IsOpen();
11968 }
11969
11971 {
11972 bool hasParent = false, hasRootAsPlayer = false;
11974
11975 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11976 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11977
11978 if (wwtu || foodDecay)
11979 {
11983
11984 if (processWetness || processTemperature || processDecay)
11985 {
11987
11988 if (processWetness)
11989 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11990
11991 if (processTemperature)
11993
11994 if (processDecay)
11995 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11996 }
11997 }
11998 }
11999
12002 {
12004 }
12005
12007 {
12010
12011 return super.GetTemperatureFreezeThreshold();
12012 }
12013
12015 {
12018
12019 return super.GetTemperatureThawThreshold();
12020 }
12021
12023 {
12026
12027 return super.GetItemOverheatThreshold();
12028 }
12029
12031 {
12033 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12034
12035 return super.GetTemperatureFreezeTime();
12036 }
12037
12039 {
12041 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12042
12043 return super.GetTemperatureThawTime();
12044 }
12045
12050
12052 {
12053 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12054 }
12055
12057 {
12058 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12059 }
12060
12063 {
12065 }
12066
12068 {
12070 }
12071
12073 {
12075 }
12076
12079 {
12080 return null;
12081 }
12082
12085 {
12086 return false;
12087 }
12088
12090 {
12092 {
12095 if (!trg)
12096 {
12098 explosive = this;
12099 }
12100
12101 explosive.PairRemote(trg);
12103
12104 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12105 trg.SetPersistentPairID(persistentID);
12106 explosive.SetPersistentPairID(persistentID);
12107
12108 return true;
12109 }
12110 return false;
12111 }
12112
12115 {
12116 float ret = 1.0;
12119 ret *= GetHealth01();
12120
12121 return ret;
12122 }
12123
12124 #ifdef DEVELOPER
12125 override void SetDebugItem()
12126 {
12127 super.SetDebugItem();
12128 _itemBase = this;
12129 }
12130
12132 {
12133 string text = super.GetDebugText();
12134
12136 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12137
12138 return text;
12139 }
12140 #endif
12141
12143 {
12144 return true;
12145 }
12146
12148
12150
12152 {
12155 }
12156
12157
12165
12181
12182 [
Obsolete(
"Use ItemSoundHandler instead")]
12185 {
12186 if (!
g_Game.IsDedicatedServer())
12187 {
12188 if (ConfigIsExisting("attachSoundSet"))
12189 {
12190 string cfg_path = "";
12191 string soundset = "";
12192 string type_name =
GetType();
12193
12196 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12197 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12198
12199 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12200 {
12201 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12202 {
12203 if (cfg_slot_array[i] == slot_type)
12204 {
12205 soundset = cfg_soundset_array[i];
12206 break;
12207 }
12208 }
12209 }
12210
12211 if (soundset != "")
12212 {
12213 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12215 }
12216 }
12217 }
12218 }
12219
12221}
12222
12224{
12226 if (entity)
12227 {
12228 bool is_item = entity.IsInherited(
ItemBase);
12229 if (is_item && full_quantity)
12230 {
12233 }
12234 }
12235 else
12236 {
12238 return NULL;
12239 }
12240 return entity;
12241}
12242
12244{
12245 if (item)
12246 {
12247 if (health > 0)
12248 item.SetHealth("", "", health);
12249
12250 if (item.CanHaveTemperature())
12251 {
12253 if (item.CanFreeze())
12254 item.SetFrozen(false);
12255 }
12256
12257 if (item.HasEnergyManager())
12258 {
12259 if (quantity >= 0)
12260 {
12261 item.GetCompEM().SetEnergy0To1(quantity);
12262 }
12263 else
12264 {
12266 }
12267 }
12268 else if (item.IsMagazine())
12269 {
12270 Magazine mag = Magazine.Cast(item);
12271 if (quantity >= 0)
12272 {
12273 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12274 }
12275 else
12276 {
12278 }
12279
12280 }
12281 else
12282 {
12283 if (quantity >= 0)
12284 {
12285 item.SetQuantityNormalized(quantity, false);
12286 }
12287 else
12288 {
12290 }
12291
12292 }
12293 }
12294}
12295
12296#ifdef DEVELOPER
12298#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.