8597{
8599 {
8600 return true;
8601 }
8602};
8603
8605{
8606
8607};
8608
8609
8610
8612{
8616
8618
8621
8622
8623
8624
8625
8634
8640
8645
8650
8671 protected bool m_IsResultOfSplit
8672
8674
8679
8680
8681
8683
8687
8688
8689
8691
8694
8695
8696
8702
8703
8711
8714
8715
8717
8718
8720
8721
8726
8727
8732
8734
8735
8737
8738
8740 {
8745
8746 if (!
g_Game.IsDedicatedServer())
8747 {
8749 {
8751
8753 {
8755 }
8756 }
8757
8760 }
8761
8762 m_OldLocation = null;
8763
8765 {
8767 }
8768
8769 if (ConfigIsExisting("headSelectionsToHide"))
8770 {
8773 }
8774
8776 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8777 {
8779 }
8780
8782
8783 m_IsResultOfSplit = false;
8784
8786 }
8787
8789 {
8790 super.InitItemVariables();
8791
8797 m_Count = ConfigGetInt(
"count");
8798
8801
8806
8809
8814
8826
8830
8831
8834 if (ConfigIsExisting("canBeSplit"))
8835 {
8838 }
8839
8841 if (ConfigIsExisting("itemBehaviour"))
8843
8844
8847 RegisterNetSyncVariableInt("m_VarLiquidType");
8848 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8849
8850 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8851 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8852 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8853
8854 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8855 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8856 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8857 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8858
8859 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8860 RegisterNetSyncVariableBool("m_IsTakeable");
8861 RegisterNetSyncVariableBool("m_IsHologram");
8862
8865 {
8868 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8869 }
8870
8872
8874 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8876
8878 }
8879
8881 {
8883 }
8884
8886 {
8889 {
8894 }
8895 }
8896
8897 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8898 {
8900 {
8903 }
8904
8906 }
8907
8909 {
8915 }
8916
8918
8920 {
8922
8923 if (!action)
8924 {
8925 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8926 return;
8927 }
8928
8930 if (!ai)
8931 {
8933 return;
8934 }
8935
8937 if (!action_array)
8938 {
8939 action_array = new array<ActionBase_Basic>;
8941 }
8942 if (LogManager.IsActionLogEnable())
8943 {
8944 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8945 }
8946
8947 if (action_array.Find(action) != -1)
8948 {
8949 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8950 }
8951 else
8952 {
8953 action_array.Insert(action);
8954 }
8955 }
8956
8958 {
8959 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8960 ActionBase action = player.GetActionManager().GetAction(actionName);
8963
8964 if (action_array)
8965 {
8966 action_array.RemoveItem(action);
8967 }
8968 }
8969
8970
8971
8973 {
8974 ActionOverrideData overrideData = new ActionOverrideData();
8978
8980 if (!actionMap)
8981 {
8984 }
8985
8986 actionMap.Insert(this.
Type(), overrideData);
8987
8988 }
8989
8991
8993
8994
8996 {
8999
9002
9003 string config_to_search = "CfgVehicles";
9004 string muzzle_owner_config;
9005
9007 {
9008 if (IsInherited(Weapon))
9009 config_to_search = "CfgWeapons";
9010
9011 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9012
9013 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9014
9015 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9016
9017 if (config_OnFire_subclass_count > 0)
9018 {
9019 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9020
9021 for (int i = 0; i < config_OnFire_subclass_count; i++)
9022 {
9023 string particle_class = "";
9024 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9025 string config_OnFire_entry = config_OnFire_class + particle_class;
9026 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9027 WPOF_array.Insert(WPOF);
9028 }
9029
9030
9032 }
9033 }
9034
9036 {
9037 config_to_search = "CfgWeapons";
9038 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9039
9040 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9041
9042 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9043
9044 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9045 {
9046 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9047
9048 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9049 {
9050 string particle_class2 = "";
9051 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9052 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9053 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9054 WPOBE_array.Insert(WPOBE);
9055 }
9056
9057
9059 }
9060 }
9061 }
9062
9063
9065 {
9068
9070 {
9071 string config_to_search = "CfgVehicles";
9072
9073 if (IsInherited(Weapon))
9074 config_to_search = "CfgWeapons";
9075
9076 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9077 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9078
9079 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9080 {
9081
9083
9085 {
9087 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9089 return;
9090 }
9091
9094
9095
9096
9097 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9098 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9099
9100 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9101 {
9102 string particle_class = "";
9103 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9104 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9105 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9106
9107 if (entry_type == CT_CLASS)
9108 {
9109 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9110 WPOOH_array.Insert(WPOF);
9111 }
9112 }
9113
9114
9116 }
9117 }
9118 }
9119
9121 {
9123 }
9124
9126 {
9128 {
9130
9133
9136
9137 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9138 }
9139 }
9140
9142 {
9144 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9145
9147 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9148
9150 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9151
9153 {
9155 }
9156 }
9157
9159 {
9161 }
9162
9164 {
9167 else
9169
9171 {
9174 }
9175 else
9176 {
9179
9182 }
9183
9185 }
9186
9188 {
9190 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9191 }
9192
9194 {
9196 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9198 }
9199
9201 {
9203 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9204 }
9205
9207 {
9210
9211 OverheatingParticle OP = new OverheatingParticle();
9216
9218 }
9219
9221 {
9224
9225 return -1;
9226 }
9227
9229 {
9231 {
9234
9235 for (int i = count; i > 0; --i)
9236 {
9237 int id = i - 1;
9240
9243
9244 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9245 {
9246 if (p)
9247 {
9250 }
9251 }
9252 }
9253 }
9254 }
9255
9257 {
9259 {
9261 {
9262 int id = i - 1;
9264
9265 if (OP)
9266 {
9268
9269 if (p)
9270 {
9272 }
9273
9274 delete OP;
9275 }
9276 }
9277
9280 }
9281 }
9282
9285 {
9286 return 0.0;
9287 }
9288
9289
9291 {
9292 return 250;
9293 }
9294
9296 {
9297 return 0;
9298 }
9299
9302 {
9304 return true;
9305
9306 return false;
9307 }
9308
9311 {
9314
9316 {
9318 }
9319 else
9320 {
9321
9323 }
9324
9326 }
9327
9334 {
9335 return -1;
9336 }
9337
9338
9339
9340
9342 {
9344 {
9345 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9346 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9347
9348 if (r_index >= 0)
9349 {
9350 InventoryLocation r_il = new InventoryLocation;
9351 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9352
9353 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9356 {
9357 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9358 }
9360 {
9361 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9362 }
9363
9364 }
9365
9366 player.GetHumanInventory().ClearUserReservedLocation(this);
9367 }
9368
9371 }
9372
9373
9374
9375
9377 {
9378 return ItemBase.m_DebugActionsMask;
9379 }
9380
9382 {
9383 return ItemBase.m_DebugActionsMask & mask;
9384 }
9385
9387 {
9388 ItemBase.m_DebugActionsMask = mask;
9389 }
9390
9392 {
9393 ItemBase.m_DebugActionsMask |= mask;
9394 }
9395
9397 {
9398 ItemBase.m_DebugActionsMask &= ~mask;
9399 }
9400
9402 {
9404 {
9406 }
9407 else
9408 {
9410 }
9411 }
9412
9413
9415 {
9416 if (GetEconomyProfile())
9417 {
9418 float q_max = GetEconomyProfile().GetQuantityMax();
9419 if (q_max > 0)
9420 {
9421 float q_min = GetEconomyProfile().GetQuantityMin();
9422 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9423
9425 {
9426 ComponentEnergyManager comp = GetCompEM();
9428 {
9430 }
9431 }
9433 {
9435
9436 }
9437
9438 }
9439 }
9440 }
9441
9444 {
9445 EntityAI parent = GetHierarchyParent();
9446
9447 if (parent)
9448 {
9449 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9450 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9451 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9452 }
9453 }
9454
9457 {
9458 EntityAI parent = GetHierarchyParent();
9459
9460 if (parent)
9461 {
9462 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9463 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9464 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9465 }
9466 }
9467
9469 {
9470
9471
9472
9473
9475
9477 {
9478 if (ScriptInputUserData.CanStoreInputUserData())
9479 {
9480 ScriptInputUserData ctx = new ScriptInputUserData;
9486 ctx.
Write(use_stack_max);
9489
9491 {
9492 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9493 }
9494 }
9495 }
9496 else if (!
g_Game.IsMultiplayer())
9497 {
9499 }
9500 }
9501
9503 {
9505 }
9506
9508 {
9510 }
9511
9513 {
9515 }
9516
9518 {
9519
9520 return false;
9521 }
9522
9524 {
9525 return false;
9526 }
9527
9531 {
9532 return false;
9533 }
9534
9536 {
9537 return "";
9538 }
9539
9541
9543 {
9544 return false;
9545 }
9546
9548 {
9549 return true;
9550 }
9551
9552
9553
9555 {
9556 return true;
9557 }
9558
9560 {
9561 return true;
9562 }
9563
9565 {
9566 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9568 }
9569
9571 {
9573 }
9574
9576 {
9578 if (!is_being_placed)
9580 SetSynchDirty();
9581 }
9582
9583
9585
9587 {
9589 }
9590
9592 {
9594 }
9595
9597 {
9598 return 1;
9599 }
9600
9602 {
9603 return false;
9604 }
9605
9607 {
9609 SetSynchDirty();
9610 }
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9647 {
9648 super.OnMovedInsideCargo(container);
9649
9650 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9651 }
9652
9653 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9654 {
9655 super.EEItemLocationChanged(oldLoc, newLoc);
9656
9657 PlayerBase newPlayer = null;
9658 PlayerBase oldPlayer = null;
9659
9660 if (newLoc.GetParent())
9661 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9662
9663 if (oldLoc.GetParent())
9664 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9665
9667 {
9668 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9669
9670 if (rIndex >= 0)
9671 {
9672 InventoryLocation rIl = new InventoryLocation;
9673 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9674
9675 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9678 {
9679 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9680 }
9682 {
9684 }
9685
9686 }
9687 }
9688
9690 {
9691 if (newPlayer)
9692 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9693
9694 if (newPlayer == oldPlayer)
9695 {
9696 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9697 {
9699 {
9700 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9701 {
9702 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9703 }
9704 }
9705 else
9706 {
9707 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9708 }
9709 }
9710
9711 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9712 {
9713 int type = oldLoc.GetType();
9715 {
9716 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9717 }
9719 {
9720 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9721 }
9722 }
9723 if (!m_OldLocation)
9724 {
9725 m_OldLocation = new InventoryLocation;
9726 }
9727 m_OldLocation.Copy(oldLoc);
9728 }
9729 else
9730 {
9731 if (m_OldLocation)
9732 {
9733 m_OldLocation.Reset();
9734 }
9735 }
9736
9737 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9738 }
9739 else
9740 {
9741 if (newPlayer)
9742 {
9743 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9744 if (resIndex >= 0)
9745 {
9746 InventoryLocation il = new InventoryLocation;
9747 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9749 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9752 {
9753 il.
GetParent().GetOnReleaseLock().Invoke(it);
9754 }
9756 {
9758 }
9759
9760 }
9761 }
9763 {
9764
9766 }
9767
9768 if (m_OldLocation)
9769 {
9770 m_OldLocation.Reset();
9771 }
9772 }
9773
9775 {
9776 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9777 }
9778
9780 {
9781 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9782 }
9783 }
9784
9785 override void EOnContact(IEntity other, Contact extra)
9786 {
9788 {
9789 int liquidType = -1;
9791 if (impactSpeed > 0.0)
9792 {
9794 #ifndef SERVER
9796 #else
9798 SetSynchDirty();
9799 #endif
9801 }
9802 }
9803
9804 #ifdef SERVER
9805 if (GetCompEM() && GetCompEM().IsPlugged())
9806 {
9807 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9808 GetCompEM().UnplugThis();
9809 }
9810 #endif
9811 }
9812
9814
9816 {
9818 }
9819
9821 {
9822
9823 }
9824
9826 {
9827 super.OnItemLocationChanged(old_owner, new_owner);
9828
9829 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9830 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9831
9832 if (!relatedPlayer && playerNew)
9833 relatedPlayer = playerNew;
9834
9835 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9836 {
9838 if (actionMgr)
9839 {
9840 ActionBase currentAction = actionMgr.GetRunningAction();
9841 if (currentAction)
9843 }
9844 }
9845
9846 Man ownerPlayerOld = null;
9847 Man ownerPlayerNew = null;
9848
9849 if (old_owner)
9850 {
9851 if (old_owner.
IsMan())
9852 {
9853 ownerPlayerOld = Man.Cast(old_owner);
9854 }
9855 else
9856 {
9857 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9858 }
9859 }
9860 else
9861 {
9863 {
9865
9866 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9867 {
9868 GetCompEM().UnplugThis();
9869 }
9870 }
9871 }
9872
9873 if (new_owner)
9874 {
9875 if (new_owner.
IsMan())
9876 {
9877 ownerPlayerNew = Man.Cast(new_owner);
9878 }
9879 else
9880 {
9881 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9882 }
9883 }
9884
9885 if (ownerPlayerOld != ownerPlayerNew)
9886 {
9887 if (ownerPlayerOld)
9888 {
9889 array<EntityAI> subItemsExit = new array<EntityAI>;
9891 for (int i = 0; i < subItemsExit.Count(); i++)
9892 {
9895 }
9896 }
9897
9898 if (ownerPlayerNew)
9899 {
9900 array<EntityAI> subItemsEnter = new array<EntityAI>;
9902 for (int j = 0; j < subItemsEnter.Count(); j++)
9903 {
9906 }
9907 }
9908 }
9909 else if (ownerPlayerNew != null)
9910 {
9911 PlayerBase nplayer;
9912 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9913 {
9914 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9916 for (int k = 0; k < subItemsUpdate.Count(); k++)
9917 {
9919 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9920 }
9921 }
9922 }
9923
9924 if (old_owner)
9925 old_owner.OnChildItemRemoved(this);
9926 if (new_owner)
9927 new_owner.OnChildItemReceived(this);
9928 }
9929
9930
9932 {
9933 super.EEDelete(parent);
9934 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9935 if (player)
9936 {
9938
9939 if (player.IsAlive())
9940 {
9941 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9942 if (r_index >= 0)
9943 {
9944 InventoryLocation r_il = new InventoryLocation;
9945 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9946
9947 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9950 {
9951 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9952 }
9954 {
9955 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9956 }
9957
9958 }
9959
9960 player.RemoveQuickBarEntityShortcut(this);
9961 }
9962 }
9963 }
9964
9966 {
9967 super.EEKilled(killer);
9968
9971 {
9972 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9973 {
9974 if (IsMagazine())
9975 {
9976 if (Magazine.Cast(this).GetAmmoCount() > 0)
9977 {
9979 }
9980 }
9981 else
9982 {
9984 }
9985 }
9986 }
9987 }
9988
9990 {
9991 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9992
9993 super.OnWasAttached(parent, slot_id);
9994
9997
10000 }
10001
10003 {
10004 super.OnWasDetached(parent, slot_id);
10005
10008
10011 }
10012
10014 {
10015 int idx;
10018
10019 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10020 if (inventory_slots.Count() < 1)
10021 {
10022 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10023 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10024 }
10025 else
10026 {
10027 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10028 }
10029
10030 idx = inventory_slots.Find(slot);
10031 if (idx < 0)
10032 return "";
10033
10034 return attach_types.Get(idx);
10035 }
10036
10038 {
10039 int idx = -1;
10040 string slot;
10041
10044
10045 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10046 if (inventory_slots.Count() < 1)
10047 {
10048 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10049 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10050 }
10051 else
10052 {
10053 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10054 if (detach_types.Count() < 1)
10055 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10056 }
10057
10058 for (int i = 0; i < inventory_slots.Count(); i++)
10059 {
10060 slot = inventory_slots.Get(i);
10061 }
10062
10063 if (slot != "")
10064 {
10065 if (detach_types.Count() == 1)
10066 idx = 0;
10067 else
10068 idx = inventory_slots.Find(slot);
10069 }
10070 if (idx < 0)
10071 return "";
10072
10073 return detach_types.Get(idx);
10074 }
10075
10077 {
10078
10080
10081
10082 float min_time = 1;
10083 float max_time = 3;
10084 float delay = Math.RandomFloat(min_time, max_time);
10085
10086 explode_timer.Run(delay, this, "DoAmmoExplosion");
10087 }
10088
10090 {
10091 Magazine magazine = Magazine.Cast(this);
10092 int pop_sounds_count = 6;
10093 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10094
10095
10096 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10097 string sound_name = pop_sounds[ sound_idx ];
10098 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10099
10100
10101 magazine.ServerAddAmmoCount(-1);
10102
10103
10104 float min_temp_to_explode = 100;
10105
10106 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10107 {
10109 }
10110 }
10111
10112
10113 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10114 {
10115 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10116
10117 const int CHANCE_DAMAGE_CARGO = 4;
10118 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10119 const int CHANCE_DAMAGE_NOTHING = 2;
10120
10122 {
10123 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10124 int chances;
10125 int rnd;
10126
10127 if (GetInventory().GetCargo())
10128 {
10129 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10130 rnd = Math.RandomInt(0,chances);
10131
10132 if (rnd < CHANCE_DAMAGE_CARGO)
10133 {
10135 }
10136 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10137 {
10139 }
10140 }
10141 else
10142 {
10143 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10144 rnd = Math.RandomInt(0,chances);
10145
10146 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10147 {
10149 }
10150 }
10151 }
10152 }
10153
10155 {
10156 CargoBase cargo = GetInventory().GetCargo();
10157 if (cargo)
10158 {
10160 if (item_count > 0)
10161 {
10162 int random_pick = Math.RandomInt(0, item_count);
10164 if (!item.IsExplosive())
10165 {
10166 item.AddHealth("","",damage);
10167 return true;
10168 }
10169 }
10170 }
10171 return false;
10172 }
10173
10175 {
10176 GameInventory inventory = GetInventory();
10178 if (attachment_count > 0)
10179 {
10180 int random_pick = Math.RandomInt(0, attachment_count);
10182 if (!attachment.IsExplosive())
10183 {
10184 attachment.AddHealth("","",damage);
10185 return true;
10186 }
10187 }
10188 return false;
10189 }
10190
10192 {
10194 }
10195
10197 {
10199 return GetInventory().CanRemoveEntity();
10200
10201 return false;
10202 }
10203
10205 {
10206
10208 return false;
10209
10210
10212 return false;
10213
10214
10215
10217 if (delta == 0)
10218 return false;
10219
10220
10221 return true;
10222 }
10223
10225 {
10227 {
10228 if (ScriptInputUserData.CanStoreInputUserData())
10229 {
10230 ScriptInputUserData ctx = new ScriptInputUserData;
10235 ctx.
Write(destination_entity);
10237 ctx.
Write(slot_id);
10239 }
10240 }
10241 else if (!
g_Game.IsMultiplayer())
10242 {
10244 }
10245 }
10246
10248 {
10249 float split_quantity_new;
10253 InventoryLocation loc = new InventoryLocation;
10254
10255 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10256 {
10258 split_quantity_new = stack_max;
10259 else
10261
10263 {
10264 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10265 if (new_item)
10266 {
10267 new_item.SetResultOfSplit(true);
10268 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10270 new_item.
SetQuantity(split_quantity_new,
false,
true);
10271 }
10272 }
10273 }
10274 else if (destination_entity && slot_id == -1)
10275 {
10276 if (quantity > stack_max)
10277 split_quantity_new = stack_max;
10278 else
10279 split_quantity_new = quantity;
10280
10282 {
10283 GameInventory destinationInventory = destination_entity.GetInventory();
10285 {
10288 }
10289
10290 if (new_item)
10291 {
10292 new_item.SetResultOfSplit(true);
10293 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10295 new_item.
SetQuantity(split_quantity_new,
false,
true);
10296 }
10297 }
10298 }
10299 else
10300 {
10301 if (stack_max != 0)
10302 {
10304 {
10306 }
10307
10308 if (split_quantity_new == 0)
10309 {
10310 if (!
g_Game.IsMultiplayer())
10311 player.PhysicalPredictiveDropItem(this);
10312 else
10313 player.ServerDropEntity(this);
10314 return;
10315 }
10316
10318 {
10320
10321 if (new_item)
10322 {
10323 new_item.SetResultOfSplit(true);
10324 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10327 new_item.PlaceOnSurface();
10328 }
10329 }
10330 }
10331 }
10332 }
10333
10335 {
10336 float split_quantity_new;
10340 InventoryLocation loc = new InventoryLocation;
10341
10342 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10343 {
10345 split_quantity_new = stack_max;
10346 else
10348
10350 {
10351 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10352 if (new_item)
10353 {
10354 new_item.SetResultOfSplit(true);
10355 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10357 new_item.
SetQuantity(split_quantity_new,
false,
true);
10358 }
10359 }
10360 }
10361 else if (destination_entity && slot_id == -1)
10362 {
10363 if (quantity > stack_max)
10364 split_quantity_new = stack_max;
10365 else
10366 split_quantity_new = quantity;
10367
10369 {
10370 GameInventory destinationInventory = destination_entity.GetInventory();
10372 {
10375 }
10376
10377 if (new_item)
10378 {
10379 new_item.SetResultOfSplit(true);
10380 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10382 new_item.
SetQuantity(split_quantity_new,
false,
true);
10383 }
10384 }
10385 }
10386 else
10387 {
10388 if (stack_max != 0)
10389 {
10391 {
10393 }
10394
10396 {
10398
10399 if (new_item)
10400 {
10401 new_item.SetResultOfSplit(true);
10402 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10405 new_item.PlaceOnSurface();
10406 }
10407 }
10408 }
10409 }
10410 }
10411
10413 {
10415 {
10416 if (ScriptInputUserData.CanStoreInputUserData())
10417 {
10418 ScriptInputUserData ctx = new ScriptInputUserData;
10423 dst.WriteToContext(ctx);
10425 }
10426 }
10427 else if (!
g_Game.IsMultiplayer())
10428 {
10430 }
10431 }
10432
10434 {
10436 {
10437 if (ScriptInputUserData.CanStoreInputUserData())
10438 {
10439 ScriptInputUserData ctx = new ScriptInputUserData;
10444 ctx.
Write(destination_entity);
10450 }
10451 }
10452 else if (!
g_Game.IsMultiplayer())
10453 {
10455 }
10456 }
10457
10459 {
10461 }
10462
10464 {
10466 float split_quantity_new;
10468 if (dst.IsValid())
10469 {
10470 int slot_id = dst.GetSlot();
10472
10473 if (quantity > stack_max)
10474 split_quantity_new = stack_max;
10475 else
10476 split_quantity_new = quantity;
10477
10479 {
10481
10482 if (new_item)
10483 {
10484 new_item.SetResultOfSplit(true);
10485 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10487 new_item.
SetQuantity(split_quantity_new,
false,
true);
10488 }
10489
10490 return new_item;
10491 }
10492 }
10493
10494 return null;
10495 }
10496
10498 {
10500 float split_quantity_new;
10502 if (destination_entity)
10503 {
10505 if (quantity > stackable)
10506 split_quantity_new = stackable;
10507 else
10508 split_quantity_new = quantity;
10509
10511 {
10512 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10513 if (new_item)
10514 {
10515 new_item.SetResultOfSplit(true);
10516 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10518 new_item.
SetQuantity(split_quantity_new,
false,
true);
10519 }
10520 }
10521 }
10522 }
10523
10525 {
10527 {
10528 if (ScriptInputUserData.CanStoreInputUserData())
10529 {
10530 ScriptInputUserData ctx = new ScriptInputUserData;
10535 ItemBase destination_entity =
this;
10536 ctx.
Write(destination_entity);
10540 }
10541 }
10542 else if (!
g_Game.IsMultiplayer())
10543 {
10545 }
10546 }
10547
10549 {
10551 float split_quantity_new;
10553 if (player)
10554 {
10556 if (quantity > stackable)
10557 split_quantity_new = stackable;
10558 else
10559 split_quantity_new = quantity;
10560
10562 {
10563 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10564 new_item =
ItemBase.Cast(in_hands);
10565 if (new_item)
10566 {
10567 new_item.SetResultOfSplit(true);
10568 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10570 new_item.SetQuantity(split_quantity_new, false, true);
10571 }
10572 }
10573 }
10574 }
10575
10577 {
10579 float split_quantity_new = Math.Floor(quantity * 0.5);
10580
10582 return;
10583
10585
10586 if (new_item)
10587 {
10588 if (new_item.GetQuantityMax() < split_quantity_new)
10589 {
10590 split_quantity_new = new_item.GetQuantityMax();
10591 }
10592
10593 new_item.SetResultOfSplit(true);
10594 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10595
10597 {
10600 }
10601 else
10602 {
10604 new_item.
SetQuantity(split_quantity_new,
false,
true);
10605 }
10606 }
10607 }
10608
10610 {
10612 float split_quantity_new = Math.Floor(quantity / 2);
10613
10615 return;
10616
10617 InventoryLocation invloc = new InventoryLocation;
10619
10621 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10622
10623 if (new_item)
10624 {
10625 if (new_item.GetQuantityMax() < split_quantity_new)
10626 {
10627 split_quantity_new = new_item.GetQuantityMax();
10628 }
10630 {
10633 }
10634 else if (split_quantity_new > 1)
10635 {
10637 new_item.
SetQuantity(split_quantity_new,
false,
true);
10638 }
10639 }
10640 }
10641
10644 {
10645 SetWeightDirty();
10647
10648 if (parent)
10649 parent.OnAttachmentQuantityChangedEx(this, delta);
10650
10652 {
10654 {
10656 }
10658 {
10659 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10661 }
10662 }
10663 }
10664
10667 {
10668
10669 }
10670
10673 {
10675 }
10676
10678 {
10679 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10680
10682 {
10683 if (newLevel == GameConstants.STATE_RUINED)
10684 {
10686 EntityAI parent = GetHierarchyParent();
10687 if (parent && parent.IsFireplace())
10688 {
10689 CargoBase cargo = GetInventory().GetCargo();
10690 if (cargo)
10691 {
10693 {
10695 }
10696 }
10697 }
10698 }
10699
10701 {
10702
10704 return;
10705 }
10706
10707 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10708 {
10710 }
10711 }
10712 }
10713
10714
10716 {
10717 super.OnRightClick();
10718
10720 {
10722 {
10723 if (ScriptInputUserData.CanStoreInputUserData())
10724 {
10725 EntityAI root = GetHierarchyRoot();
10726 Man playerOwner = GetHierarchyRootPlayer();
10727 InventoryLocation dst = new InventoryLocation;
10728
10729
10730 if (!playerOwner && root && root == this)
10731 {
10733 }
10734 else
10735 {
10736
10737 GetInventory().GetCurrentInventoryLocation(dst);
10739 {
10740 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10742 {
10744 }
10745 else
10746 {
10748
10749
10750 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10751 {
10753 }
10754 else
10755 {
10756 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10757 }
10758 }
10759 }
10760 }
10761
10762 ScriptInputUserData ctx = new ScriptInputUserData;
10770 }
10771 }
10772 else if (!
g_Game.IsMultiplayer())
10773 {
10775 }
10776 }
10777 }
10778
10780 {
10781 if (root)
10782 {
10783 vector m4[4];
10784 root.GetTransform(m4);
10785 dst.SetGround(this, m4);
10786 }
10787 else
10788 {
10789 GetInventory().GetCurrentInventoryLocation(dst);
10790 }
10791 }
10792
10793 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10794 {
10795
10796 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10797 return false;
10798
10799 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10800 return false;
10801
10802
10804 return false;
10805
10806
10807 Magazine mag = Magazine.Cast(this);
10808 if (mag)
10809 {
10810 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10811 return false;
10812
10813 if (stack_max_limit)
10814 {
10815 Magazine other_mag = Magazine.Cast(other_item);
10816 if (other_item)
10817 {
10818 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10819 return false;
10820 }
10821
10822 }
10823 }
10824 else
10825 {
10826
10828 return false;
10829
10831 return false;
10832 }
10833
10834 PlayerBase player = null;
10835 if (CastTo(player, GetHierarchyRootPlayer()))
10836 {
10837 if (player.GetInventory().HasAttachment(this))
10838 return false;
10839
10840 if (player.IsItemsToDelete())
10841 return false;
10842 }
10843
10844 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10845 return false;
10846
10847 int slotID;
10849 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10850 return false;
10851
10852 return true;
10853 }
10854
10856 {
10858 }
10859
10861 {
10862 return m_IsResultOfSplit;
10863 }
10864
10866 {
10867 m_IsResultOfSplit = value;
10868 }
10869
10871 {
10873 }
10874
10876 {
10877 float other_item_quantity = other_item.GetQuantity();
10878 float this_free_space;
10879
10881
10883
10884 if (other_item_quantity > this_free_space)
10885 {
10886 return this_free_space;
10887 }
10888 else
10889 {
10890 return other_item_quantity;
10891 }
10892 }
10893
10895 {
10897 }
10898
10900 {
10902 return;
10903
10904 if (!IsMagazine() && other_item)
10905 {
10907 if (quantity_used != 0)
10908 {
10909 float hp1 = GetHealth01("","");
10910 float hp2 = other_item.GetHealth01("","");
10911 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10912 hpResult = hpResult / (
GetQuantity() + quantity_used);
10913
10914 hpResult *= GetMaxHealth();
10915 Math.Round(hpResult);
10916 SetHealth("", "Health", hpResult);
10917
10919 other_item.AddQuantity(-quantity_used);
10920 }
10921 }
10923 }
10924
10926 {
10927 #ifdef SERVER
10928 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10929 GetHierarchyParent().IncreaseLifetimeUp();
10930 #endif
10931 };
10932
10934 {
10935 PlayerBase p = PlayerBase.Cast(player);
10936
10937 array<int> recipesIds = p.m_Recipes;
10938 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10939 if (moduleRecipesManager)
10940 {
10941 EntityAI itemInHands = player.GetEntityInHands();
10942 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10943 }
10944
10945 for (int i = 0;i < recipesIds.Count(); i++)
10946 {
10947 int key = recipesIds.Get(i);
10948 string recipeName = moduleRecipesManager.GetRecipeName(key);
10950 }
10951 }
10952
10953
10954 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10955 {
10956 super.GetDebugActions(outputList);
10957
10958
10964
10965
10970
10975
10976
10980
10981
10983 {
10987 }
10988
10991
10992
10996
10998
10999 InventoryLocation loc = new InventoryLocation();
11000 GetInventory().GetCurrentInventoryLocation(loc);
11002 {
11003 if (Gizmo_IsSupported())
11006 }
11007
11009 }
11010
11011
11012
11013
11015 {
11016 super.OnAction(action_id, player, ctx);
11017
11019 {
11020 switch (action_id)
11021 {
11025 return true;
11029 return true;
11030 }
11031 }
11032
11034 {
11035 switch (action_id)
11036 {
11038 Delete();
11039 return true;
11040 }
11041 }
11042
11043 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11044 {
11045 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11046 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11047 PlayerBase p = PlayerBase.Cast(player);
11048 if (
EActions.RECIPES_RANGE_START < 1000)
11049 {
11050 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11051 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11052 }
11053 }
11054 #ifndef SERVER
11055 else if (action_id ==
EActions.WATCH_PLAYER)
11056 {
11057 PluginDeveloper.SetDeveloperItemClientEx(player);
11058 }
11059 #endif
11061 {
11062 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11063 {
11064 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11065 OnDebugButtonPressServer(id + 1);
11066 }
11067
11068 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11069 {
11070 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11072 }
11073
11074 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11075 {
11076 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11078 }
11079
11080 else if (action_id ==
EActions.ADD_QUANTITY)
11081 {
11082 if (IsMagazine())
11083 {
11084 Magazine mag = Magazine.Cast(this);
11085 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11086 }
11087 else
11088 {
11090 }
11091
11092 if (m_EM)
11093 {
11094 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11095 }
11096
11097 }
11098
11099 else if (action_id ==
EActions.REMOVE_QUANTITY)
11100 {
11101 if (IsMagazine())
11102 {
11103 Magazine mag2 = Magazine.Cast(this);
11104 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11105 }
11106 else
11107 {
11109 }
11110 if (m_EM)
11111 {
11112 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11113 }
11114
11115 }
11116
11117 else if (action_id ==
EActions.SET_QUANTITY_0)
11118 {
11120
11121 if (m_EM)
11122 {
11123 m_EM.SetEnergy(0);
11124 }
11125 }
11126
11127 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11128 {
11130
11131 if (m_EM)
11132 {
11133 m_EM.SetEnergy(m_EM.GetEnergyMax());
11134 }
11135 }
11136
11137 else if (action_id ==
EActions.ADD_HEALTH)
11138 {
11139 AddHealth("","",GetMaxHealth("","Health")/5);
11140 }
11141 else if (action_id ==
EActions.REMOVE_HEALTH)
11142 {
11143 AddHealth("","",-GetMaxHealth("","Health")/5);
11144 }
11145 else if (action_id ==
EActions.DESTROY_HEALTH)
11146 {
11147 SetHealth01("","",0);
11148 }
11149 else if (action_id ==
EActions.WATCH_ITEM)
11150 {
11152 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11153 #ifdef DEVELOPER
11154 SetDebugDeveloper_item(this);
11155 #endif
11156 }
11157
11158 else if (action_id ==
EActions.ADD_TEMPERATURE)
11159 {
11160 AddTemperature(20);
11161
11162 }
11163
11164 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11165 {
11166 AddTemperature(-20);
11167
11168 }
11169
11170 else if (action_id ==
EActions.FLIP_FROZEN)
11171 {
11172 SetFrozen(!GetIsFrozen());
11173
11174 }
11175
11176 else if (action_id ==
EActions.ADD_WETNESS)
11177 {
11179
11180 }
11181
11182 else if (action_id ==
EActions.REMOVE_WETNESS)
11183 {
11185
11186 }
11187
11188 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11189 {
11192
11193
11194 }
11195
11196 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11197 {
11200 }
11201
11202 else if (action_id ==
EActions.MAKE_SPECIAL)
11203 {
11204 auto debugParams = DebugSpawnParams.WithPlayer(player);
11205 OnDebugSpawnEx(debugParams);
11206 }
11207
11208 }
11209
11210
11211 return false;
11212 }
11213
11214
11215
11216
11220
11223
11224
11225
11227 {
11228 return false;
11229 }
11230
11231
11233 {
11234 return true;
11235 }
11236
11237
11239 {
11240 return true;
11241 }
11242
11243
11244
11246 {
11247 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11248 return g_Game.ConfigIsExisting(config_path);
11249 }
11250
11253 {
11254 return null;
11255 }
11256
11258 {
11259 return false;
11260 }
11261
11263 {
11264 return false;
11265 }
11266
11270
11271
11273 {
11274 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11275 return module_repairing.CanRepair(this, item_repair_kit);
11276 }
11277
11278
11279 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11280 {
11281 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11282 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11283 }
11284
11285
11287 {
11288
11289
11290
11291
11292
11293
11294
11295
11296 return 1;
11297 }
11298
11299
11300
11302 {
11304 }
11305
11306
11307
11309 {
11311 }
11312
11313
11322 {
11323 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11324
11325 if (player)
11326 {
11327 player.MessageStatus(text);
11328 }
11329 }
11330
11331
11340 {
11341 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11342
11343 if (player)
11344 {
11345 player.MessageAction(text);
11346 }
11347 }
11348
11349
11358 {
11359 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11360
11361 if (player)
11362 {
11363 player.MessageFriendly(text);
11364 }
11365 }
11366
11367
11376 {
11377 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11378
11379 if (player)
11380 {
11381 player.MessageImportant(text);
11382 }
11383 }
11384
11386 {
11387 return true;
11388 }
11389
11390
11391 override bool KindOf(
string tag)
11392 {
11393 bool found = false;
11394 string item_name = this.
GetType();
11396 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11397
11398 int array_size = item_tag_array.Count();
11399 for (int i = 0; i < array_size; i++)
11400 {
11401 if (item_tag_array.Get(i) == tag)
11402 {
11403 found = true;
11404 break;
11405 }
11406 }
11407 return found;
11408 }
11409
11410
11412 {
11413
11414 super.OnRPC(sender, rpc_type,ctx);
11415
11416
11417 switch (rpc_type)
11418 {
11419 #ifndef SERVER
11420 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11421 Param2<bool, string> p = new Param2<bool, string>(false, "");
11422
11424 return;
11425
11426 bool play = p.param1;
11427 string soundSet = p.param2;
11428
11429 if (play)
11430 {
11432 {
11434 {
11436 }
11437 }
11438 else
11439 {
11441 }
11442 }
11443 else
11444 {
11446 }
11447
11448 break;
11449 #endif
11450
11451 }
11452
11454 {
11456 }
11457 }
11458
11459
11460
11461
11463 {
11464 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11465 return plugin.GetID(
name);
11466 }
11467
11469 {
11470 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11471 return plugin.GetName(id);
11472 }
11473
11476 {
11477
11478
11479 int varFlags;
11480 if (!ctx.
Read(varFlags))
11481 return;
11482
11483 if (varFlags & ItemVariableFlags.FLOAT)
11484 {
11486 }
11487 }
11488
11490 {
11491
11492 super.SerializeNumericalVars(floats_out);
11493
11494
11495
11497 {
11499 }
11500
11502 {
11504 }
11505
11507 {
11509 }
11510
11512 {
11517 }
11518
11520 {
11522 }
11523 }
11524
11526 {
11527
11528 super.DeSerializeNumericalVars(floats);
11529
11530
11531 int index = 0;
11532 int mask = Math.Round(floats.Get(index));
11533
11534 index++;
11535
11537 {
11539 {
11541 }
11542 else
11543 {
11544 float quantity = floats.Get(index);
11545 SetQuantity(quantity,
true,
false,
false,
false);
11546 }
11547 index++;
11548 }
11549
11551 {
11552 float wet = floats.Get(index);
11554 index++;
11555 }
11556
11558 {
11559 int liquidtype = Math.Round(floats.Get(index));
11561 index++;
11562 }
11563
11565 {
11567 index++;
11569 index++;
11571 index++;
11573 index++;
11574 }
11575
11577 {
11578 int cleanness = Math.Round(floats.Get(index));
11580 index++;
11581 }
11582 }
11583
11585 {
11586 super.WriteVarsToCTX(ctx);
11587
11588
11590 {
11592 }
11593
11595 {
11597 }
11598
11600 {
11602 }
11603
11605 {
11606 int r,g,b,a;
11612 }
11613
11615 {
11617 }
11618 }
11619
11621 {
11622 if (!super.ReadVarsFromCTX(ctx,version))
11623 return false;
11624
11625 int intValue;
11626 float value;
11627
11628 if (version < 140)
11629 {
11630 if (!ctx.
Read(intValue))
11631 return false;
11632
11633 m_VariablesMask = intValue;
11634 }
11635
11637 {
11638 if (!ctx.
Read(value))
11639 return false;
11640
11642 {
11644 }
11645 else
11646 {
11648 }
11649 }
11650
11651 if (version < 140)
11652 {
11654 {
11655 if (!ctx.
Read(value))
11656 return false;
11657 SetTemperatureDirect(value);
11658 }
11659 }
11660
11662 {
11663 if (!ctx.
Read(value))
11664 return false;
11666 }
11667
11669 {
11670 if (!ctx.
Read(intValue))
11671 return false;
11673 }
11674
11676 {
11677 int r,g,b,a;
11679 return false;
11681 return false;
11683 return false;
11685 return false;
11686
11688 }
11689
11691 {
11692 if (!ctx.
Read(intValue))
11693 return false;
11695 }
11696
11697 if (version >= 138 && version < 140)
11698 {
11700 {
11701 if (!ctx.
Read(intValue))
11702 return false;
11703 SetFrozen(intValue);
11704 }
11705 }
11706
11707 return true;
11708 }
11709
11710
11712 {
11715 {
11717 }
11718
11719 if (!super.OnStoreLoad(ctx, version))
11720 {
11722 return false;
11723 }
11724
11725 if (version >= 114)
11726 {
11727 bool hasQuickBarIndexSaved;
11728
11729 if (!ctx.
Read(hasQuickBarIndexSaved))
11730 {
11732 return false;
11733 }
11734
11735 if (hasQuickBarIndexSaved)
11736 {
11737 int itmQBIndex;
11738
11739
11740 if (!ctx.
Read(itmQBIndex))
11741 {
11743 return false;
11744 }
11745
11746 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11747 if (itmQBIndex != -1 && parentPlayer)
11748 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11749 }
11750 }
11751 else
11752 {
11753
11754 PlayerBase player;
11755 int itemQBIndex;
11756 if (version ==
int.
MAX)
11757 {
11758 if (!ctx.
Read(itemQBIndex))
11759 {
11761 return false;
11762 }
11763 }
11764 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11765 {
11766
11767 if (!ctx.
Read(itemQBIndex))
11768 {
11770 return false;
11771 }
11772 if (itemQBIndex != -1 && player)
11773 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11774 }
11775 }
11776
11777 if (version < 140)
11778 {
11779
11780 if (!LoadVariables(ctx, version))
11781 {
11783 return false;
11784 }
11785 }
11786
11787
11789 {
11791 return false;
11792 }
11793 if (version >= 132)
11794 {
11796 if (raib)
11797 {
11799 {
11801 return false;
11802 }
11803 }
11804 }
11805
11807 return true;
11808 }
11809
11810
11811
11813 {
11814 super.OnStoreSave(ctx);
11815
11816 PlayerBase player;
11817 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11818 {
11820
11821 int itemQBIndex = -1;
11822 itemQBIndex = player.FindQuickBarEntityIndex(this);
11823 ctx.
Write(itemQBIndex);
11824 }
11825 else
11826 {
11828 }
11829
11831
11833 if (raib)
11834 {
11836 }
11837 }
11838
11839
11841 {
11842 super.AfterStoreLoad();
11843
11845 {
11847 }
11848
11850 {
11853 }
11854 }
11855
11857 {
11858 super.EEOnAfterLoad();
11859
11861 {
11863 }
11864
11867 }
11868
11870 {
11871 return false;
11872 }
11873
11874
11875
11877 {
11879 {
11880 #ifdef PLATFORM_CONSOLE
11881
11883 {
11885 if (menu)
11886 {
11888 }
11889 }
11890 #endif
11891 }
11892
11894 {
11897 }
11898
11900 {
11901 SetWeightDirty();
11903 }
11905 {
11908 }
11909
11911 {
11914
11917 }
11919 {
11923 }
11924
11925 super.OnVariablesSynchronized();
11926 }
11927
11928
11929
11931 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11932 {
11933 if (!IsServerCheck(allow_client))
11934 return false;
11935
11937 return false;
11938
11941
11942 if (value <= (min + 0.001))
11943 value = min;
11944
11945 if (value == min)
11946 {
11947 if (destroy_config)
11948 {
11949 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11950 if (dstr)
11951 {
11953 this.Delete();
11954 return true;
11955 }
11956 }
11957 else if (destroy_forced)
11958 {
11960 this.Delete();
11961 return true;
11962 }
11963
11965 }
11966
11969
11971 {
11972 EntityAI parent = GetHierarchyRoot();
11973 InventoryLocation iLoc = new InventoryLocation();
11974 GetInventory().GetCurrentInventoryLocation(iLoc);
11976 {
11977 int iLocSlot = iLoc.
GetSlot();
11979 {
11981 }
11983 {
11985 }
11986 }
11987 }
11988
11990 {
11992
11993 if (delta)
11995 }
11996
11998
11999 return false;
12000 }
12001
12002
12004 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12005 {
12007 }
12008
12010 {
12013 }
12014
12016 {
12019 }
12020
12022 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12023 {
12024 float value_clamped = Math.Clamp(value, 0, 1);
12026 SetQuantity(result, destroy_config, destroy_forced);
12027 }
12028
12029
12032 {
12034 }
12035
12037 {
12039 }
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12051 {
12052 int slot = -1;
12053 GameInventory inventory = GetInventory();
12054 if (inventory)
12055 {
12056 InventoryLocation il = new InventoryLocation;
12059 }
12060
12062 }
12063
12065 {
12066 float quantity_max = 0;
12067
12069 {
12070 if (attSlotID != -1)
12071 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12072
12073 if (quantity_max <= 0)
12075 }
12076
12077 if (quantity_max <= 0)
12079
12080 return quantity_max;
12081 }
12082
12084 {
12086 }
12087
12089 {
12091 }
12092
12093
12095 {
12097 }
12098
12100 {
12102 }
12103
12105 {
12107 }
12108
12109
12111 {
12112
12113 float weightEx = GetWeightEx();
12114 float special = GetInventoryAndCargoWeight();
12115 return weightEx - special;
12116 }
12117
12118
12120 {
12122 }
12123
12125 {
12127 {
12128 #ifdef DEVELOPER
12129 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12130 {
12131 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12133 }
12134 #endif
12135
12136 return GetQuantity() * GetConfigWeightModified();
12137 }
12138 else if (HasEnergyManager())
12139 {
12140 #ifdef DEVELOPER
12141 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12142 {
12143 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12144 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12145 }
12146 #endif
12147 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12148 }
12149 else
12150 {
12151 #ifdef DEVELOPER
12152 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12153 {
12154 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12155 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12156 }
12157 #endif
12158 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12159 }
12160 }
12161
12164 {
12165 int item_count = 0;
12167
12168 GameInventory inventory = GetInventory();
12169 CargoBase cargo = inventory.
GetCargo();
12170 if (cargo != NULL)
12171 {
12173 }
12174
12176 for (int i = 0; i < nAttachments; ++i)
12177 {
12179 if (item)
12180 item_count += item.GetNumberOfItems();
12181 }
12182 return item_count;
12183 }
12184
12187 {
12188 float weight = 0;
12189 float wetness = 1;
12190 if (include_wetness)
12193 {
12194 weight = wetness * m_ConfigWeight;
12195 }
12197 {
12198 weight = 1;
12199 }
12200 return weight;
12201 }
12202
12203
12204
12206 {
12207 GameInventory inventory = GetInventory();
12208 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12209 {
12210 array<EntityAI> items = new array<EntityAI>;
12212 for (int i = 0; i < items.Count(); ++i)
12213 {
12215 if (item)
12216 {
12217 g_Game.ObjectDelete(item);
12218 }
12219 }
12220 }
12221 }
12222
12223
12224
12225
12227 {
12228 float energy = 0;
12229 if (HasEnergyManager())
12230 {
12231 energy = GetCompEM().GetEnergy();
12232 }
12233 return energy;
12234 }
12235
12236
12238 {
12239 super.OnEnergyConsumed();
12240
12242 }
12243
12245 {
12246 super.OnEnergyAdded();
12247
12249 }
12250
12251
12253 {
12254 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12255 {
12257 {
12258 float energy_0to1 = GetCompEM().GetEnergy0To1();
12260 }
12261 }
12262 }
12263
12264
12266 {
12267 return ConfigGetFloat("heatIsolation");
12268 }
12269
12271 {
12273 }
12274
12276 {
12277 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12278 if (
g_Game.ConfigIsExisting(paramPath))
12279 return g_Game.ConfigGetFloat(paramPath);
12280
12281 return 0.0;
12282 }
12283
12285 {
12286 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12287 if (
g_Game.ConfigIsExisting(paramPath))
12288 return g_Game.ConfigGetFloat(paramPath);
12289
12290 return 0.0;
12291 }
12292
12293 override void SetWet(
float value,
bool allow_client =
false)
12294 {
12295 if (!IsServerCheck(allow_client))
12296 return;
12297
12300
12302
12303 m_VarWet = Math.Clamp(value, min, max);
12304
12306 {
12309 }
12310 }
12311
12312 override void AddWet(
float value)
12313 {
12315 }
12316
12318 {
12320 }
12321
12323 {
12325 }
12326
12328 {
12330 }
12331
12333 {
12335 }
12336
12338 {
12340 }
12341
12342 override void OnWetChanged(
float newVal,
float oldVal)
12343 {
12346 if (newLevel != oldLevel)
12347 {
12349 }
12350 }
12351
12353 {
12354 SetWeightDirty();
12355 }
12356
12358 {
12359 return GetWetLevelInternal(
m_VarWet);
12360 }
12361
12362
12363
12365 {
12367 }
12368
12370 {
12372 }
12373
12375 {
12377 }
12378
12380 {
12382 }
12383
12384
12385
12387 {
12388 if (ConfigIsExisting("itemModelLength"))
12389 {
12390 return ConfigGetFloat("itemModelLength");
12391 }
12392 return 0;
12393 }
12394
12396 {
12397 if (ConfigIsExisting("itemAttachOffset"))
12398 {
12399 return ConfigGetFloat("itemAttachOffset");
12400 }
12401 return 0;
12402 }
12403
12404 override void SetCleanness(
int value,
bool allow_client =
false)
12405 {
12406 if (!IsServerCheck(allow_client))
12407 return;
12408
12410
12412
12415 }
12416
12418 {
12420 }
12421
12423 {
12424 return true;
12425 }
12426
12427
12428
12429
12431 {
12433 }
12434
12436 {
12438 }
12439
12440
12441
12442
12443 override void SetColor(
int r,
int g,
int b,
int a)
12444 {
12450 }
12452 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12453 {
12458 }
12459
12461 {
12463 }
12464
12467 {
12468 int r,g,b,a;
12470 r = r/255;
12471 g = g/255;
12472 b = b/255;
12473 a = a/255;
12474 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12475 }
12476
12477
12478
12479 override void SetLiquidType(
int value,
bool allow_client =
false)
12480 {
12481 if (!IsServerCheck(allow_client))
12482 return;
12483
12488 }
12489
12491 {
12492 return ConfigGetInt("varLiquidTypeInit");
12493 }
12494
12496 {
12498 }
12499
12501 {
12503 SetFrozen(false);
12504 }
12505
12508 {
12509 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12510 }
12511
12512
12515 {
12516 PlayerBase nplayer;
12517 if (PlayerBase.CastTo(nplayer, player))
12518 {
12520 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12521 }
12522 }
12523
12524
12527 {
12528 PlayerBase nplayer;
12529 if (PlayerBase.CastTo(nplayer,player))
12530 {
12531 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12532 }
12533
12534 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12535
12536 if (HasEnergyManager())
12537 {
12538 GetCompEM().UpdatePlugState();
12539 }
12540 }
12541
12542
12544 {
12545 super.OnPlacementStarted(player);
12546
12548 }
12549
12550 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12551 {
12553 {
12554 m_AdminLog.OnPlacementComplete(player,
this);
12555 }
12556
12557 super.OnPlacementComplete(player, position, orientation);
12558 }
12559
12560
12561
12562
12563
12565 {
12567 {
12568 return true;
12569 }
12570 else
12571 {
12572 return false;
12573 }
12574 }
12575
12576
12578 {
12580 {
12582 }
12583 }
12584
12585
12587 {
12589 }
12590
12592 {
12594 }
12595
12596 override void InsertAgent(
int agent,
float count = 1)
12597 {
12598 if (count < 1)
12599 return;
12600
12602 }
12603
12606 {
12608 }
12609
12610
12612 {
12614 }
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12658 {
12660 return false;
12661 return true;
12662 }
12663
12665 {
12666
12668 }
12669
12670
12673 {
12674 super.CheckForRoofLimited(timeTresholdMS);
12675
12676 float time =
g_Game.GetTime();
12677 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12678 {
12679 m_PreviousRoofTestTime = time;
12680 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12681 }
12682 }
12683
12684
12686 {
12688 {
12689 return 0;
12690 }
12691
12692 if (GetInventory().GetAttachmentSlotsCount() != 0)
12693 {
12694 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12695 if (filter)
12696 return filter.GetProtectionLevel(type, false, system);
12697 else
12698 return 0;
12699 }
12700
12701 string subclassPath, entryName;
12702
12703 switch (type)
12704 {
12706 entryName = "biological";
12707 break;
12709 entryName = "chemical";
12710 break;
12711 default:
12712 entryName = "biological";
12713 break;
12714 }
12715
12716 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12717
12718 return g_Game.ConfigGetFloat(subclassPath + entryName);
12719 }
12720
12721
12722
12725 {
12726 if (!IsMagazine())
12728
12730 }
12731
12732
12733
12734
12735
12740 {
12741 return true;
12742 }
12743
12745 {
12747 }
12748
12749
12750
12751
12752
12754 {
12755 if (parent)
12756 {
12757 if (parent.IsInherited(DayZInfected))
12758 return true;
12759
12760 if (!parent.IsRuined())
12761 return true;
12762 }
12763
12764 return true;
12765 }
12766
12768 {
12769 if (!super.CanPutAsAttachment(parent))
12770 {
12771 return false;
12772 }
12773
12774 if (!IsRuined() && !parent.IsRuined())
12775 {
12776 return true;
12777 }
12778
12779 return false;
12780 }
12781
12783 {
12784
12785
12786
12787
12788 return super.CanReceiveItemIntoCargo(item);
12789 }
12790
12792 {
12793
12794
12795
12796
12797 GameInventory attachmentInv = attachment.GetInventory();
12799 {
12800 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12801 return false;
12802 }
12803
12804 InventoryLocation loc = new InventoryLocation();
12805 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12806 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12807 return false;
12808
12809 return super.CanReceiveAttachment(attachment, slotId);
12810 }
12811
12813 {
12814 if (!super.CanReleaseAttachment(attachment))
12815 return false;
12816
12817 return GetInventory().AreChildrenAccessible();
12818 }
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12841 {
12842 int id = muzzle_owner.GetMuzzleID();
12843 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12844
12845 if (WPOF_array)
12846 {
12847 for (int i = 0; i < WPOF_array.Count(); i++)
12848 {
12849 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12850
12851 if (WPOF)
12852 {
12853 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12854 }
12855 }
12856 }
12857 }
12858
12859
12861 {
12862 int id = muzzle_owner.GetMuzzleID();
12864
12865 if (WPOBE_array)
12866 {
12867 for (int i = 0; i < WPOBE_array.Count(); i++)
12868 {
12869 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12870
12871 if (WPOBE)
12872 {
12873 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12874 }
12875 }
12876 }
12877 }
12878
12879
12881 {
12882 int id = muzzle_owner.GetMuzzleID();
12883 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12884
12885 if (WPOOH_array)
12886 {
12887 for (int i = 0; i < WPOOH_array.Count(); i++)
12888 {
12889 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12890
12891 if (WPOOH)
12892 {
12893 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12894 }
12895 }
12896 }
12897 }
12898
12899
12901 {
12902 int id = muzzle_owner.GetMuzzleID();
12903 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12904
12905 if (WPOOH_array)
12906 {
12907 for (int i = 0; i < WPOOH_array.Count(); i++)
12908 {
12909 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12910
12911 if (WPOOH)
12912 {
12913 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12914 }
12915 }
12916 }
12917 }
12918
12919
12921 {
12922 int id = muzzle_owner.GetMuzzleID();
12923 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12924
12925 if (WPOOH_array)
12926 {
12927 for (int i = 0; i < WPOOH_array.Count(); i++)
12928 {
12929 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12930
12931 if (WPOOH)
12932 {
12933 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12934 }
12935 }
12936 }
12937 }
12938
12939
12940
12942 {
12944 {
12945 return true;
12946 }
12947
12948 return false;
12949 }
12950
12952 {
12954 {
12955 return true;
12956 }
12957
12958 return false;
12959 }
12960
12962 {
12964 {
12965 return true;
12966 }
12967
12968 return false;
12969 }
12970
12972 {
12973 return false;
12974 }
12975
12978 {
12979 return UATimeSpent.DEFAULT_DEPLOY;
12980 }
12981
12982
12983
12984
12986 {
12988 SetSynchDirty();
12989 }
12990
12992 {
12994 }
12995
12996
12998 {
12999 return false;
13000 }
13001
13004 {
13005 string att_type = "None";
13006
13007 if (ConfigIsExisting("soundAttType"))
13008 {
13009 att_type = ConfigGetString("soundAttType");
13010 }
13011
13013 }
13014
13016 {
13018 }
13019
13020
13021
13022
13023
13029
13031 {
13034
13036 }
13037
13038
13040 {
13042 return;
13043
13045
13048
13051
13052 SoundParameters params = new SoundParameters();
13056 }
13057
13058
13060 {
13062 {
13065
13066 SetSynchDirty();
13067
13070 }
13071 }
13072
13074 {
13076 }
13077
13078
13080 {
13082 return;
13083
13085 SetSynchDirty();
13086
13089 }
13090
13092 {
13095 }
13096
13098 {
13100 }
13101
13102 void OnApply(PlayerBase player);
13103
13105 {
13106 return 1.0;
13107 };
13108
13110 {
13112 }
13113
13115 {
13117 }
13118
13120
13122 {
13123 SetDynamicPhysicsLifeTime(0.01);
13125 }
13126
13128 {
13129 array<string> zone_names = new array<string>;
13130 GetDamageZones(zone_names);
13131 for (int i = 0; i < zone_names.Count(); i++)
13132 {
13133 SetHealthMax(zone_names.Get(i),"Health");
13134 }
13135 SetHealthMax("","Health");
13136 }
13137
13140 {
13141 float global_health = GetHealth01("","Health");
13142 array<string> zones = new array<string>;
13143 GetDamageZones(zones);
13144
13145 for (int i = 0; i < zones.Count(); i++)
13146 {
13147 SetHealth01(zones.Get(i),"Health",global_health);
13148 }
13149 }
13150
13153 {
13154 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13155 }
13156
13158 {
13159 if (!hasRootAsPlayer)
13160 {
13161 if (refParentIB)
13162 {
13163
13164 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13165 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13166
13167 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13168 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13169
13172 }
13173 else
13174 {
13175
13178 }
13179 }
13180 }
13181
13183 {
13185 {
13186 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13187 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13188 {
13189 float heatPermCoef = 1.0;
13191 while (ent)
13192 {
13193 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13194 ent = ent.GetHierarchyParent();
13195 }
13196
13197 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13198 }
13199 }
13200 }
13201
13203 {
13204
13205 EntityAI parent = GetHierarchyParent();
13206 if (!parent)
13207 {
13208 hasParent = false;
13209 hasRootAsPlayer = false;
13210 }
13211 else
13212 {
13213 hasParent = true;
13214 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13215 refParentIB =
ItemBase.Cast(parent);
13216 }
13217 }
13218
13219 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13220 {
13221
13222 }
13223
13225 {
13226
13227 return false;
13228 }
13229
13231 {
13232
13233
13234 return false;
13235 }
13236
13238 {
13239
13240 return false;
13241 }
13242
13245 {
13246 return !GetIsFrozen() &&
IsOpen();
13247 }
13248
13250 {
13251 bool hasParent = false, hasRootAsPlayer = false;
13253
13254 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13255 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13256
13257 if (wwtu || foodDecay)
13258 {
13262
13263 if (processWetness || processTemperature || processDecay)
13264 {
13266
13267 if (processWetness)
13268 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13269
13270 if (processTemperature)
13272
13273 if (processDecay)
13274 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13275 }
13276 }
13277 }
13278
13281 {
13283 }
13284
13286 {
13289
13290 return super.GetTemperatureFreezeThreshold();
13291 }
13292
13294 {
13297
13298 return super.GetTemperatureThawThreshold();
13299 }
13300
13302 {
13305
13306 return super.GetItemOverheatThreshold();
13307 }
13308
13310 {
13312 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13313
13314 return super.GetTemperatureFreezeTime();
13315 }
13316
13318 {
13320 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13321
13322 return super.GetTemperatureThawTime();
13323 }
13324
13329
13331 {
13332 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13333 }
13334
13336 {
13337 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13338 }
13339
13342 {
13344 }
13345
13347 {
13349 }
13350
13352 {
13354 }
13355
13358 {
13359 return null;
13360 }
13361
13364 {
13365 return false;
13366 }
13367
13369 {
13371 {
13374 if (!trg)
13375 {
13377 explosive = this;
13378 }
13379
13380 explosive.PairRemote(trg);
13382
13383 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13384 trg.SetPersistentPairID(persistentID);
13385 explosive.SetPersistentPairID(persistentID);
13386
13387 return true;
13388 }
13389 return false;
13390 }
13391
13394 {
13395 float ret = 1.0;
13398 ret *= GetHealth01();
13399
13400 return ret;
13401 }
13402
13403 #ifdef DEVELOPER
13404 override void SetDebugItem()
13405 {
13406 super.SetDebugItem();
13407 _itemBase = this;
13408 }
13409
13411 {
13412 string text = super.GetDebugText();
13413
13415 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13416
13417 return text;
13418 }
13419 #endif
13420
13422 {
13423 return true;
13424 }
13425
13427
13429
13431 {
13434 }
13435
13436
13444
13460
13461 [
Obsolete(
"Use ItemSoundHandler instead")]
13464 {
13465 if (!
g_Game.IsDedicatedServer())
13466 {
13467 if (ConfigIsExisting("attachSoundSet"))
13468 {
13469 string cfg_path = "";
13470 string soundset = "";
13471 string type_name =
GetType();
13472
13475 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13476 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13477
13478 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13479 {
13480 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13481 {
13482 if (cfg_slot_array[i] == slot_type)
13483 {
13484 soundset = cfg_soundset_array[i];
13485 break;
13486 }
13487 }
13488 }
13489
13490 if (soundset != "")
13491 {
13492 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13494 }
13495 }
13496 }
13497 }
13498
13500}
13501
13503{
13505 if (entity)
13506 {
13507 bool is_item = entity.IsInherited(
ItemBase);
13508 if (is_item && full_quantity)
13509 {
13512 }
13513 }
13514 else
13515 {
13517 return NULL;
13518 }
13519 return entity;
13520}
13521
13523{
13524 if (item)
13525 {
13526 if (health > 0)
13527 item.SetHealth("", "", health);
13528
13529 if (item.CanHaveTemperature())
13530 {
13532 if (item.CanFreeze())
13533 item.SetFrozen(false);
13534 }
13535
13536 if (item.HasEnergyManager())
13537 {
13538 if (quantity >= 0)
13539 {
13540 item.GetCompEM().SetEnergy0To1(quantity);
13541 }
13542 else
13543 {
13545 }
13546 }
13547 else if (item.IsMagazine())
13548 {
13549 Magazine mag = Magazine.Cast(item);
13550 if (quantity >= 0)
13551 {
13552 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13553 }
13554 else
13555 {
13557 }
13558
13559 }
13560 else
13561 {
13562 if (quantity >= 0)
13563 {
13564 item.SetQuantityNormalized(quantity, false);
13565 }
13566 else
13567 {
13569 }
13570
13571 }
13572 }
13573}
13574
13575#ifdef DEVELOPER
13577#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.