8621{
8623 {
8624 return true;
8625 }
8626};
8627
8629{
8630
8631};
8632
8633
8634
8636{
8640
8642
8645
8646
8647
8648
8649
8658
8664
8669
8674
8695 protected bool m_IsResultOfSplit
8696
8698
8703
8704
8705
8707
8711
8712
8713
8715
8718
8719
8720
8726
8727
8735
8738
8739
8741
8742
8744
8745
8750
8751
8756
8758
8759
8761
8762
8764 {
8769
8770 if (!
g_Game.IsDedicatedServer())
8771 {
8773 {
8775
8777 {
8779 }
8780 }
8781
8784 }
8785
8786 m_OldLocation = null;
8787
8789 {
8791 }
8792
8793 if (ConfigIsExisting("headSelectionsToHide"))
8794 {
8797 }
8798
8800 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8801 {
8803 }
8804
8806
8807 m_IsResultOfSplit = false;
8808
8810 }
8811
8813 {
8814 super.InitItemVariables();
8815
8821 m_Count = ConfigGetInt(
"count");
8822
8825
8830
8833
8838
8850
8854
8855
8858 if (ConfigIsExisting("canBeSplit"))
8859 {
8862 }
8863
8865 if (ConfigIsExisting("itemBehaviour"))
8867
8868
8871 RegisterNetSyncVariableInt("m_VarLiquidType");
8872 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8873
8874 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8875 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8876 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8877
8878 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8879 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8880 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8881 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8882
8883 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8884 RegisterNetSyncVariableBool("m_IsTakeable");
8885 RegisterNetSyncVariableBool("m_IsHologram");
8886
8889 {
8892 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8893 }
8894
8896
8898 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8900
8902 }
8903
8905 {
8907 }
8908
8910 {
8913 {
8918 }
8919 }
8920
8921 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8922 {
8924 {
8927 }
8928
8930 }
8931
8933 {
8939 }
8940
8942
8944 {
8946
8947 if (!action)
8948 {
8949 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8950 return;
8951 }
8952
8954 if (!ai)
8955 {
8957 return;
8958 }
8959
8961 if (!action_array)
8962 {
8963 action_array = new array<ActionBase_Basic>;
8965 }
8966 if (LogManager.IsActionLogEnable())
8967 {
8968 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8969 }
8970
8971 if (action_array.Find(action) != -1)
8972 {
8973 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8974 }
8975 else
8976 {
8977 action_array.Insert(action);
8978 }
8979 }
8980
8982 {
8983 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8984 ActionBase action = player.GetActionManager().GetAction(actionName);
8987
8988 if (action_array)
8989 {
8990 action_array.RemoveItem(action);
8991 }
8992 }
8993
8994
8995
8997 {
8998 ActionOverrideData overrideData = new ActionOverrideData();
9002
9004 if (!actionMap)
9005 {
9008 }
9009
9010 actionMap.Insert(this.
Type(), overrideData);
9011
9012 }
9013
9015
9017
9018
9020 {
9023
9026
9027 string config_to_search = "CfgVehicles";
9028 string muzzle_owner_config;
9029
9031 {
9032 if (IsInherited(Weapon))
9033 config_to_search = "CfgWeapons";
9034
9035 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9036
9037 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9038
9039 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9040
9041 if (config_OnFire_subclass_count > 0)
9042 {
9043 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9044
9045 for (int i = 0; i < config_OnFire_subclass_count; i++)
9046 {
9047 string particle_class = "";
9048 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9049 string config_OnFire_entry = config_OnFire_class + particle_class;
9050 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9051 WPOF_array.Insert(WPOF);
9052 }
9053
9054
9056 }
9057 }
9058
9060 {
9061 config_to_search = "CfgWeapons";
9062 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9063
9064 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9065
9066 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9067
9068 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9069 {
9070 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9071
9072 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9073 {
9074 string particle_class2 = "";
9075 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9076 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9077 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9078 WPOBE_array.Insert(WPOBE);
9079 }
9080
9081
9083 }
9084 }
9085 }
9086
9087
9089 {
9092
9094 {
9095 string config_to_search = "CfgVehicles";
9096
9097 if (IsInherited(Weapon))
9098 config_to_search = "CfgWeapons";
9099
9100 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9101 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9102
9103 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9104 {
9105
9107
9109 {
9111 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9113 return;
9114 }
9115
9118
9119
9120
9121 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9122 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9123
9124 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9125 {
9126 string particle_class = "";
9127 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9128 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9129 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9130
9131 if (entry_type == CT_CLASS)
9132 {
9133 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9134 WPOOH_array.Insert(WPOF);
9135 }
9136 }
9137
9138
9140 }
9141 }
9142 }
9143
9145 {
9147 }
9148
9150 {
9152 {
9154
9157
9160
9161 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9162 }
9163 }
9164
9166 {
9168 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9169
9171 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9172
9174 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9175
9177 {
9179 }
9180 }
9181
9183 {
9185 }
9186
9188 {
9191 else
9193
9195 {
9198 }
9199 else
9200 {
9203
9206 }
9207
9209 }
9210
9212 {
9214 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9215 }
9216
9218 {
9220 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9222 }
9223
9225 {
9227 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9228 }
9229
9231 {
9234
9235 OverheatingParticle OP = new OverheatingParticle();
9240
9242 }
9243
9245 {
9248
9249 return -1;
9250 }
9251
9253 {
9255 {
9258
9259 for (int i = count; i > 0; --i)
9260 {
9261 int id = i - 1;
9264
9267
9268 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9269 {
9270 if (p)
9271 {
9274 }
9275 }
9276 }
9277 }
9278 }
9279
9281 {
9283 {
9285 {
9286 int id = i - 1;
9288
9289 if (OP)
9290 {
9292
9293 if (p)
9294 {
9296 }
9297
9298 delete OP;
9299 }
9300 }
9301
9304 }
9305 }
9306
9309 {
9310 return 0.0;
9311 }
9312
9313
9315 {
9316 return 250;
9317 }
9318
9320 {
9321 return 0;
9322 }
9323
9326 {
9328 return true;
9329
9330 return false;
9331 }
9332
9335 {
9338
9340 {
9342 }
9343 else
9344 {
9345
9347 }
9348
9350 }
9351
9358 {
9359 return -1;
9360 }
9361
9362
9363
9364
9366 {
9368 {
9369 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9370 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9371
9372 if (r_index >= 0)
9373 {
9374 InventoryLocation r_il = new InventoryLocation;
9375 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9376
9377 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9380 {
9381 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9382 }
9384 {
9385 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9386 }
9387
9388 }
9389
9390 player.GetHumanInventory().ClearUserReservedLocation(this);
9391 }
9392
9395 }
9396
9397
9398
9399
9401 {
9402 return ItemBase.m_DebugActionsMask;
9403 }
9404
9406 {
9407 return ItemBase.m_DebugActionsMask & mask;
9408 }
9409
9411 {
9412 ItemBase.m_DebugActionsMask = mask;
9413 }
9414
9416 {
9417 ItemBase.m_DebugActionsMask |= mask;
9418 }
9419
9421 {
9422 ItemBase.m_DebugActionsMask &= ~mask;
9423 }
9424
9426 {
9428 {
9430 }
9431 else
9432 {
9434 }
9435 }
9436
9437
9439 {
9440 if (GetEconomyProfile())
9441 {
9442 float q_max = GetEconomyProfile().GetQuantityMax();
9443 if (q_max > 0)
9444 {
9445 float q_min = GetEconomyProfile().GetQuantityMin();
9446 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9447
9449 {
9450 ComponentEnergyManager comp = GetCompEM();
9452 {
9454 }
9455 }
9457 {
9459
9460 }
9461
9462 }
9463 }
9464 }
9465
9468 {
9469 EntityAI parent = GetHierarchyParent();
9470
9471 if (parent)
9472 {
9473 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9474 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9475 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9476 }
9477 }
9478
9481 {
9482 EntityAI parent = GetHierarchyParent();
9483
9484 if (parent)
9485 {
9486 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9487 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9488 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9489 }
9490 }
9491
9493 {
9494
9495
9496
9497
9499
9501 {
9502 if (ScriptInputUserData.CanStoreInputUserData())
9503 {
9504 ScriptInputUserData ctx = new ScriptInputUserData;
9510 ctx.
Write(use_stack_max);
9513
9515 {
9516 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9517 }
9518 }
9519 }
9520 else if (!
g_Game.IsMultiplayer())
9521 {
9523 }
9524 }
9525
9527 {
9529 }
9530
9532 {
9534 }
9535
9537 {
9539 }
9540
9542 {
9543
9544 return false;
9545 }
9546
9548 {
9549 return false;
9550 }
9551
9555 {
9556 return false;
9557 }
9558
9560 {
9561 return "";
9562 }
9563
9565
9567 {
9568 return false;
9569 }
9570
9572 {
9573 return true;
9574 }
9575
9576
9577
9579 {
9580 return true;
9581 }
9582
9584 {
9585 return true;
9586 }
9587
9589 {
9590 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9592 }
9593
9595 {
9597 }
9598
9600 {
9602 if (!is_being_placed)
9604 SetSynchDirty();
9605 }
9606
9607
9609
9611 {
9613 }
9614
9616 {
9618 }
9619
9621 {
9622 return 1;
9623 }
9624
9626 {
9627 return false;
9628 }
9629
9631 {
9633 SetSynchDirty();
9634 }
9635
9636
9637
9638
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
9671 {
9672 super.OnMovedInsideCargo(container);
9673
9674 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9675 }
9676
9677 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9678 {
9679 super.EEItemLocationChanged(oldLoc, newLoc);
9680
9681 PlayerBase newPlayer = null;
9682 PlayerBase oldPlayer = null;
9683
9684 if (newLoc.GetParent())
9685 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9686
9687 if (oldLoc.GetParent())
9688 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9689
9691 {
9692 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9693
9694 if (rIndex >= 0)
9695 {
9696 InventoryLocation rIl = new InventoryLocation;
9697 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9698
9699 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9702 {
9703 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9704 }
9706 {
9708 }
9709
9710 }
9711 }
9712
9714 {
9715 if (newPlayer)
9716 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9717
9718 if (newPlayer == oldPlayer)
9719 {
9720 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9721 {
9723 {
9724 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9725 {
9726 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9727 }
9728 }
9729 else
9730 {
9731 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9732 }
9733 }
9734
9735 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9736 {
9737 int type = oldLoc.GetType();
9739 {
9740 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9741 }
9743 {
9744 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9745 }
9746 }
9747 if (!m_OldLocation)
9748 {
9749 m_OldLocation = new InventoryLocation;
9750 }
9751 m_OldLocation.Copy(oldLoc);
9752 }
9753 else
9754 {
9755 if (m_OldLocation)
9756 {
9757 m_OldLocation.Reset();
9758 }
9759 }
9760
9761 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9762 }
9763 else
9764 {
9765 if (newPlayer)
9766 {
9767 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9768 if (resIndex >= 0)
9769 {
9770 InventoryLocation il = new InventoryLocation;
9771 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9773 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9776 {
9777 il.
GetParent().GetOnReleaseLock().Invoke(it);
9778 }
9780 {
9782 }
9783
9784 }
9785 }
9787 {
9788
9790 }
9791
9792 if (m_OldLocation)
9793 {
9794 m_OldLocation.Reset();
9795 }
9796 }
9797
9799 {
9800 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9801 }
9802
9804 {
9805 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9806 }
9807 }
9808
9809 override void EOnContact(IEntity other, Contact extra)
9810 {
9812 {
9813 int liquidType = -1;
9815 if (impactSpeed > 0.0)
9816 {
9818 #ifndef SERVER
9820 #else
9822 SetSynchDirty();
9823 #endif
9825 }
9826 }
9827
9828 #ifdef SERVER
9829 if (GetCompEM() && GetCompEM().IsPlugged())
9830 {
9831 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9832 GetCompEM().UnplugThis();
9833 }
9834 #endif
9835 }
9836
9838
9840 {
9842 }
9843
9845 {
9846
9847 }
9848
9850 {
9851 super.OnItemLocationChanged(old_owner, new_owner);
9852
9853 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9854 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9855
9856 if (!relatedPlayer && playerNew)
9857 relatedPlayer = playerNew;
9858
9859 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9860 {
9862 if (actionMgr)
9863 {
9864 ActionBase currentAction = actionMgr.GetRunningAction();
9865 if (currentAction)
9867 }
9868 }
9869
9870 Man ownerPlayerOld = null;
9871 Man ownerPlayerNew = null;
9872
9873 if (old_owner)
9874 {
9875 if (old_owner.
IsMan())
9876 {
9877 ownerPlayerOld = Man.Cast(old_owner);
9878 }
9879 else
9880 {
9881 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9882 }
9883 }
9884 else
9885 {
9887 {
9889
9890 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9891 {
9892 GetCompEM().UnplugThis();
9893 }
9894 }
9895 }
9896
9897 if (new_owner)
9898 {
9899 if (new_owner.
IsMan())
9900 {
9901 ownerPlayerNew = Man.Cast(new_owner);
9902 }
9903 else
9904 {
9905 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9906 }
9907 }
9908
9909 if (ownerPlayerOld != ownerPlayerNew)
9910 {
9911 if (ownerPlayerOld)
9912 {
9913 array<EntityAI> subItemsExit = new array<EntityAI>;
9915 for (int i = 0; i < subItemsExit.Count(); i++)
9916 {
9919 }
9920 }
9921
9922 if (ownerPlayerNew)
9923 {
9924 array<EntityAI> subItemsEnter = new array<EntityAI>;
9926 for (int j = 0; j < subItemsEnter.Count(); j++)
9927 {
9930 }
9931 }
9932 }
9933 else if (ownerPlayerNew != null)
9934 {
9935 PlayerBase nplayer;
9936 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9937 {
9938 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9940 for (int k = 0; k < subItemsUpdate.Count(); k++)
9941 {
9943 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9944 }
9945 }
9946 }
9947
9948 if (old_owner)
9949 old_owner.OnChildItemRemoved(this);
9950 if (new_owner)
9951 new_owner.OnChildItemReceived(this);
9952 }
9953
9954
9956 {
9957 super.EEDelete(parent);
9958 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9959 if (player)
9960 {
9962
9963 if (player.IsAlive())
9964 {
9965 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9966 if (r_index >= 0)
9967 {
9968 InventoryLocation r_il = new InventoryLocation;
9969 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9970
9971 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9974 {
9975 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9976 }
9978 {
9979 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9980 }
9981
9982 }
9983
9984 player.RemoveQuickBarEntityShortcut(this);
9985 }
9986 }
9987 }
9988
9990 {
9991 super.EEKilled(killer);
9992
9995 {
9996 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9997 {
9998 if (IsMagazine())
9999 {
10000 if (Magazine.Cast(this).GetAmmoCount() > 0)
10001 {
10003 }
10004 }
10005 else
10006 {
10008 }
10009 }
10010 }
10011 }
10012
10014 {
10015 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10016
10017 super.OnWasAttached(parent, slot_id);
10018
10021
10024 }
10025
10027 {
10028 super.OnWasDetached(parent, slot_id);
10029
10032
10035 }
10036
10038 {
10039 int idx;
10042
10043 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10044 if (inventory_slots.Count() < 1)
10045 {
10046 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10047 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10048 }
10049 else
10050 {
10051 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10052 }
10053
10054 idx = inventory_slots.Find(slot);
10055 if (idx < 0)
10056 return "";
10057
10058 return attach_types.Get(idx);
10059 }
10060
10062 {
10063 int idx = -1;
10064 string slot;
10065
10068
10069 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10070 if (inventory_slots.Count() < 1)
10071 {
10072 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10073 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10074 }
10075 else
10076 {
10077 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10078 if (detach_types.Count() < 1)
10079 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10080 }
10081
10082 for (int i = 0; i < inventory_slots.Count(); i++)
10083 {
10084 slot = inventory_slots.Get(i);
10085 }
10086
10087 if (slot != "")
10088 {
10089 if (detach_types.Count() == 1)
10090 idx = 0;
10091 else
10092 idx = inventory_slots.Find(slot);
10093 }
10094 if (idx < 0)
10095 return "";
10096
10097 return detach_types.Get(idx);
10098 }
10099
10101 {
10102
10104
10105
10106 float min_time = 1;
10107 float max_time = 3;
10108 float delay = Math.RandomFloat(min_time, max_time);
10109
10110 explode_timer.Run(delay, this, "DoAmmoExplosion");
10111 }
10112
10114 {
10115 Magazine magazine = Magazine.Cast(this);
10116 int pop_sounds_count = 6;
10117 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10118
10119
10120 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10121 string sound_name = pop_sounds[ sound_idx ];
10122 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10123
10124
10125 magazine.ServerAddAmmoCount(-1);
10126
10127
10128 float min_temp_to_explode = 100;
10129
10130 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10131 {
10133 }
10134 }
10135
10136
10137 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10138 {
10139 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10140
10141 const int CHANCE_DAMAGE_CARGO = 4;
10142 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10143 const int CHANCE_DAMAGE_NOTHING = 2;
10144
10146 {
10147 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10148 int chances;
10149 int rnd;
10150
10151 if (GetInventory().GetCargo())
10152 {
10153 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10154 rnd = Math.RandomInt(0,chances);
10155
10156 if (rnd < CHANCE_DAMAGE_CARGO)
10157 {
10159 }
10160 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10161 {
10163 }
10164 }
10165 else
10166 {
10167 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10168 rnd = Math.RandomInt(0,chances);
10169
10170 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10171 {
10173 }
10174 }
10175 }
10176 }
10177
10179 {
10180 CargoBase cargo = GetInventory().GetCargo();
10181 if (cargo)
10182 {
10184 if (item_count > 0)
10185 {
10186 int random_pick = Math.RandomInt(0, item_count);
10188 if (!item.IsExplosive())
10189 {
10190 item.AddHealth("","",damage);
10191 return true;
10192 }
10193 }
10194 }
10195 return false;
10196 }
10197
10199 {
10200 GameInventory inventory = GetInventory();
10202 if (attachment_count > 0)
10203 {
10204 int random_pick = Math.RandomInt(0, attachment_count);
10206 if (!attachment.IsExplosive())
10207 {
10208 attachment.AddHealth("","",damage);
10209 return true;
10210 }
10211 }
10212 return false;
10213 }
10214
10216 {
10218 }
10219
10221 {
10223 return GetInventory().CanRemoveEntity();
10224
10225 return false;
10226 }
10227
10229 {
10230
10232 return false;
10233
10234
10236 return false;
10237
10238
10239
10241 if (delta == 0)
10242 return false;
10243
10244
10245 return true;
10246 }
10247
10249 {
10251 {
10252 if (ScriptInputUserData.CanStoreInputUserData())
10253 {
10254 ScriptInputUserData ctx = new ScriptInputUserData;
10259 ctx.
Write(destination_entity);
10261 ctx.
Write(slot_id);
10263 }
10264 }
10265 else if (!
g_Game.IsMultiplayer())
10266 {
10268 }
10269 }
10270
10272 {
10273 float split_quantity_new;
10277 InventoryLocation loc = new InventoryLocation;
10278
10279 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10280 {
10282 split_quantity_new = stack_max;
10283 else
10285
10287 {
10288 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10289 if (new_item)
10290 {
10291 new_item.SetResultOfSplit(true);
10292 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10294 new_item.
SetQuantity(split_quantity_new,
false,
true);
10295 }
10296 }
10297 }
10298 else if (destination_entity && slot_id == -1)
10299 {
10300 if (quantity > stack_max)
10301 split_quantity_new = stack_max;
10302 else
10303 split_quantity_new = quantity;
10304
10306 {
10307 GameInventory destinationInventory = destination_entity.GetInventory();
10309 {
10312 }
10313
10314 if (new_item)
10315 {
10316 new_item.SetResultOfSplit(true);
10317 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10319 new_item.
SetQuantity(split_quantity_new,
false,
true);
10320 }
10321 }
10322 }
10323 else
10324 {
10325 if (stack_max != 0)
10326 {
10328 {
10330 }
10331
10332 if (split_quantity_new == 0)
10333 {
10334 if (!
g_Game.IsMultiplayer())
10335 player.PhysicalPredictiveDropItem(this);
10336 else
10337 player.ServerDropEntity(this);
10338 return;
10339 }
10340
10342 {
10344
10345 if (new_item)
10346 {
10347 new_item.SetResultOfSplit(true);
10348 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10351 new_item.PlaceOnSurface();
10352 }
10353 }
10354 }
10355 }
10356 }
10357
10359 {
10360 float split_quantity_new;
10364 InventoryLocation loc = new InventoryLocation;
10365
10366 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10367 {
10369 split_quantity_new = stack_max;
10370 else
10372
10374 {
10375 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10376 if (new_item)
10377 {
10378 new_item.SetResultOfSplit(true);
10379 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10381 new_item.
SetQuantity(split_quantity_new,
false,
true);
10382 }
10383 }
10384 }
10385 else if (destination_entity && slot_id == -1)
10386 {
10387 if (quantity > stack_max)
10388 split_quantity_new = stack_max;
10389 else
10390 split_quantity_new = quantity;
10391
10393 {
10394 GameInventory destinationInventory = destination_entity.GetInventory();
10396 {
10399 }
10400
10401 if (new_item)
10402 {
10403 new_item.SetResultOfSplit(true);
10404 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10406 new_item.
SetQuantity(split_quantity_new,
false,
true);
10407 }
10408 }
10409 }
10410 else
10411 {
10412 if (stack_max != 0)
10413 {
10415 {
10417 }
10418
10420 {
10422
10423 if (new_item)
10424 {
10425 new_item.SetResultOfSplit(true);
10426 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10429 new_item.PlaceOnSurface();
10430 }
10431 }
10432 }
10433 }
10434 }
10435
10437 {
10439 {
10440 if (ScriptInputUserData.CanStoreInputUserData())
10441 {
10442 ScriptInputUserData ctx = new ScriptInputUserData;
10447 dst.WriteToContext(ctx);
10449 }
10450 }
10451 else if (!
g_Game.IsMultiplayer())
10452 {
10454 }
10455 }
10456
10458 {
10460 {
10461 if (ScriptInputUserData.CanStoreInputUserData())
10462 {
10463 ScriptInputUserData ctx = new ScriptInputUserData;
10468 ctx.
Write(destination_entity);
10474 }
10475 }
10476 else if (!
g_Game.IsMultiplayer())
10477 {
10479 }
10480 }
10481
10483 {
10485 }
10486
10488 {
10490 float split_quantity_new;
10492 if (dst.IsValid())
10493 {
10494 int slot_id = dst.GetSlot();
10496
10497 if (quantity > stack_max)
10498 split_quantity_new = stack_max;
10499 else
10500 split_quantity_new = quantity;
10501
10503 {
10505
10506 if (new_item)
10507 {
10508 new_item.SetResultOfSplit(true);
10509 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10511 new_item.
SetQuantity(split_quantity_new,
false,
true);
10512 }
10513
10514 return new_item;
10515 }
10516 }
10517
10518 return null;
10519 }
10520
10522 {
10524 float split_quantity_new;
10526 if (destination_entity)
10527 {
10529 if (quantity > stackable)
10530 split_quantity_new = stackable;
10531 else
10532 split_quantity_new = quantity;
10533
10535 {
10536 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10537 if (new_item)
10538 {
10539 new_item.SetResultOfSplit(true);
10540 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10542 new_item.
SetQuantity(split_quantity_new,
false,
true);
10543 }
10544 }
10545 }
10546 }
10547
10549 {
10551 {
10552 if (ScriptInputUserData.CanStoreInputUserData())
10553 {
10554 ScriptInputUserData ctx = new ScriptInputUserData;
10559 ItemBase destination_entity =
this;
10560 ctx.
Write(destination_entity);
10564 }
10565 }
10566 else if (!
g_Game.IsMultiplayer())
10567 {
10569 }
10570 }
10571
10573 {
10575 float split_quantity_new;
10577 if (player)
10578 {
10580 if (quantity > stackable)
10581 split_quantity_new = stackable;
10582 else
10583 split_quantity_new = quantity;
10584
10586 {
10587 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10588 new_item =
ItemBase.Cast(in_hands);
10589 if (new_item)
10590 {
10591 new_item.SetResultOfSplit(true);
10592 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10594 new_item.SetQuantity(split_quantity_new, false, true);
10595 }
10596 }
10597 }
10598 }
10599
10601 {
10603 float split_quantity_new = Math.Floor(quantity * 0.5);
10604
10606 return;
10607
10609
10610 if (new_item)
10611 {
10612 if (new_item.GetQuantityMax() < split_quantity_new)
10613 {
10614 split_quantity_new = new_item.GetQuantityMax();
10615 }
10616
10617 new_item.SetResultOfSplit(true);
10618 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10619
10621 {
10624 }
10625 else
10626 {
10628 new_item.
SetQuantity(split_quantity_new,
false,
true);
10629 }
10630 }
10631 }
10632
10634 {
10636 float split_quantity_new = Math.Floor(quantity / 2);
10637
10639 return;
10640
10641 InventoryLocation invloc = new InventoryLocation;
10643
10645 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10646
10647 if (new_item)
10648 {
10649 if (new_item.GetQuantityMax() < split_quantity_new)
10650 {
10651 split_quantity_new = new_item.GetQuantityMax();
10652 }
10654 {
10657 }
10658 else if (split_quantity_new > 1)
10659 {
10661 new_item.
SetQuantity(split_quantity_new,
false,
true);
10662 }
10663 }
10664 }
10665
10668 {
10669 SetWeightDirty();
10671
10672 if (parent)
10673 parent.OnAttachmentQuantityChangedEx(this, delta);
10674
10676 {
10678 {
10680 }
10682 {
10683 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10685 }
10686 }
10687 }
10688
10691 {
10692
10693 }
10694
10697 {
10699 }
10700
10702 {
10703 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10704
10706 {
10707 if (newLevel == GameConstants.STATE_RUINED)
10708 {
10710 EntityAI parent = GetHierarchyParent();
10711 if (parent && parent.IsFireplace())
10712 {
10713 CargoBase cargo = GetInventory().GetCargo();
10714 if (cargo)
10715 {
10717 {
10719 }
10720 }
10721 }
10722 }
10723
10725 {
10726
10728 return;
10729 }
10730
10731 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10732 {
10734 }
10735 }
10736 }
10737
10738
10740 {
10741 super.OnRightClick();
10742
10744 {
10746 {
10747 if (ScriptInputUserData.CanStoreInputUserData())
10748 {
10749 EntityAI root = GetHierarchyRoot();
10750 Man playerOwner = GetHierarchyRootPlayer();
10751 InventoryLocation dst = new InventoryLocation;
10752
10753
10754 if (!playerOwner && root && root == this)
10755 {
10757 }
10758 else
10759 {
10760
10761 GetInventory().GetCurrentInventoryLocation(dst);
10763 {
10764 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10766 {
10768 }
10769 else
10770 {
10772
10773
10774 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10775 {
10777 }
10778 else
10779 {
10780 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10781 }
10782 }
10783 }
10784 }
10785
10786 ScriptInputUserData ctx = new ScriptInputUserData;
10794 }
10795 }
10796 else if (!
g_Game.IsMultiplayer())
10797 {
10799 }
10800 }
10801 }
10802
10804 {
10805 if (root)
10806 {
10807 vector m4[4];
10808 root.GetTransform(m4);
10809 dst.SetGround(this, m4);
10810 }
10811 else
10812 {
10813 GetInventory().GetCurrentInventoryLocation(dst);
10814 }
10815 }
10816
10817 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10818 {
10819
10820 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10821 return false;
10822
10823 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10824 return false;
10825
10826
10828 return false;
10829
10830
10831 Magazine mag = Magazine.Cast(this);
10832 if (mag)
10833 {
10834 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10835 return false;
10836
10837 if (stack_max_limit)
10838 {
10839 Magazine other_mag = Magazine.Cast(other_item);
10840 if (other_item)
10841 {
10842 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10843 return false;
10844 }
10845
10846 }
10847 }
10848 else
10849 {
10850
10852 return false;
10853
10855 return false;
10856 }
10857
10858 PlayerBase player = null;
10859 if (CastTo(player, GetHierarchyRootPlayer()))
10860 {
10861 if (player.GetInventory().HasAttachment(this))
10862 return false;
10863
10864 if (player.IsItemsToDelete())
10865 return false;
10866 }
10867
10868 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10869 return false;
10870
10871 int slotID;
10873 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10874 return false;
10875
10876 return true;
10877 }
10878
10880 {
10882 }
10883
10885 {
10886 return m_IsResultOfSplit;
10887 }
10888
10890 {
10891 m_IsResultOfSplit = value;
10892 }
10893
10895 {
10897 }
10898
10900 {
10901 float other_item_quantity = other_item.GetQuantity();
10902 float this_free_space;
10903
10905
10907
10908 if (other_item_quantity > this_free_space)
10909 {
10910 return this_free_space;
10911 }
10912 else
10913 {
10914 return other_item_quantity;
10915 }
10916 }
10917
10919 {
10921 }
10922
10924 {
10926 return;
10927
10928 if (!IsMagazine() && other_item)
10929 {
10931 if (quantity_used != 0)
10932 {
10933 float hp1 = GetHealth01("","");
10934 float hp2 = other_item.GetHealth01("","");
10935 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10936 hpResult = hpResult / (
GetQuantity() + quantity_used);
10937
10938 hpResult *= GetMaxHealth();
10939 Math.Round(hpResult);
10940 SetHealth("", "Health", hpResult);
10941
10943 other_item.AddQuantity(-quantity_used);
10944 }
10945 }
10947 }
10948
10950 {
10951 #ifdef SERVER
10952 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10953 GetHierarchyParent().IncreaseLifetimeUp();
10954 #endif
10955 };
10956
10958 {
10959 PlayerBase p = PlayerBase.Cast(player);
10960
10961 array<int> recipesIds = p.m_Recipes;
10962 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10963 if (moduleRecipesManager)
10964 {
10965 EntityAI itemInHands = player.GetEntityInHands();
10966 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10967 }
10968
10969 for (int i = 0;i < recipesIds.Count(); i++)
10970 {
10971 int key = recipesIds.Get(i);
10972 string recipeName = moduleRecipesManager.GetRecipeName(key);
10974 }
10975 }
10976
10977
10978 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10979 {
10980 super.GetDebugActions(outputList);
10981
10982
10988
10989
10994
10999
11000
11004
11005
11007 {
11011 }
11012
11015
11016
11020
11022
11023 InventoryLocation loc = new InventoryLocation();
11024 GetInventory().GetCurrentInventoryLocation(loc);
11026 {
11027 if (Gizmo_IsSupported())
11030 }
11031
11033 }
11034
11035
11036
11037
11039 {
11040 super.OnAction(action_id, player, ctx);
11041
11043 {
11044 switch (action_id)
11045 {
11049 return true;
11053 return true;
11054 }
11055 }
11056
11058 {
11059 switch (action_id)
11060 {
11062 Delete();
11063 return true;
11064 }
11065 }
11066
11067 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11068 {
11069 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11070 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11071 PlayerBase p = PlayerBase.Cast(player);
11072 if (
EActions.RECIPES_RANGE_START < 1000)
11073 {
11074 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11075 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11076 }
11077 }
11078 #ifndef SERVER
11079 else if (action_id ==
EActions.WATCH_PLAYER)
11080 {
11081 PluginDeveloper.SetDeveloperItemClientEx(player);
11082 }
11083 #endif
11085 {
11086 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11087 {
11088 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11089 OnDebugButtonPressServer(id + 1);
11090 }
11091
11092 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11093 {
11094 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11096 }
11097
11098 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11099 {
11100 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11102 }
11103
11104 else if (action_id ==
EActions.ADD_QUANTITY)
11105 {
11106 if (IsMagazine())
11107 {
11108 Magazine mag = Magazine.Cast(this);
11109 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11110 }
11111 else
11112 {
11114 }
11115
11116 if (m_EM)
11117 {
11118 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11119 }
11120
11121 }
11122
11123 else if (action_id ==
EActions.REMOVE_QUANTITY)
11124 {
11125 if (IsMagazine())
11126 {
11127 Magazine mag2 = Magazine.Cast(this);
11128 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11129 }
11130 else
11131 {
11133 }
11134 if (m_EM)
11135 {
11136 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11137 }
11138
11139 }
11140
11141 else if (action_id ==
EActions.SET_QUANTITY_0)
11142 {
11144
11145 if (m_EM)
11146 {
11147 m_EM.SetEnergy(0);
11148 }
11149 }
11150
11151 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11152 {
11154
11155 if (m_EM)
11156 {
11157 m_EM.SetEnergy(m_EM.GetEnergyMax());
11158 }
11159 }
11160
11161 else if (action_id ==
EActions.ADD_HEALTH)
11162 {
11163 AddHealth("","",GetMaxHealth("","Health")/5);
11164 }
11165 else if (action_id ==
EActions.REMOVE_HEALTH)
11166 {
11167 AddHealth("","",-GetMaxHealth("","Health")/5);
11168 }
11169 else if (action_id ==
EActions.DESTROY_HEALTH)
11170 {
11171 SetHealth01("","",0);
11172 }
11173 else if (action_id ==
EActions.WATCH_ITEM)
11174 {
11176 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11177 #ifdef DEVELOPER
11178 SetDebugDeveloper_item(this);
11179 #endif
11180 }
11181
11182 else if (action_id ==
EActions.ADD_TEMPERATURE)
11183 {
11184 AddTemperature(20);
11185
11186 }
11187
11188 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11189 {
11190 AddTemperature(-20);
11191
11192 }
11193
11194 else if (action_id ==
EActions.FLIP_FROZEN)
11195 {
11196 SetFrozen(!GetIsFrozen());
11197
11198 }
11199
11200 else if (action_id ==
EActions.ADD_WETNESS)
11201 {
11203
11204 }
11205
11206 else if (action_id ==
EActions.REMOVE_WETNESS)
11207 {
11209
11210 }
11211
11212 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11213 {
11216
11217
11218 }
11219
11220 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11221 {
11224 }
11225
11226 else if (action_id ==
EActions.MAKE_SPECIAL)
11227 {
11228 auto debugParams = DebugSpawnParams.WithPlayer(player);
11229 OnDebugSpawnEx(debugParams);
11230 }
11231
11232 }
11233
11234
11235 return false;
11236 }
11237
11238
11239
11240
11244
11247
11248
11249
11251 {
11252 return false;
11253 }
11254
11255
11257 {
11258 return true;
11259 }
11260
11261
11263 {
11264 return true;
11265 }
11266
11267
11268
11270 {
11271 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11272 return g_Game.ConfigIsExisting(config_path);
11273 }
11274
11277 {
11278 return null;
11279 }
11280
11282 {
11283 return false;
11284 }
11285
11287 {
11288 return false;
11289 }
11290
11294
11295
11297 {
11298 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11299 return module_repairing.CanRepair(this, item_repair_kit);
11300 }
11301
11302
11303 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11304 {
11305 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11306 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11307 }
11308
11309
11311 {
11312
11313
11314
11315
11316
11317
11318
11319
11320 return 1;
11321 }
11322
11323
11324
11326 {
11328 }
11329
11330
11331
11333 {
11335 }
11336
11337
11346 {
11347 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11348
11349 if (player)
11350 {
11351 player.MessageStatus(text);
11352 }
11353 }
11354
11355
11364 {
11365 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11366
11367 if (player)
11368 {
11369 player.MessageAction(text);
11370 }
11371 }
11372
11373
11382 {
11383 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11384
11385 if (player)
11386 {
11387 player.MessageFriendly(text);
11388 }
11389 }
11390
11391
11400 {
11401 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11402
11403 if (player)
11404 {
11405 player.MessageImportant(text);
11406 }
11407 }
11408
11410 {
11411 return true;
11412 }
11413
11414
11415 override bool KindOf(
string tag)
11416 {
11417 bool found = false;
11418 string item_name = this.
GetType();
11420 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11421
11422 int array_size = item_tag_array.Count();
11423 for (int i = 0; i < array_size; i++)
11424 {
11425 if (item_tag_array.Get(i) == tag)
11426 {
11427 found = true;
11428 break;
11429 }
11430 }
11431 return found;
11432 }
11433
11434
11436 {
11437
11438 super.OnRPC(sender, rpc_type,ctx);
11439
11440
11441 switch (rpc_type)
11442 {
11443 #ifndef SERVER
11444 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11445 Param2<bool, string> p = new Param2<bool, string>(false, "");
11446
11448 return;
11449
11450 bool play = p.param1;
11451 string soundSet = p.param2;
11452
11453 if (play)
11454 {
11456 {
11458 {
11460 }
11461 }
11462 else
11463 {
11465 }
11466 }
11467 else
11468 {
11470 }
11471
11472 break;
11473 #endif
11474
11475 }
11476
11478 {
11480 }
11481 }
11482
11483
11484
11485
11487 {
11488 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11489 return plugin.GetID(
name);
11490 }
11491
11493 {
11494 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11495 return plugin.GetName(id);
11496 }
11497
11500 {
11501
11502
11503 int varFlags;
11504 if (!ctx.
Read(varFlags))
11505 return;
11506
11507 if (varFlags & ItemVariableFlags.FLOAT)
11508 {
11510 }
11511 }
11512
11514 {
11515
11516 super.SerializeNumericalVars(floats_out);
11517
11518
11519
11521 {
11523 }
11524
11526 {
11528 }
11529
11531 {
11533 }
11534
11536 {
11541 }
11542
11544 {
11546 }
11547 }
11548
11550 {
11551
11552 super.DeSerializeNumericalVars(floats);
11553
11554
11555 int index = 0;
11556 int mask = Math.Round(floats.Get(index));
11557
11558 index++;
11559
11561 {
11563 {
11565 }
11566 else
11567 {
11568 float quantity = floats.Get(index);
11569 SetQuantity(quantity,
true,
false,
false,
false);
11570 }
11571 index++;
11572 }
11573
11575 {
11576 float wet = floats.Get(index);
11578 index++;
11579 }
11580
11582 {
11583 int liquidtype = Math.Round(floats.Get(index));
11585 index++;
11586 }
11587
11589 {
11591 index++;
11593 index++;
11595 index++;
11597 index++;
11598 }
11599
11601 {
11602 int cleanness = Math.Round(floats.Get(index));
11604 index++;
11605 }
11606 }
11607
11609 {
11610 super.WriteVarsToCTX(ctx);
11611
11612
11614 {
11616 }
11617
11619 {
11621 }
11622
11624 {
11626 }
11627
11629 {
11630 int r,g,b,a;
11636 }
11637
11639 {
11641 }
11642 }
11643
11645 {
11646 if (!super.ReadVarsFromCTX(ctx,version))
11647 return false;
11648
11649 int intValue;
11650 float value;
11651
11652 if (version < 140)
11653 {
11654 if (!ctx.
Read(intValue))
11655 return false;
11656
11657 m_VariablesMask = intValue;
11658 }
11659
11661 {
11662 if (!ctx.
Read(value))
11663 return false;
11664
11666 {
11668 }
11669 else
11670 {
11672 }
11673 }
11674
11675 if (version < 140)
11676 {
11678 {
11679 if (!ctx.
Read(value))
11680 return false;
11681 SetTemperatureDirect(value);
11682 }
11683 }
11684
11686 {
11687 if (!ctx.
Read(value))
11688 return false;
11690 }
11691
11693 {
11694 if (!ctx.
Read(intValue))
11695 return false;
11697 }
11698
11700 {
11701 int r,g,b,a;
11703 return false;
11705 return false;
11707 return false;
11709 return false;
11710
11712 }
11713
11715 {
11716 if (!ctx.
Read(intValue))
11717 return false;
11719 }
11720
11721 if (version >= 138 && version < 140)
11722 {
11724 {
11725 if (!ctx.
Read(intValue))
11726 return false;
11727 SetFrozen(intValue);
11728 }
11729 }
11730
11731 return true;
11732 }
11733
11734
11736 {
11739 {
11741 }
11742
11743 if (!super.OnStoreLoad(ctx, version))
11744 {
11746 return false;
11747 }
11748
11749 if (version >= 114)
11750 {
11751 bool hasQuickBarIndexSaved;
11752
11753 if (!ctx.
Read(hasQuickBarIndexSaved))
11754 {
11756 return false;
11757 }
11758
11759 if (hasQuickBarIndexSaved)
11760 {
11761 int itmQBIndex;
11762
11763
11764 if (!ctx.
Read(itmQBIndex))
11765 {
11767 return false;
11768 }
11769
11770 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11771 if (itmQBIndex != -1 && parentPlayer)
11772 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11773 }
11774 }
11775 else
11776 {
11777
11778 PlayerBase player;
11779 int itemQBIndex;
11780 if (version ==
int.
MAX)
11781 {
11782 if (!ctx.
Read(itemQBIndex))
11783 {
11785 return false;
11786 }
11787 }
11788 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11789 {
11790
11791 if (!ctx.
Read(itemQBIndex))
11792 {
11794 return false;
11795 }
11796 if (itemQBIndex != -1 && player)
11797 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11798 }
11799 }
11800
11801 if (version < 140)
11802 {
11803
11804 if (!LoadVariables(ctx, version))
11805 {
11807 return false;
11808 }
11809 }
11810
11811
11813 {
11815 return false;
11816 }
11817 if (version >= 132)
11818 {
11820 if (raib)
11821 {
11823 {
11825 return false;
11826 }
11827 }
11828 }
11829
11831 return true;
11832 }
11833
11834
11835
11837 {
11838 super.OnStoreSave(ctx);
11839
11840 PlayerBase player;
11841 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11842 {
11844
11845 int itemQBIndex = -1;
11846 itemQBIndex = player.FindQuickBarEntityIndex(this);
11847 ctx.
Write(itemQBIndex);
11848 }
11849 else
11850 {
11852 }
11853
11855
11857 if (raib)
11858 {
11860 }
11861 }
11862
11863
11865 {
11866 super.AfterStoreLoad();
11867
11869 {
11871 }
11872
11874 {
11877 }
11878 }
11879
11881 {
11882 super.EEOnAfterLoad();
11883
11885 {
11887 }
11888
11891 }
11892
11894 {
11895 return false;
11896 }
11897
11898
11899
11901 {
11903 {
11904 #ifdef PLATFORM_CONSOLE
11905
11907 {
11909 if (menu)
11910 {
11912 }
11913 }
11914 #endif
11915 }
11916
11918 {
11921 }
11922
11924 {
11925 SetWeightDirty();
11927 }
11929 {
11932 }
11933
11935 {
11938
11941 }
11943 {
11947 }
11948
11949 super.OnVariablesSynchronized();
11950 }
11951
11952
11953
11955 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11956 {
11957 if (!IsServerCheck(allow_client))
11958 return false;
11959
11961 return false;
11962
11965
11966 if (value <= (min + 0.001))
11967 value = min;
11968
11969 if (value == min)
11970 {
11971 if (destroy_config)
11972 {
11973 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11974 if (dstr)
11975 {
11977 this.Delete();
11978 return true;
11979 }
11980 }
11981 else if (destroy_forced)
11982 {
11984 this.Delete();
11985 return true;
11986 }
11987
11989 }
11990
11993
11995 {
11996 EntityAI parent = GetHierarchyRoot();
11997 InventoryLocation iLoc = new InventoryLocation();
11998 GetInventory().GetCurrentInventoryLocation(iLoc);
12000 {
12001 int iLocSlot = iLoc.
GetSlot();
12003 {
12005 }
12007 {
12009 }
12010 }
12011 }
12012
12014 {
12016
12017 if (delta)
12019 }
12020
12022
12023 return false;
12024 }
12025
12026
12028 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12029 {
12031 }
12032
12034 {
12037 }
12038
12040 {
12043 }
12044
12046 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12047 {
12048 float value_clamped = Math.Clamp(value, 0, 1);
12050 SetQuantity(result, destroy_config, destroy_forced);
12051 }
12052
12053
12056 {
12058 }
12059
12061 {
12063 }
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12075 {
12076 int slot = -1;
12077 GameInventory inventory = GetInventory();
12078 if (inventory)
12079 {
12080 InventoryLocation il = new InventoryLocation;
12083 }
12084
12086 }
12087
12089 {
12090 float quantity_max = 0;
12091
12093 {
12094 if (attSlotID != -1)
12095 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12096
12097 if (quantity_max <= 0)
12099 }
12100
12101 if (quantity_max <= 0)
12103
12104 return quantity_max;
12105 }
12106
12108 {
12110 }
12111
12113 {
12115 }
12116
12117
12119 {
12121 }
12122
12124 {
12126 }
12127
12129 {
12131 }
12132
12133
12135 {
12136
12137 float weightEx = GetWeightEx();
12138 float special = GetInventoryAndCargoWeight();
12139 return weightEx - special;
12140 }
12141
12142
12144 {
12146 }
12147
12149 {
12151 {
12152 #ifdef DEVELOPER
12153 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12154 {
12155 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12157 }
12158 #endif
12159
12160 return GetQuantity() * GetConfigWeightModified();
12161 }
12162 else if (HasEnergyManager())
12163 {
12164 #ifdef DEVELOPER
12165 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12166 {
12167 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12168 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12169 }
12170 #endif
12171 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12172 }
12173 else
12174 {
12175 #ifdef DEVELOPER
12176 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12177 {
12178 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12179 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12180 }
12181 #endif
12182 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12183 }
12184 }
12185
12188 {
12189 int item_count = 0;
12191
12192 GameInventory inventory = GetInventory();
12193 CargoBase cargo = inventory.
GetCargo();
12194 if (cargo != NULL)
12195 {
12197 }
12198
12200 for (int i = 0; i < nAttachments; ++i)
12201 {
12203 if (item)
12204 item_count += item.GetNumberOfItems();
12205 }
12206 return item_count;
12207 }
12208
12211 {
12212 float weight = 0;
12213 float wetness = 1;
12214 if (include_wetness)
12217 {
12218 weight = wetness * m_ConfigWeight;
12219 }
12221 {
12222 weight = 1;
12223 }
12224 return weight;
12225 }
12226
12227
12228
12230 {
12231 GameInventory inventory = GetInventory();
12232 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12233 {
12234 array<EntityAI> items = new array<EntityAI>;
12236 for (int i = 0; i < items.Count(); ++i)
12237 {
12239 if (item)
12240 {
12241 g_Game.ObjectDelete(item);
12242 }
12243 }
12244 }
12245 }
12246
12247
12248
12249
12251 {
12252 float energy = 0;
12253 if (HasEnergyManager())
12254 {
12255 energy = GetCompEM().GetEnergy();
12256 }
12257 return energy;
12258 }
12259
12260
12262 {
12263 super.OnEnergyConsumed();
12264
12266 }
12267
12269 {
12270 super.OnEnergyAdded();
12271
12273 }
12274
12275
12277 {
12278 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12279 {
12281 {
12282 float energy_0to1 = GetCompEM().GetEnergy0To1();
12284 }
12285 }
12286 }
12287
12288
12290 {
12291 return ConfigGetFloat("heatIsolation");
12292 }
12293
12295 {
12297 }
12298
12300 {
12301 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12302 if (
g_Game.ConfigIsExisting(paramPath))
12303 return g_Game.ConfigGetFloat(paramPath);
12304
12305 return 0.0;
12306 }
12307
12309 {
12310 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12311 if (
g_Game.ConfigIsExisting(paramPath))
12312 return g_Game.ConfigGetFloat(paramPath);
12313
12314 return 0.0;
12315 }
12316
12317 override void SetWet(
float value,
bool allow_client =
false)
12318 {
12319 if (!IsServerCheck(allow_client))
12320 return;
12321
12324
12326
12327 m_VarWet = Math.Clamp(value, min, max);
12328
12330 {
12333 }
12334 }
12335
12336 override void AddWet(
float value)
12337 {
12339 }
12340
12342 {
12344 }
12345
12347 {
12349 }
12350
12352 {
12354 }
12355
12357 {
12359 }
12360
12362 {
12364 }
12365
12366 override void OnWetChanged(
float newVal,
float oldVal)
12367 {
12370 if (newLevel != oldLevel)
12371 {
12373 }
12374 }
12375
12377 {
12378 SetWeightDirty();
12379 }
12380
12382 {
12383 return GetWetLevelInternal(
m_VarWet);
12384 }
12385
12386
12387
12389 {
12391 }
12392
12394 {
12396 }
12397
12399 {
12401 }
12402
12404 {
12406 }
12407
12408
12409
12411 {
12412 if (ConfigIsExisting("itemModelLength"))
12413 {
12414 return ConfigGetFloat("itemModelLength");
12415 }
12416 return 0;
12417 }
12418
12420 {
12421 if (ConfigIsExisting("itemAttachOffset"))
12422 {
12423 return ConfigGetFloat("itemAttachOffset");
12424 }
12425 return 0;
12426 }
12427
12428 override void SetCleanness(
int value,
bool allow_client =
false)
12429 {
12430 if (!IsServerCheck(allow_client))
12431 return;
12432
12434
12436
12439 }
12440
12442 {
12444 }
12445
12447 {
12448 return true;
12449 }
12450
12451
12452
12453
12455 {
12457 }
12458
12460 {
12462 }
12463
12464
12465
12466
12467 override void SetColor(
int r,
int g,
int b,
int a)
12468 {
12474 }
12476 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12477 {
12482 }
12483
12485 {
12487 }
12488
12491 {
12492 int r,g,b,a;
12494 r = r/255;
12495 g = g/255;
12496 b = b/255;
12497 a = a/255;
12498 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12499 }
12500
12501
12502
12503 override void SetLiquidType(
int value,
bool allow_client =
false)
12504 {
12505 if (!IsServerCheck(allow_client))
12506 return;
12507
12512 }
12513
12515 {
12516 return ConfigGetInt("varLiquidTypeInit");
12517 }
12518
12520 {
12522 }
12523
12525 {
12527 SetFrozen(false);
12528 }
12529
12532 {
12533 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12534 }
12535
12536
12539 {
12540 PlayerBase nplayer;
12541 if (PlayerBase.CastTo(nplayer, player))
12542 {
12544 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12545 }
12546 }
12547
12548
12551 {
12552 PlayerBase nplayer;
12553 if (PlayerBase.CastTo(nplayer,player))
12554 {
12555 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12556 }
12557
12558 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12559
12560 if (HasEnergyManager())
12561 {
12562 GetCompEM().UpdatePlugState();
12563 }
12564 }
12565
12566
12568 {
12569 super.OnPlacementStarted(player);
12570
12572 }
12573
12574 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12575 {
12577 {
12578 m_AdminLog.OnPlacementComplete(player,
this);
12579 }
12580
12581 super.OnPlacementComplete(player, position, orientation);
12582 }
12583
12584
12585
12586
12587
12589 {
12591 {
12592 return true;
12593 }
12594 else
12595 {
12596 return false;
12597 }
12598 }
12599
12600
12602 {
12604 {
12606 }
12607 }
12608
12609
12611 {
12613 }
12614
12616 {
12618 }
12619
12620 override void InsertAgent(
int agent,
float count = 1)
12621 {
12622 if (count < 1)
12623 return;
12624
12626 }
12627
12630 {
12632 }
12633
12634
12636 {
12638 }
12639
12640
12641
12642
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
12682 {
12684 return false;
12685 return true;
12686 }
12687
12689 {
12690
12692 }
12693
12694
12697 {
12698 super.CheckForRoofLimited(timeTresholdMS);
12699
12700 float time =
g_Game.GetTime();
12701 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12702 {
12703 m_PreviousRoofTestTime = time;
12704 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12705 }
12706 }
12707
12708
12710 {
12712 {
12713 return 0;
12714 }
12715
12716 if (GetInventory().GetAttachmentSlotsCount() != 0)
12717 {
12718 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12719 if (filter)
12720 return filter.GetProtectionLevel(type, false, system);
12721 else
12722 return 0;
12723 }
12724
12725 string subclassPath, entryName;
12726
12727 switch (type)
12728 {
12730 entryName = "biological";
12731 break;
12733 entryName = "chemical";
12734 break;
12735 default:
12736 entryName = "biological";
12737 break;
12738 }
12739
12740 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12741
12742 return g_Game.ConfigGetFloat(subclassPath + entryName);
12743 }
12744
12745
12746
12749 {
12750 if (!IsMagazine())
12752
12754 }
12755
12756
12757
12758
12759
12764 {
12765 return true;
12766 }
12767
12769 {
12771 }
12772
12773
12774
12775
12776
12778 {
12779 if (parent)
12780 {
12781 if (parent.IsInherited(DayZInfected))
12782 return true;
12783
12784 if (!parent.IsRuined())
12785 return true;
12786 }
12787
12788 return true;
12789 }
12790
12792 {
12793 if (!super.CanPutAsAttachment(parent))
12794 {
12795 return false;
12796 }
12797
12798 if (!IsRuined() && !parent.IsRuined())
12799 {
12800 return true;
12801 }
12802
12803 return false;
12804 }
12805
12807 {
12808
12809
12810
12811
12812 return super.CanReceiveItemIntoCargo(item);
12813 }
12814
12816 {
12817
12818
12819
12820
12821 GameInventory attachmentInv = attachment.GetInventory();
12823 {
12824 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12825 return false;
12826 }
12827
12828 InventoryLocation loc = new InventoryLocation();
12829 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12830 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12831 return false;
12832
12833 return super.CanReceiveAttachment(attachment, slotId);
12834 }
12835
12837 {
12838 if (!super.CanReleaseAttachment(attachment))
12839 return false;
12840
12841 return GetInventory().AreChildrenAccessible();
12842 }
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12865 {
12866 int id = muzzle_owner.GetMuzzleID();
12867 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12868
12869 if (WPOF_array)
12870 {
12871 for (int i = 0; i < WPOF_array.Count(); i++)
12872 {
12873 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12874
12875 if (WPOF)
12876 {
12877 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12878 }
12879 }
12880 }
12881 }
12882
12883
12885 {
12886 int id = muzzle_owner.GetMuzzleID();
12888
12889 if (WPOBE_array)
12890 {
12891 for (int i = 0; i < WPOBE_array.Count(); i++)
12892 {
12893 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12894
12895 if (WPOBE)
12896 {
12897 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12898 }
12899 }
12900 }
12901 }
12902
12903
12905 {
12906 int id = muzzle_owner.GetMuzzleID();
12907 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12908
12909 if (WPOOH_array)
12910 {
12911 for (int i = 0; i < WPOOH_array.Count(); i++)
12912 {
12913 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12914
12915 if (WPOOH)
12916 {
12917 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12918 }
12919 }
12920 }
12921 }
12922
12923
12925 {
12926 int id = muzzle_owner.GetMuzzleID();
12927 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12928
12929 if (WPOOH_array)
12930 {
12931 for (int i = 0; i < WPOOH_array.Count(); i++)
12932 {
12933 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12934
12935 if (WPOOH)
12936 {
12937 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12938 }
12939 }
12940 }
12941 }
12942
12943
12945 {
12946 int id = muzzle_owner.GetMuzzleID();
12947 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12948
12949 if (WPOOH_array)
12950 {
12951 for (int i = 0; i < WPOOH_array.Count(); i++)
12952 {
12953 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12954
12955 if (WPOOH)
12956 {
12957 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12958 }
12959 }
12960 }
12961 }
12962
12963
12964
12966 {
12968 {
12969 return true;
12970 }
12971
12972 return false;
12973 }
12974
12976 {
12978 {
12979 return true;
12980 }
12981
12982 return false;
12983 }
12984
12986 {
12988 {
12989 return true;
12990 }
12991
12992 return false;
12993 }
12994
12996 {
12997 return false;
12998 }
12999
13002 {
13003 return UATimeSpent.DEFAULT_DEPLOY;
13004 }
13005
13006
13007
13008
13010 {
13012 SetSynchDirty();
13013 }
13014
13016 {
13018 }
13019
13020
13022 {
13023 return false;
13024 }
13025
13028 {
13029 string att_type = "None";
13030
13031 if (ConfigIsExisting("soundAttType"))
13032 {
13033 att_type = ConfigGetString("soundAttType");
13034 }
13035
13037 }
13038
13040 {
13042 }
13043
13044
13045
13046
13047
13053
13055 {
13058
13060 }
13061
13062
13064 {
13066 return;
13067
13069
13072
13075
13076 SoundParameters params = new SoundParameters();
13080 }
13081
13082
13084 {
13086 {
13089
13090 SetSynchDirty();
13091
13094 }
13095 }
13096
13098 {
13100 }
13101
13102
13104 {
13106 return;
13107
13109 SetSynchDirty();
13110
13113 }
13114
13116 {
13119 }
13120
13122 {
13124 }
13125
13126 void OnApply(PlayerBase player);
13127
13129 {
13130 return 1.0;
13131 };
13132
13134 {
13136 }
13137
13139 {
13141 }
13142
13144
13146 {
13147 SetDynamicPhysicsLifeTime(0.01);
13149 }
13150
13152 {
13153 array<string> zone_names = new array<string>;
13154 GetDamageZones(zone_names);
13155 for (int i = 0; i < zone_names.Count(); i++)
13156 {
13157 SetHealthMax(zone_names.Get(i),"Health");
13158 }
13159 SetHealthMax("","Health");
13160 }
13161
13164 {
13165 float global_health = GetHealth01("","Health");
13166 array<string> zones = new array<string>;
13167 GetDamageZones(zones);
13168
13169 for (int i = 0; i < zones.Count(); i++)
13170 {
13171 SetHealth01(zones.Get(i),"Health",global_health);
13172 }
13173 }
13174
13177 {
13178 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13179 }
13180
13182 {
13183 if (!hasRootAsPlayer)
13184 {
13185 if (refParentIB)
13186 {
13187
13188 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13189 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13190
13191 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13192 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13193
13196 }
13197 else
13198 {
13199
13202 }
13203 }
13204 }
13205
13207 {
13209 {
13210 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13211 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13212 {
13213 float heatPermCoef = 1.0;
13215 while (ent)
13216 {
13217 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13218 ent = ent.GetHierarchyParent();
13219 }
13220
13221 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13222 }
13223 }
13224 }
13225
13227 {
13228
13229 EntityAI parent = GetHierarchyParent();
13230 if (!parent)
13231 {
13232 hasParent = false;
13233 hasRootAsPlayer = false;
13234 }
13235 else
13236 {
13237 hasParent = true;
13238 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13239 refParentIB =
ItemBase.Cast(parent);
13240 }
13241 }
13242
13243 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13244 {
13245
13246 }
13247
13249 {
13250
13251 return false;
13252 }
13253
13255 {
13256
13257
13258 return false;
13259 }
13260
13262 {
13263
13264 return false;
13265 }
13266
13269 {
13270 return !GetIsFrozen() &&
IsOpen();
13271 }
13272
13274 {
13275 bool hasParent = false, hasRootAsPlayer = false;
13277
13278 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13279 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13280
13281 if (wwtu || foodDecay)
13282 {
13286
13287 if (processWetness || processTemperature || processDecay)
13288 {
13290
13291 if (processWetness)
13292 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13293
13294 if (processTemperature)
13296
13297 if (processDecay)
13298 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13299 }
13300 }
13301 }
13302
13305 {
13307 }
13308
13310 {
13313
13314 return super.GetTemperatureFreezeThreshold();
13315 }
13316
13318 {
13321
13322 return super.GetTemperatureThawThreshold();
13323 }
13324
13326 {
13329
13330 return super.GetItemOverheatThreshold();
13331 }
13332
13334 {
13336 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13337
13338 return super.GetTemperatureFreezeTime();
13339 }
13340
13342 {
13344 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13345
13346 return super.GetTemperatureThawTime();
13347 }
13348
13353
13355 {
13356 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13357 }
13358
13360 {
13361 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13362 }
13363
13366 {
13368 }
13369
13371 {
13373 }
13374
13376 {
13378 }
13379
13382 {
13383 return null;
13384 }
13385
13388 {
13389 return false;
13390 }
13391
13393 {
13395 {
13398 if (!trg)
13399 {
13401 explosive = this;
13402 }
13403
13404 explosive.PairRemote(trg);
13406
13407 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13408 trg.SetPersistentPairID(persistentID);
13409 explosive.SetPersistentPairID(persistentID);
13410
13411 return true;
13412 }
13413 return false;
13414 }
13415
13418 {
13419 float ret = 1.0;
13422 ret *= GetHealth01();
13423
13424 return ret;
13425 }
13426
13427 #ifdef DEVELOPER
13428 override void SetDebugItem()
13429 {
13430 super.SetDebugItem();
13431 _itemBase = this;
13432 }
13433
13435 {
13436 string text = super.GetDebugText();
13437
13439 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13440
13441 return text;
13442 }
13443 #endif
13444
13446 {
13447 return true;
13448 }
13449
13451
13453
13455 {
13458 }
13459
13460
13468
13484
13485 [
Obsolete(
"Use ItemSoundHandler instead")]
13488 {
13489 if (!
g_Game.IsDedicatedServer())
13490 {
13491 if (ConfigIsExisting("attachSoundSet"))
13492 {
13493 string cfg_path = "";
13494 string soundset = "";
13495 string type_name =
GetType();
13496
13499 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13500 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13501
13502 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13503 {
13504 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13505 {
13506 if (cfg_slot_array[i] == slot_type)
13507 {
13508 soundset = cfg_soundset_array[i];
13509 break;
13510 }
13511 }
13512 }
13513
13514 if (soundset != "")
13515 {
13516 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13518 }
13519 }
13520 }
13521 }
13522
13524}
13525
13527{
13529 if (entity)
13530 {
13531 bool is_item = entity.IsInherited(
ItemBase);
13532 if (is_item && full_quantity)
13533 {
13536 }
13537 }
13538 else
13539 {
13541 return NULL;
13542 }
13543 return entity;
13544}
13545
13547{
13548 if (item)
13549 {
13550 if (health > 0)
13551 item.SetHealth("", "", health);
13552
13553 if (item.CanHaveTemperature())
13554 {
13556 if (item.CanFreeze())
13557 item.SetFrozen(false);
13558 }
13559
13560 if (item.HasEnergyManager())
13561 {
13562 if (quantity >= 0)
13563 {
13564 item.GetCompEM().SetEnergy0To1(quantity);
13565 }
13566 else
13567 {
13569 }
13570 }
13571 else if (item.IsMagazine())
13572 {
13573 Magazine mag = Magazine.Cast(item);
13574 if (quantity >= 0)
13575 {
13576 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13577 }
13578 else
13579 {
13581 }
13582
13583 }
13584 else
13585 {
13586 if (quantity >= 0)
13587 {
13588 item.SetQuantityNormalized(quantity, false);
13589 }
13590 else
13591 {
13593 }
13594
13595 }
13596 }
13597}
13598
13599#ifdef DEVELOPER
13601#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.