7340{
7342 {
7343 return true;
7344 }
7345};
7346
7347
7348
7350{
7354
7356
7359
7360
7361
7362
7363
7372
7378
7383
7388
7409 protected bool m_IsResultOfSplit
7410
7412
7417
7418
7419
7421
7425
7426
7427
7429
7432
7433
7434
7440
7441
7449
7452
7453
7455
7456
7458
7459
7464
7465
7470
7471
7473
7474
7476 {
7481
7482 if (!
GetGame().IsDedicatedServer())
7483 {
7485 {
7487
7489 {
7491 }
7492 }
7493
7496 }
7497
7498 m_OldLocation = null;
7499
7501 {
7503 }
7504
7505 if (ConfigIsExisting("headSelectionsToHide"))
7506 {
7509 }
7510
7512 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7513 {
7515 }
7516
7518
7519 m_IsResultOfSplit = false;
7520
7522 }
7523
7525 {
7526 super.InitItemVariables();
7527
7533 m_Count = ConfigGetInt(
"count");
7534
7537
7542
7545
7550
7562
7566
7567
7570 if (ConfigIsExisting("canBeSplit"))
7571 {
7574 }
7575
7577 if (ConfigIsExisting("itemBehaviour"))
7579
7580
7583 RegisterNetSyncVariableInt("m_VarLiquidType");
7584 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7585
7586 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7587 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7588 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7589
7590 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7591 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7592 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7593 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7594
7595 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7596 RegisterNetSyncVariableBool("m_IsTakeable");
7597 RegisterNetSyncVariableBool("m_IsHologram");
7598
7601 {
7604 }
7605
7607
7609 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7611
7612 }
7613
7615 {
7617 }
7618
7620 {
7623 {
7628 }
7629 }
7630
7631 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7632 {
7634 {
7637 }
7638
7640 }
7641
7643 {
7649 }
7650
7652
7654 {
7656
7657 if (!action)
7658 {
7659 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7660 return;
7661 }
7662
7664 if (!ai)
7665 {
7667 return;
7668 }
7669
7671 if (!action_array)
7672 {
7673 action_array = new array<ActionBase_Basic>;
7675 }
7676 if (LogManager.IsActionLogEnable())
7677 {
7678 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7679 }
7680
7681 if (action_array.Find(action) != -1)
7682 {
7683 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7684 }
7685 else
7686 {
7687 action_array.Insert(action);
7688 }
7689 }
7690
7692 {
7694 ActionBase action = player.GetActionManager().GetAction(actionName);
7697
7698 if (action_array)
7699 {
7700 action_array.RemoveItem(action);
7701 }
7702 }
7703
7704
7705
7707 {
7708 ActionOverrideData overrideData = new ActionOverrideData();
7712
7714 if (!actionMap)
7715 {
7718 }
7719
7720 actionMap.Insert(this.
Type(), overrideData);
7721
7722 }
7723
7725
7727
7728
7730 {
7733
7736
7737 string config_to_search = "CfgVehicles";
7738 string muzzle_owner_config;
7739
7741 {
7742 if (IsInherited(Weapon))
7743 config_to_search = "CfgWeapons";
7744
7745 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7746
7747 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7748
7750
7751 if (config_OnFire_subclass_count > 0)
7752 {
7753 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7754
7755 for (int i = 0; i < config_OnFire_subclass_count; i++)
7756 {
7757 string particle_class = "";
7759 string config_OnFire_entry = config_OnFire_class + particle_class;
7760 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7761 WPOF_array.Insert(WPOF);
7762 }
7763
7764
7766 }
7767 }
7768
7770 {
7771 config_to_search = "CfgWeapons";
7772 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7773
7774 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7775
7777
7778 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7779 {
7780 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7781
7782 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7783 {
7784 string particle_class2 = "";
7786 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7787 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7788 WPOBE_array.Insert(WPOBE);
7789 }
7790
7791
7793 }
7794 }
7795 }
7796
7797
7799 {
7802
7804 {
7805 string config_to_search = "CfgVehicles";
7806
7807 if (IsInherited(Weapon))
7808 config_to_search = "CfgWeapons";
7809
7810 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7811 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7812
7813 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
7814 {
7815
7817
7819 {
7821 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7823 return;
7824 }
7825
7828
7829
7830
7832 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7833
7834 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7835 {
7836 string particle_class = "";
7838 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7840
7841 if (entry_type == CT_CLASS)
7842 {
7843 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7844 WPOOH_array.Insert(WPOF);
7845 }
7846 }
7847
7848
7850 }
7851 }
7852 }
7853
7855 {
7857 }
7858
7860 {
7862 {
7864
7867
7870
7871 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7872 }
7873 }
7874
7876 {
7878 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7879
7881 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7882
7884 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7885
7887 {
7889 }
7890 }
7891
7893 {
7895 }
7896
7898 {
7901 else
7903
7905 {
7908 }
7909 else
7910 {
7913
7916 }
7917
7919 }
7920
7922 {
7924 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7925 }
7926
7928 {
7930 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7932 }
7933
7935 {
7937 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7938 }
7939
7941 {
7944
7945 OverheatingParticle OP = new OverheatingParticle();
7950
7952 }
7953
7955 {
7958
7959 return -1;
7960 }
7961
7963 {
7965 {
7968
7969 for (int i = count; i > 0; --i)
7970 {
7971 int id = i - 1;
7974
7977
7978 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7979 {
7980 if (p)
7981 {
7984 }
7985 }
7986 }
7987 }
7988 }
7989
7991 {
7993 {
7995 {
7996 int id = i - 1;
7998
7999 if (OP)
8000 {
8002
8003 if (p)
8004 {
8006 }
8007
8008 delete OP;
8009 }
8010 }
8011
8014 }
8015 }
8016
8019 {
8020 return 0.0;
8021 }
8022
8023
8025 {
8026 return 250;
8027 }
8028
8030 {
8031 return 0;
8032 }
8033
8036 {
8038 return true;
8039
8040 return false;
8041 }
8042
8045 {
8048
8050 {
8052 }
8053 else
8054 {
8055
8057 }
8058
8060 }
8061
8068 {
8069 return -1;
8070 }
8071
8072
8073
8074
8076 {
8078 {
8080 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8081
8082 if (r_index >= 0)
8083 {
8084 InventoryLocation r_il = new InventoryLocation;
8085 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8086
8087 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8090 {
8091 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8092 }
8094 {
8095 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8096 }
8097
8098 }
8099
8100 player.GetHumanInventory().ClearUserReservedLocation(this);
8101 }
8102
8105 }
8106
8107
8108
8109
8111 {
8112 return ItemBase.m_DebugActionsMask;
8113 }
8114
8116 {
8117 return ItemBase.m_DebugActionsMask & mask;
8118 }
8119
8121 {
8122 ItemBase.m_DebugActionsMask = mask;
8123 }
8124
8126 {
8127 ItemBase.m_DebugActionsMask |= mask;
8128 }
8129
8131 {
8132 ItemBase.m_DebugActionsMask &= ~mask;
8133 }
8134
8136 {
8138 {
8140 }
8141 else
8142 {
8144 }
8145 }
8146
8147
8149 {
8150 if (GetEconomyProfile())
8151 {
8152 float q_max = GetEconomyProfile().GetQuantityMax();
8153 if (q_max > 0)
8154 {
8155 float q_min = GetEconomyProfile().GetQuantityMin();
8156 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8157
8159 {
8160 ComponentEnergyManager comp = GetCompEM();
8162 {
8164 }
8165 }
8167 {
8169
8170 }
8171
8172 }
8173 }
8174 }
8175
8178 {
8179 EntityAI parent = GetHierarchyParent();
8180
8181 if (parent)
8182 {
8183 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8184 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8185 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8186 }
8187 }
8188
8191 {
8192 EntityAI parent = GetHierarchyParent();
8193
8194 if (parent)
8195 {
8196 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8197 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8198 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8199 }
8200 }
8201
8203 {
8204
8205
8206
8207
8209
8211 {
8212 if (ScriptInputUserData.CanStoreInputUserData())
8213 {
8214 ScriptInputUserData ctx = new ScriptInputUserData;
8220 ctx.
Write(use_stack_max);
8223
8225 {
8226 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8227 }
8228 }
8229 }
8230 else if (!
GetGame().IsMultiplayer())
8231 {
8233 }
8234 }
8235
8237 {
8239 }
8240
8242 {
8244 }
8245
8247 {
8249 }
8250
8252 {
8253
8254 return false;
8255 }
8256
8258 {
8259 return false;
8260 }
8261
8265 {
8266 return false;
8267 }
8268
8270 {
8271 return "";
8272 }
8273
8275
8277 {
8278 return false;
8279 }
8280
8282 {
8283 return true;
8284 }
8285
8286
8287
8289 {
8290 return true;
8291 }
8292
8294 {
8295 return true;
8296 }
8297
8299 {
8300 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8302 }
8303
8305 {
8307 }
8308
8310 {
8312 if (!is_being_placed)
8314 SetSynchDirty();
8315 }
8316
8317
8319
8321 {
8323 }
8324
8326 {
8328 }
8329
8331 {
8332 return 1;
8333 }
8334
8336 {
8337 return false;
8338 }
8339
8341 {
8343 SetSynchDirty();
8344 }
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8381 {
8382 super.OnMovedInsideCargo(container);
8383
8384 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8385 }
8386
8387 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8388 {
8389 super.EEItemLocationChanged(oldLoc,newLoc);
8390
8391 PlayerBase new_player = null;
8392 PlayerBase old_player = null;
8393
8394 if (newLoc.GetParent())
8395 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8396
8397 if (oldLoc.GetParent())
8398 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8399
8401 {
8402 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
8403
8404 if (r_index >= 0)
8405 {
8406 InventoryLocation r_il = new InventoryLocation;
8407 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8408
8409 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8412 {
8413 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8414 }
8416 {
8417 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8418 }
8419
8420 }
8421 }
8422
8424 {
8425 if (new_player)
8426 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
8427
8428 if (new_player == old_player)
8429 {
8430
8431 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8432 {
8434 {
8435 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8436 {
8437 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8438 }
8439 }
8440 else
8441 {
8442 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8443 }
8444 }
8445
8446 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8447 {
8448 int type = oldLoc.GetType();
8450 {
8451 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8452 }
8454 {
8455 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8456 }
8457 }
8458 if (!m_OldLocation)
8459 {
8460 m_OldLocation = new InventoryLocation;
8461 }
8462 m_OldLocation.Copy(oldLoc);
8463 }
8464 else
8465 {
8466 if (m_OldLocation)
8467 {
8468 m_OldLocation.Reset();
8469 }
8470 }
8471
8473 }
8474 else
8475 {
8476 if (new_player)
8477 {
8478 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8479 if (res_index >= 0)
8480 {
8481 InventoryLocation il = new InventoryLocation;
8482 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
8484 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
8487 {
8488 il.
GetParent().GetOnReleaseLock().Invoke(it);
8489 }
8491 {
8493 }
8494
8495 }
8496 }
8498 {
8499
8501 }
8502
8503 if (m_OldLocation)
8504 {
8505 m_OldLocation.Reset();
8506 }
8507 }
8508 }
8509
8510 override void EOnContact(IEntity other, Contact extra)
8511 {
8513 {
8514 int liquidType = -1;
8516 if (impactSpeed > 0.0)
8517 {
8519 #ifndef SERVER
8521 #else
8523 SetSynchDirty();
8524 #endif
8526 }
8527 }
8528
8529 #ifdef SERVER
8530 if (GetCompEM() && GetCompEM().IsPlugged())
8531 {
8532 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8533 GetCompEM().UnplugThis();
8534 }
8535 #endif
8536 }
8537
8539
8541 {
8543 }
8544
8546 {
8547
8548 }
8549
8551 {
8552 super.OnItemLocationChanged(old_owner, new_owner);
8553
8554 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8555 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8556
8557 if (!relatedPlayer && playerNew)
8558 relatedPlayer = playerNew;
8559
8560 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8561 {
8563 if (actionMgr)
8564 {
8565 ActionBase currentAction = actionMgr.GetRunningAction();
8566 if (currentAction)
8568 }
8569 }
8570
8571 Man ownerPlayerOld = null;
8572 Man ownerPlayerNew = null;
8573
8574 if (old_owner)
8575 {
8576 if (old_owner.
IsMan())
8577 {
8578 ownerPlayerOld = Man.Cast(old_owner);
8579 }
8580 else
8581 {
8582 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8583 }
8584 }
8585 else
8586 {
8588 {
8590
8591 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8592 {
8593 GetCompEM().UnplugThis();
8594 }
8595 }
8596 }
8597
8598 if (new_owner)
8599 {
8600 if (new_owner.
IsMan())
8601 {
8602 ownerPlayerNew = Man.Cast(new_owner);
8603 }
8604 else
8605 {
8606 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8607 }
8608 }
8609
8610 if (ownerPlayerOld != ownerPlayerNew)
8611 {
8612 if (ownerPlayerOld)
8613 {
8614 array<EntityAI> subItemsExit = new array<EntityAI>;
8616 for (int i = 0; i < subItemsExit.Count(); i++)
8617 {
8620 }
8621 }
8622
8623 if (ownerPlayerNew)
8624 {
8625 array<EntityAI> subItemsEnter = new array<EntityAI>;
8627 for (int j = 0; j < subItemsEnter.Count(); j++)
8628 {
8631 }
8632 }
8633 }
8634 else if (ownerPlayerNew != null)
8635 {
8636 PlayerBase nplayer;
8637 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8638 {
8639 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8641 for (int k = 0; k < subItemsUpdate.Count(); k++)
8642 {
8644 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8645 }
8646 }
8647 }
8648
8649 if (old_owner)
8650 old_owner.OnChildItemRemoved(this);
8651 if (new_owner)
8652 new_owner.OnChildItemReceived(this);
8653 }
8654
8655
8657 {
8658 super.EEDelete(parent);
8659 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8660 if (player)
8661 {
8663
8664 if (player.IsAlive())
8665 {
8666 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8667 if (r_index >= 0)
8668 {
8669 InventoryLocation r_il = new InventoryLocation;
8670 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8671
8672 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8675 {
8676 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8677 }
8679 {
8680 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8681 }
8682
8683 }
8684
8685 player.RemoveQuickBarEntityShortcut(this);
8686 }
8687 }
8688 }
8689
8691 {
8692 super.EEKilled(killer);
8693
8696 {
8697 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8698 {
8699 if (IsMagazine())
8700 {
8701 if (Magazine.Cast(this).GetAmmoCount() > 0)
8702 {
8704 }
8705 }
8706 else
8707 {
8709 }
8710 }
8711 }
8712 }
8713
8715 {
8716 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8717
8718 super.OnWasAttached(parent, slot_id);
8719
8722
8724 }
8725
8727 {
8728 super.OnWasDetached(parent, slot_id);
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 ];
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 if (GetInventory().GetCargo())
8878 {
8879 int item_count = GetInventory().GetCargo().GetItemCount();
8880 if (item_count > 0)
8881 {
8882 int random_pick = Math.RandomInt(0, item_count);
8884 if (!item.IsExplosive())
8885 {
8886 item.AddHealth("","",damage);
8887 return true;
8888 }
8889 }
8890 }
8891 return false;
8892 }
8893
8895 {
8896 int attachment_count = GetInventory().AttachmentCount();
8897 if (attachment_count > 0)
8898 {
8899 int random_pick = Math.RandomInt(0, attachment_count);
8900 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8901 if (!attachment.IsExplosive())
8902 {
8903 attachment.AddHealth("","",damage);
8904 return true;
8905 }
8906 }
8907 return false;
8908 }
8909
8911 {
8913 }
8914
8916 {
8918 return GetInventory().CanRemoveEntity();
8919
8920 return false;
8921 }
8922
8924 {
8926 return;
8927
8929 {
8930 if (ScriptInputUserData.CanStoreInputUserData())
8931 {
8932 ScriptInputUserData ctx = new ScriptInputUserData;
8937 ctx.
Write(destination_entity);
8941 }
8942 }
8943 else if (!
GetGame().IsMultiplayer())
8944 {
8946 }
8947 }
8948
8950 {
8952 return;
8953
8954 float split_quantity_new;
8958 InventoryLocation loc = new InventoryLocation;
8959
8960 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8961 {
8963 split_quantity_new = stack_max;
8964 else
8966
8967 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8968 if (new_item)
8969 {
8970 new_item.SetResultOfSplit(true);
8971 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8973 new_item.SetQuantity(split_quantity_new);
8974 }
8975 }
8976 else if (destination_entity && slot_id == -1)
8977 {
8978 if (quantity > stack_max)
8979 split_quantity_new = stack_max;
8980 else
8981 split_quantity_new = quantity;
8982
8984 {
8987 }
8988
8989 if (new_item)
8990 {
8991 new_item.SetResultOfSplit(true);
8992 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8994 new_item.SetQuantity(split_quantity_new);
8995 }
8996 }
8997 else
8998 {
8999 if (stack_max != 0)
9000 {
9002 {
9004 }
9005
9006 if (split_quantity_new == 0)
9007 {
9008 if (!
GetGame().IsMultiplayer())
9009 player.PhysicalPredictiveDropItem(this);
9010 else
9011 player.ServerDropEntity(this);
9012 return;
9013 }
9014
9016
9017 if (new_item)
9018 {
9019 new_item.SetResultOfSplit(true);
9020 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9022 new_item.SetQuantity(stack_max);
9023 new_item.PlaceOnSurface();
9024 }
9025 }
9026 }
9027 }
9028
9030 {
9032 return;
9033
9034 float split_quantity_new;
9038 InventoryLocation loc = new InventoryLocation;
9039
9040 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9041 {
9043 split_quantity_new = stack_max;
9044 else
9046
9047 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9048 if (new_item)
9049 {
9050 new_item.SetResultOfSplit(true);
9051 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9053 new_item.SetQuantity(split_quantity_new);
9054 }
9055 }
9056 else if (destination_entity && slot_id == -1)
9057 {
9058 if (quantity > stack_max)
9059 split_quantity_new = stack_max;
9060 else
9061 split_quantity_new = quantity;
9062
9064 {
9067 }
9068
9069 if (new_item)
9070 {
9071 new_item.SetResultOfSplit(true);
9072 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9074 new_item.SetQuantity(split_quantity_new);
9075 }
9076 }
9077 else
9078 {
9079 if (stack_max != 0)
9080 {
9082 {
9084 }
9085
9087
9088 if (new_item)
9089 {
9090 new_item.SetResultOfSplit(true);
9091 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9093 new_item.SetQuantity(stack_max);
9094 new_item.PlaceOnSurface();
9095 }
9096 }
9097 }
9098 }
9099
9101 {
9103 return;
9104
9106 {
9107 if (ScriptInputUserData.CanStoreInputUserData())
9108 {
9109 ScriptInputUserData ctx = new ScriptInputUserData;
9114 dst.WriteToContext(ctx);
9116 }
9117 }
9118 else if (!
GetGame().IsMultiplayer())
9119 {
9121 }
9122 }
9123
9125 {
9127 return;
9128
9130 {
9131 if (ScriptInputUserData.CanStoreInputUserData())
9132 {
9133 ScriptInputUserData ctx = new ScriptInputUserData;
9138 ctx.
Write(destination_entity);
9144 }
9145 }
9146 else if (!
GetGame().IsMultiplayer())
9147 {
9149 }
9150 }
9151
9153 {
9155 }
9156
9158 {
9160 return this;
9161
9163 float split_quantity_new;
9165 if (dst.IsValid())
9166 {
9167 int slot_id = dst.GetSlot();
9169
9170 if (quantity > stack_max)
9171 split_quantity_new = stack_max;
9172 else
9173 split_quantity_new = quantity;
9174
9176
9177 if (new_item)
9178 {
9179 new_item.SetResultOfSplit(true);
9180 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9183 }
9184
9185 return new_item;
9186 }
9187
9188 return null;
9189 }
9190
9192 {
9194 return;
9195
9197 float split_quantity_new;
9199 if (destination_entity)
9200 {
9202 if (quantity > stackable)
9203 split_quantity_new = stackable;
9204 else
9205 split_quantity_new = quantity;
9206
9207 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9208 if (new_item)
9209 {
9210 new_item.SetResultOfSplit(true);
9211 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9213 new_item.SetQuantity(split_quantity_new);
9214 }
9215 }
9216 }
9217
9219 {
9221 return;
9222
9224 {
9225 if (ScriptInputUserData.CanStoreInputUserData())
9226 {
9227 ScriptInputUserData ctx = new ScriptInputUserData;
9232 ItemBase destination_entity =
this;
9233 ctx.
Write(destination_entity);
9237 }
9238 }
9239 else if (!
GetGame().IsMultiplayer())
9240 {
9242 }
9243 }
9244
9246 {
9248 return;
9249
9251 float split_quantity_new;
9253 if (player)
9254 {
9256 if (quantity > stackable)
9257 split_quantity_new = stackable;
9258 else
9259 split_quantity_new = quantity;
9260
9261 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9262 new_item =
ItemBase.Cast(in_hands);
9263 if (new_item)
9264 {
9265 new_item.SetResultOfSplit(true);
9266 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9268 new_item.SetQuantity(split_quantity_new);
9269 }
9270 }
9271 }
9272
9274 {
9276 return;
9277
9279 float split_quantity_new = Math.Floor(quantity * 0.5);
9280
9282
9283 if (new_item)
9284 {
9285 if (new_item.GetQuantityMax() < split_quantity_new)
9286 {
9287 split_quantity_new = new_item.GetQuantityMax();
9288 }
9289
9290 new_item.SetResultOfSplit(true);
9291 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9292
9294 {
9297 }
9298 else
9299 {
9302 }
9303 }
9304 }
9305
9307 {
9309 return;
9310
9312 float split_quantity_new = Math.Floor(quantity / 2);
9313
9314 InventoryLocation invloc = new InventoryLocation;
9316
9318 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9319
9320 if (new_item)
9321 {
9322 if (new_item.GetQuantityMax() < split_quantity_new)
9323 {
9324 split_quantity_new = new_item.GetQuantityMax();
9325 }
9327 {
9330 }
9331 else
9332 {
9335 }
9336 }
9337 }
9338
9341 {
9342 SetWeightDirty();
9344
9345 if (parent)
9346 parent.OnAttachmentQuantityChangedEx(this, delta);
9347
9349 {
9351 {
9353 }
9355 {
9356 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9358 }
9359 }
9360
9361 }
9362
9365 {
9366
9367 }
9368
9371 {
9373 }
9374
9376 {
9377 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9378
9380 {
9381 if (newLevel == GameConstants.STATE_RUINED)
9382 {
9384 EntityAI parent = GetHierarchyParent();
9385 if (parent && parent.IsFireplace())
9386 {
9387 CargoBase cargo = GetInventory().GetCargo();
9388 if (cargo)
9389 {
9391 {
9393 }
9394 }
9395 }
9396 }
9397
9399 {
9400
9402 return;
9403 }
9404
9405 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9406 {
9408 }
9409 }
9410 }
9411
9412
9414 {
9415 super.OnRightClick();
9416
9418 {
9420 {
9421 if (ScriptInputUserData.CanStoreInputUserData())
9422 {
9423 vector m4[4];
9425
9426 EntityAI root = GetHierarchyRoot();
9427
9428 InventoryLocation dst = new InventoryLocation;
9430 {
9431 if (root)
9432 {
9433 root.GetTransform(m4);
9435 }
9436 else
9437 GetInventory().GetCurrentInventoryLocation(dst);
9438 }
9439 else
9440 {
9442
9443
9444 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9445 {
9446 if (root)
9447 {
9448 root.GetTransform(m4);
9450 }
9451 else
9452 GetInventory().GetCurrentInventoryLocation(dst);
9453 }
9454 else
9455 {
9456 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9457 }
9458 }
9459
9460 ScriptInputUserData ctx = new ScriptInputUserData;
9468 }
9469 }
9470 else if (!
GetGame().IsMultiplayer())
9471 {
9473 }
9474 }
9475 }
9476
9477 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9478 {
9479
9480 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9481 return false;
9482
9483 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9484 return false;
9485
9486
9488 return false;
9489
9490
9491 Magazine mag = Magazine.Cast(this);
9492 if (mag)
9493 {
9494 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9495 return false;
9496
9497 if (stack_max_limit)
9498 {
9499 Magazine other_mag = Magazine.Cast(other_item);
9500 if (other_item)
9501 {
9502 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9503 return false;
9504 }
9505
9506 }
9507 }
9508 else
9509 {
9510
9512 return false;
9513
9515 return false;
9516 }
9517
9518 PlayerBase player = null;
9519 if (CastTo(player, GetHierarchyRootPlayer()))
9520 {
9521 if (player.GetInventory().HasAttachment(this))
9522 return false;
9523
9524 if (player.IsItemsToDelete())
9525 return false;
9526 }
9527
9528 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9529 return false;
9530
9531 int slotID;
9533 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9534 return false;
9535
9536 return true;
9537 }
9538
9540 {
9542 }
9543
9545 {
9546 return m_IsResultOfSplit;
9547 }
9548
9550 {
9551 m_IsResultOfSplit = value;
9552 }
9553
9555 {
9557 }
9558
9560 {
9561 float other_item_quantity = other_item.GetQuantity();
9562 float this_free_space;
9563
9565
9567
9568 if (other_item_quantity > this_free_space)
9569 {
9570 return this_free_space;
9571 }
9572 else
9573 {
9574 return other_item_quantity;
9575 }
9576 }
9577
9579 {
9581 }
9582
9584 {
9586 return;
9587
9588 if (!IsMagazine() && other_item)
9589 {
9591 if (quantity_used != 0)
9592 {
9593 float hp1 = GetHealth01("","");
9594 float hp2 = other_item.GetHealth01("","");
9595 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9596 hpResult = hpResult / (
GetQuantity() + quantity_used);
9597
9598 hpResult *= GetMaxHealth();
9599 Math.Round(hpResult);
9600 SetHealth("", "Health", hpResult);
9601
9603 other_item.AddQuantity(-quantity_used);
9604 }
9605 }
9607 }
9608
9610 {
9611 #ifdef SERVER
9612 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9613 GetHierarchyParent().IncreaseLifetimeUp();
9614 #endif
9615 };
9616
9618 {
9619 PlayerBase p = PlayerBase.Cast(player);
9620
9621 array<int> recipesIds = p.m_Recipes;
9622 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9623 if (moduleRecipesManager)
9624 {
9625 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9626 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9627 }
9628
9629 for (int i = 0;i < recipesIds.Count(); i++)
9630 {
9631 int key = recipesIds.Get(i);
9632 string recipeName = moduleRecipesManager.GetRecipeName(key);
9634 }
9635 }
9636
9637
9638 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9639 {
9640 super.GetDebugActions(outputList);
9641
9642
9647
9648
9652
9656
9657
9660
9661
9663 {
9666 }
9667
9669
9672
9676 }
9677
9678
9679
9680
9682 {
9683 super.OnAction(action_id, player, ctx);
9684 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9685 {
9686 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9687 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9688 PlayerBase p = PlayerBase.Cast(player);
9689 if (
EActions.RECIPES_RANGE_START < 1000)
9690 {
9691 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9692 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9693 }
9694 }
9695 #ifndef SERVER
9696 else if (action_id ==
EActions.WATCH_PLAYER)
9697 {
9698 PluginDeveloper.SetDeveloperItemClientEx(player);
9699 }
9700 #endif
9702 {
9703 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9704 {
9705 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9706 OnDebugButtonPressServer(id + 1);
9707 }
9708
9709 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9710 {
9711 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9713 }
9714
9715 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9716 {
9717 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9719 }
9720
9721 else if (action_id ==
EActions.ADD_QUANTITY)
9722 {
9723 if (IsMagazine())
9724 {
9725 Magazine mag = Magazine.Cast(this);
9726 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9727 }
9728 else
9729 {
9731 }
9732
9733 if (m_EM)
9734 {
9735 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9736 }
9737
9738 }
9739
9740 else if (action_id ==
EActions.REMOVE_QUANTITY)
9741 {
9742 if (IsMagazine())
9743 {
9744 Magazine mag2 = Magazine.Cast(this);
9745 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9746 }
9747 else
9748 {
9750 }
9751 if (m_EM)
9752 {
9753 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9754 }
9755
9756 }
9757
9758 else if (action_id ==
EActions.SET_QUANTITY_0)
9759 {
9761
9762 if (m_EM)
9763 {
9764 m_EM.SetEnergy(0);
9765 }
9766 }
9767
9768 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9769 {
9771
9772 if (m_EM)
9773 {
9774 m_EM.SetEnergy(m_EM.GetEnergyMax());
9775 }
9776 }
9777
9778 else if (action_id ==
EActions.ADD_HEALTH)
9779 {
9780 AddHealth("","",GetMaxHealth("","Health")/5);
9781 }
9782 else if (action_id ==
EActions.REMOVE_HEALTH)
9783 {
9784 AddHealth("","",-GetMaxHealth("","Health")/5);
9785 }
9786 else if (action_id ==
EActions.DESTROY_HEALTH)
9787 {
9788 SetHealth01("","",0);
9789 }
9790 else if (action_id ==
EActions.WATCH_ITEM)
9791 {
9793 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9794 #ifdef DEVELOPER
9795 SetDebugDeveloper_item(this);
9796 #endif
9797 }
9798
9799 else if (action_id ==
EActions.ADD_TEMPERATURE)
9800 {
9801 AddTemperature(20);
9802
9803 }
9804
9805 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9806 {
9807 AddTemperature(-20);
9808
9809 }
9810
9811 else if (action_id ==
EActions.FLIP_FROZEN)
9812 {
9813 SetFrozen(!GetIsFrozen());
9814
9815 }
9816
9817 else if (action_id ==
EActions.ADD_WETNESS)
9818 {
9820
9821 }
9822
9823 else if (action_id ==
EActions.REMOVE_WETNESS)
9824 {
9826
9827 }
9828
9829 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9830 {
9833
9834
9835 }
9836
9837 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9838 {
9841 }
9842
9843 else if (action_id ==
EActions.MAKE_SPECIAL)
9844 {
9845 auto debugParams = DebugSpawnParams.WithPlayer(player);
9846 OnDebugSpawnEx(debugParams);
9847 }
9848
9849 else if (action_id ==
EActions.DELETE)
9850 {
9851 Delete();
9852 }
9853
9854 }
9855
9856
9857 return false;
9858 }
9859
9860
9861
9862
9866
9869
9870
9871
9873 {
9874 return false;
9875 }
9876
9877
9879 {
9880 return true;
9881 }
9882
9883
9885 {
9886 return true;
9887 }
9888
9889
9890
9892 {
9893 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9895 }
9896
9899 {
9900 return null;
9901 }
9902
9904 {
9905 return false;
9906 }
9907
9909 {
9910 return false;
9911 }
9912
9916
9917
9919 {
9920 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9921 return module_repairing.CanRepair(this, item_repair_kit);
9922 }
9923
9924
9925 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9926 {
9927 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9928 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9929 }
9930
9931
9933 {
9934
9935
9936
9937
9938
9939
9940
9941
9942 return 1;
9943 }
9944
9945
9946
9948 {
9950 }
9951
9952
9953
9955 {
9957 }
9958
9959
9968 {
9969 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9970
9971 if (player)
9972 {
9973 player.MessageStatus(text);
9974 }
9975 }
9976
9977
9986 {
9987 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9988
9989 if (player)
9990 {
9991 player.MessageAction(text);
9992 }
9993 }
9994
9995
10004 {
10005 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10006
10007 if (player)
10008 {
10009 player.MessageFriendly(text);
10010 }
10011 }
10012
10013
10022 {
10023 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10024
10025 if (player)
10026 {
10027 player.MessageImportant(text);
10028 }
10029 }
10030
10032 {
10033 return true;
10034 }
10035
10036
10037 override bool KindOf(
string tag)
10038 {
10039 bool found = false;
10040 string item_name = this.
GetType();
10043
10044 int array_size = item_tag_array.Count();
10045 for (int i = 0; i < array_size; i++)
10046 {
10047 if (item_tag_array.Get(i) == tag)
10048 {
10049 found = true;
10050 break;
10051 }
10052 }
10053 return found;
10054 }
10055
10056
10058 {
10059
10060 super.OnRPC(sender, rpc_type,ctx);
10061
10062
10063 switch (rpc_type)
10064 {
10065 #ifndef SERVER
10066 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10067 Param2<bool, string> p = new Param2<bool, string>(false, "");
10068
10070 return;
10071
10072 bool play = p.param1;
10073 string soundSet = p.param2;
10074
10075 if (play)
10076 {
10078 {
10080 {
10082 }
10083 }
10084 else
10085 {
10087 }
10088 }
10089 else
10090 {
10092 }
10093
10094 break;
10095 #endif
10096
10097 }
10098
10100 {
10102 }
10103 }
10104
10105
10106
10107
10109 {
10110 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10111 return plugin.GetID(
name);
10112 }
10113
10115 {
10116 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10117 return plugin.GetName(id);
10118 }
10119
10122 {
10123
10124
10125 int varFlags;
10126 if (!ctx.
Read(varFlags))
10127 return;
10128
10129 if (varFlags & ItemVariableFlags.FLOAT)
10130 {
10132 }
10133 }
10134
10136 {
10137
10138 super.SerializeNumericalVars(floats_out);
10139
10140
10141
10143 {
10145 }
10146
10148 {
10150 }
10151
10153 {
10155 }
10156
10158 {
10163 }
10164
10166 {
10168 }
10169 }
10170
10172 {
10173
10174 super.DeSerializeNumericalVars(floats);
10175
10176
10177 int index = 0;
10178 int mask = Math.Round(floats.Get(index));
10179
10180 index++;
10181
10183 {
10185 {
10187 }
10188 else
10189 {
10190 float quantity = floats.Get(index);
10191 SetQuantity(quantity,
true,
false,
false,
false);
10192 }
10193 index++;
10194 }
10195
10197 {
10198 float wet = floats.Get(index);
10200 index++;
10201 }
10202
10204 {
10205 int liquidtype = Math.Round(floats.Get(index));
10207 index++;
10208 }
10209
10211 {
10213 index++;
10215 index++;
10217 index++;
10219 index++;
10220 }
10221
10223 {
10224 int cleanness = Math.Round(floats.Get(index));
10226 index++;
10227 }
10228 }
10229
10231 {
10232 super.WriteVarsToCTX(ctx);
10233
10234
10236 {
10238 }
10239
10241 {
10243 }
10244
10246 {
10248 }
10249
10251 {
10252 int r,g,b,a;
10258 }
10259
10261 {
10263 }
10264 }
10265
10267 {
10268 if (!super.ReadVarsFromCTX(ctx,version))
10269 return false;
10270
10271 int intValue;
10272 float value;
10273
10274 if (version < 140)
10275 {
10276 if (!ctx.
Read(intValue))
10277 return false;
10278
10279 m_VariablesMask = intValue;
10280 }
10281
10283 {
10284 if (!ctx.
Read(value))
10285 return false;
10286
10288 {
10290 }
10291 else
10292 {
10294 }
10295 }
10296
10297 if (version < 140)
10298 {
10300 {
10301 if (!ctx.
Read(value))
10302 return false;
10303 SetTemperatureDirect(value);
10304 }
10305 }
10306
10308 {
10309 if (!ctx.
Read(value))
10310 return false;
10312 }
10313
10315 {
10316 if (!ctx.
Read(intValue))
10317 return false;
10319 }
10320
10322 {
10323 int r,g,b,a;
10325 return false;
10327 return false;
10329 return false;
10331 return false;
10332
10334 }
10335
10337 {
10338 if (!ctx.
Read(intValue))
10339 return false;
10341 }
10342
10343 if (version >= 138 && version < 140)
10344 {
10346 {
10347 if (!ctx.
Read(intValue))
10348 return false;
10349 SetFrozen(intValue);
10350 }
10351 }
10352
10353 return true;
10354 }
10355
10356
10358 {
10361 {
10363 }
10364
10365 if (!super.OnStoreLoad(ctx, version))
10366 {
10368 return false;
10369 }
10370
10371 if (version >= 114)
10372 {
10373 bool hasQuickBarIndexSaved;
10374
10375 if (!ctx.
Read(hasQuickBarIndexSaved))
10376 {
10378 return false;
10379 }
10380
10381 if (hasQuickBarIndexSaved)
10382 {
10383 int itmQBIndex;
10384
10385
10386 if (!ctx.
Read(itmQBIndex))
10387 {
10389 return false;
10390 }
10391
10392 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10393 if (itmQBIndex != -1 && parentPlayer)
10394 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10395 }
10396 }
10397 else
10398 {
10399
10400 PlayerBase player;
10401 int itemQBIndex;
10402 if (version ==
int.
MAX)
10403 {
10404 if (!ctx.
Read(itemQBIndex))
10405 {
10407 return false;
10408 }
10409 }
10410 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10411 {
10412
10413 if (!ctx.
Read(itemQBIndex))
10414 {
10416 return false;
10417 }
10418 if (itemQBIndex != -1 && player)
10419 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10420 }
10421 }
10422
10423 if (version < 140)
10424 {
10425
10426 if (!LoadVariables(ctx, version))
10427 {
10429 return false;
10430 }
10431 }
10432
10433
10435 {
10437 return false;
10438 }
10439 if (version >= 132)
10440 {
10442 if (raib)
10443 {
10445 {
10447 return false;
10448 }
10449 }
10450 }
10451
10453 return true;
10454 }
10455
10456
10457
10459 {
10460 super.OnStoreSave(ctx);
10461
10462 PlayerBase player;
10463 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10464 {
10466
10467 int itemQBIndex = -1;
10468 itemQBIndex = player.FindQuickBarEntityIndex(this);
10469 ctx.
Write(itemQBIndex);
10470 }
10471 else
10472 {
10474 }
10475
10477
10479 if (raib)
10480 {
10482 }
10483 }
10484
10485
10487 {
10488 super.AfterStoreLoad();
10489
10491 {
10493 }
10494
10496 {
10499 }
10500 }
10501
10503 {
10504 super.EEOnAfterLoad();
10505
10507 {
10509 }
10510
10513 }
10514
10516 {
10517 return false;
10518 }
10519
10520
10521
10523 {
10525 {
10526 #ifdef PLATFORM_CONSOLE
10527
10529 {
10531 if (menu)
10532 {
10534 }
10535 }
10536 #endif
10537 }
10538
10540 {
10543 }
10544
10546 {
10547 SetWeightDirty();
10549 }
10551 {
10554 }
10555
10557 {
10560 }
10562 {
10565 }
10566
10567 super.OnVariablesSynchronized();
10568 }
10569
10570
10571
10573 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10574 {
10575 if (!IsServerCheck(allow_client))
10576 return false;
10577
10579 return false;
10580
10583
10584 if (value <= (min + 0.001))
10585 value = min;
10586
10587 if (value == min)
10588 {
10589 if (destroy_config)
10590 {
10591 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10592 if (dstr)
10593 {
10595 this.Delete();
10596 return true;
10597 }
10598 }
10599 else if (destroy_forced)
10600 {
10602 this.Delete();
10603 return true;
10604 }
10605
10607 }
10608
10611
10613 {
10615
10616 if (delta)
10618 }
10619
10621
10622 return false;
10623 }
10624
10625
10627 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10628 {
10630 }
10631
10633 {
10636 }
10637
10639 {
10642 }
10643
10646 {
10647 float value_clamped = Math.Clamp(value, 0, 1);
10649 SetQuantity(result, destroy_config, destroy_forced);
10650 }
10651
10652
10655 {
10657 }
10658
10660 {
10662 }
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10674 {
10675 int slot = -1;
10676 if (GetInventory())
10677 {
10678 InventoryLocation il = new InventoryLocation;
10679 GetInventory().GetCurrentInventoryLocation(il);
10681 }
10682
10684 }
10685
10687 {
10688 float quantity_max = 0;
10689
10691 {
10692 if (attSlotID != -1)
10693 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10694
10695 if (quantity_max <= 0)
10697 }
10698
10699 if (quantity_max <= 0)
10701
10702 return quantity_max;
10703 }
10704
10706 {
10708 }
10709
10711 {
10713 }
10714
10715
10717 {
10719 }
10720
10722 {
10724 }
10725
10727 {
10729 }
10730
10731
10733 {
10734
10735 float weightEx = GetWeightEx();
10736 float special = GetInventoryAndCargoWeight();
10737 return weightEx - special;
10738 }
10739
10740
10742 {
10744 }
10745
10747 {
10749 {
10750 #ifdef DEVELOPER
10751 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10752 {
10753 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10755 }
10756 #endif
10757
10758 return GetQuantity() * GetConfigWeightModified();
10759 }
10760 else if (HasEnergyManager())
10761 {
10762 #ifdef DEVELOPER
10763 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10764 {
10765 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10766 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10767 }
10768 #endif
10769 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
10770 }
10771 else
10772 {
10773 #ifdef DEVELOPER
10774 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10775 {
10776 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10777 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10778 }
10779 #endif
10780 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified());
10781 }
10782 }
10783
10786 {
10787 int item_count = 0;
10789
10790 if (GetInventory().GetCargo() != NULL)
10791 {
10792 item_count = GetInventory().GetCargo().GetItemCount();
10793 }
10794
10795 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10796 {
10797 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10798 if (item)
10799 item_count += item.GetNumberOfItems();
10800 }
10801 return item_count;
10802 }
10803
10806 {
10807 float weight = 0;
10808 float wetness = 1;
10809 if (include_wetness)
10812 {
10813 weight = wetness * m_ConfigWeight;
10814 }
10816 {
10817 weight = 1;
10818 }
10819 return weight;
10820 }
10821
10822
10823
10825 {
10826 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
10827 {
10828 GameInventory inv = GetInventory();
10829 array<EntityAI> items = new array<EntityAI>;
10831 for (int i = 0; i < items.Count(); i++)
10832 {
10834 if (item)
10835 {
10837 }
10838 }
10839 }
10840 }
10841
10842
10843
10844
10846 {
10847 float energy = 0;
10848 if (HasEnergyManager())
10849 {
10850 energy = GetCompEM().GetEnergy();
10851 }
10852 return energy;
10853 }
10854
10855
10857 {
10858 super.OnEnergyConsumed();
10859
10861 }
10862
10864 {
10865 super.OnEnergyAdded();
10866
10868 }
10869
10870
10872 {
10873 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10874 {
10876 {
10877 float energy_0to1 = GetCompEM().GetEnergy0To1();
10879 }
10880 }
10881 }
10882
10883
10885 {
10886 return ConfigGetFloat("heatIsolation");
10887 }
10888
10890 {
10892 }
10893
10895 {
10896 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10897 if (
GetGame().ConfigIsExisting(paramPath))
10899
10900 return 0.0;
10901 }
10902
10904 {
10905 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10906 if (
GetGame().ConfigIsExisting(paramPath))
10908
10909 return 0.0;
10910 }
10911
10912 override void SetWet(
float value,
bool allow_client =
false)
10913 {
10914 if (!IsServerCheck(allow_client))
10915 return;
10916
10919
10921
10922 m_VarWet = Math.Clamp(value, min, max);
10923
10925 {
10928 }
10929 }
10930
10931 override void AddWet(
float value)
10932 {
10934 }
10935
10937 {
10939 }
10940
10942 {
10944 }
10945
10947 {
10949 }
10950
10952 {
10954 }
10955
10957 {
10959 }
10960
10961 override void OnWetChanged(
float newVal,
float oldVal)
10962 {
10965 if (newLevel != oldLevel)
10966 {
10968 }
10969 }
10970
10972 {
10973 SetWeightDirty();
10974 }
10975
10977 {
10978 return GetWetLevelInternal(
m_VarWet);
10979 }
10980
10981
10982
10984 {
10986 }
10987
10989 {
10991 }
10992
10994 {
10996 }
10997
10999 {
11001 }
11002
11003
11004
11006 {
11007 if (ConfigIsExisting("itemModelLength"))
11008 {
11009 return ConfigGetFloat("itemModelLength");
11010 }
11011 return 0;
11012 }
11013
11015 {
11016 if (ConfigIsExisting("itemAttachOffset"))
11017 {
11018 return ConfigGetFloat("itemAttachOffset");
11019 }
11020 return 0;
11021 }
11022
11023 override void SetCleanness(
int value,
bool allow_client =
false)
11024 {
11025 if (!IsServerCheck(allow_client))
11026 return;
11027
11029
11031
11034 }
11035
11037 {
11039 }
11040
11042 {
11043 return true;
11044 }
11045
11046
11047
11048
11050 {
11052 }
11053
11055 {
11057 }
11058
11059
11060
11061
11062 override void SetColor(
int r,
int g,
int b,
int a)
11063 {
11069 }
11071 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11072 {
11077 }
11078
11080 {
11082 }
11083
11086 {
11087 int r,g,b,a;
11089 r = r/255;
11090 g = g/255;
11091 b = b/255;
11092 a = a/255;
11093 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11094 }
11095
11096
11097
11098 override void SetLiquidType(
int value,
bool allow_client =
false)
11099 {
11100 if (!IsServerCheck(allow_client))
11101 return;
11102
11107 }
11108
11110 {
11111 return ConfigGetInt("varLiquidTypeInit");
11112 }
11113
11115 {
11117 }
11118
11120 {
11122 SetFrozen(false);
11123 }
11124
11127 {
11128 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11129 }
11130
11131
11134 {
11135 PlayerBase nplayer;
11136 if (PlayerBase.CastTo(nplayer, player))
11137 {
11139
11140 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11141 }
11142 }
11143
11144
11147 {
11148 PlayerBase nplayer;
11149 if (PlayerBase.CastTo(nplayer,player))
11150 {
11151
11152 nplayer.SetEnableQuickBarEntityShortcut(this,false);
11153
11154 }
11155
11156
11157 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11158
11159
11160 if (HasEnergyManager())
11161 {
11162 GetCompEM().UpdatePlugState();
11163 }
11164 }
11165
11166
11168 {
11169 super.OnPlacementStarted(player);
11170
11172 }
11173
11174 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11175 {
11177 {
11178 m_AdminLog.OnPlacementComplete(player,
this);
11179 }
11180
11181 super.OnPlacementComplete(player, position, orientation);
11182 }
11183
11184
11185
11186
11187
11189 {
11191 {
11192 return true;
11193 }
11194 else
11195 {
11196 return false;
11197 }
11198 }
11199
11200
11202 {
11204 {
11206 }
11207 }
11208
11209
11211 {
11213 }
11214
11216 {
11218 }
11219
11220 override void InsertAgent(
int agent,
float count = 1)
11221 {
11222 if (count < 1)
11223 return;
11224
11226 }
11227
11230 {
11232 }
11233
11234
11236 {
11238 }
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11282 {
11284 return false;
11285 return true;
11286 }
11287
11289 {
11290
11292 }
11293
11294
11297 {
11298 super.CheckForRoofLimited(timeTresholdMS);
11299
11301 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11302 {
11303 m_PreviousRoofTestTime = time;
11304 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11305 }
11306 }
11307
11308
11310 {
11312 {
11313 return 0;
11314 }
11315
11316 if (GetInventory().GetAttachmentSlotsCount() != 0)
11317 {
11318 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11319 if (filter)
11320 return filter.GetProtectionLevel(type, false, system);
11321 else
11322 return 0;
11323 }
11324
11325 string subclassPath, entryName;
11326
11327 switch (type)
11328 {
11330 entryName = "biological";
11331 break;
11333 entryName = "chemical";
11334 break;
11335 default:
11336 entryName = "biological";
11337 break;
11338 }
11339
11340 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11341
11343 }
11344
11345
11346
11349 {
11350 if (!IsMagazine())
11352
11354 }
11355
11356
11357
11358
11359
11364 {
11365 return true;
11366 }
11367
11369 {
11371 }
11372
11373
11374
11375
11376
11378 {
11379 if (parent)
11380 {
11381 if (parent.IsInherited(DayZInfected))
11382 return true;
11383
11384 if (!parent.IsRuined())
11385 return true;
11386 }
11387
11388 return true;
11389 }
11390
11392 {
11393 if (!super.CanPutAsAttachment(parent))
11394 {
11395 return false;
11396 }
11397
11398 if (!IsRuined() && !parent.IsRuined())
11399 {
11400 return true;
11401 }
11402
11403 return false;
11404 }
11405
11407 {
11408
11409
11410
11411
11412 return super.CanReceiveItemIntoCargo(item);
11413 }
11414
11416 {
11417
11418
11419
11420
11421 GameInventory attachmentInv = attachment.GetInventory();
11423 {
11424 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11425 return false;
11426 }
11427
11428 InventoryLocation loc = new InventoryLocation();
11429 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11430 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11431 return false;
11432
11433 return super.CanReceiveAttachment(attachment, slotId);
11434 }
11435
11437 {
11438 if (!super.CanReleaseAttachment(attachment))
11439 return false;
11440
11441 return GetInventory().AreChildrenAccessible();
11442 }
11443
11444
11445
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11465 {
11466 int id = muzzle_owner.GetMuzzleID();
11467 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11468
11469 if (WPOF_array)
11470 {
11471 for (int i = 0; i < WPOF_array.Count(); i++)
11472 {
11473 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11474
11475 if (WPOF)
11476 {
11477 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11478 }
11479 }
11480 }
11481 }
11482
11483
11485 {
11486 int id = muzzle_owner.GetMuzzleID();
11488
11489 if (WPOBE_array)
11490 {
11491 for (int i = 0; i < WPOBE_array.Count(); i++)
11492 {
11493 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11494
11495 if (WPOBE)
11496 {
11497 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11498 }
11499 }
11500 }
11501 }
11502
11503
11505 {
11506 int id = muzzle_owner.GetMuzzleID();
11507 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11508
11509 if (WPOOH_array)
11510 {
11511 for (int i = 0; i < WPOOH_array.Count(); i++)
11512 {
11513 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11514
11515 if (WPOOH)
11516 {
11517 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11518 }
11519 }
11520 }
11521 }
11522
11523
11525 {
11526 int id = muzzle_owner.GetMuzzleID();
11527 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11528
11529 if (WPOOH_array)
11530 {
11531 for (int i = 0; i < WPOOH_array.Count(); i++)
11532 {
11533 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11534
11535 if (WPOOH)
11536 {
11537 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11538 }
11539 }
11540 }
11541 }
11542
11543
11545 {
11546 int id = muzzle_owner.GetMuzzleID();
11547 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11548
11549 if (WPOOH_array)
11550 {
11551 for (int i = 0; i < WPOOH_array.Count(); i++)
11552 {
11553 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11554
11555 if (WPOOH)
11556 {
11557 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11558 }
11559 }
11560 }
11561 }
11562
11563
11564
11566 {
11568 {
11569 return true;
11570 }
11571
11572 return false;
11573 }
11574
11576 {
11578 {
11579 return true;
11580 }
11581
11582 return false;
11583 }
11584
11586 {
11588 {
11589 return true;
11590 }
11591
11592 return false;
11593 }
11594
11596 {
11597 return false;
11598 }
11599
11602 {
11603 return UATimeSpent.DEFAULT_DEPLOY;
11604 }
11605
11606
11607
11608
11610 {
11612 SetSynchDirty();
11613 }
11614
11616 {
11618 }
11619
11620
11622 {
11623 return false;
11624 }
11625
11628 {
11629 string att_type = "None";
11630
11631 if (ConfigIsExisting("soundAttType"))
11632 {
11633 att_type = ConfigGetString("soundAttType");
11634 }
11635
11637 }
11638
11640 {
11642 }
11643
11644
11645
11646
11647
11651
11653 {
11656
11658 }
11659
11660
11662 {
11664 return;
11665
11667
11670
11673
11674 SoundParameters params = new SoundParameters();
11678 }
11679
11680
11682 {
11684 return;
11685
11687 SetSynchDirty();
11688
11691 }
11692
11693
11695 {
11697 return;
11698
11700 SetSynchDirty();
11701
11704 }
11705
11707 {
11709 }
11710
11712 {
11714 }
11715
11718 {
11719 if (!
GetGame().IsDedicatedServer())
11720 {
11721 if (ConfigIsExisting("attachSoundSet"))
11722 {
11723 string cfg_path = "";
11724 string soundset = "";
11725 string type_name =
GetType();
11726
11729 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11730 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11731
11732 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11733 {
11734 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11735 {
11736 if (cfg_slot_array[i] == slot_type)
11737 {
11738 soundset = cfg_soundset_array[i];
11739 break;
11740 }
11741 }
11742 }
11743
11744 if (soundset != "")
11745 {
11746 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11748 }
11749 }
11750 }
11751 }
11752
11754 {
11755
11756 }
11757
11758 void OnApply(PlayerBase player);
11759
11761 {
11762 return 1.0;
11763 };
11764
11766 {
11768 }
11769
11771 {
11773 }
11774
11776
11778 {
11779 SetDynamicPhysicsLifeTime(0.01);
11781 }
11782
11784 {
11785 array<string> zone_names = new array<string>;
11786 GetDamageZones(zone_names);
11787 for (int i = 0; i < zone_names.Count(); i++)
11788 {
11789 SetHealthMax(zone_names.Get(i),"Health");
11790 }
11791 SetHealthMax("","Health");
11792 }
11793
11796 {
11797 float global_health = GetHealth01("","Health");
11798 array<string> zones = new array<string>;
11799 GetDamageZones(zones);
11800
11801 for (int i = 0; i < zones.Count(); i++)
11802 {
11803 SetHealth01(zones.Get(i),"Health",global_health);
11804 }
11805 }
11806
11809 {
11810 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11811 }
11812
11814 {
11815 if (!hasRootAsPlayer)
11816 {
11817 if (refParentIB)
11818 {
11819
11820 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11821 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11822
11823 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11824 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11825
11828 }
11829 else
11830 {
11831
11834 }
11835 }
11836 }
11837
11839 {
11841 {
11842 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11843 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
11844 {
11845 float heatPermCoef = 1.0;
11847 while (ent)
11848 {
11849 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11850 ent = ent.GetHierarchyParent();
11851 }
11852
11853 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11854 }
11855 }
11856 }
11857
11859 {
11860
11861 EntityAI parent = GetHierarchyParent();
11862 if (!parent)
11863 {
11864 hasParent = false;
11865 hasRootAsPlayer = false;
11866 }
11867 else
11868 {
11869 hasParent = true;
11870 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11871 refParentIB =
ItemBase.Cast(parent);
11872 }
11873 }
11874
11875 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11876 {
11877
11878 }
11879
11881 {
11882
11883 return false;
11884 }
11885
11887 {
11888
11889
11890 return false;
11891 }
11892
11894 {
11895
11896 return false;
11897 }
11898
11901 {
11902 return !GetIsFrozen() &&
IsOpen();
11903 }
11904
11906 {
11907 bool hasParent = false, hasRootAsPlayer = false;
11909
11910 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11911 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11912
11913 if (wwtu || foodDecay)
11914 {
11918
11919 if (processWetness || processTemperature || processDecay)
11920 {
11922
11923 if (processWetness)
11924 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11925
11926 if (processTemperature)
11928
11929 if (processDecay)
11930 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11931 }
11932 }
11933 }
11934
11937 {
11939 }
11940
11942 {
11945
11946 return super.GetTemperatureFreezeThreshold();
11947 }
11948
11950 {
11953
11954 return super.GetTemperatureThawThreshold();
11955 }
11956
11958 {
11961
11962 return super.GetItemOverheatThreshold();
11963 }
11964
11966 {
11968 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11969
11970 return super.GetTemperatureFreezeTime();
11971 }
11972
11974 {
11976 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11977
11978 return super.GetTemperatureThawTime();
11979 }
11980
11985
11987 {
11988 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11989 }
11990
11992 {
11993 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11994 }
11995
11998 {
12000 }
12001
12003 {
12005 }
12006
12008 {
12010 }
12011
12014 {
12015 return null;
12016 }
12017
12020 {
12021 return false;
12022 }
12023
12025 {
12027 {
12030 if (!trg)
12031 {
12033 explosive = this;
12034 }
12035
12036 explosive.PairRemote(trg);
12038
12039 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12040 trg.SetPersistentPairID(persistentID);
12041 explosive.SetPersistentPairID(persistentID);
12042
12043 return true;
12044 }
12045 return false;
12046 }
12047
12050 {
12051 float ret = 1.0;
12054 ret *= GetHealth01();
12055
12056 return ret;
12057 }
12058
12059 #ifdef DEVELOPER
12060 override void SetDebugItem()
12061 {
12062 super.SetDebugItem();
12063 _itemBase = this;
12064 }
12065
12067 {
12068 string text = super.GetDebugText();
12069
12071 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12072
12073 return text;
12074 }
12075 #endif
12076
12078 {
12079 return true;
12080 }
12081
12083
12085
12087 {
12090 }
12091
12092
12100
12116}
12117
12119{
12121 if (entity)
12122 {
12123 bool is_item = entity.IsInherited(
ItemBase);
12124 if (is_item && full_quantity)
12125 {
12128 }
12129 }
12130 else
12131 {
12133 return NULL;
12134 }
12135 return entity;
12136}
12137
12139{
12140 if (item)
12141 {
12142 if (health > 0)
12143 item.SetHealth("", "", health);
12144
12145 if (item.CanHaveTemperature())
12146 {
12148 if (item.CanFreeze())
12149 item.SetFrozen(false);
12150 }
12151
12152 if (item.HasEnergyManager())
12153 {
12154 if (quantity >= 0)
12155 {
12156 item.GetCompEM().SetEnergy0To1(quantity);
12157 }
12158 else
12159 {
12161 }
12162 }
12163 else if (item.IsMagazine())
12164 {
12165 Magazine mag = Magazine.Cast(item);
12166 if (quantity >= 0)
12167 {
12168 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12169 }
12170 else
12171 {
12173 }
12174
12175 }
12176 else
12177 {
12178 if (quantity >= 0)
12179 {
12180 item.SetQuantityNormalized(quantity, false);
12181 }
12182 else
12183 {
12185 }
12186
12187 }
12188 }
12189}
12190
12191#ifdef DEVELOPER
12193#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionManagerBase(PlayerBase player)
map< typename, ref array< ActionBase_Basic > > TInputActionMap
void AddAction(typename actionName)
void RemoveAction(typename actionName)
TInputActionMap m_InputActionMap
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
const int ECE_PLACE_ON_SURFACE
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
DamageType
exposed from C++ (do not change)
PluginAdminLog m_AdminLog
override bool IsExplosive()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
static bool HasDebugActionsMask(int mask)
bool HidesSelectionBySlot()
void SplitItem(PlayerBase player)
void CopyScriptPropertiesFrom(EntityAI oldItem)
override void InsertAgent(int agent, float count=1)
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
static void SetDebugActionsMask(int mask)
void SetIsDeploySound(bool is_deploy_sound)
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
override bool IsHeavyBehaviour()
override void SetWetMax()
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
void ClearStartItemSoundServer()
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
override void RemoveAllAgentsExcept(int agent_to_keep)
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
bool CanBeMovedOverride()
override void SetWet(float value, bool allow_client=false)
ref TIntArray m_SingleUseActions
override void ProcessVariables()
ref TStringArray m_HeadHidingSelections
float GetWeightSpecialized(bool forceRecalc=false)
bool LoadAgents(ParamsReadContext ctx, int version)
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
ref array< ref OverheatingParticle > m_OverheatingParticles
override float GetTemperatureFreezeThreshold()
bool m_IsSoundSynchRemote
void StopItemSoundServer(int id)
static void ToggleDebugActionsMask(int mask)
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetTemperatureFreezeTime()
ref array< int > m_CompatibleLocks
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
float m_TemperaturePerQuantityWeight
bool m_RecipesInitialized
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
override float GetTemperatureThawThreshold()
override void OnEnergyConsumed()
void 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...
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
override EWetnessLevel GetWetLevel()
float GetSingleInventoryItemWeight()
ref TIntArray m_InteractActions
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
bool CanPlayDeployLoopSound()
override float GetWetMax()
bool CanBeUsedForSuicide()
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
void StartItemSoundServer(int id)
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
bool m_CanBeMovedOverride
override string ChangeIntoOnAttach(string slot)
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
override float GetQuantity()
int m_ShotsToStartOverheating
override void OnWetChanged(float newVal, float oldVal)
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void OnOverheatingDecay()
float GetDryingIncrement(string pIncrementName)
void SoundSynchRemoteReset()
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
override bool CanReleaseAttachment(EntityAI attachment)
override void OnMovedInsideCargo(EntityAI container)
void SetCEBasedQuantity()
bool m_CanPlayImpactSound
override string GetAttachmentSoundType()
float GetOverheatingCoef()
array< string > GetHeadHidingSelection()
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
override bool IsStoreLoad()
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
void SetResultOfSplit(bool value)
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
void UpdateAllOverheatingParticles()
float GetSoakingIncrement(string pIncrementName)
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetStoreLoadedQuantity()
const int ITEM_SOUNDS_MAX
float GetItemModelLength()
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
void CombineItems(ItemBase other_item, bool use_stack_max=true)
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
void TransferAgents(int agents)
transfer agents from another item
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
float GetHeatIsolationInit()
void SetCanBeMovedOverride(bool setting)
override bool HasQuantity()
bool IsCargoException4x3(EntityAI item)
ref TIntArray m_ContinuousActions
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
void LoadParticleConfigOnFire(int id)
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
override float GetWetInit()
int m_ImpactSoundSurfaceHash
int m_MaxOverheatingValue
void SetupSpawnedItem(ItemBase item, float health, float quantity)
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)
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
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)
void Open()
Implementations only.
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 EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
override void OnRightClick()
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
bool IsActionTargetVisible()
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
int NameToID(string name)
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
void ClearStopItemSoundServer()
override string ChangeIntoOnDetach()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
EffectSound m_SoundDeployFinish
float GetQuantityNormalizedScripted()
override void SetCleanness(int value, bool allow_client=false)
override float GetWetMin()
ref ItemSoundHandler m_ItemSoundHandler
override bool KindOf(string tag)
void ItemSoundHandler(ItemBase parent)
EffectSound m_LockingSound
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
void RemoteDetonatorTrigger()
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
override void Explode(int damageType, string ammoType="")
void OnItemLocationChanged(ItemBase item)
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
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 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 bool CanMakeGardenplot()
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override WrittenNoteData GetWrittenNoteData()
override int GetDamageSystemVersionChange()
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
override void InitItemVariables()
override void SetActionAnimOverrides()
override void OnCreatePhysics()
override string GetDeploySoundset()
override float GetBandagingEffectivity()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void OnStoreSave(ParamsWriteContext ctx)
override void AfterStoreLoad()
override int GetOnDigWormsAmount()
override bool IsSelfAdjustingTemperature()
override bool IsPlayerInside(PlayerBase player, string selection)
override void OnVariablesSynchronized()
override void RefreshPhysics()
override bool CanObstruct()
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanPutInCargo(EntityAI parent)
override string GetLoopDeploySoundset()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override void OnInventoryExit(Man player)
override bool IsTakeable()
override bool IsIgnoredByConstruction()
override void InitItemSounds()
override void EEKilled(Object killer)
override void OnCombine(ItemBase other_item)
override bool CanExplodeInFire()
override bool IsFacingPlayer(PlayerBase player, string selection)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
override bool IsBloodContainer()
override bool IsClothing()
override bool CanBeSplit()
override bool IsDeployable()
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
override bool CanBeDisinfected()
override float GetInfectionChance(int system=0, Param param=null)
override void OnEndPlacement()
float GetOverheatingLimitMax()
void SetOverheatingLimitMax(float max)
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
float GetOverheatingLimitMin()
void SetOverheatingLimitMin(float min)
void RegisterParticle(Particle p)
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
void SetControlledDevice(EntityAI pDevice)
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
void SetCalcDetails(string details)
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Serializer ParamsReadContext
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
proto native CGame GetGame()
Serializer ParamsWriteContext
const int COMP_TYPE_ENERGY_MANAGER
void Error(string err)
Messagebox with error message.
proto native void SetColor(int color)
array< string > TStringArray
EntityEvent
Entity events for event-mask, or throwing event from code.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
const int VARIABLE_LIQUIDTYPE
const int VARIABLE_CLEANNESS
const int VARIABLE_TEMPERATURE
const int VARIABLE_QUANTITY
static proto float AbsFloat(float f)
Returns absolute value.
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_DEBUG_ACTION
class JsonUndergroundAreaTriggerData GetPosition
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.