8656{
8658 {
8659 return true;
8660 }
8661};
8662
8664{
8665
8666};
8667
8668
8669
8671{
8675
8677
8680
8681
8682
8683
8684
8693
8699
8704
8709
8730 protected bool m_IsResultOfSplit
8731
8733
8738
8739
8740
8742
8746
8747
8748
8750
8753
8754
8755
8761
8762
8770
8773
8774
8776
8777
8779
8780
8785
8786
8791
8793
8794
8796
8797
8799 {
8804
8805 if (!
g_Game.IsDedicatedServer())
8806 {
8808 {
8810
8812 {
8814 }
8815 }
8816
8819 }
8820
8821 m_OldLocation = null;
8822
8824 {
8826 }
8827
8828 if (ConfigIsExisting("headSelectionsToHide"))
8829 {
8832 }
8833
8835 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8836 {
8838 }
8839
8841
8842 m_IsResultOfSplit = false;
8843
8845 }
8846
8848 {
8849 super.InitItemVariables();
8850
8856 m_Count = ConfigGetInt(
"count");
8857
8860
8865
8868
8873
8885
8889
8890
8893 if (ConfigIsExisting("canBeSplit"))
8894 {
8897 }
8898
8900 if (ConfigIsExisting("itemBehaviour"))
8902
8903
8906 RegisterNetSyncVariableInt("m_VarLiquidType");
8907 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8908
8909 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8910 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8911 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8912
8913 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8914 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8915 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8916 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8917
8918 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8919 RegisterNetSyncVariableBool("m_IsTakeable");
8920 RegisterNetSyncVariableBool("m_IsHologram");
8921
8924 {
8927 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8928 }
8929
8931
8933 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8935
8937 }
8938
8940 {
8942 }
8943
8945 {
8948 {
8953 }
8954 }
8955
8956 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8957 {
8959 {
8962 }
8963
8965 }
8966
8968 {
8974 }
8975
8977
8979 {
8981
8982 if (!action)
8983 {
8984 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8985 return;
8986 }
8987
8989 if (!ai)
8990 {
8992 return;
8993 }
8994
8996 if (!action_array)
8997 {
8998 action_array = new array<ActionBase_Basic>;
9000 }
9001 if (LogManager.IsActionLogEnable())
9002 {
9003 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9004 }
9005
9006 if (action_array.Find(action) != -1)
9007 {
9008 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9009 }
9010 else
9011 {
9012 action_array.Insert(action);
9013 }
9014 }
9015
9017 {
9018 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9019 ActionBase action = player.GetActionManager().GetAction(actionName);
9022
9023 if (action_array)
9024 {
9025 action_array.RemoveItem(action);
9026 }
9027 }
9028
9029
9030
9032 {
9033 ActionOverrideData overrideData = new ActionOverrideData();
9037
9039 if (!actionMap)
9040 {
9043 }
9044
9045 actionMap.Insert(this.
Type(), overrideData);
9046
9047 }
9048
9050
9052
9053
9055 {
9058
9061
9062 string config_to_search = "CfgVehicles";
9063 string muzzle_owner_config;
9064
9066 {
9067 if (IsInherited(Weapon))
9068 config_to_search = "CfgWeapons";
9069
9070 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9071
9072 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9073
9074 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9075
9076 if (config_OnFire_subclass_count > 0)
9077 {
9078 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9079
9080 for (int i = 0; i < config_OnFire_subclass_count; i++)
9081 {
9082 string particle_class = "";
9083 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9084 string config_OnFire_entry = config_OnFire_class + particle_class;
9085 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9086 WPOF_array.Insert(WPOF);
9087 }
9088
9089
9091 }
9092 }
9093
9095 {
9096 config_to_search = "CfgWeapons";
9097 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9098
9099 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9100
9101 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9102
9103 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9104 {
9105 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9106
9107 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9108 {
9109 string particle_class2 = "";
9110 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9111 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9112 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9113 WPOBE_array.Insert(WPOBE);
9114 }
9115
9116
9118 }
9119 }
9120 }
9121
9122
9124 {
9127
9129 {
9130 string config_to_search = "CfgVehicles";
9131
9132 if (IsInherited(Weapon))
9133 config_to_search = "CfgWeapons";
9134
9135 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9136 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9137
9138 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9139 {
9140
9142
9144 {
9146 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9148 return;
9149 }
9150
9153
9154
9155
9156 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9157 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9158
9159 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9160 {
9161 string particle_class = "";
9162 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9163 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9164 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9165
9166 if (entry_type == CT_CLASS)
9167 {
9168 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9169 WPOOH_array.Insert(WPOF);
9170 }
9171 }
9172
9173
9175 }
9176 }
9177 }
9178
9180 {
9182 }
9183
9185 {
9187 {
9189
9192
9195
9196 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9197 }
9198 }
9199
9201 {
9203 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9204
9206 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9207
9209 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9210
9212 {
9214 }
9215 }
9216
9218 {
9220 }
9221
9223 {
9226 else
9228
9230 {
9233 }
9234 else
9235 {
9238
9241 }
9242
9244 }
9245
9247 {
9249 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9250 }
9251
9253 {
9255 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9257 }
9258
9260 {
9262 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9263 }
9264
9266 {
9269
9270 OverheatingParticle OP = new OverheatingParticle();
9275
9277 }
9278
9280 {
9283
9284 return -1;
9285 }
9286
9288 {
9290 {
9293
9294 for (int i = count; i > 0; --i)
9295 {
9296 int id = i - 1;
9299
9302
9303 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9304 {
9305 if (p)
9306 {
9309 }
9310 }
9311 }
9312 }
9313 }
9314
9316 {
9318 {
9320 {
9321 int id = i - 1;
9323
9324 if (OP)
9325 {
9327
9328 if (p)
9329 {
9331 }
9332
9333 delete OP;
9334 }
9335 }
9336
9339 }
9340 }
9341
9344 {
9345 return 0.0;
9346 }
9347
9348
9350 {
9351 return 250;
9352 }
9353
9355 {
9356 return 0;
9357 }
9358
9361 {
9363 return true;
9364
9365 return false;
9366 }
9367
9370 {
9373
9375 {
9377 }
9378 else
9379 {
9380
9382 }
9383
9385 }
9386
9393 {
9394 return -1;
9395 }
9396
9397
9398
9399
9401 {
9403 {
9404 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9405 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9406
9407 if (r_index >= 0)
9408 {
9409 InventoryLocation r_il = new InventoryLocation;
9410 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9411
9412 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9415 {
9416 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9417 }
9419 {
9420 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9421 }
9422
9423 }
9424
9425 player.GetHumanInventory().ClearUserReservedLocation(this);
9426 }
9427
9430 }
9431
9432
9433
9434
9436 {
9437 return ItemBase.m_DebugActionsMask;
9438 }
9439
9441 {
9442 return ItemBase.m_DebugActionsMask & mask;
9443 }
9444
9446 {
9447 ItemBase.m_DebugActionsMask = mask;
9448 }
9449
9451 {
9452 ItemBase.m_DebugActionsMask |= mask;
9453 }
9454
9456 {
9457 ItemBase.m_DebugActionsMask &= ~mask;
9458 }
9459
9461 {
9463 {
9465 }
9466 else
9467 {
9469 }
9470 }
9471
9472
9474 {
9475 if (GetEconomyProfile())
9476 {
9477 float q_max = GetEconomyProfile().GetQuantityMax();
9478 if (q_max > 0)
9479 {
9480 float q_min = GetEconomyProfile().GetQuantityMin();
9481 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9482
9484 {
9485 ComponentEnergyManager comp = GetCompEM();
9487 {
9489 }
9490 }
9492 {
9494
9495 }
9496
9497 }
9498 }
9499 }
9500
9503 {
9504 EntityAI parent = GetHierarchyParent();
9505
9506 if (parent)
9507 {
9508 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9509 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9510 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9511 }
9512 }
9513
9516 {
9517 EntityAI parent = GetHierarchyParent();
9518
9519 if (parent)
9520 {
9521 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9522 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9523 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9524 }
9525 }
9526
9528 {
9529
9530
9531
9532
9534
9536 {
9537 if (ScriptInputUserData.CanStoreInputUserData())
9538 {
9539 ScriptInputUserData ctx = new ScriptInputUserData;
9545 ctx.
Write(use_stack_max);
9548
9550 {
9551 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9552 }
9553 }
9554 }
9555 else if (!
g_Game.IsMultiplayer())
9556 {
9558 }
9559 }
9560
9562 {
9564 }
9565
9567 {
9569 }
9570
9572 {
9574 }
9575
9577 {
9578
9579 return false;
9580 }
9581
9583 {
9584 return false;
9585 }
9586
9590 {
9591 return false;
9592 }
9593
9595 {
9596 return "";
9597 }
9598
9600
9602 {
9603 return false;
9604 }
9605
9607 {
9608 return true;
9609 }
9610
9611
9612
9614 {
9615 return true;
9616 }
9617
9619 {
9620 return true;
9621 }
9622
9624 {
9625 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9627 }
9628
9630 {
9632 }
9633
9635 {
9637 if (!is_being_placed)
9639 SetSynchDirty();
9640 }
9641
9642
9644
9646 {
9648 }
9649
9651 {
9653 }
9654
9656 {
9657 return 1;
9658 }
9659
9661 {
9662 return false;
9663 }
9664
9666 {
9668 SetSynchDirty();
9669 }
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9706 {
9707 super.OnMovedInsideCargo(container);
9708
9709 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9710 }
9711
9712 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9713 {
9714 super.EEItemLocationChanged(oldLoc, newLoc);
9715
9716 PlayerBase newPlayer = null;
9717 PlayerBase oldPlayer = null;
9718
9719 if (newLoc.GetParent())
9720 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9721
9722 if (oldLoc.GetParent())
9723 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9724
9726 {
9727 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9728
9729 if (rIndex >= 0)
9730 {
9731 InventoryLocation rIl = new InventoryLocation;
9732 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9733
9734 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9737 {
9738 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9739 }
9741 {
9743 }
9744
9745 }
9746 }
9747
9749 {
9750 if (newPlayer)
9751 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9752
9753 if (newPlayer == oldPlayer)
9754 {
9755 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9756 {
9758 {
9759 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9760 {
9761 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9762 }
9763 }
9764 else
9765 {
9766 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9767 }
9768 }
9769
9770 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9771 {
9772 int type = oldLoc.GetType();
9774 {
9775 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9776 }
9778 {
9779 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9780 }
9781 }
9782 if (!m_OldLocation)
9783 {
9784 m_OldLocation = new InventoryLocation;
9785 }
9786 m_OldLocation.Copy(oldLoc);
9787 }
9788 else
9789 {
9790 if (m_OldLocation)
9791 {
9792 m_OldLocation.Reset();
9793 }
9794 }
9795
9796 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9797 }
9798 else
9799 {
9800 if (newPlayer)
9801 {
9802 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9803 if (resIndex >= 0)
9804 {
9805 InventoryLocation il = new InventoryLocation;
9806 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9808 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9811 {
9812 il.
GetParent().GetOnReleaseLock().Invoke(it);
9813 }
9815 {
9817 }
9818
9819 }
9820 }
9822 {
9823
9825 }
9826
9827 if (m_OldLocation)
9828 {
9829 m_OldLocation.Reset();
9830 }
9831 }
9832
9834 {
9835 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9836 }
9837
9839 {
9840 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9841 }
9842 }
9843
9844 override void EOnContact(IEntity other, Contact extra)
9845 {
9847 {
9848 int liquidType = -1;
9850 if (impactSpeed > 0.0)
9851 {
9853 #ifndef SERVER
9855 #else
9857 SetSynchDirty();
9858 #endif
9860 }
9861 }
9862
9863 #ifdef SERVER
9864 if (GetCompEM() && GetCompEM().IsPlugged())
9865 {
9866 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9867 GetCompEM().UnplugThis();
9868 }
9869 #endif
9870 }
9871
9873
9875 {
9877 }
9878
9880 {
9881
9882 }
9883
9885 {
9886 super.OnItemLocationChanged(old_owner, new_owner);
9887
9888 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9889 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9890
9891 if (!relatedPlayer && playerNew)
9892 relatedPlayer = playerNew;
9893
9894 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9895 {
9897 if (actionMgr)
9898 {
9899 ActionBase currentAction = actionMgr.GetRunningAction();
9900 if (currentAction)
9902 }
9903 }
9904
9905 Man ownerPlayerOld = null;
9906 Man ownerPlayerNew = null;
9907
9908 if (old_owner)
9909 {
9910 if (old_owner.
IsMan())
9911 {
9912 ownerPlayerOld = Man.Cast(old_owner);
9913 }
9914 else
9915 {
9916 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9917 }
9918 }
9919 else
9920 {
9922 {
9924
9925 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9926 {
9927 GetCompEM().UnplugThis();
9928 }
9929 }
9930 }
9931
9932 if (new_owner)
9933 {
9934 if (new_owner.
IsMan())
9935 {
9936 ownerPlayerNew = Man.Cast(new_owner);
9937 }
9938 else
9939 {
9940 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9941 }
9942 }
9943
9944 if (ownerPlayerOld != ownerPlayerNew)
9945 {
9946 if (ownerPlayerOld)
9947 {
9948 array<EntityAI> subItemsExit = new array<EntityAI>;
9950 for (int i = 0; i < subItemsExit.Count(); i++)
9951 {
9954 }
9955 }
9956
9957 if (ownerPlayerNew)
9958 {
9959 array<EntityAI> subItemsEnter = new array<EntityAI>;
9961 for (int j = 0; j < subItemsEnter.Count(); j++)
9962 {
9965 }
9966 }
9967 }
9968 else if (ownerPlayerNew != null)
9969 {
9970 PlayerBase nplayer;
9971 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9972 {
9973 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9975 for (int k = 0; k < subItemsUpdate.Count(); k++)
9976 {
9978 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9979 }
9980 }
9981 }
9982
9983 if (old_owner)
9984 old_owner.OnChildItemRemoved(this);
9985 if (new_owner)
9986 new_owner.OnChildItemReceived(this);
9987 }
9988
9989
9991 {
9992 super.EEDelete(parent);
9993 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9994 if (player)
9995 {
9997
9998 if (player.IsAlive())
9999 {
10000 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10001 if (r_index >= 0)
10002 {
10003 InventoryLocation r_il = new InventoryLocation;
10004 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10005
10006 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10009 {
10010 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10011 }
10013 {
10014 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10015 }
10016
10017 }
10018
10019 player.RemoveQuickBarEntityShortcut(this);
10020 }
10021 }
10022 }
10023
10025 {
10026 super.EEKilled(killer);
10027
10030 {
10031 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10032 {
10033 if (IsMagazine())
10034 {
10035 if (Magazine.Cast(this).GetAmmoCount() > 0)
10036 {
10038 }
10039 }
10040 else
10041 {
10043 }
10044 }
10045 }
10046 }
10047
10049 {
10050 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10051
10052 super.OnWasAttached(parent, slot_id);
10053
10056
10059 }
10060
10062 {
10063 super.OnWasDetached(parent, slot_id);
10064
10067
10070 }
10071
10073 {
10074 int idx;
10077
10078 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10079 if (inventory_slots.Count() < 1)
10080 {
10081 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10082 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10083 }
10084 else
10085 {
10086 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10087 }
10088
10089 idx = inventory_slots.Find(slot);
10090 if (idx < 0)
10091 return "";
10092
10093 return attach_types.Get(idx);
10094 }
10095
10097 {
10098 int idx = -1;
10099 string slot;
10100
10103
10104 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10105 if (inventory_slots.Count() < 1)
10106 {
10107 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10108 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10109 }
10110 else
10111 {
10112 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10113 if (detach_types.Count() < 1)
10114 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10115 }
10116
10117 for (int i = 0; i < inventory_slots.Count(); i++)
10118 {
10119 slot = inventory_slots.Get(i);
10120 }
10121
10122 if (slot != "")
10123 {
10124 if (detach_types.Count() == 1)
10125 idx = 0;
10126 else
10127 idx = inventory_slots.Find(slot);
10128 }
10129 if (idx < 0)
10130 return "";
10131
10132 return detach_types.Get(idx);
10133 }
10134
10136 {
10137
10139
10140
10141 float min_time = 1;
10142 float max_time = 3;
10143 float delay = Math.RandomFloat(min_time, max_time);
10144
10145 explode_timer.Run(delay, this, "DoAmmoExplosion");
10146 }
10147
10149 {
10150 Magazine magazine = Magazine.Cast(this);
10151 int pop_sounds_count = 6;
10152 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10153
10154
10155 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10156 string sound_name = pop_sounds[ sound_idx ];
10157 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10158
10159
10160 magazine.ServerAddAmmoCount(-1);
10161
10162
10163 float min_temp_to_explode = 100;
10164
10165 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10166 {
10168 }
10169 }
10170
10171
10172 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10173 {
10174 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10175
10176 const int CHANCE_DAMAGE_CARGO = 4;
10177 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10178 const int CHANCE_DAMAGE_NOTHING = 2;
10179
10181 {
10182 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10183 int chances;
10184 int rnd;
10185
10186 if (GetInventory().GetCargo())
10187 {
10188 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10189 rnd = Math.RandomInt(0,chances);
10190
10191 if (rnd < CHANCE_DAMAGE_CARGO)
10192 {
10194 }
10195 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10196 {
10198 }
10199 }
10200 else
10201 {
10202 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10203 rnd = Math.RandomInt(0,chances);
10204
10205 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10206 {
10208 }
10209 }
10210 }
10211 }
10212
10214 {
10215 CargoBase cargo = GetInventory().GetCargo();
10216 if (cargo)
10217 {
10219 if (item_count > 0)
10220 {
10221 int random_pick = Math.RandomInt(0, item_count);
10223 if (!item.IsExplosive())
10224 {
10225 item.AddHealth("","",damage);
10226 return true;
10227 }
10228 }
10229 }
10230 return false;
10231 }
10232
10234 {
10235 GameInventory inventory = GetInventory();
10237 if (attachment_count > 0)
10238 {
10239 int random_pick = Math.RandomInt(0, attachment_count);
10241 if (!attachment.IsExplosive())
10242 {
10243 attachment.AddHealth("","",damage);
10244 return true;
10245 }
10246 }
10247 return false;
10248 }
10249
10251 {
10253 }
10254
10256 {
10258 return GetInventory().CanRemoveEntity();
10259
10260 return false;
10261 }
10262
10264 {
10265
10267 return false;
10268
10269
10271 return false;
10272
10273
10274
10276 if (delta == 0)
10277 return false;
10278
10279
10280 return true;
10281 }
10282
10284 {
10286 {
10287 if (ScriptInputUserData.CanStoreInputUserData())
10288 {
10289 ScriptInputUserData ctx = new ScriptInputUserData;
10294 ctx.
Write(destination_entity);
10296 ctx.
Write(slot_id);
10298 }
10299 }
10300 else if (!
g_Game.IsMultiplayer())
10301 {
10303 }
10304 }
10305
10307 {
10308 float split_quantity_new;
10312 InventoryLocation loc = new InventoryLocation;
10313
10314 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10315 {
10317 split_quantity_new = stack_max;
10318 else
10320
10322 {
10323 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10324 if (new_item)
10325 {
10326 new_item.SetResultOfSplit(true);
10327 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10329 new_item.
SetQuantity(split_quantity_new,
false,
true);
10330 }
10331 }
10332 }
10333 else if (destination_entity && slot_id == -1)
10334 {
10335 if (quantity > stack_max)
10336 split_quantity_new = stack_max;
10337 else
10338 split_quantity_new = quantity;
10339
10341 {
10342 GameInventory destinationInventory = destination_entity.GetInventory();
10344 {
10347 }
10348
10349 if (new_item)
10350 {
10351 new_item.SetResultOfSplit(true);
10352 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10354 new_item.
SetQuantity(split_quantity_new,
false,
true);
10355 }
10356 }
10357 }
10358 else
10359 {
10360 if (stack_max != 0)
10361 {
10363 {
10365 }
10366
10367 if (split_quantity_new == 0)
10368 {
10369 if (!
g_Game.IsMultiplayer())
10370 player.PhysicalPredictiveDropItem(this);
10371 else
10372 player.ServerDropEntity(this);
10373 return;
10374 }
10375
10377 {
10379
10380 if (new_item)
10381 {
10382 new_item.SetResultOfSplit(true);
10383 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10386 new_item.PlaceOnSurface();
10387 }
10388 }
10389 }
10390 }
10391 }
10392
10394 {
10395 float split_quantity_new;
10399 InventoryLocation loc = new InventoryLocation;
10400
10401 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10402 {
10404 split_quantity_new = stack_max;
10405 else
10407
10409 {
10410 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10411 if (new_item)
10412 {
10413 new_item.SetResultOfSplit(true);
10414 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10416 new_item.
SetQuantity(split_quantity_new,
false,
true);
10417 }
10418 }
10419 }
10420 else if (destination_entity && slot_id == -1)
10421 {
10422 if (quantity > stack_max)
10423 split_quantity_new = stack_max;
10424 else
10425 split_quantity_new = quantity;
10426
10428 {
10429 GameInventory destinationInventory = destination_entity.GetInventory();
10431 {
10434 }
10435
10436 if (new_item)
10437 {
10438 new_item.SetResultOfSplit(true);
10439 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10441 new_item.
SetQuantity(split_quantity_new,
false,
true);
10442 }
10443 }
10444 }
10445 else
10446 {
10447 if (stack_max != 0)
10448 {
10450 {
10452 }
10453
10455 {
10457
10458 if (new_item)
10459 {
10460 new_item.SetResultOfSplit(true);
10461 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10464 new_item.PlaceOnSurface();
10465 }
10466 }
10467 }
10468 }
10469 }
10470
10472 {
10474 {
10475 if (ScriptInputUserData.CanStoreInputUserData())
10476 {
10477 ScriptInputUserData ctx = new ScriptInputUserData;
10482 dst.WriteToContext(ctx);
10484 }
10485 }
10486 else if (!
g_Game.IsMultiplayer())
10487 {
10489 }
10490 }
10491
10493 {
10495 {
10496 if (ScriptInputUserData.CanStoreInputUserData())
10497 {
10498 ScriptInputUserData ctx = new ScriptInputUserData;
10503 ctx.
Write(destination_entity);
10509 }
10510 }
10511 else if (!
g_Game.IsMultiplayer())
10512 {
10514 }
10515 }
10516
10518 {
10520 }
10521
10523 {
10525 float split_quantity_new;
10527 if (dst.IsValid())
10528 {
10529 int slot_id = dst.GetSlot();
10531
10532 if (quantity > stack_max)
10533 split_quantity_new = stack_max;
10534 else
10535 split_quantity_new = quantity;
10536
10538 {
10540
10541 if (new_item)
10542 {
10543 new_item.SetResultOfSplit(true);
10544 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10546 new_item.
SetQuantity(split_quantity_new,
false,
true);
10547 }
10548
10549 return new_item;
10550 }
10551 }
10552
10553 return null;
10554 }
10555
10557 {
10559 float split_quantity_new;
10561 if (destination_entity)
10562 {
10564 if (quantity > stackable)
10565 split_quantity_new = stackable;
10566 else
10567 split_quantity_new = quantity;
10568
10570 {
10571 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10572 if (new_item)
10573 {
10574 new_item.SetResultOfSplit(true);
10575 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10577 new_item.
SetQuantity(split_quantity_new,
false,
true);
10578 }
10579 }
10580 }
10581 }
10582
10584 {
10586 {
10587 if (ScriptInputUserData.CanStoreInputUserData())
10588 {
10589 ScriptInputUserData ctx = new ScriptInputUserData;
10594 ItemBase destination_entity =
this;
10595 ctx.
Write(destination_entity);
10599 }
10600 }
10601 else if (!
g_Game.IsMultiplayer())
10602 {
10604 }
10605 }
10606
10608 {
10610 float split_quantity_new;
10612 if (player)
10613 {
10615 if (quantity > stackable)
10616 split_quantity_new = stackable;
10617 else
10618 split_quantity_new = quantity;
10619
10621 {
10622 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10623 new_item =
ItemBase.Cast(in_hands);
10624 if (new_item)
10625 {
10626 new_item.SetResultOfSplit(true);
10627 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10629 new_item.SetQuantity(split_quantity_new, false, true);
10630 }
10631 }
10632 }
10633 }
10634
10636 {
10638 float split_quantity_new = Math.Floor(quantity * 0.5);
10639
10641 return;
10642
10644
10645 if (new_item)
10646 {
10647 if (new_item.GetQuantityMax() < split_quantity_new)
10648 {
10649 split_quantity_new = new_item.GetQuantityMax();
10650 }
10651
10652 new_item.SetResultOfSplit(true);
10653 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10654
10656 {
10659 }
10660 else
10661 {
10663 new_item.
SetQuantity(split_quantity_new,
false,
true);
10664 }
10665 }
10666 }
10667
10669 {
10671 float split_quantity_new = Math.Floor(quantity / 2);
10672
10674 return;
10675
10676 InventoryLocation invloc = new InventoryLocation;
10678
10680 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10681
10682 if (new_item)
10683 {
10684 if (new_item.GetQuantityMax() < split_quantity_new)
10685 {
10686 split_quantity_new = new_item.GetQuantityMax();
10687 }
10689 {
10692 }
10693 else if (split_quantity_new > 1)
10694 {
10696 new_item.
SetQuantity(split_quantity_new,
false,
true);
10697 }
10698 }
10699 }
10700
10703 {
10704 SetWeightDirty();
10706
10707 if (parent)
10708 parent.OnAttachmentQuantityChangedEx(this, delta);
10709
10711 {
10713 {
10715 }
10717 {
10718 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10720 }
10721 }
10722 }
10723
10726 {
10727
10728 }
10729
10732 {
10734 }
10735
10737 {
10738 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10739
10741 {
10742 if (newLevel == GameConstants.STATE_RUINED)
10743 {
10745 EntityAI parent = GetHierarchyParent();
10746 if (parent && parent.IsFireplace())
10747 {
10748 CargoBase cargo = GetInventory().GetCargo();
10749 if (cargo)
10750 {
10752 {
10754 }
10755 }
10756 }
10757 }
10758
10760 {
10761
10763 return;
10764 }
10765
10766 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10767 {
10769 }
10770 }
10771 }
10772
10773
10775 {
10776 super.OnRightClick();
10777
10779 {
10781 {
10782 if (ScriptInputUserData.CanStoreInputUserData())
10783 {
10784 EntityAI root = GetHierarchyRoot();
10785 Man playerOwner = GetHierarchyRootPlayer();
10786 InventoryLocation dst = new InventoryLocation;
10787
10788
10789 if (!playerOwner && root && root == this)
10790 {
10792 }
10793 else
10794 {
10795
10796 GetInventory().GetCurrentInventoryLocation(dst);
10798 {
10799 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10801 {
10803 }
10804 else
10805 {
10807
10808
10809 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10810 {
10812 }
10813 else
10814 {
10815 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10816 }
10817 }
10818 }
10819 }
10820
10821 ScriptInputUserData ctx = new ScriptInputUserData;
10829 }
10830 }
10831 else if (!
g_Game.IsMultiplayer())
10832 {
10834 }
10835 }
10836 }
10837
10839 {
10840 if (root)
10841 {
10842 vector m4[4];
10843 root.GetTransform(m4);
10844 dst.SetGround(this, m4);
10845 }
10846 else
10847 {
10848 GetInventory().GetCurrentInventoryLocation(dst);
10849 }
10850 }
10851
10852 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10853 {
10854
10855 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10856 return false;
10857
10858 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10859 return false;
10860
10861
10863 return false;
10864
10865
10866 Magazine mag = Magazine.Cast(this);
10867 if (mag)
10868 {
10869 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10870 return false;
10871
10872 if (stack_max_limit)
10873 {
10874 Magazine other_mag = Magazine.Cast(other_item);
10875 if (other_item)
10876 {
10877 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10878 return false;
10879 }
10880
10881 }
10882 }
10883 else
10884 {
10885
10887 return false;
10888
10890 return false;
10891 }
10892
10893 PlayerBase player = null;
10894 if (CastTo(player, GetHierarchyRootPlayer()))
10895 {
10896 if (player.GetInventory().HasAttachment(this))
10897 return false;
10898
10899 if (player.IsItemsToDelete())
10900 return false;
10901 }
10902
10903 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10904 return false;
10905
10906 int slotID;
10908 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10909 return false;
10910
10911 return true;
10912 }
10913
10915 {
10917 }
10918
10920 {
10921 return m_IsResultOfSplit;
10922 }
10923
10925 {
10926 m_IsResultOfSplit = value;
10927 }
10928
10930 {
10932 }
10933
10935 {
10936 float other_item_quantity = other_item.GetQuantity();
10937 float this_free_space;
10938
10940
10942
10943 if (other_item_quantity > this_free_space)
10944 {
10945 return this_free_space;
10946 }
10947 else
10948 {
10949 return other_item_quantity;
10950 }
10951 }
10952
10954 {
10956 }
10957
10959 {
10961 return;
10962
10963 if (!IsMagazine() && other_item)
10964 {
10966 if (quantity_used != 0)
10967 {
10968 float hp1 = GetHealth01("","");
10969 float hp2 = other_item.GetHealth01("","");
10970 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10971 hpResult = hpResult / (
GetQuantity() + quantity_used);
10972
10973 hpResult *= GetMaxHealth();
10974 Math.Round(hpResult);
10975 SetHealth("", "Health", hpResult);
10976
10978 other_item.AddQuantity(-quantity_used);
10979 }
10980 }
10982 }
10983
10985 {
10986 #ifdef SERVER
10987 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10988 GetHierarchyParent().IncreaseLifetimeUp();
10989 #endif
10990 };
10991
10993 {
10994 PlayerBase p = PlayerBase.Cast(player);
10995
10996 array<int> recipesIds = p.m_Recipes;
10997 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10998 if (moduleRecipesManager)
10999 {
11000 EntityAI itemInHands = player.GetEntityInHands();
11001 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11002 }
11003
11004 for (int i = 0;i < recipesIds.Count(); i++)
11005 {
11006 int key = recipesIds.Get(i);
11007 string recipeName = moduleRecipesManager.GetRecipeName(key);
11009 }
11010 }
11011
11012
11013 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11014 {
11015 super.GetDebugActions(outputList);
11016
11017
11023
11024
11029
11034
11035
11039
11040
11042 {
11046 }
11047
11050
11051
11055
11057
11058 InventoryLocation loc = new InventoryLocation();
11059 GetInventory().GetCurrentInventoryLocation(loc);
11061 {
11062 if (Gizmo_IsSupported())
11065 }
11066
11068 }
11069
11070
11071
11072
11074 {
11075 super.OnAction(action_id, player, ctx);
11076
11078 {
11079 switch (action_id)
11080 {
11084 return true;
11088 return true;
11089 }
11090 }
11091
11093 {
11094 switch (action_id)
11095 {
11097 Delete();
11098 return true;
11099 }
11100 }
11101
11102 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11103 {
11104 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11105 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11106 PlayerBase p = PlayerBase.Cast(player);
11107 if (
EActions.RECIPES_RANGE_START < 1000)
11108 {
11109 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11110 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11111 }
11112 }
11113 #ifndef SERVER
11114 else if (action_id ==
EActions.WATCH_PLAYER)
11115 {
11116 PluginDeveloper.SetDeveloperItemClientEx(player);
11117 }
11118 #endif
11120 {
11121 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11122 {
11123 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11124 OnDebugButtonPressServer(id + 1);
11125 }
11126
11127 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11128 {
11129 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11131 }
11132
11133 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11134 {
11135 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11137 }
11138
11139 else if (action_id ==
EActions.ADD_QUANTITY)
11140 {
11141 if (IsMagazine())
11142 {
11143 Magazine mag = Magazine.Cast(this);
11144 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11145 }
11146 else
11147 {
11149 }
11150
11151 if (m_EM)
11152 {
11153 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11154 }
11155
11156 }
11157
11158 else if (action_id ==
EActions.REMOVE_QUANTITY)
11159 {
11160 if (IsMagazine())
11161 {
11162 Magazine mag2 = Magazine.Cast(this);
11163 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11164 }
11165 else
11166 {
11168 }
11169 if (m_EM)
11170 {
11171 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11172 }
11173
11174 }
11175
11176 else if (action_id ==
EActions.SET_QUANTITY_0)
11177 {
11179
11180 if (m_EM)
11181 {
11182 m_EM.SetEnergy(0);
11183 }
11184 }
11185
11186 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11187 {
11189
11190 if (m_EM)
11191 {
11192 m_EM.SetEnergy(m_EM.GetEnergyMax());
11193 }
11194 }
11195
11196 else if (action_id ==
EActions.ADD_HEALTH)
11197 {
11198 AddHealth("","",GetMaxHealth("","Health")/5);
11199 }
11200 else if (action_id ==
EActions.REMOVE_HEALTH)
11201 {
11202 AddHealth("","",-GetMaxHealth("","Health")/5);
11203 }
11204 else if (action_id ==
EActions.DESTROY_HEALTH)
11205 {
11206 SetHealth01("","",0);
11207 }
11208 else if (action_id ==
EActions.WATCH_ITEM)
11209 {
11211 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11212 #ifdef DEVELOPER
11213 SetDebugDeveloper_item(this);
11214 #endif
11215 }
11216
11217 else if (action_id ==
EActions.ADD_TEMPERATURE)
11218 {
11219 AddTemperature(20);
11220
11221 }
11222
11223 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11224 {
11225 AddTemperature(-20);
11226
11227 }
11228
11229 else if (action_id ==
EActions.FLIP_FROZEN)
11230 {
11231 SetFrozen(!GetIsFrozen());
11232
11233 }
11234
11235 else if (action_id ==
EActions.ADD_WETNESS)
11236 {
11238
11239 }
11240
11241 else if (action_id ==
EActions.REMOVE_WETNESS)
11242 {
11244
11245 }
11246
11247 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11248 {
11251
11252
11253 }
11254
11255 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11256 {
11259 }
11260
11261 else if (action_id ==
EActions.MAKE_SPECIAL)
11262 {
11263 auto debugParams = DebugSpawnParams.WithPlayer(player);
11264 OnDebugSpawnEx(debugParams);
11265 }
11266
11267 }
11268
11269
11270 return false;
11271 }
11272
11273
11274
11275
11279
11282
11283
11284
11286 {
11287 return false;
11288 }
11289
11290
11292 {
11293 return true;
11294 }
11295
11296
11298 {
11299 return true;
11300 }
11301
11302
11303
11305 {
11306 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11307 return g_Game.ConfigIsExisting(config_path);
11308 }
11309
11312 {
11313 return null;
11314 }
11315
11317 {
11318 return false;
11319 }
11320
11322 {
11323 return false;
11324 }
11325
11329
11330
11332 {
11333 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11334 return module_repairing.CanRepair(this, item_repair_kit);
11335 }
11336
11337
11338 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11339 {
11340 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11341 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11342 }
11343
11344
11346 {
11347
11348
11349
11350
11351
11352
11353
11354
11355 return 1;
11356 }
11357
11358
11359
11361 {
11363 }
11364
11365
11366
11368 {
11370 }
11371
11372
11381 {
11382 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11383
11384 if (player)
11385 {
11386 player.MessageStatus(text);
11387 }
11388 }
11389
11390
11399 {
11400 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11401
11402 if (player)
11403 {
11404 player.MessageAction(text);
11405 }
11406 }
11407
11408
11417 {
11418 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11419
11420 if (player)
11421 {
11422 player.MessageFriendly(text);
11423 }
11424 }
11425
11426
11435 {
11436 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11437
11438 if (player)
11439 {
11440 player.MessageImportant(text);
11441 }
11442 }
11443
11445 {
11446 return true;
11447 }
11448
11449
11450 override bool KindOf(
string tag)
11451 {
11452 bool found = false;
11453 string item_name = this.
GetType();
11455 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11456
11457 int array_size = item_tag_array.Count();
11458 for (int i = 0; i < array_size; i++)
11459 {
11460 if (item_tag_array.Get(i) == tag)
11461 {
11462 found = true;
11463 break;
11464 }
11465 }
11466 return found;
11467 }
11468
11469
11471 {
11472
11473 super.OnRPC(sender, rpc_type,ctx);
11474
11475
11476 switch (rpc_type)
11477 {
11478 #ifndef SERVER
11479 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11480 Param2<bool, string> p = new Param2<bool, string>(false, "");
11481
11483 return;
11484
11485 bool play = p.param1;
11486 string soundSet = p.param2;
11487
11488 if (play)
11489 {
11491 {
11493 {
11495 }
11496 }
11497 else
11498 {
11500 }
11501 }
11502 else
11503 {
11505 }
11506
11507 break;
11508 #endif
11509
11510 }
11511
11513 {
11515 }
11516 }
11517
11518
11519
11520
11522 {
11523 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11524 return plugin.GetID(
name);
11525 }
11526
11528 {
11529 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11530 return plugin.GetName(id);
11531 }
11532
11535 {
11536
11537
11538 int varFlags;
11539 if (!ctx.
Read(varFlags))
11540 return;
11541
11542 if (varFlags & ItemVariableFlags.FLOAT)
11543 {
11545 }
11546 }
11547
11549 {
11550
11551 super.SerializeNumericalVars(floats_out);
11552
11553
11554
11556 {
11558 }
11559
11561 {
11563 }
11564
11566 {
11568 }
11569
11571 {
11576 }
11577
11579 {
11581 }
11582 }
11583
11585 {
11586
11587 super.DeSerializeNumericalVars(floats);
11588
11589
11590 int index = 0;
11591 int mask = Math.Round(floats.Get(index));
11592
11593 index++;
11594
11596 {
11598 {
11600 }
11601 else
11602 {
11603 float quantity = floats.Get(index);
11604 SetQuantity(quantity,
true,
false,
false,
false);
11605 }
11606 index++;
11607 }
11608
11610 {
11611 float wet = floats.Get(index);
11613 index++;
11614 }
11615
11617 {
11618 int liquidtype = Math.Round(floats.Get(index));
11620 index++;
11621 }
11622
11624 {
11626 index++;
11628 index++;
11630 index++;
11632 index++;
11633 }
11634
11636 {
11637 int cleanness = Math.Round(floats.Get(index));
11639 index++;
11640 }
11641 }
11642
11644 {
11645 super.WriteVarsToCTX(ctx);
11646
11647
11649 {
11651 }
11652
11654 {
11656 }
11657
11659 {
11661 }
11662
11664 {
11665 int r,g,b,a;
11671 }
11672
11674 {
11676 }
11677 }
11678
11680 {
11681 if (!super.ReadVarsFromCTX(ctx,version))
11682 return false;
11683
11684 int intValue;
11685 float value;
11686
11687 if (version < 140)
11688 {
11689 if (!ctx.
Read(intValue))
11690 return false;
11691
11692 m_VariablesMask = intValue;
11693 }
11694
11696 {
11697 if (!ctx.
Read(value))
11698 return false;
11699
11701 {
11703 }
11704 else
11705 {
11707 }
11708 }
11709
11710 if (version < 140)
11711 {
11713 {
11714 if (!ctx.
Read(value))
11715 return false;
11716 SetTemperatureDirect(value);
11717 }
11718 }
11719
11721 {
11722 if (!ctx.
Read(value))
11723 return false;
11725 }
11726
11728 {
11729 if (!ctx.
Read(intValue))
11730 return false;
11732 }
11733
11735 {
11736 int r,g,b,a;
11738 return false;
11740 return false;
11742 return false;
11744 return false;
11745
11747 }
11748
11750 {
11751 if (!ctx.
Read(intValue))
11752 return false;
11754 }
11755
11756 if (version >= 138 && version < 140)
11757 {
11759 {
11760 if (!ctx.
Read(intValue))
11761 return false;
11762 SetFrozen(intValue);
11763 }
11764 }
11765
11766 return true;
11767 }
11768
11769
11771 {
11774 {
11776 }
11777
11778 if (!super.OnStoreLoad(ctx, version))
11779 {
11781 return false;
11782 }
11783
11784 if (version >= 114)
11785 {
11786 bool hasQuickBarIndexSaved;
11787
11788 if (!ctx.
Read(hasQuickBarIndexSaved))
11789 {
11791 return false;
11792 }
11793
11794 if (hasQuickBarIndexSaved)
11795 {
11796 int itmQBIndex;
11797
11798
11799 if (!ctx.
Read(itmQBIndex))
11800 {
11802 return false;
11803 }
11804
11805 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11806 if (itmQBIndex != -1 && parentPlayer)
11807 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11808 }
11809 }
11810 else
11811 {
11812
11813 PlayerBase player;
11814 int itemQBIndex;
11815 if (version ==
int.
MAX)
11816 {
11817 if (!ctx.
Read(itemQBIndex))
11818 {
11820 return false;
11821 }
11822 }
11823 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11824 {
11825
11826 if (!ctx.
Read(itemQBIndex))
11827 {
11829 return false;
11830 }
11831 if (itemQBIndex != -1 && player)
11832 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11833 }
11834 }
11835
11836 if (version < 140)
11837 {
11838
11839 if (!LoadVariables(ctx, version))
11840 {
11842 return false;
11843 }
11844 }
11845
11846
11848 {
11850 return false;
11851 }
11852 if (version >= 132)
11853 {
11855 if (raib)
11856 {
11858 {
11860 return false;
11861 }
11862 }
11863 }
11864
11866 return true;
11867 }
11868
11869
11870
11872 {
11873 super.OnStoreSave(ctx);
11874
11875 PlayerBase player;
11876 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11877 {
11879
11880 int itemQBIndex = -1;
11881 itemQBIndex = player.FindQuickBarEntityIndex(this);
11882 ctx.
Write(itemQBIndex);
11883 }
11884 else
11885 {
11887 }
11888
11890
11892 if (raib)
11893 {
11895 }
11896 }
11897
11898
11900 {
11901 super.AfterStoreLoad();
11902
11904 {
11906 }
11907
11909 {
11912 }
11913 }
11914
11916 {
11917 super.EEOnAfterLoad();
11918
11920 {
11922 }
11923
11926 }
11927
11929 {
11930 return false;
11931 }
11932
11933
11934
11936 {
11938 {
11939 #ifdef PLATFORM_CONSOLE
11940
11942 {
11944 if (menu)
11945 {
11947 }
11948 }
11949 #endif
11950 }
11951
11953 {
11956 }
11957
11959 {
11960 SetWeightDirty();
11962 }
11964 {
11967 }
11968
11970 {
11973
11976 }
11978 {
11982 }
11983
11984 super.OnVariablesSynchronized();
11985 }
11986
11987
11988
11990 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11991 {
11992 if (!IsServerCheck(allow_client))
11993 return false;
11994
11996 return false;
11997
12000
12001 if (value <= (min + 0.001))
12002 value = min;
12003
12004 if (value == min)
12005 {
12006 if (destroy_config)
12007 {
12008 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12009 if (dstr)
12010 {
12012 this.Delete();
12013 return true;
12014 }
12015 }
12016 else if (destroy_forced)
12017 {
12019 this.Delete();
12020 return true;
12021 }
12022
12024 }
12025
12028
12030 {
12031 EntityAI parent = GetHierarchyRoot();
12032 InventoryLocation iLoc = new InventoryLocation();
12033 GetInventory().GetCurrentInventoryLocation(iLoc);
12035 {
12036 int iLocSlot = iLoc.
GetSlot();
12038 {
12040 }
12042 {
12044 }
12045 }
12046 }
12047
12049 {
12051
12052 if (delta)
12054 }
12055
12057
12058 return false;
12059 }
12060
12061
12063 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12064 {
12066 }
12067
12069 {
12072 }
12073
12075 {
12078 }
12079
12081 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12082 {
12083 float value_clamped = Math.Clamp(value, 0, 1);
12085 SetQuantity(result, destroy_config, destroy_forced);
12086 }
12087
12088
12091 {
12093 }
12094
12096 {
12098 }
12099
12100
12101
12102
12103
12104
12105
12106
12107
12108
12110 {
12111 int slot = -1;
12112 GameInventory inventory = GetInventory();
12113 if (inventory)
12114 {
12115 InventoryLocation il = new InventoryLocation;
12118 }
12119
12121 }
12122
12124 {
12125 float quantity_max = 0;
12126
12128 {
12129 if (attSlotID != -1)
12130 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12131
12132 if (quantity_max <= 0)
12134 }
12135
12136 if (quantity_max <= 0)
12138
12139 return quantity_max;
12140 }
12141
12143 {
12145 }
12146
12148 {
12150 }
12151
12152
12154 {
12156 }
12157
12159 {
12161 }
12162
12164 {
12166 }
12167
12168
12170 {
12171
12172 float weightEx = GetWeightEx();
12173 float special = GetInventoryAndCargoWeight();
12174 return weightEx - special;
12175 }
12176
12177
12179 {
12181 }
12182
12184 {
12186 {
12187 #ifdef DEVELOPER
12188 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12189 {
12190 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12192 }
12193 #endif
12194
12195 return GetQuantity() * GetConfigWeightModified();
12196 }
12197 else if (HasEnergyManager())
12198 {
12199 #ifdef DEVELOPER
12200 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12201 {
12202 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12203 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12204 }
12205 #endif
12206 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12207 }
12208 else
12209 {
12210 #ifdef DEVELOPER
12211 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12212 {
12213 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12214 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12215 }
12216 #endif
12217 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12218 }
12219 }
12220
12223 {
12224 int item_count = 0;
12226
12227 GameInventory inventory = GetInventory();
12228 CargoBase cargo = inventory.
GetCargo();
12229 if (cargo != NULL)
12230 {
12232 }
12233
12235 for (int i = 0; i < nAttachments; ++i)
12236 {
12238 if (item)
12239 item_count += item.GetNumberOfItems();
12240 }
12241 return item_count;
12242 }
12243
12246 {
12247 float weight = 0;
12248 float wetness = 1;
12249 if (include_wetness)
12252 {
12253 weight = wetness * m_ConfigWeight;
12254 }
12256 {
12257 weight = 1;
12258 }
12259 return weight;
12260 }
12261
12262
12263
12265 {
12266 GameInventory inventory = GetInventory();
12267 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12268 {
12269 array<EntityAI> items = new array<EntityAI>;
12271 for (int i = 0; i < items.Count(); ++i)
12272 {
12274 if (item)
12275 {
12276 g_Game.ObjectDelete(item);
12277 }
12278 }
12279 }
12280 }
12281
12282
12283
12284
12286 {
12287 float energy = 0;
12288 if (HasEnergyManager())
12289 {
12290 energy = GetCompEM().GetEnergy();
12291 }
12292 return energy;
12293 }
12294
12295
12297 {
12298 super.OnEnergyConsumed();
12299
12301 }
12302
12304 {
12305 super.OnEnergyAdded();
12306
12308 }
12309
12310
12312 {
12313 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12314 {
12316 {
12317 float energy_0to1 = GetCompEM().GetEnergy0To1();
12319 }
12320 }
12321 }
12322
12323
12325 {
12326 return ConfigGetFloat("heatIsolation");
12327 }
12328
12330 {
12332 }
12333
12335 {
12336 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12337 if (
g_Game.ConfigIsExisting(paramPath))
12338 return g_Game.ConfigGetFloat(paramPath);
12339
12340 return 0.0;
12341 }
12342
12344 {
12345 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12346 if (
g_Game.ConfigIsExisting(paramPath))
12347 return g_Game.ConfigGetFloat(paramPath);
12348
12349 return 0.0;
12350 }
12351
12352 override void SetWet(
float value,
bool allow_client =
false)
12353 {
12354 if (!IsServerCheck(allow_client))
12355 return;
12356
12359
12361
12362 m_VarWet = Math.Clamp(value, min, max);
12363
12365 {
12368 }
12369 }
12370
12371 override void AddWet(
float value)
12372 {
12374 }
12375
12377 {
12379 }
12380
12382 {
12384 }
12385
12387 {
12389 }
12390
12392 {
12394 }
12395
12397 {
12399 }
12400
12401 override void OnWetChanged(
float newVal,
float oldVal)
12402 {
12405 if (newLevel != oldLevel)
12406 {
12408 }
12409 }
12410
12412 {
12413 SetWeightDirty();
12414 }
12415
12417 {
12418 return GetWetLevelInternal(
m_VarWet);
12419 }
12420
12421
12422
12424 {
12426 }
12427
12429 {
12431 }
12432
12434 {
12436 }
12437
12439 {
12441 }
12442
12443
12444
12446 {
12447 if (ConfigIsExisting("itemModelLength"))
12448 {
12449 return ConfigGetFloat("itemModelLength");
12450 }
12451 return 0;
12452 }
12453
12455 {
12456 if (ConfigIsExisting("itemAttachOffset"))
12457 {
12458 return ConfigGetFloat("itemAttachOffset");
12459 }
12460 return 0;
12461 }
12462
12463 override void SetCleanness(
int value,
bool allow_client =
false)
12464 {
12465 if (!IsServerCheck(allow_client))
12466 return;
12467
12469
12471
12474 }
12475
12477 {
12479 }
12480
12482 {
12483 return true;
12484 }
12485
12486
12487
12488
12490 {
12492 }
12493
12495 {
12497 }
12498
12499
12500
12501
12502 override void SetColor(
int r,
int g,
int b,
int a)
12503 {
12509 }
12511 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12512 {
12517 }
12518
12520 {
12522 }
12523
12526 {
12527 int r,g,b,a;
12529 r = r/255;
12530 g = g/255;
12531 b = b/255;
12532 a = a/255;
12533 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12534 }
12535
12536
12537
12538 override void SetLiquidType(
int value,
bool allow_client =
false)
12539 {
12540 if (!IsServerCheck(allow_client))
12541 return;
12542
12547 }
12548
12550 {
12551 return ConfigGetInt("varLiquidTypeInit");
12552 }
12553
12555 {
12557 }
12558
12560 {
12562 SetFrozen(false);
12563 }
12564
12567 {
12568 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12569 }
12570
12571
12574 {
12575 PlayerBase nplayer;
12576 if (PlayerBase.CastTo(nplayer, player))
12577 {
12579 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12580 }
12581 }
12582
12583
12586 {
12587 PlayerBase nplayer;
12588 if (PlayerBase.CastTo(nplayer,player))
12589 {
12590 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12591 }
12592
12593 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12594
12595 if (HasEnergyManager())
12596 {
12597 GetCompEM().UpdatePlugState();
12598 }
12599 }
12600
12601
12603 {
12604 super.OnPlacementStarted(player);
12605
12607 }
12608
12609 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12610 {
12612 {
12613 m_AdminLog.OnPlacementComplete(player,
this);
12614 }
12615
12616 super.OnPlacementComplete(player, position, orientation);
12617 }
12618
12619
12620
12621
12622
12624 {
12626 {
12627 return true;
12628 }
12629 else
12630 {
12631 return false;
12632 }
12633 }
12634
12635
12637 {
12639 {
12641 }
12642 }
12643
12644
12646 {
12648 }
12649
12651 {
12653 }
12654
12655 override void InsertAgent(
int agent,
float count = 1)
12656 {
12657 if (count < 1)
12658 return;
12659
12661 }
12662
12665 {
12667 }
12668
12669
12671 {
12673 }
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12717 {
12719 return false;
12720 return true;
12721 }
12722
12724 {
12725
12727 }
12728
12729
12732 {
12733 super.CheckForRoofLimited(timeTresholdMS);
12734
12735 float time =
g_Game.GetTime();
12736 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12737 {
12738 m_PreviousRoofTestTime = time;
12739 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12740 }
12741 }
12742
12743
12745 {
12747 {
12748 return 0;
12749 }
12750
12751 if (GetInventory().GetAttachmentSlotsCount() != 0)
12752 {
12753 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12754 if (filter)
12755 return filter.GetProtectionLevel(type, false, system);
12756 else
12757 return 0;
12758 }
12759
12760 string subclassPath, entryName;
12761
12762 switch (type)
12763 {
12765 entryName = "biological";
12766 break;
12768 entryName = "chemical";
12769 break;
12770 default:
12771 entryName = "biological";
12772 break;
12773 }
12774
12775 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12776
12777 return g_Game.ConfigGetFloat(subclassPath + entryName);
12778 }
12779
12780
12781
12784 {
12785 if (!IsMagazine())
12787
12789 }
12790
12791
12792
12793
12794
12799 {
12800 return true;
12801 }
12802
12804 {
12806 }
12807
12808
12809
12810
12811
12813 {
12814 if (parent)
12815 {
12816 if (parent.IsInherited(DayZInfected))
12817 return true;
12818
12819 if (!parent.IsRuined())
12820 return true;
12821 }
12822
12823 return true;
12824 }
12825
12827 {
12828 if (!super.CanPutAsAttachment(parent))
12829 {
12830 return false;
12831 }
12832
12833 if (!IsRuined() && !parent.IsRuined())
12834 {
12835 return true;
12836 }
12837
12838 return false;
12839 }
12840
12842 {
12843
12844
12845
12846
12847 return super.CanReceiveItemIntoCargo(item);
12848 }
12849
12851 {
12852
12853
12854
12855
12856 GameInventory attachmentInv = attachment.GetInventory();
12858 {
12859 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12860 return false;
12861 }
12862
12863 InventoryLocation loc = new InventoryLocation();
12864 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12865 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12866 return false;
12867
12868 return super.CanReceiveAttachment(attachment, slotId);
12869 }
12870
12872 {
12873 if (!super.CanReleaseAttachment(attachment))
12874 return false;
12875
12876 return GetInventory().AreChildrenAccessible();
12877 }
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12900 {
12901 int id = muzzle_owner.GetMuzzleID();
12902 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12903
12904 if (WPOF_array)
12905 {
12906 for (int i = 0; i < WPOF_array.Count(); i++)
12907 {
12908 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12909
12910 if (WPOF)
12911 {
12912 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12913 }
12914 }
12915 }
12916 }
12917
12918
12920 {
12921 int id = muzzle_owner.GetMuzzleID();
12923
12924 if (WPOBE_array)
12925 {
12926 for (int i = 0; i < WPOBE_array.Count(); i++)
12927 {
12928 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12929
12930 if (WPOBE)
12931 {
12932 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12933 }
12934 }
12935 }
12936 }
12937
12938
12940 {
12941 int id = muzzle_owner.GetMuzzleID();
12942 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12943
12944 if (WPOOH_array)
12945 {
12946 for (int i = 0; i < WPOOH_array.Count(); i++)
12947 {
12948 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12949
12950 if (WPOOH)
12951 {
12952 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12953 }
12954 }
12955 }
12956 }
12957
12958
12960 {
12961 int id = muzzle_owner.GetMuzzleID();
12962 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12963
12964 if (WPOOH_array)
12965 {
12966 for (int i = 0; i < WPOOH_array.Count(); i++)
12967 {
12968 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12969
12970 if (WPOOH)
12971 {
12972 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12973 }
12974 }
12975 }
12976 }
12977
12978
12980 {
12981 int id = muzzle_owner.GetMuzzleID();
12982 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12983
12984 if (WPOOH_array)
12985 {
12986 for (int i = 0; i < WPOOH_array.Count(); i++)
12987 {
12988 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12989
12990 if (WPOOH)
12991 {
12992 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12993 }
12994 }
12995 }
12996 }
12997
12998
12999
13001 {
13003 {
13004 return true;
13005 }
13006
13007 return false;
13008 }
13009
13011 {
13013 {
13014 return true;
13015 }
13016
13017 return false;
13018 }
13019
13021 {
13023 {
13024 return true;
13025 }
13026
13027 return false;
13028 }
13029
13031 {
13032 return false;
13033 }
13034
13037 {
13038 return UATimeSpent.DEFAULT_DEPLOY;
13039 }
13040
13041
13042
13043
13045 {
13047 SetSynchDirty();
13048 }
13049
13051 {
13053 }
13054
13055
13057 {
13058 return false;
13059 }
13060
13063 {
13064 string att_type = "None";
13065
13066 if (ConfigIsExisting("soundAttType"))
13067 {
13068 att_type = ConfigGetString("soundAttType");
13069 }
13070
13072 }
13073
13075 {
13077 }
13078
13079
13080
13081
13082
13088
13090 {
13093
13095 }
13096
13097
13099 {
13101 return;
13102
13104
13107
13110
13111 SoundParameters params = new SoundParameters();
13115 }
13116
13117
13119 {
13121 {
13124
13125 SetSynchDirty();
13126
13129 }
13130 }
13131
13133 {
13135 }
13136
13137
13139 {
13141 return;
13142
13144 SetSynchDirty();
13145
13148 }
13149
13151 {
13154 }
13155
13157 {
13159 }
13160
13161 void OnApply(PlayerBase player);
13162
13164 {
13165 return 1.0;
13166 };
13167
13169 {
13171 }
13172
13174 {
13176 }
13177
13179
13181 {
13182 SetDynamicPhysicsLifeTime(0.01);
13184 }
13185
13187 {
13188 array<string> zone_names = new array<string>;
13189 GetDamageZones(zone_names);
13190 for (int i = 0; i < zone_names.Count(); i++)
13191 {
13192 SetHealthMax(zone_names.Get(i),"Health");
13193 }
13194 SetHealthMax("","Health");
13195 }
13196
13199 {
13200 float global_health = GetHealth01("","Health");
13201 array<string> zones = new array<string>;
13202 GetDamageZones(zones);
13203
13204 for (int i = 0; i < zones.Count(); i++)
13205 {
13206 SetHealth01(zones.Get(i),"Health",global_health);
13207 }
13208 }
13209
13212 {
13213 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13214 }
13215
13217 {
13218 if (!hasRootAsPlayer)
13219 {
13220 if (refParentIB)
13221 {
13222
13223 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13224 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13225
13226 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13227 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13228
13231 }
13232 else
13233 {
13234
13237 }
13238 }
13239 }
13240
13242 {
13244 {
13245 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13246 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13247 {
13248 float heatPermCoef = 1.0;
13250 while (ent)
13251 {
13252 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13253 ent = ent.GetHierarchyParent();
13254 }
13255
13256 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13257 }
13258 }
13259 }
13260
13262 {
13263
13264 EntityAI parent = GetHierarchyParent();
13265 if (!parent)
13266 {
13267 hasParent = false;
13268 hasRootAsPlayer = false;
13269 }
13270 else
13271 {
13272 hasParent = true;
13273 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13274 refParentIB =
ItemBase.Cast(parent);
13275 }
13276 }
13277
13278 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13279 {
13280
13281 }
13282
13284 {
13285
13286 return false;
13287 }
13288
13290 {
13291
13292
13293 return false;
13294 }
13295
13297 {
13298
13299 return false;
13300 }
13301
13304 {
13305 return !GetIsFrozen() &&
IsOpen();
13306 }
13307
13309 {
13310 bool hasParent = false, hasRootAsPlayer = false;
13312
13313 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13314 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13315
13316 if (wwtu || foodDecay)
13317 {
13321
13322 if (processWetness || processTemperature || processDecay)
13323 {
13325
13326 if (processWetness)
13327 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13328
13329 if (processTemperature)
13331
13332 if (processDecay)
13333 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13334 }
13335 }
13336 }
13337
13340 {
13342 }
13343
13345 {
13348
13349 return super.GetTemperatureFreezeThreshold();
13350 }
13351
13353 {
13356
13357 return super.GetTemperatureThawThreshold();
13358 }
13359
13361 {
13364
13365 return super.GetItemOverheatThreshold();
13366 }
13367
13369 {
13371 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13372
13373 return super.GetTemperatureFreezeTime();
13374 }
13375
13377 {
13379 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13380
13381 return super.GetTemperatureThawTime();
13382 }
13383
13388
13390 {
13391 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13392 }
13393
13395 {
13396 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13397 }
13398
13401 {
13403 }
13404
13406 {
13408 }
13409
13411 {
13413 }
13414
13417 {
13418 return null;
13419 }
13420
13423 {
13424 return false;
13425 }
13426
13428 {
13430 {
13433 if (!trg)
13434 {
13436 explosive = this;
13437 }
13438
13439 explosive.PairRemote(trg);
13441
13442 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13443 trg.SetPersistentPairID(persistentID);
13444 explosive.SetPersistentPairID(persistentID);
13445
13446 return true;
13447 }
13448 return false;
13449 }
13450
13453 {
13454 float ret = 1.0;
13457 ret *= GetHealth01();
13458
13459 return ret;
13460 }
13461
13462 #ifdef DEVELOPER
13463 override void SetDebugItem()
13464 {
13465 super.SetDebugItem();
13466 _itemBase = this;
13467 }
13468
13470 {
13471 string text = super.GetDebugText();
13472
13474 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13475
13476 return text;
13477 }
13478 #endif
13479
13481 {
13482 return true;
13483 }
13484
13486
13488
13490 {
13493 }
13494
13495
13503
13519
13520 [
Obsolete(
"Use ItemSoundHandler instead")]
13523 {
13524 if (!
g_Game.IsDedicatedServer())
13525 {
13526 if (ConfigIsExisting("attachSoundSet"))
13527 {
13528 string cfg_path = "";
13529 string soundset = "";
13530 string type_name =
GetType();
13531
13534 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13535 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13536
13537 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13538 {
13539 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13540 {
13541 if (cfg_slot_array[i] == slot_type)
13542 {
13543 soundset = cfg_soundset_array[i];
13544 break;
13545 }
13546 }
13547 }
13548
13549 if (soundset != "")
13550 {
13551 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13553 }
13554 }
13555 }
13556 }
13557
13559}
13560
13562{
13564 if (entity)
13565 {
13566 bool is_item = entity.IsInherited(
ItemBase);
13567 if (is_item && full_quantity)
13568 {
13571 }
13572 }
13573 else
13574 {
13576 return NULL;
13577 }
13578 return entity;
13579}
13580
13582{
13583 if (item)
13584 {
13585 if (health > 0)
13586 item.SetHealth("", "", health);
13587
13588 if (item.CanHaveTemperature())
13589 {
13591 if (item.CanFreeze())
13592 item.SetFrozen(false);
13593 }
13594
13595 if (item.HasEnergyManager())
13596 {
13597 if (quantity >= 0)
13598 {
13599 item.GetCompEM().SetEnergy0To1(quantity);
13600 }
13601 else
13602 {
13604 }
13605 }
13606 else if (item.IsMagazine())
13607 {
13608 Magazine mag = Magazine.Cast(item);
13609 if (quantity >= 0)
13610 {
13611 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13612 }
13613 else
13614 {
13616 }
13617
13618 }
13619 else
13620 {
13621 if (quantity >= 0)
13622 {
13623 item.SetQuantityNormalized(quantity, false);
13624 }
13625 else
13626 {
13628 }
13629
13630 }
13631 }
13632}
13633
13634#ifdef DEVELOPER
13636#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
bool SetAttachSoundEvent()
bool SetDetachSoundEvent()
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionManagerBase(PlayerBase player)
map< typename, ref array< ActionBase_Basic > > TInputActionMap
void AddAction(typename actionName)
void RemoveAction(typename actionName)
TInputActionMap m_InputActionMap
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
const int ECE_PLACE_ON_SURFACE
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
Open
Implementations only.
override void EEOnCECreate()
DamageType
exposed from C++ (do not change)
PluginAdminLog m_AdminLog
override bool IsExplosive()
override bool IsPrepareToDelete()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
proto GizmoApi GetGizmoApi()
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
static bool HasDebugActionsMask(int mask)
bool HidesSelectionBySlot()
void SplitItem(PlayerBase player)
void CopyScriptPropertiesFrom(EntityAI oldItem)
override void InsertAgent(int agent, float count=1)
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
static void SetDebugActionsMask(int mask)
void SetIsDeploySound(bool is_deploy_sound)
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
override bool IsHeavyBehaviour()
override void SetWetMax()
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
void ClearStartItemSoundServer()
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
override void RemoveAllAgentsExcept(int agent_to_keep)
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
bool CanBeMovedOverride()
override void SetWet(float value, bool allow_client=false)
ref TIntArray m_SingleUseActions
void StartItemSoundServer(int id, int slotId)
override void ProcessVariables()
ref TStringArray m_HeadHidingSelections
float GetWeightSpecialized(bool forceRecalc=false)
bool LoadAgents(ParamsReadContext ctx, int version)
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
ref array< ref OverheatingParticle > m_OverheatingParticles
override float GetTemperatureFreezeThreshold()
bool m_IsSoundSynchRemote
void StopItemSoundServer(int id)
static void ToggleDebugActionsMask(int mask)
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetTemperatureFreezeTime()
ref array< int > m_CompatibleLocks
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
float m_TemperaturePerQuantityWeight
bool m_RecipesInitialized
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
override float GetTemperatureThawThreshold()
override void OnEnergyConsumed()
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
override EWetnessLevel GetWetLevel()
float GetSingleInventoryItemWeight()
ref TIntArray m_InteractActions
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
bool CanPlayDeployLoopSound()
override float GetWetMax()
bool CanBeUsedForSuicide()
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
bool m_CanBeMovedOverride
override string ChangeIntoOnAttach(string slot)
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
override float GetQuantity()
int m_ShotsToStartOverheating
override void OnWetChanged(float newVal, float oldVal)
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void OnOverheatingDecay()
float GetDryingIncrement(string pIncrementName)
void SoundSynchRemoteReset()
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
override bool CanReleaseAttachment(EntityAI attachment)
override void OnMovedInsideCargo(EntityAI container)
void SetCEBasedQuantity()
bool m_CanPlayImpactSound
override string GetAttachmentSoundType()
float GetOverheatingCoef()
array< string > GetHeadHidingSelection()
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
override bool IsStoreLoad()
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
void SetResultOfSplit(bool value)
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
void UpdateAllOverheatingParticles()
float GetSoakingIncrement(string pIncrementName)
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetStoreLoadedQuantity()
const int ITEM_SOUNDS_MAX
float GetItemModelLength()
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
void CombineItems(ItemBase other_item, bool use_stack_max=true)
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
void TransferAgents(int agents)
transfer agents from another item
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
float GetHeatIsolationInit()
void SetCanBeMovedOverride(bool setting)
override bool HasQuantity()
bool IsCargoException4x3(EntityAI item)
ref TIntArray m_ContinuousActions
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
void LoadParticleConfigOnFire(int id)
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
override float GetWetInit()
int m_ImpactSoundSurfaceHash
int m_MaxOverheatingValue
void SetupSpawnedItem(ItemBase item, float health, float quantity)
bool ShouldSplitQuantity(float quantity)
static ref map< string, int > m_WeaponTypeToID
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
array< int > GetValidFinishers()
returns an array of possible finishers
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
ItemSoundHandler GetItemSoundHandler()
override int GetQuantityMin()
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
override int GetQuickBarBonus()
override void SetTakeable(bool pState)
float m_OverheatingDecayInterval
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
void RemoveAudioVisualsOnClient()
static void AddDebugActionsMask(int mask)
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
bool CanRepair(ItemBase item_repair_kit)
bool can_this_be_combined
EffectSound m_SoundDeploy
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
float GetDeployTime()
how long it takes to deploy this item in seconds
override bool IsSplitable()
bool DamageItemAttachments(float damage)
override void WriteVarsToCTX(ParamsWriteContext ctx)
void ConvertEnergyToQuantity()
override void RemoveAllAgents()
override void SetQuantityToMinimum()
bool m_WantPlayImpactSound
override float GetTemperatureThawTime()
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
float m_StoreLoadedQuantity
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
float GetFilterDamageRatio()
override void SetLiquidType(int value, bool allow_client=false)
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
void OnApply(PlayerBase player)
override void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
ref Timer m_CheckOverheating
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool IsOneHandedBehaviour()
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetDisinfectQuantity(int system=0, Param param1=null)
override bool IsHologram()
float GetItemAttachOffset()
static int GetDebugActionsMask()
override int GetLiquidType()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnEnergyAdded()
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
EffectSound m_DeployLoopSoundEx
override void DeSerializeNumericalVars(array< float > floats)
void StopItemDynamicPhysics()
override void SetStoreLoad(bool value)
float GetOverheatingValue()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
override void EOnContact(IEntity other, Contact extra)
void SplitIntoStackMaxHands(PlayerBase player)
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override void SetStoreLoadedQuantity(float value)
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void OnLiquidTypeChanged(int oldType, int newType)
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void PlayDeployFinishSound()
bool AllowFoodConsumption()
bool m_IsOverheatingEffectActive
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
bool PairWithDevice(notnull ItemBase otherDevice)
static void RemoveDebugActionsMask(int mask)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void PerformDamageSystemReinit()
override void ClearInventory()
static int m_LastRegisteredWeaponID
ItemBase GetLightSourceItem()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
override float GetItemOverheatThreshold()
void StopDeployLoopSoundEx()
override void SerializeNumericalVars(array< float > floats_out)
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
static int m_DebugActionsMask
void KillAllOverheatingParticles()
bool CanBeCookedOnStick()
override int GetQuantityMax()
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
void OnActivatedByTripWire()
override void RemoveAgent(int agent_id)
bool m_ItemBeingDroppedPhys
override bool CanPutAsAttachment(EntityAI parent)
void PlayDetachSound(string slot_type)
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override bool IsBeingPlaced()
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
bool m_FixDamageSystemInit
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
void LoadParticleConfigOnOverheating(int id)
bool IsSoundSynchRemote()
override void OnRightClick()
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
bool IsActionTargetVisible()
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
int NameToID(string name)
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
void ClearStopItemSoundServer()
override string ChangeIntoOnDetach()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
EffectSound m_SoundDeployFinish
float GetQuantityNormalizedScripted()
override void SetCleanness(int value, bool allow_client=false)
override float GetWetMin()
ref ItemSoundHandler m_ItemSoundHandler
override bool KindOf(string tag)
void ItemSoundHandler(ItemBase parent)
EffectSound m_LockingSound
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
void RemoteDetonatorTrigger()
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
override void Explode(int damageType, string ammoType="")
void OnItemLocationChanged(ItemBase item)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
proto native EntityAI GetAttachmentFromIndex(int index)
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
proto native int AttachmentCount()
Returns count of attachments attached to this item.
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
bool WriteToContext(ParamsWriteContext ctx)
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
override bool CanDisplayCargo()
override void OnInventoryEnter(Man player)
override string GetFoldSoundset()
override bool CanPutAsAttachment(EntityAI parent)
override bool CanReceiveItemIntoCargo(EntityAI item)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
override void EEDelete(EntityAI parent)
override bool CanBeRepairedByCrafting()
override void OnPlacementStarted(Man player)
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override bool IsElectricAppliance()
override bool IsItemTent()
override void SetActions()
override string GetLoopFoldSoundset()
override bool CanMakeGardenplot()
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override WrittenNoteData GetWrittenNoteData()
override int GetDamageSystemVersionChange()
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
override void InitItemVariables()
override void SetActionAnimOverrides()
override void OnCreatePhysics()
override string GetDeploySoundset()
override float GetBandagingEffectivity()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void OnStoreSave(ParamsWriteContext ctx)
override void AfterStoreLoad()
override int GetOnDigWormsAmount()
override bool IsSelfAdjustingTemperature()
override bool IsPlayerInside(PlayerBase player, string selection)
override void OnVariablesSynchronized()
override void RefreshPhysics()
override bool CanObstruct()
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanPutInCargo(EntityAI parent)
override string GetLoopDeploySoundset()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override void OnInventoryExit(Man player)
override bool IsTakeable()
override bool IsIgnoredByConstruction()
override void InitItemSounds()
override void EEKilled(Object killer)
override void OnCombine(ItemBase other_item)
override bool CanExplodeInFire()
override bool IsFacingPlayer(PlayerBase player, string selection)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
override bool IsBloodContainer()
override bool IsClothing()
override bool CanBeSplit()
override bool IsDeployable()
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
override bool CanBeDisinfected()
override float GetInfectionChance(int system=0, Param param=null)
override void OnEndPlacement()
float GetOverheatingLimitMax()
void SetOverheatingLimitMax(float max)
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
float GetOverheatingLimitMin()
void SetOverheatingLimitMin(float min)
void RegisterParticle(Particle p)
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
void SetControlledDevice(EntityAI pDevice)
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
void SetCalcDetails(string details)
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Serializer ParamsReadContext
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Serializer ParamsWriteContext
const int COMP_TYPE_ENERGY_MANAGER
void Error(string err)
Messagebox with error message.
proto native void SetColor(int color)
array< string > TStringArray
void Obsolete(string msg="")
EntityEvent
Entity events for event-mask, or throwing event from code.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
const int VARIABLE_LIQUIDTYPE
const int VARIABLE_CLEANNESS
const int VARIABLE_TEMPERATURE
const int VARIABLE_QUANTITY
static proto float AbsFloat(float f)
Returns absolute value.
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_DEBUG_ACTION
vector GetPosition()
Get the world position of the Effect.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.