6432{
6434 {
6435 return true;
6436 }
6437};
6438
6439
6440
6442{
6446
6448
6451
6452
6453
6454
6455
6464
6470
6475
6480
6501 protected bool m_IsResultOfSplit
6502
6504
6509
6510
6511
6513
6517
6518
6519
6521
6524
6525
6526
6532
6533
6541
6544
6545
6547
6548
6550
6551
6556
6557
6562
6563
6565
6566
6568 {
6573
6574 if (!
GetGame().IsDedicatedServer())
6575 {
6577 {
6579
6581 {
6583 }
6584 }
6585
6588 }
6589
6590 m_OldLocation = null;
6591
6593 {
6595 }
6596
6597 if (ConfigIsExisting("headSelectionsToHide"))
6598 {
6601 }
6602
6604 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6605 {
6607 }
6608
6610
6611 m_IsResultOfSplit = false;
6612
6614 }
6615
6617 {
6618 super.InitItemVariables();
6619
6625 m_Count = ConfigGetInt(
"count");
6626
6629
6634
6637
6642
6654
6658
6659
6662 if (ConfigIsExisting("canBeSplit"))
6663 {
6666 }
6667
6669 if (ConfigIsExisting("itemBehaviour"))
6671
6672
6675 RegisterNetSyncVariableInt("m_VarLiquidType");
6676 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6677
6678 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6679 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6680 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6681
6682 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6683 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6684 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6685 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6686
6687 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6688 RegisterNetSyncVariableBool("m_IsTakeable");
6689 RegisterNetSyncVariableBool("m_IsHologram");
6690
6693 {
6696 }
6697
6699
6701 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6703
6704 }
6705
6707 {
6709 }
6710
6712 {
6715 {
6720 }
6721 }
6722
6723 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6724 {
6726 {
6729 }
6730
6732 }
6733
6735 {
6741 }
6742
6744
6746 {
6748
6749 if (!action)
6750 {
6751 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6752 return;
6753 }
6754
6756 if (!ai)
6757 {
6759 return;
6760 }
6761
6763 if (!action_array)
6764 {
6765 action_array = new array<ActionBase_Basic>;
6767 }
6768 if (LogManager.IsActionLogEnable())
6769 {
6770 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6771 }
6772
6773 if (action_array.Find(action) != -1)
6774 {
6775 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6776 }
6777 else
6778 {
6779 action_array.Insert(action);
6780 }
6781 }
6782
6784 {
6786 ActionBase action = player.GetActionManager().GetAction(actionName);
6789
6790 if (action_array)
6791 {
6792 action_array.RemoveItem(action);
6793 }
6794 }
6795
6796
6797
6799 {
6800 ActionOverrideData overrideData = new ActionOverrideData();
6804
6806 if (!actionMap)
6807 {
6810 }
6811
6812 actionMap.Insert(this.
Type(), overrideData);
6813
6814 }
6815
6817
6819
6820
6822 {
6825
6828
6829 string config_to_search = "CfgVehicles";
6830 string muzzle_owner_config;
6831
6833 {
6834 if (IsInherited(Weapon))
6835 config_to_search = "CfgWeapons";
6836
6837 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6838
6839 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6840
6842
6843 if (config_OnFire_subclass_count > 0)
6844 {
6845 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6846
6847 for (int i = 0; i < config_OnFire_subclass_count; i++)
6848 {
6849 string particle_class = "";
6851 string config_OnFire_entry = config_OnFire_class + particle_class;
6852 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6853 WPOF_array.Insert(WPOF);
6854 }
6855
6856
6858 }
6859 }
6860
6862 {
6863 config_to_search = "CfgWeapons";
6864 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6865
6866 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6867
6869
6870 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6871 {
6872 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6873
6874 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6875 {
6876 string particle_class2 = "";
6878 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6879 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6880 WPOBE_array.Insert(WPOBE);
6881 }
6882
6883
6885 }
6886 }
6887 }
6888
6889
6891 {
6894
6896 {
6897 string config_to_search = "CfgVehicles";
6898
6899 if (IsInherited(Weapon))
6900 config_to_search = "CfgWeapons";
6901
6902 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6903 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6904
6905 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6906 {
6907
6909
6911 {
6913 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6915 return;
6916 }
6917
6920
6921
6922
6924 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6925
6926 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6927 {
6928 string particle_class = "";
6930 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6932
6933 if (entry_type == CT_CLASS)
6934 {
6935 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6936 WPOOH_array.Insert(WPOF);
6937 }
6938 }
6939
6940
6942 }
6943 }
6944 }
6945
6947 {
6949 }
6950
6952 {
6954 {
6956
6959
6962
6963 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6964 }
6965 }
6966
6968 {
6970 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6971
6973 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6974
6976 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6977
6979 {
6981 }
6982 }
6983
6985 {
6987 }
6988
6990 {
6993 else
6995
6997 {
7000 }
7001 else
7002 {
7005
7008 }
7009
7011 }
7012
7014 {
7016 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7017 }
7018
7020 {
7022 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7024 }
7025
7027 {
7029 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7030 }
7031
7033 {
7036
7037 OverheatingParticle OP = new OverheatingParticle();
7042
7044 }
7045
7047 {
7050
7051 return -1;
7052 }
7053
7055 {
7057 {
7060
7061 for (int i = count; i > 0; --i)
7062 {
7063 int id = i - 1;
7066
7069
7070 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7071 {
7072 if (p)
7073 {
7076 }
7077 }
7078 }
7079 }
7080 }
7081
7083 {
7085 {
7087 {
7088 int id = i - 1;
7090
7091 if (OP)
7092 {
7094
7095 if (p)
7096 {
7098 }
7099
7100 delete OP;
7101 }
7102 }
7103
7106 }
7107 }
7108
7111 {
7112 return 0.0;
7113 }
7114
7115
7117 {
7118 return 250;
7119 }
7120
7122 {
7123 return 0;
7124 }
7125
7128 {
7130 return true;
7131
7132 return false;
7133 }
7134
7137 {
7140
7142 {
7144 }
7145 else
7146 {
7147
7149 }
7150
7152 }
7153
7160 {
7161 return -1;
7162 }
7163
7164
7165
7166
7168 {
7170 {
7172 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7173
7174 if (r_index >= 0)
7175 {
7176 InventoryLocation r_il = new InventoryLocation;
7177 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7178
7179 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7182 {
7183 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7184 }
7186 {
7187 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7188 }
7189
7190 }
7191
7192 player.GetHumanInventory().ClearUserReservedLocation(this);
7193 }
7194
7197 }
7198
7199
7200
7201
7203 {
7204 return ItemBase.m_DebugActionsMask;
7205 }
7206
7208 {
7209 return ItemBase.m_DebugActionsMask & mask;
7210 }
7211
7213 {
7214 ItemBase.m_DebugActionsMask = mask;
7215 }
7216
7218 {
7219 ItemBase.m_DebugActionsMask |= mask;
7220 }
7221
7223 {
7224 ItemBase.m_DebugActionsMask &= ~mask;
7225 }
7226
7228 {
7230 {
7232 }
7233 else
7234 {
7236 }
7237 }
7238
7239
7241 {
7242 if (GetEconomyProfile())
7243 {
7244 float q_max = GetEconomyProfile().GetQuantityMax();
7245 if (q_max > 0)
7246 {
7247 float q_min = GetEconomyProfile().GetQuantityMin();
7248 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7249
7251 {
7252 ComponentEnergyManager comp = GetCompEM();
7254 {
7256 }
7257 }
7259 {
7261
7262 }
7263
7264 }
7265 }
7266 }
7267
7270 {
7271 EntityAI parent = GetHierarchyParent();
7272
7273 if (parent)
7274 {
7275 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7276 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7277 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7278 }
7279 }
7280
7283 {
7284 EntityAI parent = GetHierarchyParent();
7285
7286 if (parent)
7287 {
7288 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7289 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7290 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7291 }
7292 }
7293
7295 {
7296
7297
7298
7299
7301
7303 {
7304 if (ScriptInputUserData.CanStoreInputUserData())
7305 {
7306 ScriptInputUserData ctx = new ScriptInputUserData;
7312 ctx.
Write(use_stack_max);
7315
7317 {
7318 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7319 }
7320 }
7321 }
7322 else if (!
GetGame().IsMultiplayer())
7323 {
7325 }
7326 }
7327
7329 {
7331 }
7332
7334 {
7336 }
7337
7339 {
7341 }
7342
7344 {
7345
7346 return false;
7347 }
7348
7350 {
7351 return false;
7352 }
7353
7357 {
7358 return false;
7359 }
7360
7362 {
7363 return "";
7364 }
7365
7367
7369 {
7370 return false;
7371 }
7372
7374 {
7375 return true;
7376 }
7377
7378
7379
7381 {
7382 return true;
7383 }
7384
7386 {
7387 return true;
7388 }
7389
7391 {
7392 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7394 }
7395
7397 {
7399 }
7400
7402 {
7404 if (!is_being_placed)
7406 SetSynchDirty();
7407 }
7408
7409
7411
7413 {
7415 }
7416
7418 {
7420 }
7421
7423 {
7424 return 1;
7425 }
7426
7428 {
7429 return false;
7430 }
7431
7433 {
7435 SetSynchDirty();
7436 }
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7473 {
7474 super.OnMovedInsideCargo(container);
7475
7476 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7477 }
7478
7479 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7480 {
7481 super.EEItemLocationChanged(oldLoc,newLoc);
7482
7483 PlayerBase new_player = null;
7484 PlayerBase old_player = null;
7485
7486 if (newLoc.GetParent())
7487 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7488
7489 if (oldLoc.GetParent())
7490 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7491
7493 {
7494 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7495
7496 if (r_index >= 0)
7497 {
7498 InventoryLocation r_il = new InventoryLocation;
7499 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7500
7501 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7504 {
7505 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7506 }
7508 {
7509 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7510 }
7511
7512 }
7513 }
7514
7516 {
7517 if (new_player)
7518 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7519
7520 if (new_player == old_player)
7521 {
7522
7523 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7524 {
7526 {
7527 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7528 {
7529 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7530 }
7531 }
7532 else
7533 {
7534 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7535 }
7536 }
7537
7538 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7539 {
7540 int type = oldLoc.GetType();
7542 {
7543 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7544 }
7546 {
7547 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7548 }
7549 }
7550 if (!m_OldLocation)
7551 {
7552 m_OldLocation = new InventoryLocation;
7553 }
7554 m_OldLocation.Copy(oldLoc);
7555 }
7556 else
7557 {
7558 if (m_OldLocation)
7559 {
7560 m_OldLocation.Reset();
7561 }
7562 }
7563
7565 }
7566 else
7567 {
7568 if (new_player)
7569 {
7570 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7571 if (res_index >= 0)
7572 {
7573 InventoryLocation il = new InventoryLocation;
7574 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7576 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7579 {
7580 il.
GetParent().GetOnReleaseLock().Invoke(it);
7581 }
7583 {
7585 }
7586
7587 }
7588 }
7590 {
7591
7593 }
7594
7595 if (m_OldLocation)
7596 {
7597 m_OldLocation.Reset();
7598 }
7599 }
7600 }
7601
7602 override void EOnContact(IEntity other, Contact extra)
7603 {
7605 {
7606 int liquidType = -1;
7608 if (impactSpeed > 0.0)
7609 {
7611 #ifndef SERVER
7613 #else
7615 SetSynchDirty();
7616 #endif
7618 }
7619 }
7620
7621 #ifdef SERVER
7622 if (GetCompEM() && GetCompEM().IsPlugged())
7623 {
7624 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7625 GetCompEM().UnplugThis();
7626 }
7627 #endif
7628 }
7629
7631
7633 {
7635 }
7636
7638 {
7639
7640 }
7641
7643 {
7644 super.OnItemLocationChanged(old_owner, new_owner);
7645
7646 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7647 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7648
7649 if (!relatedPlayer && playerNew)
7650 relatedPlayer = playerNew;
7651
7652 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7653 {
7655 if (actionMgr)
7656 {
7657 ActionBase currentAction = actionMgr.GetRunningAction();
7658 if (currentAction)
7660 }
7661 }
7662
7663 Man ownerPlayerOld = null;
7664 Man ownerPlayerNew = null;
7665
7666 if (old_owner)
7667 {
7668 if (old_owner.
IsMan())
7669 {
7670 ownerPlayerOld = Man.Cast(old_owner);
7671 }
7672 else
7673 {
7674 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7675 }
7676 }
7677 else
7678 {
7680 {
7682
7683 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7684 {
7685 GetCompEM().UnplugThis();
7686 }
7687 }
7688 }
7689
7690 if (new_owner)
7691 {
7692 if (new_owner.
IsMan())
7693 {
7694 ownerPlayerNew = Man.Cast(new_owner);
7695 }
7696 else
7697 {
7698 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7699 }
7700 }
7701
7702 if (ownerPlayerOld != ownerPlayerNew)
7703 {
7704 if (ownerPlayerOld)
7705 {
7706 array<EntityAI> subItemsExit = new array<EntityAI>;
7708 for (int i = 0; i < subItemsExit.Count(); i++)
7709 {
7712 }
7713 }
7714
7715 if (ownerPlayerNew)
7716 {
7717 array<EntityAI> subItemsEnter = new array<EntityAI>;
7719 for (int j = 0; j < subItemsEnter.Count(); j++)
7720 {
7723 }
7724 }
7725 }
7726 else if (ownerPlayerNew != null)
7727 {
7728 PlayerBase nplayer;
7729 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7730 {
7731 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7733 for (int k = 0; k < subItemsUpdate.Count(); k++)
7734 {
7736 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7737 }
7738 }
7739 }
7740
7741 if (old_owner)
7742 old_owner.OnChildItemRemoved(this);
7743 if (new_owner)
7744 new_owner.OnChildItemReceived(this);
7745 }
7746
7747
7749 {
7750 super.EEDelete(parent);
7751 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7752 if (player)
7753 {
7755
7756 if (player.IsAlive())
7757 {
7758 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7759 if (r_index >= 0)
7760 {
7761 InventoryLocation r_il = new InventoryLocation;
7762 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7763
7764 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7767 {
7768 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7769 }
7771 {
7772 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7773 }
7774
7775 }
7776
7777 player.RemoveQuickBarEntityShortcut(this);
7778 }
7779 }
7780 }
7781
7783 {
7784 super.EEKilled(killer);
7785
7788 {
7789 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7790 {
7791 if (IsMagazine())
7792 {
7793 if (Magazine.Cast(this).GetAmmoCount() > 0)
7794 {
7796 }
7797 }
7798 else
7799 {
7801 }
7802 }
7803 }
7804 }
7805
7807 {
7808 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7809
7810 super.OnWasAttached(parent, slot_id);
7811
7814
7816 }
7817
7819 {
7820 super.OnWasDetached(parent, slot_id);
7821
7824 }
7825
7827 {
7828 int idx;
7831
7832 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7833 if (inventory_slots.Count() < 1)
7834 {
7835 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7836 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7837 }
7838 else
7839 {
7840 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7841 }
7842
7843 idx = inventory_slots.Find(slot);
7844 if (idx < 0)
7845 return "";
7846
7847 return attach_types.Get(idx);
7848 }
7849
7851 {
7852 int idx = -1;
7853 string slot;
7854
7857
7858 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7859 if (inventory_slots.Count() < 1)
7860 {
7861 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7862 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7863 }
7864 else
7865 {
7866 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7867 if (detach_types.Count() < 1)
7868 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7869 }
7870
7871 for (int i = 0; i < inventory_slots.Count(); i++)
7872 {
7873 slot = inventory_slots.Get(i);
7874 }
7875
7876 if (slot != "")
7877 {
7878 if (detach_types.Count() == 1)
7879 idx = 0;
7880 else
7881 idx = inventory_slots.Find(slot);
7882 }
7883 if (idx < 0)
7884 return "";
7885
7886 return detach_types.Get(idx);
7887 }
7888
7890 {
7891
7893
7894
7895 float min_time = 1;
7896 float max_time = 3;
7897 float delay = Math.RandomFloat(min_time, max_time);
7898
7899 explode_timer.Run(delay, this, "DoAmmoExplosion");
7900 }
7901
7903 {
7904 Magazine magazine = Magazine.Cast(this);
7905 int pop_sounds_count = 6;
7906 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7907
7908
7909 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7910 string sound_name = pop_sounds[ sound_idx ];
7912
7913
7914 magazine.ServerAddAmmoCount(-1);
7915
7916
7917 float min_temp_to_explode = 100;
7918
7919 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7920 {
7922 }
7923 }
7924
7925
7926 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7927 {
7928 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7929
7930 const int CHANCE_DAMAGE_CARGO = 4;
7931 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7932 const int CHANCE_DAMAGE_NOTHING = 2;
7933
7935 {
7936 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7937 int chances;
7938 int rnd;
7939
7940 if (GetInventory().GetCargo())
7941 {
7942 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7943 rnd = Math.RandomInt(0,chances);
7944
7945 if (rnd < CHANCE_DAMAGE_CARGO)
7946 {
7948 }
7949 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7950 {
7952 }
7953 }
7954 else
7955 {
7956 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7957 rnd = Math.RandomInt(0,chances);
7958
7959 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7960 {
7962 }
7963 }
7964 }
7965 }
7966
7968 {
7969 if (GetInventory().GetCargo())
7970 {
7971 int item_count = GetInventory().GetCargo().GetItemCount();
7972 if (item_count > 0)
7973 {
7974 int random_pick = Math.RandomInt(0, item_count);
7976 if (!item.IsExplosive())
7977 {
7978 item.AddHealth("","",damage);
7979 return true;
7980 }
7981 }
7982 }
7983 return false;
7984 }
7985
7987 {
7988 int attachment_count = GetInventory().AttachmentCount();
7989 if (attachment_count > 0)
7990 {
7991 int random_pick = Math.RandomInt(0, attachment_count);
7992 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7993 if (!attachment.IsExplosive())
7994 {
7995 attachment.AddHealth("","",damage);
7996 return true;
7997 }
7998 }
7999 return false;
8000 }
8001
8003 {
8005 }
8006
8008 {
8010 return GetInventory().CanRemoveEntity();
8011
8012 return false;
8013 }
8014
8016 {
8017
8019 return false;
8020
8021
8023 return false;
8024
8025
8026
8028 if (delta == 0)
8029 return false;
8030
8031
8032 return true;
8033 }
8034
8036 {
8038 {
8039 if (ScriptInputUserData.CanStoreInputUserData())
8040 {
8041 ScriptInputUserData ctx = new ScriptInputUserData;
8046 ctx.
Write(destination_entity);
8050 }
8051 }
8052 else if (!
GetGame().IsMultiplayer())
8053 {
8055 }
8056 }
8057
8059 {
8060 float split_quantity_new;
8064 InventoryLocation loc = new InventoryLocation;
8065
8066 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8067 {
8069 split_quantity_new = stack_max;
8070 else
8072
8074 {
8075 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8076 if (new_item)
8077 {
8078 new_item.SetResultOfSplit(true);
8079 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8081 new_item.
SetQuantity(split_quantity_new,
false,
true);
8082 }
8083 }
8084 }
8085 else if (destination_entity && slot_id == -1)
8086 {
8087 if (quantity > stack_max)
8088 split_quantity_new = stack_max;
8089 else
8090 split_quantity_new = quantity;
8091
8093 {
8095 {
8098 }
8099
8100 if (new_item)
8101 {
8102 new_item.SetResultOfSplit(true);
8103 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8105 new_item.
SetQuantity(split_quantity_new,
false,
true);
8106 }
8107 }
8108 }
8109 else
8110 {
8111 if (stack_max != 0)
8112 {
8114 {
8116 }
8117
8118 if (split_quantity_new == 0)
8119 {
8120 if (!
GetGame().IsMultiplayer())
8121 player.PhysicalPredictiveDropItem(this);
8122 else
8123 player.ServerDropEntity(this);
8124 return;
8125 }
8126
8128 {
8130
8131 if (new_item)
8132 {
8133 new_item.SetResultOfSplit(true);
8134 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8137 new_item.PlaceOnSurface();
8138 }
8139 }
8140 }
8141 }
8142 }
8143
8145 {
8146 float split_quantity_new;
8150 InventoryLocation loc = new InventoryLocation;
8151
8152 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8153 {
8155 split_quantity_new = stack_max;
8156 else
8158
8160 {
8161 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8162 if (new_item)
8163 {
8164 new_item.SetResultOfSplit(true);
8165 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8167 new_item.
SetQuantity(split_quantity_new,
false,
true);
8168 }
8169 }
8170 }
8171 else if (destination_entity && slot_id == -1)
8172 {
8173 if (quantity > stack_max)
8174 split_quantity_new = stack_max;
8175 else
8176 split_quantity_new = quantity;
8177
8179 {
8181 {
8184 }
8185
8186 if (new_item)
8187 {
8188 new_item.SetResultOfSplit(true);
8189 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8191 new_item.
SetQuantity(split_quantity_new,
false,
true);
8192 }
8193 }
8194 }
8195 else
8196 {
8197 if (stack_max != 0)
8198 {
8200 {
8202 }
8203
8205 {
8207
8208 if (new_item)
8209 {
8210 new_item.SetResultOfSplit(true);
8211 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8214 new_item.PlaceOnSurface();
8215 }
8216 }
8217 }
8218 }
8219 }
8220
8222 {
8224 {
8225 if (ScriptInputUserData.CanStoreInputUserData())
8226 {
8227 ScriptInputUserData ctx = new ScriptInputUserData;
8232 dst.WriteToContext(ctx);
8234 }
8235 }
8236 else if (!
GetGame().IsMultiplayer())
8237 {
8239 }
8240 }
8241
8243 {
8245 {
8246 if (ScriptInputUserData.CanStoreInputUserData())
8247 {
8248 ScriptInputUserData ctx = new ScriptInputUserData;
8253 ctx.
Write(destination_entity);
8259 }
8260 }
8261 else if (!
GetGame().IsMultiplayer())
8262 {
8264 }
8265 }
8266
8268 {
8270 }
8271
8273 {
8275 float split_quantity_new;
8277 if (dst.IsValid())
8278 {
8279 int slot_id = dst.GetSlot();
8281
8282 if (quantity > stack_max)
8283 split_quantity_new = stack_max;
8284 else
8285 split_quantity_new = quantity;
8286
8288 {
8290
8291 if (new_item)
8292 {
8293 new_item.SetResultOfSplit(true);
8294 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8296 new_item.
SetQuantity(split_quantity_new,
false,
true);
8297 }
8298
8299 return new_item;
8300 }
8301 }
8302
8303 return null;
8304 }
8305
8307 {
8309 float split_quantity_new;
8311 if (destination_entity)
8312 {
8314 if (quantity > stackable)
8315 split_quantity_new = stackable;
8316 else
8317 split_quantity_new = quantity;
8318
8320 {
8321 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8322 if (new_item)
8323 {
8324 new_item.SetResultOfSplit(true);
8325 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8327 new_item.
SetQuantity(split_quantity_new,
false,
true);
8328 }
8329 }
8330 }
8331 }
8332
8334 {
8336 {
8337 if (ScriptInputUserData.CanStoreInputUserData())
8338 {
8339 ScriptInputUserData ctx = new ScriptInputUserData;
8344 ItemBase destination_entity =
this;
8345 ctx.
Write(destination_entity);
8349 }
8350 }
8351 else if (!
GetGame().IsMultiplayer())
8352 {
8354 }
8355 }
8356
8358 {
8360 float split_quantity_new;
8362 if (player)
8363 {
8365 if (quantity > stackable)
8366 split_quantity_new = stackable;
8367 else
8368 split_quantity_new = quantity;
8369
8371 {
8372 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8373 new_item =
ItemBase.Cast(in_hands);
8374 if (new_item)
8375 {
8376 new_item.SetResultOfSplit(true);
8377 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8379 new_item.SetQuantity(split_quantity_new, false, true);
8380 }
8381 }
8382 }
8383 }
8384
8386 {
8388 float split_quantity_new = Math.Floor(quantity * 0.5);
8389
8391 return;
8392
8394
8395 if (new_item)
8396 {
8397 if (new_item.GetQuantityMax() < split_quantity_new)
8398 {
8399 split_quantity_new = new_item.GetQuantityMax();
8400 }
8401
8402 new_item.SetResultOfSplit(true);
8403 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8404
8406 {
8409 }
8410 else
8411 {
8413 new_item.
SetQuantity(split_quantity_new,
false,
true);
8414 }
8415 }
8416 }
8417
8419 {
8421 float split_quantity_new = Math.Floor(quantity / 2);
8422
8424 return;
8425
8426 InventoryLocation invloc = new InventoryLocation;
8428
8430 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8431
8432 if (new_item)
8433 {
8434 if (new_item.GetQuantityMax() < split_quantity_new)
8435 {
8436 split_quantity_new = new_item.GetQuantityMax();
8437 }
8439 {
8442 }
8443 else if (split_quantity_new > 1)
8444 {
8446 new_item.
SetQuantity(split_quantity_new,
false,
true);
8447 }
8448 }
8449 }
8450
8453 {
8454 SetWeightDirty();
8456
8457 if (parent)
8458 parent.OnAttachmentQuantityChangedEx(this, delta);
8459
8461 {
8463 {
8465 }
8467 {
8468 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8470 }
8471 }
8472
8473 }
8474
8477 {
8478
8479 }
8480
8483 {
8485 }
8486
8488 {
8489 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8490
8492 {
8493 if (newLevel == GameConstants.STATE_RUINED)
8494 {
8496 EntityAI parent = GetHierarchyParent();
8497 if (parent && parent.IsFireplace())
8498 {
8499 CargoBase cargo = GetInventory().GetCargo();
8500 if (cargo)
8501 {
8503 {
8505 }
8506 }
8507 }
8508 }
8509
8511 {
8512
8514 return;
8515 }
8516
8517 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8518 {
8520 }
8521 }
8522 }
8523
8524
8526 {
8527 super.OnRightClick();
8528
8530 {
8532 {
8533 if (ScriptInputUserData.CanStoreInputUserData())
8534 {
8535 EntityAI root = GetHierarchyRoot();
8536 Man playerOwner = GetHierarchyRootPlayer();
8537 InventoryLocation dst = new InventoryLocation;
8538
8539
8540 if (!playerOwner && root && root == this)
8541 {
8543 }
8544 else
8545 {
8546
8547 GetInventory().GetCurrentInventoryLocation(dst);
8549 {
8552 {
8554 }
8555 else
8556 {
8558
8559
8560 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8561 {
8563 }
8564 else
8565 {
8566 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8567 }
8568 }
8569 }
8570 }
8571
8572 ScriptInputUserData ctx = new ScriptInputUserData;
8580 }
8581 }
8582 else if (!
GetGame().IsMultiplayer())
8583 {
8585 }
8586 }
8587 }
8588
8590 {
8591 if (root)
8592 {
8593 vector m4[4];
8594 root.GetTransform(m4);
8595 dst.SetGround(this, m4);
8596 }
8597 else
8598 {
8599 GetInventory().GetCurrentInventoryLocation(dst);
8600 }
8601 }
8602
8603 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8604 {
8605
8606 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8607 return false;
8608
8609 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8610 return false;
8611
8612
8614 return false;
8615
8616
8617 Magazine mag = Magazine.Cast(this);
8618 if (mag)
8619 {
8620 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8621 return false;
8622
8623 if (stack_max_limit)
8624 {
8625 Magazine other_mag = Magazine.Cast(other_item);
8626 if (other_item)
8627 {
8628 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8629 return false;
8630 }
8631
8632 }
8633 }
8634 else
8635 {
8636
8638 return false;
8639
8641 return false;
8642 }
8643
8644 PlayerBase player = null;
8645 if (CastTo(player, GetHierarchyRootPlayer()))
8646 {
8647 if (player.GetInventory().HasAttachment(this))
8648 return false;
8649
8650 if (player.IsItemsToDelete())
8651 return false;
8652 }
8653
8654 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8655 return false;
8656
8657 int slotID;
8659 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8660 return false;
8661
8662 return true;
8663 }
8664
8666 {
8668 }
8669
8671 {
8672 return m_IsResultOfSplit;
8673 }
8674
8676 {
8677 m_IsResultOfSplit = value;
8678 }
8679
8681 {
8683 }
8684
8686 {
8687 float other_item_quantity = other_item.GetQuantity();
8688 float this_free_space;
8689
8691
8693
8694 if (other_item_quantity > this_free_space)
8695 {
8696 return this_free_space;
8697 }
8698 else
8699 {
8700 return other_item_quantity;
8701 }
8702 }
8703
8705 {
8707 }
8708
8710 {
8712 return;
8713
8714 if (!IsMagazine() && other_item)
8715 {
8717 if (quantity_used != 0)
8718 {
8719 float hp1 = GetHealth01("","");
8720 float hp2 = other_item.GetHealth01("","");
8721 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8722 hpResult = hpResult / (
GetQuantity() + quantity_used);
8723
8724 hpResult *= GetMaxHealth();
8725 Math.Round(hpResult);
8726 SetHealth("", "Health", hpResult);
8727
8729 other_item.AddQuantity(-quantity_used);
8730 }
8731 }
8733 }
8734
8736 {
8737 #ifdef SERVER
8738 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8739 GetHierarchyParent().IncreaseLifetimeUp();
8740 #endif
8741 };
8742
8744 {
8745 PlayerBase p = PlayerBase.Cast(player);
8746
8747 array<int> recipesIds = p.m_Recipes;
8748 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8749 if (moduleRecipesManager)
8750 {
8751 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8752 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8753 }
8754
8755 for (int i = 0;i < recipesIds.Count(); i++)
8756 {
8757 int key = recipesIds.Get(i);
8758 string recipeName = moduleRecipesManager.GetRecipeName(key);
8760 }
8761 }
8762
8763
8764 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8765 {
8766 super.GetDebugActions(outputList);
8767
8768
8774
8775
8780
8785
8786
8790
8791
8793 {
8797 }
8798
8801
8802
8806
8808
8809 InventoryLocation loc = new InventoryLocation();
8810 GetInventory().GetCurrentInventoryLocation(loc);
8812 {
8813 if (Gizmo_IsSupported())
8816 }
8817
8819 }
8820
8821
8822
8823
8825 {
8826 super.OnAction(action_id, player, ctx);
8827
8829 {
8830 switch (action_id)
8831 {
8834 return true;
8837 return true;
8838 }
8839 }
8840
8842 {
8843 switch (action_id)
8844 {
8846 Delete();
8847 return true;
8848 }
8849 }
8850
8851 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8852 {
8853 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8854 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8855 PlayerBase p = PlayerBase.Cast(player);
8856 if (
EActions.RECIPES_RANGE_START < 1000)
8857 {
8858 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8859 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8860 }
8861 }
8862 #ifndef SERVER
8863 else if (action_id ==
EActions.WATCH_PLAYER)
8864 {
8865 PluginDeveloper.SetDeveloperItemClientEx(player);
8866 }
8867 #endif
8869 {
8870 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8871 {
8872 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8873 OnDebugButtonPressServer(id + 1);
8874 }
8875
8876 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8877 {
8878 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8880 }
8881
8882 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8883 {
8884 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8886 }
8887
8888 else if (action_id ==
EActions.ADD_QUANTITY)
8889 {
8890 if (IsMagazine())
8891 {
8892 Magazine mag = Magazine.Cast(this);
8893 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8894 }
8895 else
8896 {
8898 }
8899
8900 if (m_EM)
8901 {
8902 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8903 }
8904
8905 }
8906
8907 else if (action_id ==
EActions.REMOVE_QUANTITY)
8908 {
8909 if (IsMagazine())
8910 {
8911 Magazine mag2 = Magazine.Cast(this);
8912 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8913 }
8914 else
8915 {
8917 }
8918 if (m_EM)
8919 {
8920 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8921 }
8922
8923 }
8924
8925 else if (action_id ==
EActions.SET_QUANTITY_0)
8926 {
8928
8929 if (m_EM)
8930 {
8931 m_EM.SetEnergy(0);
8932 }
8933 }
8934
8935 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8936 {
8938
8939 if (m_EM)
8940 {
8941 m_EM.SetEnergy(m_EM.GetEnergyMax());
8942 }
8943 }
8944
8945 else if (action_id ==
EActions.ADD_HEALTH)
8946 {
8947 AddHealth("","",GetMaxHealth("","Health")/5);
8948 }
8949 else if (action_id ==
EActions.REMOVE_HEALTH)
8950 {
8951 AddHealth("","",-GetMaxHealth("","Health")/5);
8952 }
8953 else if (action_id ==
EActions.DESTROY_HEALTH)
8954 {
8955 SetHealth01("","",0);
8956 }
8957 else if (action_id ==
EActions.WATCH_ITEM)
8958 {
8960 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8961 #ifdef DEVELOPER
8962 SetDebugDeveloper_item(this);
8963 #endif
8964 }
8965
8966 else if (action_id ==
EActions.ADD_TEMPERATURE)
8967 {
8968 AddTemperature(20);
8969
8970 }
8971
8972 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8973 {
8974 AddTemperature(-20);
8975
8976 }
8977
8978 else if (action_id ==
EActions.FLIP_FROZEN)
8979 {
8980 SetFrozen(!GetIsFrozen());
8981
8982 }
8983
8984 else if (action_id ==
EActions.ADD_WETNESS)
8985 {
8987
8988 }
8989
8990 else if (action_id ==
EActions.REMOVE_WETNESS)
8991 {
8993
8994 }
8995
8996 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8997 {
9000
9001
9002 }
9003
9004 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9005 {
9008 }
9009
9010 else if (action_id ==
EActions.MAKE_SPECIAL)
9011 {
9012 auto debugParams = DebugSpawnParams.WithPlayer(player);
9013 OnDebugSpawnEx(debugParams);
9014 }
9015
9016 }
9017
9018
9019 return false;
9020 }
9021
9022
9023
9024
9028
9031
9032
9033
9035 {
9036 return false;
9037 }
9038
9039
9041 {
9042 return true;
9043 }
9044
9045
9047 {
9048 return true;
9049 }
9050
9051
9052
9054 {
9055 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9057 }
9058
9061 {
9062 return null;
9063 }
9064
9066 {
9067 return false;
9068 }
9069
9071 {
9072 return false;
9073 }
9074
9078
9079
9081 {
9082 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9083 return module_repairing.CanRepair(this, item_repair_kit);
9084 }
9085
9086
9087 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9088 {
9089 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9090 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9091 }
9092
9093
9095 {
9096
9097
9098
9099
9100
9101
9102
9103
9104 return 1;
9105 }
9106
9107
9108
9110 {
9112 }
9113
9114
9115
9117 {
9119 }
9120
9121
9130 {
9131 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9132
9133 if (player)
9134 {
9135 player.MessageStatus(text);
9136 }
9137 }
9138
9139
9148 {
9149 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9150
9151 if (player)
9152 {
9153 player.MessageAction(text);
9154 }
9155 }
9156
9157
9166 {
9167 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9168
9169 if (player)
9170 {
9171 player.MessageFriendly(text);
9172 }
9173 }
9174
9175
9184 {
9185 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9186
9187 if (player)
9188 {
9189 player.MessageImportant(text);
9190 }
9191 }
9192
9194 {
9195 return true;
9196 }
9197
9198
9199 override bool KindOf(
string tag)
9200 {
9201 bool found = false;
9202 string item_name = this.
GetType();
9205
9206 int array_size = item_tag_array.Count();
9207 for (int i = 0; i < array_size; i++)
9208 {
9209 if (item_tag_array.Get(i) == tag)
9210 {
9211 found = true;
9212 break;
9213 }
9214 }
9215 return found;
9216 }
9217
9218
9220 {
9221
9222 super.OnRPC(sender, rpc_type,ctx);
9223
9224
9225 switch (rpc_type)
9226 {
9227 #ifndef SERVER
9228 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9229 Param2<bool, string> p = new Param2<bool, string>(false, "");
9230
9232 return;
9233
9234 bool play = p.param1;
9235 string soundSet = p.param2;
9236
9237 if (play)
9238 {
9240 {
9242 {
9244 }
9245 }
9246 else
9247 {
9249 }
9250 }
9251 else
9252 {
9254 }
9255
9256 break;
9257 #endif
9258
9259 }
9260
9262 {
9264 }
9265 }
9266
9267
9268
9269
9271 {
9272 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9273 return plugin.GetID(
name);
9274 }
9275
9277 {
9278 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9279 return plugin.GetName(id);
9280 }
9281
9284 {
9285
9286
9287 int varFlags;
9288 if (!ctx.
Read(varFlags))
9289 return;
9290
9291 if (varFlags & ItemVariableFlags.FLOAT)
9292 {
9294 }
9295 }
9296
9298 {
9299
9300 super.SerializeNumericalVars(floats_out);
9301
9302
9303
9305 {
9307 }
9308
9310 {
9312 }
9313
9315 {
9317 }
9318
9320 {
9325 }
9326
9328 {
9330 }
9331 }
9332
9334 {
9335
9336 super.DeSerializeNumericalVars(floats);
9337
9338
9339 int index = 0;
9340 int mask = Math.Round(floats.Get(index));
9341
9342 index++;
9343
9345 {
9347 {
9349 }
9350 else
9351 {
9352 float quantity = floats.Get(index);
9354 }
9355 index++;
9356 }
9357
9359 {
9360 float wet = floats.Get(index);
9362 index++;
9363 }
9364
9366 {
9367 int liquidtype = Math.Round(floats.Get(index));
9369 index++;
9370 }
9371
9373 {
9375 index++;
9377 index++;
9379 index++;
9381 index++;
9382 }
9383
9385 {
9386 int cleanness = Math.Round(floats.Get(index));
9388 index++;
9389 }
9390 }
9391
9393 {
9394 super.WriteVarsToCTX(ctx);
9395
9396
9398 {
9400 }
9401
9403 {
9405 }
9406
9408 {
9410 }
9411
9413 {
9414 int r,g,b,a;
9420 }
9421
9423 {
9425 }
9426 }
9427
9429 {
9430 if (!super.ReadVarsFromCTX(ctx,version))
9431 return false;
9432
9433 int intValue;
9434 float value;
9435
9436 if (version < 140)
9437 {
9438 if (!ctx.
Read(intValue))
9439 return false;
9440
9441 m_VariablesMask = intValue;
9442 }
9443
9445 {
9446 if (!ctx.
Read(value))
9447 return false;
9448
9450 {
9452 }
9453 else
9454 {
9456 }
9457 }
9458
9459 if (version < 140)
9460 {
9462 {
9463 if (!ctx.
Read(value))
9464 return false;
9465 SetTemperatureDirect(value);
9466 }
9467 }
9468
9470 {
9471 if (!ctx.
Read(value))
9472 return false;
9474 }
9475
9477 {
9478 if (!ctx.
Read(intValue))
9479 return false;
9481 }
9482
9484 {
9485 int r,g,b,a;
9487 return false;
9489 return false;
9491 return false;
9493 return false;
9494
9496 }
9497
9499 {
9500 if (!ctx.
Read(intValue))
9501 return false;
9503 }
9504
9505 if (version >= 138 && version < 140)
9506 {
9508 {
9509 if (!ctx.
Read(intValue))
9510 return false;
9511 SetFrozen(intValue);
9512 }
9513 }
9514
9515 return true;
9516 }
9517
9518
9520 {
9523 {
9525 }
9526
9527 if (!super.OnStoreLoad(ctx, version))
9528 {
9530 return false;
9531 }
9532
9533 if (version >= 114)
9534 {
9535 bool hasQuickBarIndexSaved;
9536
9537 if (!ctx.
Read(hasQuickBarIndexSaved))
9538 {
9540 return false;
9541 }
9542
9543 if (hasQuickBarIndexSaved)
9544 {
9545 int itmQBIndex;
9546
9547
9548 if (!ctx.
Read(itmQBIndex))
9549 {
9551 return false;
9552 }
9553
9554 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9555 if (itmQBIndex != -1 && parentPlayer)
9556 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9557 }
9558 }
9559 else
9560 {
9561
9562 PlayerBase player;
9563 int itemQBIndex;
9564 if (version ==
int.
MAX)
9565 {
9566 if (!ctx.
Read(itemQBIndex))
9567 {
9569 return false;
9570 }
9571 }
9572 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9573 {
9574
9575 if (!ctx.
Read(itemQBIndex))
9576 {
9578 return false;
9579 }
9580 if (itemQBIndex != -1 && player)
9581 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9582 }
9583 }
9584
9585 if (version < 140)
9586 {
9587
9588 if (!LoadVariables(ctx, version))
9589 {
9591 return false;
9592 }
9593 }
9594
9595
9597 {
9599 return false;
9600 }
9601 if (version >= 132)
9602 {
9604 if (raib)
9605 {
9607 {
9609 return false;
9610 }
9611 }
9612 }
9613
9615 return true;
9616 }
9617
9618
9619
9621 {
9622 super.OnStoreSave(ctx);
9623
9624 PlayerBase player;
9625 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9626 {
9628
9629 int itemQBIndex = -1;
9630 itemQBIndex = player.FindQuickBarEntityIndex(this);
9631 ctx.
Write(itemQBIndex);
9632 }
9633 else
9634 {
9636 }
9637
9639
9641 if (raib)
9642 {
9644 }
9645 }
9646
9647
9649 {
9650 super.AfterStoreLoad();
9651
9653 {
9655 }
9656
9658 {
9661 }
9662 }
9663
9665 {
9666 super.EEOnAfterLoad();
9667
9669 {
9671 }
9672
9675 }
9676
9678 {
9679 return false;
9680 }
9681
9682
9683
9685 {
9687 {
9688 #ifdef PLATFORM_CONSOLE
9689
9691 {
9693 if (menu)
9694 {
9696 }
9697 }
9698 #endif
9699 }
9700
9702 {
9705 }
9706
9708 {
9709 SetWeightDirty();
9711 }
9713 {
9716 }
9717
9719 {
9722 }
9724 {
9727 }
9728
9729 super.OnVariablesSynchronized();
9730 }
9731
9732
9733
9735 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9736 {
9737 if (!IsServerCheck(allow_client))
9738 return false;
9739
9741 return false;
9742
9745
9746 if (value <= (min + 0.001))
9747 value = min;
9748
9749 if (value == min)
9750 {
9751 if (destroy_config)
9752 {
9753 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9754 if (dstr)
9755 {
9757 this.Delete();
9758 return true;
9759 }
9760 }
9761 else if (destroy_forced)
9762 {
9764 this.Delete();
9765 return true;
9766 }
9767
9769 }
9770
9773
9775 {
9777
9778 if (delta)
9780 }
9781
9783
9784 return false;
9785 }
9786
9787
9789 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9790 {
9792 }
9793
9795 {
9798 }
9799
9801 {
9804 }
9805
9807 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9808 {
9809 float value_clamped = Math.Clamp(value, 0, 1);
9811 SetQuantity(result, destroy_config, destroy_forced);
9812 }
9813
9814
9817 {
9819 }
9820
9822 {
9824 }
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9836 {
9837 int slot = -1;
9838 if (GetInventory())
9839 {
9840 InventoryLocation il = new InventoryLocation;
9841 GetInventory().GetCurrentInventoryLocation(il);
9843 }
9844
9846 }
9847
9849 {
9850 float quantity_max = 0;
9851
9853 {
9854 if (attSlotID != -1)
9855 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9856
9857 if (quantity_max <= 0)
9859 }
9860
9861 if (quantity_max <= 0)
9863
9864 return quantity_max;
9865 }
9866
9868 {
9870 }
9871
9873 {
9875 }
9876
9877
9879 {
9881 }
9882
9884 {
9886 }
9887
9889 {
9891 }
9892
9893
9895 {
9896
9897 float weightEx = GetWeightEx();
9898 float special = GetInventoryAndCargoWeight();
9899 return weightEx - special;
9900 }
9901
9902
9904 {
9906 }
9907
9909 {
9911 {
9912 #ifdef DEVELOPER
9913 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9914 {
9915 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9917 }
9918 #endif
9919
9921 }
9922 else if (HasEnergyManager())
9923 {
9924 #ifdef DEVELOPER
9925 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9926 {
9927 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9928 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9929 }
9930 #endif
9931 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9932 }
9933 else
9934 {
9935 #ifdef DEVELOPER
9936 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9937 {
9938 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9939 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9940 }
9941 #endif
9942 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9943 }
9944 }
9945
9948 {
9949 int item_count = 0;
9951
9952 if (GetInventory().GetCargo() != NULL)
9953 {
9954 item_count = GetInventory().GetCargo().GetItemCount();
9955 }
9956
9957 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9958 {
9959 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9960 if (item)
9961 item_count += item.GetNumberOfItems();
9962 }
9963 return item_count;
9964 }
9965
9968 {
9969 float weight = 0;
9970 float wetness = 1;
9971 if (include_wetness)
9974 {
9975 weight = wetness * m_ConfigWeight;
9976 }
9978 {
9979 weight = 1;
9980 }
9981 return weight;
9982 }
9983
9984
9985
9987 {
9988 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9989 {
9990 GameInventory inv = GetInventory();
9991 array<EntityAI> items = new array<EntityAI>;
9993 for (int i = 0; i < items.Count(); i++)
9994 {
9996 if (item)
9997 {
9999 }
10000 }
10001 }
10002 }
10003
10004
10005
10006
10008 {
10009 float energy = 0;
10010 if (HasEnergyManager())
10011 {
10012 energy = GetCompEM().GetEnergy();
10013 }
10014 return energy;
10015 }
10016
10017
10019 {
10020 super.OnEnergyConsumed();
10021
10023 }
10024
10026 {
10027 super.OnEnergyAdded();
10028
10030 }
10031
10032
10034 {
10035 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10036 {
10038 {
10039 float energy_0to1 = GetCompEM().GetEnergy0To1();
10041 }
10042 }
10043 }
10044
10045
10047 {
10048 return ConfigGetFloat("heatIsolation");
10049 }
10050
10052 {
10054 }
10055
10057 {
10058 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10059 if (
GetGame().ConfigIsExisting(paramPath))
10061
10062 return 0.0;
10063 }
10064
10066 {
10067 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10068 if (
GetGame().ConfigIsExisting(paramPath))
10070
10071 return 0.0;
10072 }
10073
10074 override void SetWet(
float value,
bool allow_client =
false)
10075 {
10076 if (!IsServerCheck(allow_client))
10077 return;
10078
10081
10083
10084 m_VarWet = Math.Clamp(value, min, max);
10085
10087 {
10090 }
10091 }
10092
10093 override void AddWet(
float value)
10094 {
10096 }
10097
10099 {
10101 }
10102
10104 {
10106 }
10107
10109 {
10111 }
10112
10114 {
10116 }
10117
10119 {
10121 }
10122
10123 override void OnWetChanged(
float newVal,
float oldVal)
10124 {
10127 if (newLevel != oldLevel)
10128 {
10130 }
10131 }
10132
10134 {
10135 SetWeightDirty();
10136 }
10137
10139 {
10140 return GetWetLevelInternal(
m_VarWet);
10141 }
10142
10143
10144
10146 {
10148 }
10149
10151 {
10153 }
10154
10156 {
10158 }
10159
10161 {
10163 }
10164
10165
10166
10168 {
10169 if (ConfigIsExisting("itemModelLength"))
10170 {
10171 return ConfigGetFloat("itemModelLength");
10172 }
10173 return 0;
10174 }
10175
10177 {
10178 if (ConfigIsExisting("itemAttachOffset"))
10179 {
10180 return ConfigGetFloat("itemAttachOffset");
10181 }
10182 return 0;
10183 }
10184
10185 override void SetCleanness(
int value,
bool allow_client =
false)
10186 {
10187 if (!IsServerCheck(allow_client))
10188 return;
10189
10191
10193
10196 }
10197
10199 {
10201 }
10202
10204 {
10205 return true;
10206 }
10207
10208
10209
10210
10212 {
10214 }
10215
10217 {
10219 }
10220
10221
10222
10223
10224 override void SetColor(
int r,
int g,
int b,
int a)
10225 {
10231 }
10233 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10234 {
10239 }
10240
10242 {
10244 }
10245
10248 {
10249 int r,g,b,a;
10251 r = r/255;
10252 g = g/255;
10253 b = b/255;
10254 a = a/255;
10255 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10256 }
10257
10258
10259
10260 override void SetLiquidType(
int value,
bool allow_client =
false)
10261 {
10262 if (!IsServerCheck(allow_client))
10263 return;
10264
10269 }
10270
10272 {
10273 return ConfigGetInt("varLiquidTypeInit");
10274 }
10275
10277 {
10279 }
10280
10282 {
10284 SetFrozen(false);
10285 }
10286
10289 {
10290 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10291 }
10292
10293
10296 {
10297 PlayerBase nplayer;
10298 if (PlayerBase.CastTo(nplayer, player))
10299 {
10301
10302 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10303 }
10304 }
10305
10306
10309 {
10310 PlayerBase nplayer;
10311 if (PlayerBase.CastTo(nplayer,player))
10312 {
10313
10314 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10315
10316 }
10317
10318
10319 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10320
10321
10322 if (HasEnergyManager())
10323 {
10324 GetCompEM().UpdatePlugState();
10325 }
10326 }
10327
10328
10330 {
10331 super.OnPlacementStarted(player);
10332
10334 }
10335
10336 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10337 {
10339 {
10340 m_AdminLog.OnPlacementComplete(player,
this);
10341 }
10342
10343 super.OnPlacementComplete(player, position, orientation);
10344 }
10345
10346
10347
10348
10349
10351 {
10353 {
10354 return true;
10355 }
10356 else
10357 {
10358 return false;
10359 }
10360 }
10361
10362
10364 {
10366 {
10368 }
10369 }
10370
10371
10373 {
10375 }
10376
10378 {
10380 }
10381
10382 override void InsertAgent(
int agent,
float count = 1)
10383 {
10384 if (count < 1)
10385 return;
10386
10388 }
10389
10392 {
10394 }
10395
10396
10398 {
10400 }
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10444 {
10446 return false;
10447 return true;
10448 }
10449
10451 {
10452
10454 }
10455
10456
10459 {
10460 super.CheckForRoofLimited(timeTresholdMS);
10461
10463 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10464 {
10465 m_PreviousRoofTestTime = time;
10466 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10467 }
10468 }
10469
10470
10472 {
10474 {
10475 return 0;
10476 }
10477
10478 if (GetInventory().GetAttachmentSlotsCount() != 0)
10479 {
10480 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10481 if (filter)
10482 return filter.GetProtectionLevel(type, false, system);
10483 else
10484 return 0;
10485 }
10486
10487 string subclassPath, entryName;
10488
10489 switch (type)
10490 {
10492 entryName = "biological";
10493 break;
10495 entryName = "chemical";
10496 break;
10497 default:
10498 entryName = "biological";
10499 break;
10500 }
10501
10502 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10503
10505 }
10506
10507
10508
10511 {
10512 if (!IsMagazine())
10514
10516 }
10517
10518
10519
10520
10521
10526 {
10527 return true;
10528 }
10529
10531 {
10533 }
10534
10535
10536
10537
10538
10540 {
10541 if (parent)
10542 {
10543 if (parent.IsInherited(DayZInfected))
10544 return true;
10545
10546 if (!parent.IsRuined())
10547 return true;
10548 }
10549
10550 return true;
10551 }
10552
10554 {
10555 if (!super.CanPutAsAttachment(parent))
10556 {
10557 return false;
10558 }
10559
10560 if (!IsRuined() && !parent.IsRuined())
10561 {
10562 return true;
10563 }
10564
10565 return false;
10566 }
10567
10569 {
10570
10571
10572
10573
10574 return super.CanReceiveItemIntoCargo(item);
10575 }
10576
10578 {
10579
10580
10581
10582
10583 GameInventory attachmentInv = attachment.GetInventory();
10585 {
10586 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10587 return false;
10588 }
10589
10590 InventoryLocation loc = new InventoryLocation();
10591 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10592 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10593 return false;
10594
10595 return super.CanReceiveAttachment(attachment, slotId);
10596 }
10597
10599 {
10600 if (!super.CanReleaseAttachment(attachment))
10601 return false;
10602
10603 return GetInventory().AreChildrenAccessible();
10604 }
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10627 {
10628 int id = muzzle_owner.GetMuzzleID();
10629 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10630
10631 if (WPOF_array)
10632 {
10633 for (int i = 0; i < WPOF_array.Count(); i++)
10634 {
10635 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10636
10637 if (WPOF)
10638 {
10639 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10640 }
10641 }
10642 }
10643 }
10644
10645
10647 {
10648 int id = muzzle_owner.GetMuzzleID();
10650
10651 if (WPOBE_array)
10652 {
10653 for (int i = 0; i < WPOBE_array.Count(); i++)
10654 {
10655 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10656
10657 if (WPOBE)
10658 {
10659 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10660 }
10661 }
10662 }
10663 }
10664
10665
10667 {
10668 int id = muzzle_owner.GetMuzzleID();
10669 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10670
10671 if (WPOOH_array)
10672 {
10673 for (int i = 0; i < WPOOH_array.Count(); i++)
10674 {
10675 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10676
10677 if (WPOOH)
10678 {
10679 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10680 }
10681 }
10682 }
10683 }
10684
10685
10687 {
10688 int id = muzzle_owner.GetMuzzleID();
10689 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10690
10691 if (WPOOH_array)
10692 {
10693 for (int i = 0; i < WPOOH_array.Count(); i++)
10694 {
10695 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10696
10697 if (WPOOH)
10698 {
10699 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10700 }
10701 }
10702 }
10703 }
10704
10705
10707 {
10708 int id = muzzle_owner.GetMuzzleID();
10709 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10710
10711 if (WPOOH_array)
10712 {
10713 for (int i = 0; i < WPOOH_array.Count(); i++)
10714 {
10715 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10716
10717 if (WPOOH)
10718 {
10719 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10720 }
10721 }
10722 }
10723 }
10724
10725
10726
10728 {
10730 {
10731 return true;
10732 }
10733
10734 return false;
10735 }
10736
10738 {
10740 {
10741 return true;
10742 }
10743
10744 return false;
10745 }
10746
10748 {
10750 {
10751 return true;
10752 }
10753
10754 return false;
10755 }
10756
10758 {
10759 return false;
10760 }
10761
10764 {
10765 return UATimeSpent.DEFAULT_DEPLOY;
10766 }
10767
10768
10769
10770
10772 {
10774 SetSynchDirty();
10775 }
10776
10778 {
10780 }
10781
10782
10784 {
10785 return false;
10786 }
10787
10790 {
10791 string att_type = "None";
10792
10793 if (ConfigIsExisting("soundAttType"))
10794 {
10795 att_type = ConfigGetString("soundAttType");
10796 }
10797
10799 }
10800
10802 {
10804 }
10805
10806
10807
10808
10809
10815
10817 {
10820
10822 }
10823
10824
10826 {
10828 return;
10829
10831
10834
10837
10838 SoundParameters params = new SoundParameters();
10842 }
10843
10844
10846 {
10848 return;
10849
10851 SetSynchDirty();
10852
10855 }
10856
10857
10859 {
10861 return;
10862
10864 SetSynchDirty();
10865
10868 }
10869
10871 {
10873 }
10874
10876 {
10878 }
10879
10882 {
10883 if (!
GetGame().IsDedicatedServer())
10884 {
10885 if (ConfigIsExisting("attachSoundSet"))
10886 {
10887 string cfg_path = "";
10888 string soundset = "";
10889 string type_name =
GetType();
10890
10893 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10894 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10895
10896 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10897 {
10898 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10899 {
10900 if (cfg_slot_array[i] == slot_type)
10901 {
10902 soundset = cfg_soundset_array[i];
10903 break;
10904 }
10905 }
10906 }
10907
10908 if (soundset != "")
10909 {
10910 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10912 }
10913 }
10914 }
10915 }
10916
10918 {
10919
10920 }
10921
10922 void OnApply(PlayerBase player);
10923
10925 {
10926 return 1.0;
10927 };
10928
10930 {
10932 }
10933
10935 {
10937 }
10938
10940
10942 {
10943 SetDynamicPhysicsLifeTime(0.01);
10945 }
10946
10948 {
10949 array<string> zone_names = new array<string>;
10950 GetDamageZones(zone_names);
10951 for (int i = 0; i < zone_names.Count(); i++)
10952 {
10953 SetHealthMax(zone_names.Get(i),"Health");
10954 }
10955 SetHealthMax("","Health");
10956 }
10957
10960 {
10961 float global_health = GetHealth01("","Health");
10962 array<string> zones = new array<string>;
10963 GetDamageZones(zones);
10964
10965 for (int i = 0; i < zones.Count(); i++)
10966 {
10967 SetHealth01(zones.Get(i),"Health",global_health);
10968 }
10969 }
10970
10973 {
10974 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10975 }
10976
10978 {
10979 if (!hasRootAsPlayer)
10980 {
10981 if (refParentIB)
10982 {
10983
10984 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10985 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10986
10987 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10988 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10989
10992 }
10993 else
10994 {
10995
10998 }
10999 }
11000 }
11001
11003 {
11005 {
11006 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11007 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11008 {
11009 float heatPermCoef = 1.0;
11011 while (ent)
11012 {
11013 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11014 ent = ent.GetHierarchyParent();
11015 }
11016
11017 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11018 }
11019 }
11020 }
11021
11023 {
11024
11025 EntityAI parent = GetHierarchyParent();
11026 if (!parent)
11027 {
11028 hasParent = false;
11029 hasRootAsPlayer = false;
11030 }
11031 else
11032 {
11033 hasParent = true;
11034 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11035 refParentIB =
ItemBase.Cast(parent);
11036 }
11037 }
11038
11039 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11040 {
11041
11042 }
11043
11045 {
11046
11047 return false;
11048 }
11049
11051 {
11052
11053
11054 return false;
11055 }
11056
11058 {
11059
11060 return false;
11061 }
11062
11065 {
11066 return !GetIsFrozen() &&
IsOpen();
11067 }
11068
11070 {
11071 bool hasParent = false, hasRootAsPlayer = false;
11073
11074 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11075 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11076
11077 if (wwtu || foodDecay)
11078 {
11082
11083 if (processWetness || processTemperature || processDecay)
11084 {
11086
11087 if (processWetness)
11088 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11089
11090 if (processTemperature)
11092
11093 if (processDecay)
11094 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11095 }
11096 }
11097 }
11098
11101 {
11103 }
11104
11106 {
11109
11110 return super.GetTemperatureFreezeThreshold();
11111 }
11112
11114 {
11117
11118 return super.GetTemperatureThawThreshold();
11119 }
11120
11122 {
11125
11126 return super.GetItemOverheatThreshold();
11127 }
11128
11130 {
11132 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11133
11134 return super.GetTemperatureFreezeTime();
11135 }
11136
11138 {
11140 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11141
11142 return super.GetTemperatureThawTime();
11143 }
11144
11149
11151 {
11152 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11153 }
11154
11156 {
11157 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11158 }
11159
11162 {
11164 }
11165
11167 {
11169 }
11170
11172 {
11174 }
11175
11178 {
11179 return null;
11180 }
11181
11184 {
11185 return false;
11186 }
11187
11189 {
11191 {
11194 if (!trg)
11195 {
11197 explosive = this;
11198 }
11199
11200 explosive.PairRemote(trg);
11202
11203 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11204 trg.SetPersistentPairID(persistentID);
11205 explosive.SetPersistentPairID(persistentID);
11206
11207 return true;
11208 }
11209 return false;
11210 }
11211
11214 {
11215 float ret = 1.0;
11218 ret *= GetHealth01();
11219
11220 return ret;
11221 }
11222
11223 #ifdef DEVELOPER
11224 override void SetDebugItem()
11225 {
11226 super.SetDebugItem();
11227 _itemBase = this;
11228 }
11229
11231 {
11232 string text = super.GetDebugText();
11233
11235 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11236
11237 return text;
11238 }
11239 #endif
11240
11242 {
11243 return true;
11244 }
11245
11247
11249
11251 {
11254 }
11255
11256
11264
11280}
11281
11283{
11285 if (entity)
11286 {
11287 bool is_item = entity.IsInherited(
ItemBase);
11288 if (is_item && full_quantity)
11289 {
11292 }
11293 }
11294 else
11295 {
11297 return NULL;
11298 }
11299 return entity;
11300}
11301
11303{
11304 if (item)
11305 {
11306 if (health > 0)
11307 item.SetHealth("", "", health);
11308
11309 if (item.CanHaveTemperature())
11310 {
11312 if (item.CanFreeze())
11313 item.SetFrozen(false);
11314 }
11315
11316 if (item.HasEnergyManager())
11317 {
11318 if (quantity >= 0)
11319 {
11320 item.GetCompEM().SetEnergy0To1(quantity);
11321 }
11322 else
11323 {
11325 }
11326 }
11327 else if (item.IsMagazine())
11328 {
11329 Magazine mag = Magazine.Cast(item);
11330 if (quantity >= 0)
11331 {
11332 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11333 }
11334 else
11335 {
11337 }
11338
11339 }
11340 else
11341 {
11342 if (quantity >= 0)
11343 {
11344 item.SetQuantityNormalized(quantity, false);
11345 }
11346 else
11347 {
11349 }
11350
11351 }
11352 }
11353}
11354
11355#ifdef DEVELOPER
11357#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
Open
Implementations only.
override void EEOnCECreate()
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 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)
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()
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)
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 void GizmoSelectObject(Object object)
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 native void GizmoSelectPhysics(Physics physics)
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
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 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.