8626{
8628 {
8629 return true;
8630 }
8631};
8632
8634{
8635
8636};
8637
8638
8639
8641{
8645
8647
8650
8651
8652
8653
8654
8663
8669
8674
8679
8700 protected bool m_IsResultOfSplit
8701
8703
8708
8709
8710
8712
8716
8717
8718
8720
8723
8724
8725
8731
8732
8740
8743
8744
8746
8747
8749
8750
8755
8756
8761
8763
8764
8766
8767
8769 {
8774
8775 if (!
g_Game.IsDedicatedServer())
8776 {
8778 {
8780
8782 {
8784 }
8785 }
8786
8789 }
8790
8791 m_OldLocation = null;
8792
8794 {
8796 }
8797
8798 if (ConfigIsExisting("headSelectionsToHide"))
8799 {
8802 }
8803
8805 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8806 {
8808 }
8809
8811
8812 m_IsResultOfSplit = false;
8813
8815 }
8816
8818 {
8819 super.InitItemVariables();
8820
8826 m_Count = ConfigGetInt(
"count");
8827
8830
8835
8838
8843
8855
8859
8860
8863 if (ConfigIsExisting("canBeSplit"))
8864 {
8867 }
8868
8870 if (ConfigIsExisting("itemBehaviour"))
8872
8873
8876 RegisterNetSyncVariableInt("m_VarLiquidType");
8877 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8878
8879 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8880 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8881 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8882
8883 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8884 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8885 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8886 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8887
8888 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8889 RegisterNetSyncVariableBool("m_IsTakeable");
8890 RegisterNetSyncVariableBool("m_IsHologram");
8891
8894 {
8897 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8898 }
8899
8901
8903 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8905
8907 }
8908
8910 {
8912 }
8913
8915 {
8918 {
8923 }
8924 }
8925
8926 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8927 {
8929 {
8932 }
8933
8935 }
8936
8938 {
8944 }
8945
8947
8949 {
8951
8952 if (!action)
8953 {
8954 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8955 return;
8956 }
8957
8959 if (!ai)
8960 {
8962 return;
8963 }
8964
8966 if (!action_array)
8967 {
8968 action_array = new array<ActionBase_Basic>;
8970 }
8971 if (LogManager.IsActionLogEnable())
8972 {
8973 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8974 }
8975
8976 if (action_array.Find(action) != -1)
8977 {
8978 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8979 }
8980 else
8981 {
8982 action_array.Insert(action);
8983 }
8984 }
8985
8987 {
8988 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8989 ActionBase action = player.GetActionManager().GetAction(actionName);
8992
8993 if (action_array)
8994 {
8995 action_array.RemoveItem(action);
8996 }
8997 }
8998
8999
9000
9002 {
9003 ActionOverrideData overrideData = new ActionOverrideData();
9007
9009 if (!actionMap)
9010 {
9013 }
9014
9015 actionMap.Insert(this.
Type(), overrideData);
9016
9017 }
9018
9020
9022
9023
9025 {
9028
9031
9032 string config_to_search = "CfgVehicles";
9033 string muzzle_owner_config;
9034
9036 {
9037 if (IsInherited(Weapon))
9038 config_to_search = "CfgWeapons";
9039
9040 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9041
9042 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9043
9044 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9045
9046 if (config_OnFire_subclass_count > 0)
9047 {
9048 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9049
9050 for (int i = 0; i < config_OnFire_subclass_count; i++)
9051 {
9052 string particle_class = "";
9053 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9054 string config_OnFire_entry = config_OnFire_class + particle_class;
9055 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9056 WPOF_array.Insert(WPOF);
9057 }
9058
9059
9061 }
9062 }
9063
9065 {
9066 config_to_search = "CfgWeapons";
9067 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9068
9069 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9070
9071 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9072
9073 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9074 {
9075 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9076
9077 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9078 {
9079 string particle_class2 = "";
9080 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9081 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9082 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9083 WPOBE_array.Insert(WPOBE);
9084 }
9085
9086
9088 }
9089 }
9090 }
9091
9092
9094 {
9097
9099 {
9100 string config_to_search = "CfgVehicles";
9101
9102 if (IsInherited(Weapon))
9103 config_to_search = "CfgWeapons";
9104
9105 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9106 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9107
9108 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9109 {
9110
9112
9114 {
9116 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9118 return;
9119 }
9120
9123
9124
9125
9126 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9127 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9128
9129 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9130 {
9131 string particle_class = "";
9132 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9133 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9134 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9135
9136 if (entry_type == CT_CLASS)
9137 {
9138 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9139 WPOOH_array.Insert(WPOF);
9140 }
9141 }
9142
9143
9145 }
9146 }
9147 }
9148
9150 {
9152 }
9153
9155 {
9157 {
9159
9162
9165
9166 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9167 }
9168 }
9169
9171 {
9173 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9174
9176 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9177
9179 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9180
9182 {
9184 }
9185 }
9186
9188 {
9190 }
9191
9193 {
9196 else
9198
9200 {
9203 }
9204 else
9205 {
9208
9211 }
9212
9214 }
9215
9217 {
9219 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9220 }
9221
9223 {
9225 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9227 }
9228
9230 {
9232 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9233 }
9234
9236 {
9239
9240 OverheatingParticle OP = new OverheatingParticle();
9245
9247 }
9248
9250 {
9253
9254 return -1;
9255 }
9256
9258 {
9260 {
9263
9264 for (int i = count; i > 0; --i)
9265 {
9266 int id = i - 1;
9269
9272
9273 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9274 {
9275 if (p)
9276 {
9279 }
9280 }
9281 }
9282 }
9283 }
9284
9286 {
9288 {
9290 {
9291 int id = i - 1;
9293
9294 if (OP)
9295 {
9297
9298 if (p)
9299 {
9301 }
9302
9303 delete OP;
9304 }
9305 }
9306
9309 }
9310 }
9311
9314 {
9315 return 0.0;
9316 }
9317
9318
9320 {
9321 return 250;
9322 }
9323
9325 {
9326 return 0;
9327 }
9328
9331 {
9333 return true;
9334
9335 return false;
9336 }
9337
9340 {
9343
9345 {
9347 }
9348 else
9349 {
9350
9352 }
9353
9355 }
9356
9363 {
9364 return -1;
9365 }
9366
9367
9368
9369
9371 {
9373 {
9374 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9375 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9376
9377 if (r_index >= 0)
9378 {
9379 InventoryLocation r_il = new InventoryLocation;
9380 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9381
9382 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9385 {
9386 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9387 }
9389 {
9390 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9391 }
9392
9393 }
9394
9395 player.GetHumanInventory().ClearUserReservedLocation(this);
9396 }
9397
9400 }
9401
9402
9403
9404
9406 {
9407 return ItemBase.m_DebugActionsMask;
9408 }
9409
9411 {
9412 return ItemBase.m_DebugActionsMask & mask;
9413 }
9414
9416 {
9417 ItemBase.m_DebugActionsMask = mask;
9418 }
9419
9421 {
9422 ItemBase.m_DebugActionsMask |= mask;
9423 }
9424
9426 {
9427 ItemBase.m_DebugActionsMask &= ~mask;
9428 }
9429
9431 {
9433 {
9435 }
9436 else
9437 {
9439 }
9440 }
9441
9442
9444 {
9445 if (GetEconomyProfile())
9446 {
9447 float q_max = GetEconomyProfile().GetQuantityMax();
9448 if (q_max > 0)
9449 {
9450 float q_min = GetEconomyProfile().GetQuantityMin();
9451 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9452
9454 {
9455 ComponentEnergyManager comp = GetCompEM();
9457 {
9459 }
9460 }
9462 {
9464
9465 }
9466
9467 }
9468 }
9469 }
9470
9473 {
9474 EntityAI parent = GetHierarchyParent();
9475
9476 if (parent)
9477 {
9478 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9479 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9480 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9481 }
9482 }
9483
9486 {
9487 EntityAI parent = GetHierarchyParent();
9488
9489 if (parent)
9490 {
9491 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9492 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9493 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9494 }
9495 }
9496
9498 {
9499
9500
9501
9502
9504
9506 {
9507 if (ScriptInputUserData.CanStoreInputUserData())
9508 {
9509 ScriptInputUserData ctx = new ScriptInputUserData;
9515 ctx.
Write(use_stack_max);
9518
9520 {
9521 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9522 }
9523 }
9524 }
9525 else if (!
g_Game.IsMultiplayer())
9526 {
9528 }
9529 }
9530
9532 {
9534 }
9535
9537 {
9539 }
9540
9542 {
9544 }
9545
9547 {
9548
9549 return false;
9550 }
9551
9553 {
9554 return false;
9555 }
9556
9560 {
9561 return false;
9562 }
9563
9565 {
9566 return "";
9567 }
9568
9570
9572 {
9573 return false;
9574 }
9575
9577 {
9578 return true;
9579 }
9580
9581
9582
9584 {
9585 return true;
9586 }
9587
9589 {
9590 return true;
9591 }
9592
9594 {
9595 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9597 }
9598
9600 {
9602 }
9603
9605 {
9607 if (!is_being_placed)
9609 SetSynchDirty();
9610 }
9611
9612
9614
9616 {
9618 }
9619
9621 {
9623 }
9624
9626 {
9627 return 1;
9628 }
9629
9631 {
9632 return false;
9633 }
9634
9636 {
9638 SetSynchDirty();
9639 }
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9676 {
9677 super.OnMovedInsideCargo(container);
9678
9679 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9680 }
9681
9682 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9683 {
9684 super.EEItemLocationChanged(oldLoc, newLoc);
9685
9686 PlayerBase newPlayer = null;
9687 PlayerBase oldPlayer = null;
9688
9689 if (newLoc.GetParent())
9690 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9691
9692 if (oldLoc.GetParent())
9693 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9694
9696 {
9697 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9698
9699 if (rIndex >= 0)
9700 {
9701 InventoryLocation rIl = new InventoryLocation;
9702 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9703
9704 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9707 {
9708 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9709 }
9711 {
9713 }
9714
9715 }
9716 }
9717
9719 {
9720 if (newPlayer)
9721 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9722
9723 if (newPlayer == oldPlayer)
9724 {
9725 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9726 {
9728 {
9729 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9730 {
9731 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9732 }
9733 }
9734 else
9735 {
9736 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9737 }
9738 }
9739
9740 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9741 {
9742 int type = oldLoc.GetType();
9744 {
9745 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9746 }
9748 {
9749 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9750 }
9751 }
9752 if (!m_OldLocation)
9753 {
9754 m_OldLocation = new InventoryLocation;
9755 }
9756 m_OldLocation.Copy(oldLoc);
9757 }
9758 else
9759 {
9760 if (m_OldLocation)
9761 {
9762 m_OldLocation.Reset();
9763 }
9764 }
9765
9766 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9767 }
9768 else
9769 {
9770 if (newPlayer)
9771 {
9772 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9773 if (resIndex >= 0)
9774 {
9775 InventoryLocation il = new InventoryLocation;
9776 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9778 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9781 {
9782 il.
GetParent().GetOnReleaseLock().Invoke(it);
9783 }
9785 {
9787 }
9788
9789 }
9790 }
9792 {
9793
9795 }
9796
9797 if (m_OldLocation)
9798 {
9799 m_OldLocation.Reset();
9800 }
9801 }
9802
9804 {
9805 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9806 }
9807
9809 {
9810 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9811 }
9812 }
9813
9814 override void EOnContact(IEntity other, Contact extra)
9815 {
9817 {
9818 int liquidType = -1;
9820 if (impactSpeed > 0.0)
9821 {
9823 #ifndef SERVER
9825 #else
9827 SetSynchDirty();
9828 #endif
9830 }
9831 }
9832
9833 #ifdef SERVER
9834 if (GetCompEM() && GetCompEM().IsPlugged())
9835 {
9836 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9837 GetCompEM().UnplugThis();
9838 }
9839 #endif
9840 }
9841
9843
9845 {
9847 }
9848
9850 {
9851
9852 }
9853
9855 {
9856 super.OnItemLocationChanged(old_owner, new_owner);
9857
9858 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9859 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9860
9861 if (!relatedPlayer && playerNew)
9862 relatedPlayer = playerNew;
9863
9864 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9865 {
9867 if (actionMgr)
9868 {
9869 ActionBase currentAction = actionMgr.GetRunningAction();
9870 if (currentAction)
9872 }
9873 }
9874
9875 Man ownerPlayerOld = null;
9876 Man ownerPlayerNew = null;
9877
9878 if (old_owner)
9879 {
9880 if (old_owner.
IsMan())
9881 {
9882 ownerPlayerOld = Man.Cast(old_owner);
9883 }
9884 else
9885 {
9886 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9887 }
9888 }
9889 else
9890 {
9892 {
9894
9895 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9896 {
9897 GetCompEM().UnplugThis();
9898 }
9899 }
9900 }
9901
9902 if (new_owner)
9903 {
9904 if (new_owner.
IsMan())
9905 {
9906 ownerPlayerNew = Man.Cast(new_owner);
9907 }
9908 else
9909 {
9910 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9911 }
9912 }
9913
9914 if (ownerPlayerOld != ownerPlayerNew)
9915 {
9916 if (ownerPlayerOld)
9917 {
9918 array<EntityAI> subItemsExit = new array<EntityAI>;
9920 for (int i = 0; i < subItemsExit.Count(); i++)
9921 {
9924 }
9925 }
9926
9927 if (ownerPlayerNew)
9928 {
9929 array<EntityAI> subItemsEnter = new array<EntityAI>;
9931 for (int j = 0; j < subItemsEnter.Count(); j++)
9932 {
9935 }
9936 }
9937 }
9938 else if (ownerPlayerNew != null)
9939 {
9940 PlayerBase nplayer;
9941 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9942 {
9943 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9945 for (int k = 0; k < subItemsUpdate.Count(); k++)
9946 {
9948 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9949 }
9950 }
9951 }
9952
9953 if (old_owner)
9954 old_owner.OnChildItemRemoved(this);
9955 if (new_owner)
9956 new_owner.OnChildItemReceived(this);
9957 }
9958
9959
9961 {
9962 super.EEDelete(parent);
9963 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9964 if (player)
9965 {
9967
9968 if (player.IsAlive())
9969 {
9970 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9971 if (r_index >= 0)
9972 {
9973 InventoryLocation r_il = new InventoryLocation;
9974 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9975
9976 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9979 {
9980 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9981 }
9983 {
9984 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9985 }
9986
9987 }
9988
9989 player.RemoveQuickBarEntityShortcut(this);
9990 }
9991 }
9992 }
9993
9995 {
9996 super.EEKilled(killer);
9997
10000 {
10001 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10002 {
10003 if (IsMagazine())
10004 {
10005 if (Magazine.Cast(this).GetAmmoCount() > 0)
10006 {
10008 }
10009 }
10010 else
10011 {
10013 }
10014 }
10015 }
10016 }
10017
10019 {
10020 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10021
10022 super.OnWasAttached(parent, slot_id);
10023
10026
10029 }
10030
10032 {
10033 super.OnWasDetached(parent, slot_id);
10034
10037
10040 }
10041
10043 {
10044 int idx;
10047
10048 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10049 if (inventory_slots.Count() < 1)
10050 {
10051 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10052 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10053 }
10054 else
10055 {
10056 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10057 }
10058
10059 idx = inventory_slots.Find(slot);
10060 if (idx < 0)
10061 return "";
10062
10063 return attach_types.Get(idx);
10064 }
10065
10067 {
10068 int idx = -1;
10069 string slot;
10070
10073
10074 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10075 if (inventory_slots.Count() < 1)
10076 {
10077 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10078 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10079 }
10080 else
10081 {
10082 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10083 if (detach_types.Count() < 1)
10084 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10085 }
10086
10087 for (int i = 0; i < inventory_slots.Count(); i++)
10088 {
10089 slot = inventory_slots.Get(i);
10090 }
10091
10092 if (slot != "")
10093 {
10094 if (detach_types.Count() == 1)
10095 idx = 0;
10096 else
10097 idx = inventory_slots.Find(slot);
10098 }
10099 if (idx < 0)
10100 return "";
10101
10102 return detach_types.Get(idx);
10103 }
10104
10106 {
10107
10109
10110
10111 float min_time = 1;
10112 float max_time = 3;
10113 float delay = Math.RandomFloat(min_time, max_time);
10114
10115 explode_timer.Run(delay, this, "DoAmmoExplosion");
10116 }
10117
10119 {
10120 Magazine magazine = Magazine.Cast(this);
10121 int pop_sounds_count = 6;
10122 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10123
10124
10125 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10126 string sound_name = pop_sounds[ sound_idx ];
10127 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10128
10129
10130 magazine.ServerAddAmmoCount(-1);
10131
10132
10133 float min_temp_to_explode = 100;
10134
10135 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10136 {
10138 }
10139 }
10140
10141
10142 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10143 {
10144 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10145
10146 const int CHANCE_DAMAGE_CARGO = 4;
10147 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10148 const int CHANCE_DAMAGE_NOTHING = 2;
10149
10151 {
10152 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10153 int chances;
10154 int rnd;
10155
10156 if (GetInventory().GetCargo())
10157 {
10158 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10159 rnd = Math.RandomInt(0,chances);
10160
10161 if (rnd < CHANCE_DAMAGE_CARGO)
10162 {
10164 }
10165 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10166 {
10168 }
10169 }
10170 else
10171 {
10172 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10173 rnd = Math.RandomInt(0,chances);
10174
10175 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10176 {
10178 }
10179 }
10180 }
10181 }
10182
10184 {
10185 CargoBase cargo = GetInventory().GetCargo();
10186 if (cargo)
10187 {
10189 if (item_count > 0)
10190 {
10191 int random_pick = Math.RandomInt(0, item_count);
10193 if (!item.IsExplosive())
10194 {
10195 item.AddHealth("","",damage);
10196 return true;
10197 }
10198 }
10199 }
10200 return false;
10201 }
10202
10204 {
10205 GameInventory inventory = GetInventory();
10207 if (attachment_count > 0)
10208 {
10209 int random_pick = Math.RandomInt(0, attachment_count);
10211 if (!attachment.IsExplosive())
10212 {
10213 attachment.AddHealth("","",damage);
10214 return true;
10215 }
10216 }
10217 return false;
10218 }
10219
10221 {
10223 }
10224
10226 {
10228 return GetInventory().CanRemoveEntity();
10229
10230 return false;
10231 }
10232
10234 {
10235
10237 return false;
10238
10239
10241 return false;
10242
10243
10244
10246 if (delta == 0)
10247 return false;
10248
10249
10250 return true;
10251 }
10252
10254 {
10256 {
10257 if (ScriptInputUserData.CanStoreInputUserData())
10258 {
10259 ScriptInputUserData ctx = new ScriptInputUserData;
10264 ctx.
Write(destination_entity);
10266 ctx.
Write(slot_id);
10268 }
10269 }
10270 else if (!
g_Game.IsMultiplayer())
10271 {
10273 }
10274 }
10275
10277 {
10278 float split_quantity_new;
10282 InventoryLocation loc = new InventoryLocation;
10283
10284 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10285 {
10287 split_quantity_new = stack_max;
10288 else
10290
10292 {
10293 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10294 if (new_item)
10295 {
10296 new_item.SetResultOfSplit(true);
10297 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10299 new_item.
SetQuantity(split_quantity_new,
false,
true);
10300 }
10301 }
10302 }
10303 else if (destination_entity && slot_id == -1)
10304 {
10305 if (quantity > stack_max)
10306 split_quantity_new = stack_max;
10307 else
10308 split_quantity_new = quantity;
10309
10311 {
10312 GameInventory destinationInventory = destination_entity.GetInventory();
10314 {
10317 }
10318
10319 if (new_item)
10320 {
10321 new_item.SetResultOfSplit(true);
10322 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10324 new_item.
SetQuantity(split_quantity_new,
false,
true);
10325 }
10326 }
10327 }
10328 else
10329 {
10330 if (stack_max != 0)
10331 {
10333 {
10335 }
10336
10337 if (split_quantity_new == 0)
10338 {
10339 if (!
g_Game.IsMultiplayer())
10340 player.PhysicalPredictiveDropItem(this);
10341 else
10342 player.ServerDropEntity(this);
10343 return;
10344 }
10345
10347 {
10349
10350 if (new_item)
10351 {
10352 new_item.SetResultOfSplit(true);
10353 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10356 new_item.PlaceOnSurface();
10357 }
10358 }
10359 }
10360 }
10361 }
10362
10364 {
10365 float split_quantity_new;
10369 InventoryLocation loc = new InventoryLocation;
10370
10371 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10372 {
10374 split_quantity_new = stack_max;
10375 else
10377
10379 {
10380 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10381 if (new_item)
10382 {
10383 new_item.SetResultOfSplit(true);
10384 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10386 new_item.
SetQuantity(split_quantity_new,
false,
true);
10387 }
10388 }
10389 }
10390 else if (destination_entity && slot_id == -1)
10391 {
10392 if (quantity > stack_max)
10393 split_quantity_new = stack_max;
10394 else
10395 split_quantity_new = quantity;
10396
10398 {
10399 GameInventory destinationInventory = destination_entity.GetInventory();
10401 {
10404 }
10405
10406 if (new_item)
10407 {
10408 new_item.SetResultOfSplit(true);
10409 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10411 new_item.
SetQuantity(split_quantity_new,
false,
true);
10412 }
10413 }
10414 }
10415 else
10416 {
10417 if (stack_max != 0)
10418 {
10420 {
10422 }
10423
10425 {
10427
10428 if (new_item)
10429 {
10430 new_item.SetResultOfSplit(true);
10431 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10434 new_item.PlaceOnSurface();
10435 }
10436 }
10437 }
10438 }
10439 }
10440
10442 {
10444 {
10445 if (ScriptInputUserData.CanStoreInputUserData())
10446 {
10447 ScriptInputUserData ctx = new ScriptInputUserData;
10452 dst.WriteToContext(ctx);
10454 }
10455 }
10456 else if (!
g_Game.IsMultiplayer())
10457 {
10459 }
10460 }
10461
10463 {
10465 {
10466 if (ScriptInputUserData.CanStoreInputUserData())
10467 {
10468 ScriptInputUserData ctx = new ScriptInputUserData;
10473 ctx.
Write(destination_entity);
10479 }
10480 }
10481 else if (!
g_Game.IsMultiplayer())
10482 {
10484 }
10485 }
10486
10488 {
10490 }
10491
10493 {
10495 float split_quantity_new;
10497 if (dst.IsValid())
10498 {
10499 int slot_id = dst.GetSlot();
10501
10502 if (quantity > stack_max)
10503 split_quantity_new = stack_max;
10504 else
10505 split_quantity_new = quantity;
10506
10508 {
10510
10511 if (new_item)
10512 {
10513 new_item.SetResultOfSplit(true);
10514 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10516 new_item.
SetQuantity(split_quantity_new,
false,
true);
10517 }
10518
10519 return new_item;
10520 }
10521 }
10522
10523 return null;
10524 }
10525
10527 {
10529 float split_quantity_new;
10531 if (destination_entity)
10532 {
10534 if (quantity > stackable)
10535 split_quantity_new = stackable;
10536 else
10537 split_quantity_new = quantity;
10538
10540 {
10541 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10542 if (new_item)
10543 {
10544 new_item.SetResultOfSplit(true);
10545 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10547 new_item.
SetQuantity(split_quantity_new,
false,
true);
10548 }
10549 }
10550 }
10551 }
10552
10554 {
10556 {
10557 if (ScriptInputUserData.CanStoreInputUserData())
10558 {
10559 ScriptInputUserData ctx = new ScriptInputUserData;
10564 ItemBase destination_entity =
this;
10565 ctx.
Write(destination_entity);
10569 }
10570 }
10571 else if (!
g_Game.IsMultiplayer())
10572 {
10574 }
10575 }
10576
10578 {
10580 float split_quantity_new;
10582 if (player)
10583 {
10585 if (quantity > stackable)
10586 split_quantity_new = stackable;
10587 else
10588 split_quantity_new = quantity;
10589
10591 {
10592 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10593 new_item =
ItemBase.Cast(in_hands);
10594 if (new_item)
10595 {
10596 new_item.SetResultOfSplit(true);
10597 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10599 new_item.SetQuantity(split_quantity_new, false, true);
10600 }
10601 }
10602 }
10603 }
10604
10606 {
10608 float split_quantity_new = Math.Floor(quantity * 0.5);
10609
10611 return;
10612
10614
10615 if (new_item)
10616 {
10617 if (new_item.GetQuantityMax() < split_quantity_new)
10618 {
10619 split_quantity_new = new_item.GetQuantityMax();
10620 }
10621
10622 new_item.SetResultOfSplit(true);
10623 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10624
10626 {
10629 }
10630 else
10631 {
10633 new_item.
SetQuantity(split_quantity_new,
false,
true);
10634 }
10635 }
10636 }
10637
10639 {
10641 float split_quantity_new = Math.Floor(quantity / 2);
10642
10644 return;
10645
10646 InventoryLocation invloc = new InventoryLocation;
10648
10650 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10651
10652 if (new_item)
10653 {
10654 if (new_item.GetQuantityMax() < split_quantity_new)
10655 {
10656 split_quantity_new = new_item.GetQuantityMax();
10657 }
10659 {
10662 }
10663 else if (split_quantity_new > 1)
10664 {
10666 new_item.
SetQuantity(split_quantity_new,
false,
true);
10667 }
10668 }
10669 }
10670
10673 {
10674 SetWeightDirty();
10676
10677 if (parent)
10678 parent.OnAttachmentQuantityChangedEx(this, delta);
10679
10681 {
10683 {
10685 }
10687 {
10688 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10690 }
10691 }
10692 }
10693
10696 {
10697
10698 }
10699
10702 {
10704 }
10705
10707 {
10708 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10709
10711 {
10712 if (newLevel == GameConstants.STATE_RUINED)
10713 {
10715 EntityAI parent = GetHierarchyParent();
10716 if (parent && parent.IsFireplace())
10717 {
10718 CargoBase cargo = GetInventory().GetCargo();
10719 if (cargo)
10720 {
10722 {
10724 }
10725 }
10726 }
10727 }
10728
10730 {
10731
10733 return;
10734 }
10735
10736 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10737 {
10739 }
10740 }
10741 }
10742
10743
10745 {
10746 super.OnRightClick();
10747
10749 {
10751 {
10752 if (ScriptInputUserData.CanStoreInputUserData())
10753 {
10754 EntityAI root = GetHierarchyRoot();
10755 Man playerOwner = GetHierarchyRootPlayer();
10756 InventoryLocation dst = new InventoryLocation;
10757
10758
10759 if (!playerOwner && root && root == this)
10760 {
10762 }
10763 else
10764 {
10765
10766 GetInventory().GetCurrentInventoryLocation(dst);
10768 {
10769 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10771 {
10773 }
10774 else
10775 {
10777
10778
10779 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10780 {
10782 }
10783 else
10784 {
10785 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10786 }
10787 }
10788 }
10789 }
10790
10791 ScriptInputUserData ctx = new ScriptInputUserData;
10799 }
10800 }
10801 else if (!
g_Game.IsMultiplayer())
10802 {
10804 }
10805 }
10806 }
10807
10809 {
10810 if (root)
10811 {
10812 vector m4[4];
10813 root.GetTransform(m4);
10814 dst.SetGround(this, m4);
10815 }
10816 else
10817 {
10818 GetInventory().GetCurrentInventoryLocation(dst);
10819 }
10820 }
10821
10822 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10823 {
10824
10825 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10826 return false;
10827
10828 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10829 return false;
10830
10831
10833 return false;
10834
10835
10836 Magazine mag = Magazine.Cast(this);
10837 if (mag)
10838 {
10839 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10840 return false;
10841
10842 if (stack_max_limit)
10843 {
10844 Magazine other_mag = Magazine.Cast(other_item);
10845 if (other_item)
10846 {
10847 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10848 return false;
10849 }
10850
10851 }
10852 }
10853 else
10854 {
10855
10857 return false;
10858
10860 return false;
10861 }
10862
10863 PlayerBase player = null;
10864 if (CastTo(player, GetHierarchyRootPlayer()))
10865 {
10866 if (player.GetInventory().HasAttachment(this))
10867 return false;
10868
10869 if (player.IsItemsToDelete())
10870 return false;
10871 }
10872
10873 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10874 return false;
10875
10876 int slotID;
10878 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10879 return false;
10880
10881 return true;
10882 }
10883
10885 {
10887 }
10888
10890 {
10891 return m_IsResultOfSplit;
10892 }
10893
10895 {
10896 m_IsResultOfSplit = value;
10897 }
10898
10900 {
10902 }
10903
10905 {
10906 float other_item_quantity = other_item.GetQuantity();
10907 float this_free_space;
10908
10910
10912
10913 if (other_item_quantity > this_free_space)
10914 {
10915 return this_free_space;
10916 }
10917 else
10918 {
10919 return other_item_quantity;
10920 }
10921 }
10922
10924 {
10926 }
10927
10929 {
10931 return;
10932
10933 if (!IsMagazine() && other_item)
10934 {
10936 if (quantity_used != 0)
10937 {
10938 float hp1 = GetHealth01("","");
10939 float hp2 = other_item.GetHealth01("","");
10940 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10941 hpResult = hpResult / (
GetQuantity() + quantity_used);
10942
10943 hpResult *= GetMaxHealth();
10944 Math.Round(hpResult);
10945 SetHealth("", "Health", hpResult);
10946
10948 other_item.AddQuantity(-quantity_used);
10949 }
10950 }
10952 }
10953
10955 {
10956 #ifdef SERVER
10957 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10958 GetHierarchyParent().IncreaseLifetimeUp();
10959 #endif
10960 };
10961
10963 {
10964 PlayerBase p = PlayerBase.Cast(player);
10965
10966 array<int> recipesIds = p.m_Recipes;
10967 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10968 if (moduleRecipesManager)
10969 {
10970 EntityAI itemInHands = player.GetEntityInHands();
10971 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10972 }
10973
10974 for (int i = 0;i < recipesIds.Count(); i++)
10975 {
10976 int key = recipesIds.Get(i);
10977 string recipeName = moduleRecipesManager.GetRecipeName(key);
10979 }
10980 }
10981
10982
10983 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10984 {
10985 super.GetDebugActions(outputList);
10986
10987
10993
10994
10999
11004
11005
11009
11010
11012 {
11016 }
11017
11020
11021
11025
11027
11028 InventoryLocation loc = new InventoryLocation();
11029 GetInventory().GetCurrentInventoryLocation(loc);
11031 {
11032 if (Gizmo_IsSupported())
11035 }
11036
11038 }
11039
11040
11041
11042
11044 {
11045 super.OnAction(action_id, player, ctx);
11046
11048 {
11049 switch (action_id)
11050 {
11054 return true;
11058 return true;
11059 }
11060 }
11061
11063 {
11064 switch (action_id)
11065 {
11067 Delete();
11068 return true;
11069 }
11070 }
11071
11072 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11073 {
11074 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11075 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11076 PlayerBase p = PlayerBase.Cast(player);
11077 if (
EActions.RECIPES_RANGE_START < 1000)
11078 {
11079 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11080 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11081 }
11082 }
11083 #ifndef SERVER
11084 else if (action_id ==
EActions.WATCH_PLAYER)
11085 {
11086 PluginDeveloper.SetDeveloperItemClientEx(player);
11087 }
11088 #endif
11090 {
11091 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11092 {
11093 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11094 OnDebugButtonPressServer(id + 1);
11095 }
11096
11097 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11098 {
11099 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11101 }
11102
11103 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11104 {
11105 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11107 }
11108
11109 else if (action_id ==
EActions.ADD_QUANTITY)
11110 {
11111 if (IsMagazine())
11112 {
11113 Magazine mag = Magazine.Cast(this);
11114 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11115 }
11116 else
11117 {
11119 }
11120
11121 if (m_EM)
11122 {
11123 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11124 }
11125
11126 }
11127
11128 else if (action_id ==
EActions.REMOVE_QUANTITY)
11129 {
11130 if (IsMagazine())
11131 {
11132 Magazine mag2 = Magazine.Cast(this);
11133 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11134 }
11135 else
11136 {
11138 }
11139 if (m_EM)
11140 {
11141 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11142 }
11143
11144 }
11145
11146 else if (action_id ==
EActions.SET_QUANTITY_0)
11147 {
11149
11150 if (m_EM)
11151 {
11152 m_EM.SetEnergy(0);
11153 }
11154 }
11155
11156 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11157 {
11159
11160 if (m_EM)
11161 {
11162 m_EM.SetEnergy(m_EM.GetEnergyMax());
11163 }
11164 }
11165
11166 else if (action_id ==
EActions.ADD_HEALTH)
11167 {
11168 AddHealth("","",GetMaxHealth("","Health")/5);
11169 }
11170 else if (action_id ==
EActions.REMOVE_HEALTH)
11171 {
11172 AddHealth("","",-GetMaxHealth("","Health")/5);
11173 }
11174 else if (action_id ==
EActions.DESTROY_HEALTH)
11175 {
11176 SetHealth01("","",0);
11177 }
11178 else if (action_id ==
EActions.WATCH_ITEM)
11179 {
11181 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11182 #ifdef DEVELOPER
11183 SetDebugDeveloper_item(this);
11184 #endif
11185 }
11186
11187 else if (action_id ==
EActions.ADD_TEMPERATURE)
11188 {
11189 AddTemperature(20);
11190
11191 }
11192
11193 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11194 {
11195 AddTemperature(-20);
11196
11197 }
11198
11199 else if (action_id ==
EActions.FLIP_FROZEN)
11200 {
11201 SetFrozen(!GetIsFrozen());
11202
11203 }
11204
11205 else if (action_id ==
EActions.ADD_WETNESS)
11206 {
11208
11209 }
11210
11211 else if (action_id ==
EActions.REMOVE_WETNESS)
11212 {
11214
11215 }
11216
11217 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11218 {
11221
11222
11223 }
11224
11225 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11226 {
11229 }
11230
11231 else if (action_id ==
EActions.MAKE_SPECIAL)
11232 {
11233 auto debugParams = DebugSpawnParams.WithPlayer(player);
11234 OnDebugSpawnEx(debugParams);
11235 }
11236
11237 }
11238
11239
11240 return false;
11241 }
11242
11243
11244
11245
11249
11252
11253
11254
11256 {
11257 return false;
11258 }
11259
11260
11262 {
11263 return true;
11264 }
11265
11266
11268 {
11269 return true;
11270 }
11271
11272
11273
11275 {
11276 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11277 return g_Game.ConfigIsExisting(config_path);
11278 }
11279
11282 {
11283 return null;
11284 }
11285
11287 {
11288 return false;
11289 }
11290
11292 {
11293 return false;
11294 }
11295
11299
11300
11302 {
11303 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11304 return module_repairing.CanRepair(this, item_repair_kit);
11305 }
11306
11307
11308 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11309 {
11310 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11311 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11312 }
11313
11314
11316 {
11317
11318
11319
11320
11321
11322
11323
11324
11325 return 1;
11326 }
11327
11328
11329
11331 {
11333 }
11334
11335
11336
11338 {
11340 }
11341
11342
11351 {
11352 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11353
11354 if (player)
11355 {
11356 player.MessageStatus(text);
11357 }
11358 }
11359
11360
11369 {
11370 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11371
11372 if (player)
11373 {
11374 player.MessageAction(text);
11375 }
11376 }
11377
11378
11387 {
11388 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11389
11390 if (player)
11391 {
11392 player.MessageFriendly(text);
11393 }
11394 }
11395
11396
11405 {
11406 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11407
11408 if (player)
11409 {
11410 player.MessageImportant(text);
11411 }
11412 }
11413
11415 {
11416 return true;
11417 }
11418
11419
11420 override bool KindOf(
string tag)
11421 {
11422 bool found = false;
11423 string item_name = this.
GetType();
11425 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11426
11427 int array_size = item_tag_array.Count();
11428 for (int i = 0; i < array_size; i++)
11429 {
11430 if (item_tag_array.Get(i) == tag)
11431 {
11432 found = true;
11433 break;
11434 }
11435 }
11436 return found;
11437 }
11438
11439
11441 {
11442
11443 super.OnRPC(sender, rpc_type,ctx);
11444
11445
11446 switch (rpc_type)
11447 {
11448 #ifndef SERVER
11449 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11450 Param2<bool, string> p = new Param2<bool, string>(false, "");
11451
11453 return;
11454
11455 bool play = p.param1;
11456 string soundSet = p.param2;
11457
11458 if (play)
11459 {
11461 {
11463 {
11465 }
11466 }
11467 else
11468 {
11470 }
11471 }
11472 else
11473 {
11475 }
11476
11477 break;
11478 #endif
11479
11480 }
11481
11483 {
11485 }
11486 }
11487
11488
11489
11490
11492 {
11493 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11494 return plugin.GetID(
name);
11495 }
11496
11498 {
11499 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11500 return plugin.GetName(id);
11501 }
11502
11505 {
11506
11507
11508 int varFlags;
11509 if (!ctx.
Read(varFlags))
11510 return;
11511
11512 if (varFlags & ItemVariableFlags.FLOAT)
11513 {
11515 }
11516 }
11517
11519 {
11520
11521 super.SerializeNumericalVars(floats_out);
11522
11523
11524
11526 {
11528 }
11529
11531 {
11533 }
11534
11536 {
11538 }
11539
11541 {
11546 }
11547
11549 {
11551 }
11552 }
11553
11555 {
11556
11557 super.DeSerializeNumericalVars(floats);
11558
11559
11560 int index = 0;
11561 int mask = Math.Round(floats.Get(index));
11562
11563 index++;
11564
11566 {
11568 {
11570 }
11571 else
11572 {
11573 float quantity = floats.Get(index);
11574 SetQuantity(quantity,
true,
false,
false,
false);
11575 }
11576 index++;
11577 }
11578
11580 {
11581 float wet = floats.Get(index);
11583 index++;
11584 }
11585
11587 {
11588 int liquidtype = Math.Round(floats.Get(index));
11590 index++;
11591 }
11592
11594 {
11596 index++;
11598 index++;
11600 index++;
11602 index++;
11603 }
11604
11606 {
11607 int cleanness = Math.Round(floats.Get(index));
11609 index++;
11610 }
11611 }
11612
11614 {
11615 super.WriteVarsToCTX(ctx);
11616
11617
11619 {
11621 }
11622
11624 {
11626 }
11627
11629 {
11631 }
11632
11634 {
11635 int r,g,b,a;
11641 }
11642
11644 {
11646 }
11647 }
11648
11650 {
11651 if (!super.ReadVarsFromCTX(ctx,version))
11652 return false;
11653
11654 int intValue;
11655 float value;
11656
11657 if (version < 140)
11658 {
11659 if (!ctx.
Read(intValue))
11660 return false;
11661
11662 m_VariablesMask = intValue;
11663 }
11664
11666 {
11667 if (!ctx.
Read(value))
11668 return false;
11669
11671 {
11673 }
11674 else
11675 {
11677 }
11678 }
11679
11680 if (version < 140)
11681 {
11683 {
11684 if (!ctx.
Read(value))
11685 return false;
11686 SetTemperatureDirect(value);
11687 }
11688 }
11689
11691 {
11692 if (!ctx.
Read(value))
11693 return false;
11695 }
11696
11698 {
11699 if (!ctx.
Read(intValue))
11700 return false;
11702 }
11703
11705 {
11706 int r,g,b,a;
11708 return false;
11710 return false;
11712 return false;
11714 return false;
11715
11717 }
11718
11720 {
11721 if (!ctx.
Read(intValue))
11722 return false;
11724 }
11725
11726 if (version >= 138 && version < 140)
11727 {
11729 {
11730 if (!ctx.
Read(intValue))
11731 return false;
11732 SetFrozen(intValue);
11733 }
11734 }
11735
11736 return true;
11737 }
11738
11739
11741 {
11744 {
11746 }
11747
11748 if (!super.OnStoreLoad(ctx, version))
11749 {
11751 return false;
11752 }
11753
11754 if (version >= 114)
11755 {
11756 bool hasQuickBarIndexSaved;
11757
11758 if (!ctx.
Read(hasQuickBarIndexSaved))
11759 {
11761 return false;
11762 }
11763
11764 if (hasQuickBarIndexSaved)
11765 {
11766 int itmQBIndex;
11767
11768
11769 if (!ctx.
Read(itmQBIndex))
11770 {
11772 return false;
11773 }
11774
11775 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11776 if (itmQBIndex != -1 && parentPlayer)
11777 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11778 }
11779 }
11780 else
11781 {
11782
11783 PlayerBase player;
11784 int itemQBIndex;
11785 if (version ==
int.
MAX)
11786 {
11787 if (!ctx.
Read(itemQBIndex))
11788 {
11790 return false;
11791 }
11792 }
11793 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11794 {
11795
11796 if (!ctx.
Read(itemQBIndex))
11797 {
11799 return false;
11800 }
11801 if (itemQBIndex != -1 && player)
11802 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11803 }
11804 }
11805
11806 if (version < 140)
11807 {
11808
11809 if (!LoadVariables(ctx, version))
11810 {
11812 return false;
11813 }
11814 }
11815
11816
11818 {
11820 return false;
11821 }
11822 if (version >= 132)
11823 {
11825 if (raib)
11826 {
11828 {
11830 return false;
11831 }
11832 }
11833 }
11834
11836 return true;
11837 }
11838
11839
11840
11842 {
11843 super.OnStoreSave(ctx);
11844
11845 PlayerBase player;
11846 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11847 {
11849
11850 int itemQBIndex = -1;
11851 itemQBIndex = player.FindQuickBarEntityIndex(this);
11852 ctx.
Write(itemQBIndex);
11853 }
11854 else
11855 {
11857 }
11858
11860
11862 if (raib)
11863 {
11865 }
11866 }
11867
11868
11870 {
11871 super.AfterStoreLoad();
11872
11874 {
11876 }
11877
11879 {
11882 }
11883 }
11884
11886 {
11887 super.EEOnAfterLoad();
11888
11890 {
11892 }
11893
11896 }
11897
11899 {
11900 return false;
11901 }
11902
11903
11904
11906 {
11908 {
11909 #ifdef PLATFORM_CONSOLE
11910
11912 {
11914 if (menu)
11915 {
11917 }
11918 }
11919 #endif
11920 }
11921
11923 {
11926 }
11927
11929 {
11930 SetWeightDirty();
11932 }
11934 {
11937 }
11938
11940 {
11943
11946 }
11948 {
11952 }
11953
11954 super.OnVariablesSynchronized();
11955 }
11956
11957
11958
11960 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11961 {
11962 if (!IsServerCheck(allow_client))
11963 return false;
11964
11966 return false;
11967
11970
11971 if (value <= (min + 0.001))
11972 value = min;
11973
11974 if (value == min)
11975 {
11976 if (destroy_config)
11977 {
11978 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11979 if (dstr)
11980 {
11982 this.Delete();
11983 return true;
11984 }
11985 }
11986 else if (destroy_forced)
11987 {
11989 this.Delete();
11990 return true;
11991 }
11992
11994 }
11995
11998
12000 {
12001 EntityAI parent = GetHierarchyRoot();
12002 InventoryLocation iLoc = new InventoryLocation();
12003 GetInventory().GetCurrentInventoryLocation(iLoc);
12005 {
12006 int iLocSlot = iLoc.
GetSlot();
12008 {
12010 }
12012 {
12014 }
12015 }
12016 }
12017
12019 {
12021
12022 if (delta)
12024 }
12025
12027
12028 return false;
12029 }
12030
12031
12033 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12034 {
12036 }
12037
12039 {
12042 }
12043
12045 {
12048 }
12049
12051 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12052 {
12053 float value_clamped = Math.Clamp(value, 0, 1);
12055 SetQuantity(result, destroy_config, destroy_forced);
12056 }
12057
12058
12061 {
12063 }
12064
12066 {
12068 }
12069
12070
12071
12072
12073
12074
12075
12076
12077
12078
12080 {
12081 int slot = -1;
12082 GameInventory inventory = GetInventory();
12083 if (inventory)
12084 {
12085 InventoryLocation il = new InventoryLocation;
12088 }
12089
12091 }
12092
12094 {
12095 float quantity_max = 0;
12096
12098 {
12099 if (attSlotID != -1)
12100 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12101
12102 if (quantity_max <= 0)
12104 }
12105
12106 if (quantity_max <= 0)
12108
12109 return quantity_max;
12110 }
12111
12113 {
12115 }
12116
12118 {
12120 }
12121
12122
12124 {
12126 }
12127
12129 {
12131 }
12132
12134 {
12136 }
12137
12138
12140 {
12141
12142 float weightEx = GetWeightEx();
12143 float special = GetInventoryAndCargoWeight();
12144 return weightEx - special;
12145 }
12146
12147
12149 {
12151 }
12152
12154 {
12156 {
12157 #ifdef DEVELOPER
12158 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12159 {
12160 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12162 }
12163 #endif
12164
12165 return GetQuantity() * GetConfigWeightModified();
12166 }
12167 else if (HasEnergyManager())
12168 {
12169 #ifdef DEVELOPER
12170 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12171 {
12172 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12173 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12174 }
12175 #endif
12176 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12177 }
12178 else
12179 {
12180 #ifdef DEVELOPER
12181 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12182 {
12183 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12184 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12185 }
12186 #endif
12187 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12188 }
12189 }
12190
12193 {
12194 int item_count = 0;
12196
12197 GameInventory inventory = GetInventory();
12198 CargoBase cargo = inventory.
GetCargo();
12199 if (cargo != NULL)
12200 {
12202 }
12203
12205 for (int i = 0; i < nAttachments; ++i)
12206 {
12208 if (item)
12209 item_count += item.GetNumberOfItems();
12210 }
12211 return item_count;
12212 }
12213
12216 {
12217 float weight = 0;
12218 float wetness = 1;
12219 if (include_wetness)
12222 {
12223 weight = wetness * m_ConfigWeight;
12224 }
12226 {
12227 weight = 1;
12228 }
12229 return weight;
12230 }
12231
12232
12233
12235 {
12236 GameInventory inventory = GetInventory();
12237 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12238 {
12239 array<EntityAI> items = new array<EntityAI>;
12241 for (int i = 0; i < items.Count(); ++i)
12242 {
12244 if (item)
12245 {
12246 g_Game.ObjectDelete(item);
12247 }
12248 }
12249 }
12250 }
12251
12252
12253
12254
12256 {
12257 float energy = 0;
12258 if (HasEnergyManager())
12259 {
12260 energy = GetCompEM().GetEnergy();
12261 }
12262 return energy;
12263 }
12264
12265
12267 {
12268 super.OnEnergyConsumed();
12269
12271 }
12272
12274 {
12275 super.OnEnergyAdded();
12276
12278 }
12279
12280
12282 {
12283 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12284 {
12286 {
12287 float energy_0to1 = GetCompEM().GetEnergy0To1();
12289 }
12290 }
12291 }
12292
12293
12295 {
12296 return ConfigGetFloat("heatIsolation");
12297 }
12298
12300 {
12302 }
12303
12305 {
12306 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12307 if (
g_Game.ConfigIsExisting(paramPath))
12308 return g_Game.ConfigGetFloat(paramPath);
12309
12310 return 0.0;
12311 }
12312
12314 {
12315 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12316 if (
g_Game.ConfigIsExisting(paramPath))
12317 return g_Game.ConfigGetFloat(paramPath);
12318
12319 return 0.0;
12320 }
12321
12322 override void SetWet(
float value,
bool allow_client =
false)
12323 {
12324 if (!IsServerCheck(allow_client))
12325 return;
12326
12329
12331
12332 m_VarWet = Math.Clamp(value, min, max);
12333
12335 {
12338 }
12339 }
12340
12341 override void AddWet(
float value)
12342 {
12344 }
12345
12347 {
12349 }
12350
12352 {
12354 }
12355
12357 {
12359 }
12360
12362 {
12364 }
12365
12367 {
12369 }
12370
12371 override void OnWetChanged(
float newVal,
float oldVal)
12372 {
12375 if (newLevel != oldLevel)
12376 {
12378 }
12379 }
12380
12382 {
12383 SetWeightDirty();
12384 }
12385
12387 {
12388 return GetWetLevelInternal(
m_VarWet);
12389 }
12390
12391
12392
12394 {
12396 }
12397
12399 {
12401 }
12402
12404 {
12406 }
12407
12409 {
12411 }
12412
12413
12414
12416 {
12417 if (ConfigIsExisting("itemModelLength"))
12418 {
12419 return ConfigGetFloat("itemModelLength");
12420 }
12421 return 0;
12422 }
12423
12425 {
12426 if (ConfigIsExisting("itemAttachOffset"))
12427 {
12428 return ConfigGetFloat("itemAttachOffset");
12429 }
12430 return 0;
12431 }
12432
12433 override void SetCleanness(
int value,
bool allow_client =
false)
12434 {
12435 if (!IsServerCheck(allow_client))
12436 return;
12437
12439
12441
12444 }
12445
12447 {
12449 }
12450
12452 {
12453 return true;
12454 }
12455
12456
12457
12458
12460 {
12462 }
12463
12465 {
12467 }
12468
12469
12470
12471
12472 override void SetColor(
int r,
int g,
int b,
int a)
12473 {
12479 }
12481 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12482 {
12487 }
12488
12490 {
12492 }
12493
12496 {
12497 int r,g,b,a;
12499 r = r/255;
12500 g = g/255;
12501 b = b/255;
12502 a = a/255;
12503 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12504 }
12505
12506
12507
12508 override void SetLiquidType(
int value,
bool allow_client =
false)
12509 {
12510 if (!IsServerCheck(allow_client))
12511 return;
12512
12517 }
12518
12520 {
12521 return ConfigGetInt("varLiquidTypeInit");
12522 }
12523
12525 {
12527 }
12528
12530 {
12532 SetFrozen(false);
12533 }
12534
12537 {
12538 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12539 }
12540
12541
12544 {
12545 PlayerBase nplayer;
12546 if (PlayerBase.CastTo(nplayer, player))
12547 {
12549 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12550 }
12551 }
12552
12553
12556 {
12557 PlayerBase nplayer;
12558 if (PlayerBase.CastTo(nplayer,player))
12559 {
12560 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12561 }
12562
12563 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12564
12565 if (HasEnergyManager())
12566 {
12567 GetCompEM().UpdatePlugState();
12568 }
12569 }
12570
12571
12573 {
12574 super.OnPlacementStarted(player);
12575
12577 }
12578
12579 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12580 {
12582 {
12583 m_AdminLog.OnPlacementComplete(player,
this);
12584 }
12585
12586 super.OnPlacementComplete(player, position, orientation);
12587 }
12588
12589
12590
12591
12592
12594 {
12596 {
12597 return true;
12598 }
12599 else
12600 {
12601 return false;
12602 }
12603 }
12604
12605
12607 {
12609 {
12611 }
12612 }
12613
12614
12616 {
12618 }
12619
12621 {
12623 }
12624
12625 override void InsertAgent(
int agent,
float count = 1)
12626 {
12627 if (count < 1)
12628 return;
12629
12631 }
12632
12635 {
12637 }
12638
12639
12641 {
12643 }
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12687 {
12689 return false;
12690 return true;
12691 }
12692
12694 {
12695
12697 }
12698
12699
12702 {
12703 super.CheckForRoofLimited(timeTresholdMS);
12704
12705 float time =
g_Game.GetTime();
12706 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12707 {
12708 m_PreviousRoofTestTime = time;
12709 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12710 }
12711 }
12712
12713
12715 {
12717 {
12718 return 0;
12719 }
12720
12721 if (GetInventory().GetAttachmentSlotsCount() != 0)
12722 {
12723 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12724 if (filter)
12725 return filter.GetProtectionLevel(type, false, system);
12726 else
12727 return 0;
12728 }
12729
12730 string subclassPath, entryName;
12731
12732 switch (type)
12733 {
12735 entryName = "biological";
12736 break;
12738 entryName = "chemical";
12739 break;
12740 default:
12741 entryName = "biological";
12742 break;
12743 }
12744
12745 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12746
12747 return g_Game.ConfigGetFloat(subclassPath + entryName);
12748 }
12749
12750
12751
12754 {
12755 if (!IsMagazine())
12757
12759 }
12760
12761
12762
12763
12764
12769 {
12770 return true;
12771 }
12772
12774 {
12776 }
12777
12778
12779
12780
12781
12783 {
12784 if (parent)
12785 {
12786 if (parent.IsInherited(DayZInfected))
12787 return true;
12788
12789 if (!parent.IsRuined())
12790 return true;
12791 }
12792
12793 return true;
12794 }
12795
12797 {
12798 if (!super.CanPutAsAttachment(parent))
12799 {
12800 return false;
12801 }
12802
12803 if (!IsRuined() && !parent.IsRuined())
12804 {
12805 return true;
12806 }
12807
12808 return false;
12809 }
12810
12812 {
12813
12814
12815
12816
12817 return super.CanReceiveItemIntoCargo(item);
12818 }
12819
12821 {
12822
12823
12824
12825
12826 GameInventory attachmentInv = attachment.GetInventory();
12828 {
12829 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12830 return false;
12831 }
12832
12833 InventoryLocation loc = new InventoryLocation();
12834 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12835 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12836 return false;
12837
12838 return super.CanReceiveAttachment(attachment, slotId);
12839 }
12840
12842 {
12843 if (!super.CanReleaseAttachment(attachment))
12844 return false;
12845
12846 return GetInventory().AreChildrenAccessible();
12847 }
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12870 {
12871 int id = muzzle_owner.GetMuzzleID();
12872 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12873
12874 if (WPOF_array)
12875 {
12876 for (int i = 0; i < WPOF_array.Count(); i++)
12877 {
12878 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12879
12880 if (WPOF)
12881 {
12882 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12883 }
12884 }
12885 }
12886 }
12887
12888
12890 {
12891 int id = muzzle_owner.GetMuzzleID();
12893
12894 if (WPOBE_array)
12895 {
12896 for (int i = 0; i < WPOBE_array.Count(); i++)
12897 {
12898 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12899
12900 if (WPOBE)
12901 {
12902 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12903 }
12904 }
12905 }
12906 }
12907
12908
12910 {
12911 int id = muzzle_owner.GetMuzzleID();
12912 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12913
12914 if (WPOOH_array)
12915 {
12916 for (int i = 0; i < WPOOH_array.Count(); i++)
12917 {
12918 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12919
12920 if (WPOOH)
12921 {
12922 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12923 }
12924 }
12925 }
12926 }
12927
12928
12930 {
12931 int id = muzzle_owner.GetMuzzleID();
12932 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12933
12934 if (WPOOH_array)
12935 {
12936 for (int i = 0; i < WPOOH_array.Count(); i++)
12937 {
12938 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12939
12940 if (WPOOH)
12941 {
12942 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12943 }
12944 }
12945 }
12946 }
12947
12948
12950 {
12951 int id = muzzle_owner.GetMuzzleID();
12952 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12953
12954 if (WPOOH_array)
12955 {
12956 for (int i = 0; i < WPOOH_array.Count(); i++)
12957 {
12958 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12959
12960 if (WPOOH)
12961 {
12962 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12963 }
12964 }
12965 }
12966 }
12967
12968
12969
12971 {
12973 {
12974 return true;
12975 }
12976
12977 return false;
12978 }
12979
12981 {
12983 {
12984 return true;
12985 }
12986
12987 return false;
12988 }
12989
12991 {
12993 {
12994 return true;
12995 }
12996
12997 return false;
12998 }
12999
13001 {
13002 return false;
13003 }
13004
13007 {
13008 return UATimeSpent.DEFAULT_DEPLOY;
13009 }
13010
13011
13012
13013
13015 {
13017 SetSynchDirty();
13018 }
13019
13021 {
13023 }
13024
13025
13027 {
13028 return false;
13029 }
13030
13033 {
13034 string att_type = "None";
13035
13036 if (ConfigIsExisting("soundAttType"))
13037 {
13038 att_type = ConfigGetString("soundAttType");
13039 }
13040
13042 }
13043
13045 {
13047 }
13048
13049
13050
13051
13052
13058
13060 {
13063
13065 }
13066
13067
13069 {
13071 return;
13072
13074
13077
13080
13081 SoundParameters params = new SoundParameters();
13085 }
13086
13087
13089 {
13091 {
13094
13095 SetSynchDirty();
13096
13099 }
13100 }
13101
13103 {
13105 }
13106
13107
13109 {
13111 return;
13112
13114 SetSynchDirty();
13115
13118 }
13119
13121 {
13124 }
13125
13127 {
13129 }
13130
13131 void OnApply(PlayerBase player);
13132
13134 {
13135 return 1.0;
13136 };
13137
13139 {
13141 }
13142
13144 {
13146 }
13147
13149
13151 {
13152 SetDynamicPhysicsLifeTime(0.01);
13154 }
13155
13157 {
13158 array<string> zone_names = new array<string>;
13159 GetDamageZones(zone_names);
13160 for (int i = 0; i < zone_names.Count(); i++)
13161 {
13162 SetHealthMax(zone_names.Get(i),"Health");
13163 }
13164 SetHealthMax("","Health");
13165 }
13166
13169 {
13170 float global_health = GetHealth01("","Health");
13171 array<string> zones = new array<string>;
13172 GetDamageZones(zones);
13173
13174 for (int i = 0; i < zones.Count(); i++)
13175 {
13176 SetHealth01(zones.Get(i),"Health",global_health);
13177 }
13178 }
13179
13182 {
13183 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13184 }
13185
13187 {
13188 if (!hasRootAsPlayer)
13189 {
13190 if (refParentIB)
13191 {
13192
13193 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13194 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13195
13196 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13197 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13198
13201 }
13202 else
13203 {
13204
13207 }
13208 }
13209 }
13210
13212 {
13214 {
13215 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13216 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13217 {
13218 float heatPermCoef = 1.0;
13220 while (ent)
13221 {
13222 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13223 ent = ent.GetHierarchyParent();
13224 }
13225
13226 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13227 }
13228 }
13229 }
13230
13232 {
13233
13234 EntityAI parent = GetHierarchyParent();
13235 if (!parent)
13236 {
13237 hasParent = false;
13238 hasRootAsPlayer = false;
13239 }
13240 else
13241 {
13242 hasParent = true;
13243 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13244 refParentIB =
ItemBase.Cast(parent);
13245 }
13246 }
13247
13248 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13249 {
13250
13251 }
13252
13254 {
13255
13256 return false;
13257 }
13258
13260 {
13261
13262
13263 return false;
13264 }
13265
13267 {
13268
13269 return false;
13270 }
13271
13274 {
13275 return !GetIsFrozen() &&
IsOpen();
13276 }
13277
13279 {
13280 bool hasParent = false, hasRootAsPlayer = false;
13282
13283 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13284 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13285
13286 if (wwtu || foodDecay)
13287 {
13291
13292 if (processWetness || processTemperature || processDecay)
13293 {
13295
13296 if (processWetness)
13297 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13298
13299 if (processTemperature)
13301
13302 if (processDecay)
13303 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13304 }
13305 }
13306 }
13307
13310 {
13312 }
13313
13315 {
13318
13319 return super.GetTemperatureFreezeThreshold();
13320 }
13321
13323 {
13326
13327 return super.GetTemperatureThawThreshold();
13328 }
13329
13331 {
13334
13335 return super.GetItemOverheatThreshold();
13336 }
13337
13339 {
13341 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13342
13343 return super.GetTemperatureFreezeTime();
13344 }
13345
13347 {
13349 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13350
13351 return super.GetTemperatureThawTime();
13352 }
13353
13358
13360 {
13361 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13362 }
13363
13365 {
13366 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13367 }
13368
13371 {
13373 }
13374
13376 {
13378 }
13379
13381 {
13383 }
13384
13387 {
13388 return null;
13389 }
13390
13393 {
13394 return false;
13395 }
13396
13398 {
13400 {
13403 if (!trg)
13404 {
13406 explosive = this;
13407 }
13408
13409 explosive.PairRemote(trg);
13411
13412 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13413 trg.SetPersistentPairID(persistentID);
13414 explosive.SetPersistentPairID(persistentID);
13415
13416 return true;
13417 }
13418 return false;
13419 }
13420
13423 {
13424 float ret = 1.0;
13427 ret *= GetHealth01();
13428
13429 return ret;
13430 }
13431
13432 #ifdef DEVELOPER
13433 override void SetDebugItem()
13434 {
13435 super.SetDebugItem();
13436 _itemBase = this;
13437 }
13438
13440 {
13441 string text = super.GetDebugText();
13442
13444 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13445
13446 return text;
13447 }
13448 #endif
13449
13451 {
13452 return true;
13453 }
13454
13456
13458
13460 {
13463 }
13464
13465
13473
13489
13490 [
Obsolete(
"Use ItemSoundHandler instead")]
13493 {
13494 if (!
g_Game.IsDedicatedServer())
13495 {
13496 if (ConfigIsExisting("attachSoundSet"))
13497 {
13498 string cfg_path = "";
13499 string soundset = "";
13500 string type_name =
GetType();
13501
13504 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13505 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13506
13507 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13508 {
13509 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13510 {
13511 if (cfg_slot_array[i] == slot_type)
13512 {
13513 soundset = cfg_soundset_array[i];
13514 break;
13515 }
13516 }
13517 }
13518
13519 if (soundset != "")
13520 {
13521 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13523 }
13524 }
13525 }
13526 }
13527
13529}
13530
13532{
13534 if (entity)
13535 {
13536 bool is_item = entity.IsInherited(
ItemBase);
13537 if (is_item && full_quantity)
13538 {
13541 }
13542 }
13543 else
13544 {
13546 return NULL;
13547 }
13548 return entity;
13549}
13550
13552{
13553 if (item)
13554 {
13555 if (health > 0)
13556 item.SetHealth("", "", health);
13557
13558 if (item.CanHaveTemperature())
13559 {
13561 if (item.CanFreeze())
13562 item.SetFrozen(false);
13563 }
13564
13565 if (item.HasEnergyManager())
13566 {
13567 if (quantity >= 0)
13568 {
13569 item.GetCompEM().SetEnergy0To1(quantity);
13570 }
13571 else
13572 {
13574 }
13575 }
13576 else if (item.IsMagazine())
13577 {
13578 Magazine mag = Magazine.Cast(item);
13579 if (quantity >= 0)
13580 {
13581 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13582 }
13583 else
13584 {
13586 }
13587
13588 }
13589 else
13590 {
13591 if (quantity >= 0)
13592 {
13593 item.SetQuantityNormalized(quantity, false);
13594 }
13595 else
13596 {
13598 }
13599
13600 }
13601 }
13602}
13603
13604#ifdef DEVELOPER
13606#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.