8661{
8663 {
8664 return true;
8665 }
8666};
8667
8669{
8670
8671};
8672
8673
8674
8676{
8680
8682
8685
8686
8687
8688
8689
8698
8704
8709
8714
8735 protected bool m_IsResultOfSplit
8736
8738
8743
8744
8745
8747
8751
8752
8753
8755
8758
8759
8760
8766
8767
8775
8778
8779
8781
8782
8784
8785
8790
8791
8796
8798
8799
8801
8802
8804 {
8809
8810 if (!
g_Game.IsDedicatedServer())
8811 {
8813 {
8815
8817 {
8819 }
8820 }
8821
8824 }
8825
8826 m_OldLocation = null;
8827
8829 {
8831 }
8832
8833 if (ConfigIsExisting("headSelectionsToHide"))
8834 {
8837 }
8838
8840 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8841 {
8843 }
8844
8846
8847 m_IsResultOfSplit = false;
8848
8850 }
8851
8853 {
8854 super.InitItemVariables();
8855
8861 m_Count = ConfigGetInt(
"count");
8862
8865
8870
8873
8878
8890
8894
8895
8898 if (ConfigIsExisting("canBeSplit"))
8899 {
8902 }
8903
8905 if (ConfigIsExisting("itemBehaviour"))
8907
8908
8911 RegisterNetSyncVariableInt("m_VarLiquidType");
8912 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8913
8914 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8915 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8916 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8917
8918 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8919 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8920 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8921 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8922
8923 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8924 RegisterNetSyncVariableBool("m_IsTakeable");
8925 RegisterNetSyncVariableBool("m_IsHologram");
8926
8929 {
8932 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8933 }
8934
8936
8938 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8940
8942 }
8943
8945 {
8947 }
8948
8950 {
8953 {
8958 }
8959 }
8960
8961 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8962 {
8964 {
8967 }
8968
8970 }
8971
8973 {
8979 }
8980
8982
8984 {
8986
8987 if (!action)
8988 {
8989 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8990 return;
8991 }
8992
8994 if (!ai)
8995 {
8997 return;
8998 }
8999
9001 if (!action_array)
9002 {
9003 action_array = new array<ActionBase_Basic>;
9005 }
9006 if (LogManager.IsActionLogEnable())
9007 {
9008 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9009 }
9010
9011 if (action_array.Find(action) != -1)
9012 {
9013 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9014 }
9015 else
9016 {
9017 action_array.Insert(action);
9018 }
9019 }
9020
9022 {
9023 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9024 ActionBase action = player.GetActionManager().GetAction(actionName);
9027
9028 if (action_array)
9029 {
9030 action_array.RemoveItem(action);
9031 }
9032 }
9033
9034
9035
9037 {
9038 ActionOverrideData overrideData = new ActionOverrideData();
9042
9044 if (!actionMap)
9045 {
9048 }
9049
9050 actionMap.Insert(this.
Type(), overrideData);
9051
9052 }
9053
9055
9057
9058
9060 {
9063
9066
9067 string config_to_search = "CfgVehicles";
9068 string muzzle_owner_config;
9069
9071 {
9072 if (IsInherited(Weapon))
9073 config_to_search = "CfgWeapons";
9074
9075 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9076
9077 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9078
9079 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9080
9081 if (config_OnFire_subclass_count > 0)
9082 {
9083 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9084
9085 for (int i = 0; i < config_OnFire_subclass_count; i++)
9086 {
9087 string particle_class = "";
9088 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9089 string config_OnFire_entry = config_OnFire_class + particle_class;
9090 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9091 WPOF_array.Insert(WPOF);
9092 }
9093
9094
9096 }
9097 }
9098
9100 {
9101 config_to_search = "CfgWeapons";
9102 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9103
9104 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9105
9106 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9107
9108 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9109 {
9110 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9111
9112 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9113 {
9114 string particle_class2 = "";
9115 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9116 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9117 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9118 WPOBE_array.Insert(WPOBE);
9119 }
9120
9121
9123 }
9124 }
9125 }
9126
9127
9129 {
9132
9134 {
9135 string config_to_search = "CfgVehicles";
9136
9137 if (IsInherited(Weapon))
9138 config_to_search = "CfgWeapons";
9139
9140 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9141 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9142
9143 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9144 {
9145
9147
9149 {
9151 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9153 return;
9154 }
9155
9158
9159
9160
9161 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9162 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9163
9164 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9165 {
9166 string particle_class = "";
9167 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9168 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9169 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9170
9171 if (entry_type == CT_CLASS)
9172 {
9173 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9174 WPOOH_array.Insert(WPOF);
9175 }
9176 }
9177
9178
9180 }
9181 }
9182 }
9183
9185 {
9187 }
9188
9190 {
9192 {
9194
9197
9200
9201 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9202 }
9203 }
9204
9206 {
9208 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9209
9211 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9212
9214 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9215
9217 {
9219 }
9220 }
9221
9223 {
9225 }
9226
9228 {
9231 else
9233
9235 {
9238 }
9239 else
9240 {
9243
9246 }
9247
9249 }
9250
9252 {
9254 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9255 }
9256
9258 {
9260 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9262 }
9263
9265 {
9267 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9268 }
9269
9271 {
9274
9275 OverheatingParticle OP = new OverheatingParticle();
9280
9282 }
9283
9285 {
9288
9289 return -1;
9290 }
9291
9293 {
9295 {
9298
9299 for (int i = count; i > 0; --i)
9300 {
9301 int id = i - 1;
9304
9307
9308 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9309 {
9310 if (p)
9311 {
9314 }
9315 }
9316 }
9317 }
9318 }
9319
9321 {
9323 {
9325 {
9326 int id = i - 1;
9328
9329 if (OP)
9330 {
9332
9333 if (p)
9334 {
9336 }
9337
9338 delete OP;
9339 }
9340 }
9341
9344 }
9345 }
9346
9349 {
9350 return 0.0;
9351 }
9352
9353
9355 {
9356 return 250;
9357 }
9358
9360 {
9361 return 0;
9362 }
9363
9366 {
9368 return true;
9369
9370 return false;
9371 }
9372
9375 {
9378
9380 {
9382 }
9383 else
9384 {
9385
9387 }
9388
9390 }
9391
9398 {
9399 return -1;
9400 }
9401
9402
9403
9404
9406 {
9408 {
9409 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9410 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9411
9412 if (r_index >= 0)
9413 {
9414 InventoryLocation r_il = new InventoryLocation;
9415 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9416
9417 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9420 {
9421 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9422 }
9424 {
9425 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9426 }
9427
9428 }
9429
9430 player.GetHumanInventory().ClearUserReservedLocation(this);
9431 }
9432
9435 }
9436
9437
9438
9439
9441 {
9442 return ItemBase.m_DebugActionsMask;
9443 }
9444
9446 {
9447 return ItemBase.m_DebugActionsMask & mask;
9448 }
9449
9451 {
9452 ItemBase.m_DebugActionsMask = mask;
9453 }
9454
9456 {
9457 ItemBase.m_DebugActionsMask |= mask;
9458 }
9459
9461 {
9462 ItemBase.m_DebugActionsMask &= ~mask;
9463 }
9464
9466 {
9468 {
9470 }
9471 else
9472 {
9474 }
9475 }
9476
9477
9479 {
9480 if (GetEconomyProfile())
9481 {
9482 float q_max = GetEconomyProfile().GetQuantityMax();
9483 if (q_max > 0)
9484 {
9485 float q_min = GetEconomyProfile().GetQuantityMin();
9486 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9487
9489 {
9490 ComponentEnergyManager comp = GetCompEM();
9492 {
9494 }
9495 }
9497 {
9499
9500 }
9501
9502 }
9503 }
9504 }
9505
9508 {
9509 EntityAI parent = GetHierarchyParent();
9510
9511 if (parent)
9512 {
9513 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9514 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9515 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9516 }
9517 }
9518
9521 {
9522 EntityAI parent = GetHierarchyParent();
9523
9524 if (parent)
9525 {
9526 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9527 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9528 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9529 }
9530 }
9531
9533 {
9534
9535
9536
9537
9539
9541 {
9542 if (ScriptInputUserData.CanStoreInputUserData())
9543 {
9544 ScriptInputUserData ctx = new ScriptInputUserData;
9550 ctx.
Write(use_stack_max);
9553
9555 {
9556 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9557 }
9558 }
9559 }
9560 else if (!
g_Game.IsMultiplayer())
9561 {
9563 }
9564 }
9565
9567 {
9569 }
9570
9572 {
9574 }
9575
9577 {
9579 }
9580
9582 {
9583
9584 return false;
9585 }
9586
9588 {
9589 return false;
9590 }
9591
9595 {
9596 return false;
9597 }
9598
9600 {
9601 return "";
9602 }
9603
9605
9607 {
9608 return false;
9609 }
9610
9612 {
9613 return true;
9614 }
9615
9616
9617
9619 {
9620 return true;
9621 }
9622
9624 {
9625 return true;
9626 }
9627
9629 {
9630 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9632 }
9633
9635 {
9637 }
9638
9640 {
9642 if (!is_being_placed)
9644 SetSynchDirty();
9645 }
9646
9647
9649
9651 {
9653 }
9654
9656 {
9658 }
9659
9661 {
9662 return 1;
9663 }
9664
9666 {
9667 return false;
9668 }
9669
9671 {
9673 SetSynchDirty();
9674 }
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9711 {
9712 super.OnMovedInsideCargo(container);
9713
9714 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9715 }
9716
9717 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9718 {
9719 super.EEItemLocationChanged(oldLoc, newLoc);
9720
9721 PlayerBase newPlayer = null;
9722 PlayerBase oldPlayer = null;
9723
9724 if (newLoc.GetParent())
9725 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9726
9727 if (oldLoc.GetParent())
9728 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9729
9731 {
9732 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9733
9734 if (rIndex >= 0)
9735 {
9736 InventoryLocation rIl = new InventoryLocation;
9737 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9738
9739 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9742 {
9743 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9744 }
9746 {
9748 }
9749
9750 }
9751 }
9752
9754 {
9755 if (newPlayer)
9756 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9757
9758 if (newPlayer == oldPlayer)
9759 {
9760 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9761 {
9763 {
9764 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9765 {
9766 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9767 }
9768 }
9769 else
9770 {
9771 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9772 }
9773 }
9774
9775 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9776 {
9777 int type = oldLoc.GetType();
9779 {
9780 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9781 }
9783 {
9784 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9785 }
9786 }
9787 if (!m_OldLocation)
9788 {
9789 m_OldLocation = new InventoryLocation;
9790 }
9791 m_OldLocation.Copy(oldLoc);
9792 }
9793 else
9794 {
9795 if (m_OldLocation)
9796 {
9797 m_OldLocation.Reset();
9798 }
9799 }
9800
9801 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9802 }
9803 else
9804 {
9805 if (newPlayer)
9806 {
9807 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9808 if (resIndex >= 0)
9809 {
9810 InventoryLocation il = new InventoryLocation;
9811 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9813 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9816 {
9817 il.
GetParent().GetOnReleaseLock().Invoke(it);
9818 }
9820 {
9822 }
9823
9824 }
9825 }
9827 {
9828
9830 }
9831
9832 if (m_OldLocation)
9833 {
9834 m_OldLocation.Reset();
9835 }
9836 }
9837
9839 {
9840 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9841 }
9842
9844 {
9845 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9846 }
9847 }
9848
9849 override void EOnContact(IEntity other, Contact extra)
9850 {
9852 {
9853 int liquidType = -1;
9855 if (impactSpeed > 0.0)
9856 {
9858 #ifndef SERVER
9860 #else
9862 SetSynchDirty();
9863 #endif
9865 }
9866 }
9867
9868 #ifdef SERVER
9869 if (GetCompEM() && GetCompEM().IsPlugged())
9870 {
9871 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9872 GetCompEM().UnplugThis();
9873 }
9874 #endif
9875 }
9876
9878
9880 {
9882 }
9883
9885 {
9886
9887 }
9888
9890 {
9891 super.OnItemLocationChanged(old_owner, new_owner);
9892
9893 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9894 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9895
9896 if (!relatedPlayer && playerNew)
9897 relatedPlayer = playerNew;
9898
9899 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9900 {
9902 if (actionMgr)
9903 {
9904 ActionBase currentAction = actionMgr.GetRunningAction();
9905 if (currentAction)
9907 }
9908 }
9909
9910 Man ownerPlayerOld = null;
9911 Man ownerPlayerNew = null;
9912
9913 if (old_owner)
9914 {
9915 if (old_owner.
IsMan())
9916 {
9917 ownerPlayerOld = Man.Cast(old_owner);
9918 }
9919 else
9920 {
9921 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9922 }
9923 }
9924 else
9925 {
9927 {
9929
9930 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9931 {
9932 GetCompEM().UnplugThis();
9933 }
9934 }
9935 }
9936
9937 if (new_owner)
9938 {
9939 if (new_owner.
IsMan())
9940 {
9941 ownerPlayerNew = Man.Cast(new_owner);
9942 }
9943 else
9944 {
9945 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9946 }
9947 }
9948
9949 if (ownerPlayerOld != ownerPlayerNew)
9950 {
9951 if (ownerPlayerOld)
9952 {
9953 array<EntityAI> subItemsExit = new array<EntityAI>;
9955 for (int i = 0; i < subItemsExit.Count(); i++)
9956 {
9959 }
9960 }
9961
9962 if (ownerPlayerNew)
9963 {
9964 array<EntityAI> subItemsEnter = new array<EntityAI>;
9966 for (int j = 0; j < subItemsEnter.Count(); j++)
9967 {
9970 }
9971 }
9972 }
9973 else if (ownerPlayerNew != null)
9974 {
9975 PlayerBase nplayer;
9976 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9977 {
9978 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9980 for (int k = 0; k < subItemsUpdate.Count(); k++)
9981 {
9983 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9984 }
9985 }
9986 }
9987
9988 if (old_owner)
9989 old_owner.OnChildItemRemoved(this);
9990 if (new_owner)
9991 new_owner.OnChildItemReceived(this);
9992 }
9993
9994
9996 {
9997 super.EEDelete(parent);
9998 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9999 if (player)
10000 {
10002
10003 if (player.IsAlive())
10004 {
10005 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10006 if (r_index >= 0)
10007 {
10008 InventoryLocation r_il = new InventoryLocation;
10009 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10010
10011 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10014 {
10015 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10016 }
10018 {
10019 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10020 }
10021
10022 }
10023
10024 player.RemoveQuickBarEntityShortcut(this);
10025 }
10026 }
10027 }
10028
10030 {
10031 super.EEKilled(killer);
10032
10035 {
10036 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10037 {
10038 if (IsMagazine())
10039 {
10040 if (Magazine.Cast(this).GetAmmoCount() > 0)
10041 {
10043 }
10044 }
10045 else
10046 {
10048 }
10049 }
10050 }
10051 }
10052
10054 {
10055 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10056
10057 super.OnWasAttached(parent, slot_id);
10058
10061
10064 }
10065
10067 {
10068 super.OnWasDetached(parent, slot_id);
10069
10072
10075 }
10076
10078 {
10079 int idx;
10082
10083 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10084 if (inventory_slots.Count() < 1)
10085 {
10086 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10087 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10088 }
10089 else
10090 {
10091 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10092 }
10093
10094 idx = inventory_slots.Find(slot);
10095 if (idx < 0)
10096 return "";
10097
10098 return attach_types.Get(idx);
10099 }
10100
10102 {
10103 int idx = -1;
10104 string slot;
10105
10108
10109 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10110 if (inventory_slots.Count() < 1)
10111 {
10112 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10113 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10114 }
10115 else
10116 {
10117 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10118 if (detach_types.Count() < 1)
10119 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10120 }
10121
10122 for (int i = 0; i < inventory_slots.Count(); i++)
10123 {
10124 slot = inventory_slots.Get(i);
10125 }
10126
10127 if (slot != "")
10128 {
10129 if (detach_types.Count() == 1)
10130 idx = 0;
10131 else
10132 idx = inventory_slots.Find(slot);
10133 }
10134 if (idx < 0)
10135 return "";
10136
10137 return detach_types.Get(idx);
10138 }
10139
10141 {
10142
10144
10145
10146 float min_time = 1;
10147 float max_time = 3;
10148 float delay = Math.RandomFloat(min_time, max_time);
10149
10150 explode_timer.Run(delay, this, "DoAmmoExplosion");
10151 }
10152
10154 {
10155 Magazine magazine = Magazine.Cast(this);
10156 int pop_sounds_count = 6;
10157 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10158
10159
10160 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10161 string sound_name = pop_sounds[ sound_idx ];
10162 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10163
10164
10165 magazine.ServerAddAmmoCount(-1);
10166
10167
10168 float min_temp_to_explode = 100;
10169
10170 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10171 {
10173 }
10174 }
10175
10176
10177 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10178 {
10179 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10180
10181 const int CHANCE_DAMAGE_CARGO = 4;
10182 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10183 const int CHANCE_DAMAGE_NOTHING = 2;
10184
10186 {
10187 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10188 int chances;
10189 int rnd;
10190
10191 if (GetInventory().GetCargo())
10192 {
10193 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10194 rnd = Math.RandomInt(0,chances);
10195
10196 if (rnd < CHANCE_DAMAGE_CARGO)
10197 {
10199 }
10200 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10201 {
10203 }
10204 }
10205 else
10206 {
10207 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10208 rnd = Math.RandomInt(0,chances);
10209
10210 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10211 {
10213 }
10214 }
10215 }
10216 }
10217
10219 {
10220 CargoBase cargo = GetInventory().GetCargo();
10221 if (cargo)
10222 {
10224 if (item_count > 0)
10225 {
10226 int random_pick = Math.RandomInt(0, item_count);
10228 if (!item.IsExplosive())
10229 {
10230 item.AddHealth("","",damage);
10231 return true;
10232 }
10233 }
10234 }
10235 return false;
10236 }
10237
10239 {
10240 GameInventory inventory = GetInventory();
10242 if (attachment_count > 0)
10243 {
10244 int random_pick = Math.RandomInt(0, attachment_count);
10246 if (!attachment.IsExplosive())
10247 {
10248 attachment.AddHealth("","",damage);
10249 return true;
10250 }
10251 }
10252 return false;
10253 }
10254
10256 {
10258 }
10259
10261 {
10263 return GetInventory().CanRemoveEntity();
10264
10265 return false;
10266 }
10267
10269 {
10270
10272 return false;
10273
10274
10276 return false;
10277
10278
10279
10281 if (delta == 0)
10282 return false;
10283
10284
10285 return true;
10286 }
10287
10289 {
10291 {
10292 if (ScriptInputUserData.CanStoreInputUserData())
10293 {
10294 ScriptInputUserData ctx = new ScriptInputUserData;
10299 ctx.
Write(destination_entity);
10301 ctx.
Write(slot_id);
10303 }
10304 }
10305 else if (!
g_Game.IsMultiplayer())
10306 {
10308 }
10309 }
10310
10312 {
10313 float split_quantity_new;
10317 InventoryLocation loc = new InventoryLocation;
10318
10319 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10320 {
10322 split_quantity_new = stack_max;
10323 else
10325
10327 {
10328 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10329 if (new_item)
10330 {
10331 new_item.SetResultOfSplit(true);
10332 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10334 new_item.
SetQuantity(split_quantity_new,
false,
true);
10335 }
10336 }
10337 }
10338 else if (destination_entity && slot_id == -1)
10339 {
10340 if (quantity > stack_max)
10341 split_quantity_new = stack_max;
10342 else
10343 split_quantity_new = quantity;
10344
10346 {
10347 GameInventory destinationInventory = destination_entity.GetInventory();
10349 {
10352 }
10353
10354 if (new_item)
10355 {
10356 new_item.SetResultOfSplit(true);
10357 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10359 new_item.
SetQuantity(split_quantity_new,
false,
true);
10360 }
10361 }
10362 }
10363 else
10364 {
10365 if (stack_max != 0)
10366 {
10368 {
10370 }
10371
10372 if (split_quantity_new == 0)
10373 {
10374 if (!
g_Game.IsMultiplayer())
10375 player.PhysicalPredictiveDropItem(this);
10376 else
10377 player.ServerDropEntity(this);
10378 return;
10379 }
10380
10382 {
10384
10385 if (new_item)
10386 {
10387 new_item.SetResultOfSplit(true);
10388 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10391 new_item.PlaceOnSurface();
10392 }
10393 }
10394 }
10395 }
10396 }
10397
10399 {
10400 float split_quantity_new;
10404 InventoryLocation loc = new InventoryLocation;
10405
10406 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10407 {
10409 split_quantity_new = stack_max;
10410 else
10412
10414 {
10415 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10416 if (new_item)
10417 {
10418 new_item.SetResultOfSplit(true);
10419 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10421 new_item.
SetQuantity(split_quantity_new,
false,
true);
10422 }
10423 }
10424 }
10425 else if (destination_entity && slot_id == -1)
10426 {
10427 if (quantity > stack_max)
10428 split_quantity_new = stack_max;
10429 else
10430 split_quantity_new = quantity;
10431
10433 {
10434 GameInventory destinationInventory = destination_entity.GetInventory();
10436 {
10439 }
10440
10441 if (new_item)
10442 {
10443 new_item.SetResultOfSplit(true);
10444 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10446 new_item.
SetQuantity(split_quantity_new,
false,
true);
10447 }
10448 }
10449 }
10450 else
10451 {
10452 if (stack_max != 0)
10453 {
10455 {
10457 }
10458
10460 {
10462
10463 if (new_item)
10464 {
10465 new_item.SetResultOfSplit(true);
10466 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10469 new_item.PlaceOnSurface();
10470 }
10471 }
10472 }
10473 }
10474 }
10475
10477 {
10479 {
10480 if (ScriptInputUserData.CanStoreInputUserData())
10481 {
10482 ScriptInputUserData ctx = new ScriptInputUserData;
10487 dst.WriteToContext(ctx);
10489 }
10490 }
10491 else if (!
g_Game.IsMultiplayer())
10492 {
10494 }
10495 }
10496
10498 {
10500 {
10501 if (ScriptInputUserData.CanStoreInputUserData())
10502 {
10503 ScriptInputUserData ctx = new ScriptInputUserData;
10508 ctx.
Write(destination_entity);
10514 }
10515 }
10516 else if (!
g_Game.IsMultiplayer())
10517 {
10519 }
10520 }
10521
10523 {
10525 }
10526
10528 {
10530 float split_quantity_new;
10532 if (dst.IsValid())
10533 {
10534 int slot_id = dst.GetSlot();
10536
10537 if (quantity > stack_max)
10538 split_quantity_new = stack_max;
10539 else
10540 split_quantity_new = quantity;
10541
10543 {
10545
10546 if (new_item)
10547 {
10548 new_item.SetResultOfSplit(true);
10549 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10551 new_item.
SetQuantity(split_quantity_new,
false,
true);
10552 }
10553
10554 return new_item;
10555 }
10556 }
10557
10558 return null;
10559 }
10560
10562 {
10564 float split_quantity_new;
10566 if (destination_entity)
10567 {
10569 if (quantity > stackable)
10570 split_quantity_new = stackable;
10571 else
10572 split_quantity_new = quantity;
10573
10575 {
10576 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10577 if (new_item)
10578 {
10579 new_item.SetResultOfSplit(true);
10580 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10582 new_item.
SetQuantity(split_quantity_new,
false,
true);
10583 }
10584 }
10585 }
10586 }
10587
10589 {
10591 {
10592 if (ScriptInputUserData.CanStoreInputUserData())
10593 {
10594 ScriptInputUserData ctx = new ScriptInputUserData;
10599 ItemBase destination_entity =
this;
10600 ctx.
Write(destination_entity);
10604 }
10605 }
10606 else if (!
g_Game.IsMultiplayer())
10607 {
10609 }
10610 }
10611
10613 {
10615 float split_quantity_new;
10617 if (player)
10618 {
10620 if (quantity > stackable)
10621 split_quantity_new = stackable;
10622 else
10623 split_quantity_new = quantity;
10624
10626 {
10627 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10628 new_item =
ItemBase.Cast(in_hands);
10629 if (new_item)
10630 {
10631 new_item.SetResultOfSplit(true);
10632 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10634 new_item.SetQuantity(split_quantity_new, false, true);
10635 }
10636 }
10637 }
10638 }
10639
10641 {
10643 float split_quantity_new = Math.Floor(quantity * 0.5);
10644
10646 return;
10647
10649
10650 if (new_item)
10651 {
10652 if (new_item.GetQuantityMax() < split_quantity_new)
10653 {
10654 split_quantity_new = new_item.GetQuantityMax();
10655 }
10656
10657 new_item.SetResultOfSplit(true);
10658 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10659
10661 {
10664 }
10665 else
10666 {
10668 new_item.
SetQuantity(split_quantity_new,
false,
true);
10669 }
10670 }
10671 }
10672
10674 {
10676 float split_quantity_new = Math.Floor(quantity / 2);
10677
10679 return;
10680
10681 InventoryLocation invloc = new InventoryLocation;
10683
10685 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10686
10687 if (new_item)
10688 {
10689 if (new_item.GetQuantityMax() < split_quantity_new)
10690 {
10691 split_quantity_new = new_item.GetQuantityMax();
10692 }
10694 {
10697 }
10698 else if (split_quantity_new > 1)
10699 {
10701 new_item.
SetQuantity(split_quantity_new,
false,
true);
10702 }
10703 }
10704 }
10705
10708 {
10709 SetWeightDirty();
10711
10712 if (parent)
10713 parent.OnAttachmentQuantityChangedEx(this, delta);
10714
10716 {
10718 {
10720 }
10722 {
10723 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10725 }
10726 }
10727 }
10728
10731 {
10732
10733 }
10734
10737 {
10739 }
10740
10742 {
10743 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10744
10746 {
10747 if (newLevel == GameConstants.STATE_RUINED)
10748 {
10750 EntityAI parent = GetHierarchyParent();
10751 if (parent && parent.IsFireplace())
10752 {
10753 CargoBase cargo = GetInventory().GetCargo();
10754 if (cargo)
10755 {
10757 {
10759 }
10760 }
10761 }
10762 }
10763
10765 {
10766
10768 return;
10769 }
10770
10771 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10772 {
10774 }
10775 }
10776 }
10777
10778
10780 {
10781 super.OnRightClick();
10782
10784 {
10786 {
10787 if (ScriptInputUserData.CanStoreInputUserData())
10788 {
10789 EntityAI root = GetHierarchyRoot();
10790 Man playerOwner = GetHierarchyRootPlayer();
10791 InventoryLocation dst = new InventoryLocation;
10792
10793
10794 if (!playerOwner && root && root == this)
10795 {
10797 }
10798 else
10799 {
10800
10801 GetInventory().GetCurrentInventoryLocation(dst);
10803 {
10804 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10806 {
10808 }
10809 else
10810 {
10812
10813
10814 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10815 {
10817 }
10818 else
10819 {
10820 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10821 }
10822 }
10823 }
10824 }
10825
10826 ScriptInputUserData ctx = new ScriptInputUserData;
10834 }
10835 }
10836 else if (!
g_Game.IsMultiplayer())
10837 {
10839 }
10840 }
10841 }
10842
10844 {
10845 if (root)
10846 {
10847 vector m4[4];
10848 root.GetTransform(m4);
10849 dst.SetGround(this, m4);
10850 }
10851 else
10852 {
10853 GetInventory().GetCurrentInventoryLocation(dst);
10854 }
10855 }
10856
10857 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10858 {
10859
10860 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10861 return false;
10862
10863 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10864 return false;
10865
10866
10868 return false;
10869
10870
10871 Magazine mag = Magazine.Cast(this);
10872 if (mag)
10873 {
10874 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10875 return false;
10876
10877 if (stack_max_limit)
10878 {
10879 Magazine other_mag = Magazine.Cast(other_item);
10880 if (other_item)
10881 {
10882 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10883 return false;
10884 }
10885
10886 }
10887 }
10888 else
10889 {
10890
10892 return false;
10893
10895 return false;
10896 }
10897
10898 PlayerBase player = null;
10899 if (CastTo(player, GetHierarchyRootPlayer()))
10900 {
10901 if (player.GetInventory().HasAttachment(this))
10902 return false;
10903
10904 if (player.IsItemsToDelete())
10905 return false;
10906 }
10907
10908 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10909 return false;
10910
10911 int slotID;
10913 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10914 return false;
10915
10916 return true;
10917 }
10918
10920 {
10922 }
10923
10925 {
10926 return m_IsResultOfSplit;
10927 }
10928
10930 {
10931 m_IsResultOfSplit = value;
10932 }
10933
10935 {
10937 }
10938
10940 {
10941 float other_item_quantity = other_item.GetQuantity();
10942 float this_free_space;
10943
10945
10947
10948 if (other_item_quantity > this_free_space)
10949 {
10950 return this_free_space;
10951 }
10952 else
10953 {
10954 return other_item_quantity;
10955 }
10956 }
10957
10959 {
10961 }
10962
10964 {
10966 return;
10967
10968 if (!IsMagazine() && other_item)
10969 {
10971 if (quantity_used != 0)
10972 {
10973 float hp1 = GetHealth01("","");
10974 float hp2 = other_item.GetHealth01("","");
10975 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10976 hpResult = hpResult / (
GetQuantity() + quantity_used);
10977
10978 hpResult *= GetMaxHealth();
10979 Math.Round(hpResult);
10980 SetHealth("", "Health", hpResult);
10981
10983 other_item.AddQuantity(-quantity_used);
10984 }
10985 }
10987 }
10988
10990 {
10991 #ifdef SERVER
10992 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10993 GetHierarchyParent().IncreaseLifetimeUp();
10994 #endif
10995 };
10996
10998 {
10999 PlayerBase p = PlayerBase.Cast(player);
11000
11001 array<int> recipesIds = p.m_Recipes;
11002 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11003 if (moduleRecipesManager)
11004 {
11005 EntityAI itemInHands = player.GetEntityInHands();
11006 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11007 }
11008
11009 for (int i = 0;i < recipesIds.Count(); i++)
11010 {
11011 int key = recipesIds.Get(i);
11012 string recipeName = moduleRecipesManager.GetRecipeName(key);
11014 }
11015 }
11016
11017
11018 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11019 {
11020 super.GetDebugActions(outputList);
11021
11022
11028
11029
11034
11039
11040
11044
11045
11047 {
11051 }
11052
11055
11056
11060
11062
11063 InventoryLocation loc = new InventoryLocation();
11064 GetInventory().GetCurrentInventoryLocation(loc);
11066 {
11067 if (Gizmo_IsSupported())
11070 }
11071
11073 }
11074
11075
11076
11077
11079 {
11080 super.OnAction(action_id, player, ctx);
11081
11083 {
11084 switch (action_id)
11085 {
11089 return true;
11093 return true;
11094 }
11095 }
11096
11098 {
11099 switch (action_id)
11100 {
11102 Delete();
11103 return true;
11104 }
11105 }
11106
11107 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11108 {
11109 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11110 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11111 PlayerBase p = PlayerBase.Cast(player);
11112 if (
EActions.RECIPES_RANGE_START < 1000)
11113 {
11114 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11115 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11116 }
11117 }
11118 #ifndef SERVER
11119 else if (action_id ==
EActions.WATCH_PLAYER)
11120 {
11121 PluginDeveloper.SetDeveloperItemClientEx(player);
11122 }
11123 #endif
11125 {
11126 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11127 {
11128 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11129 OnDebugButtonPressServer(id + 1);
11130 }
11131
11132 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11133 {
11134 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11136 }
11137
11138 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11139 {
11140 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11142 }
11143
11144 else if (action_id ==
EActions.ADD_QUANTITY)
11145 {
11146 if (IsMagazine())
11147 {
11148 Magazine mag = Magazine.Cast(this);
11149 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11150 }
11151 else
11152 {
11154 }
11155
11156 if (m_EM)
11157 {
11158 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11159 }
11160
11161 }
11162
11163 else if (action_id ==
EActions.REMOVE_QUANTITY)
11164 {
11165 if (IsMagazine())
11166 {
11167 Magazine mag2 = Magazine.Cast(this);
11168 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11169 }
11170 else
11171 {
11173 }
11174 if (m_EM)
11175 {
11176 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11177 }
11178
11179 }
11180
11181 else if (action_id ==
EActions.SET_QUANTITY_0)
11182 {
11184
11185 if (m_EM)
11186 {
11187 m_EM.SetEnergy(0);
11188 }
11189 }
11190
11191 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11192 {
11194
11195 if (m_EM)
11196 {
11197 m_EM.SetEnergy(m_EM.GetEnergyMax());
11198 }
11199 }
11200
11201 else if (action_id ==
EActions.ADD_HEALTH)
11202 {
11203 AddHealth("","",GetMaxHealth("","Health")/5);
11204 }
11205 else if (action_id ==
EActions.REMOVE_HEALTH)
11206 {
11207 AddHealth("","",-GetMaxHealth("","Health")/5);
11208 }
11209 else if (action_id ==
EActions.DESTROY_HEALTH)
11210 {
11211 SetHealth01("","",0);
11212 }
11213 else if (action_id ==
EActions.WATCH_ITEM)
11214 {
11216 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11217 #ifdef DEVELOPER
11218 SetDebugDeveloper_item(this);
11219 #endif
11220 }
11221
11222 else if (action_id ==
EActions.ADD_TEMPERATURE)
11223 {
11224 AddTemperature(20);
11225
11226 }
11227
11228 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11229 {
11230 AddTemperature(-20);
11231
11232 }
11233
11234 else if (action_id ==
EActions.FLIP_FROZEN)
11235 {
11236 SetFrozen(!GetIsFrozen());
11237
11238 }
11239
11240 else if (action_id ==
EActions.ADD_WETNESS)
11241 {
11243
11244 }
11245
11246 else if (action_id ==
EActions.REMOVE_WETNESS)
11247 {
11249
11250 }
11251
11252 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11253 {
11256
11257
11258 }
11259
11260 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11261 {
11264 }
11265
11266 else if (action_id ==
EActions.MAKE_SPECIAL)
11267 {
11268 auto debugParams = DebugSpawnParams.WithPlayer(player);
11269 OnDebugSpawnEx(debugParams);
11270 }
11271
11272 }
11273
11274
11275 return false;
11276 }
11277
11278
11279
11280
11284
11287
11288
11289
11291 {
11292 return false;
11293 }
11294
11295
11297 {
11298 return true;
11299 }
11300
11301
11303 {
11304 return true;
11305 }
11306
11307
11308
11310 {
11311 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11312 return g_Game.ConfigIsExisting(config_path);
11313 }
11314
11317 {
11318 return null;
11319 }
11320
11322 {
11323 return false;
11324 }
11325
11327 {
11328 return false;
11329 }
11330
11334
11335
11337 {
11338 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11339 return module_repairing.CanRepair(this, item_repair_kit);
11340 }
11341
11342
11343 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11344 {
11345 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11346 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11347 }
11348
11349
11351 {
11352
11353
11354
11355
11356
11357
11358
11359
11360 return 1;
11361 }
11362
11363
11364
11366 {
11368 }
11369
11370
11371
11373 {
11375 }
11376
11377
11386 {
11387 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11388
11389 if (player)
11390 {
11391 player.MessageStatus(text);
11392 }
11393 }
11394
11395
11404 {
11405 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11406
11407 if (player)
11408 {
11409 player.MessageAction(text);
11410 }
11411 }
11412
11413
11422 {
11423 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11424
11425 if (player)
11426 {
11427 player.MessageFriendly(text);
11428 }
11429 }
11430
11431
11440 {
11441 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11442
11443 if (player)
11444 {
11445 player.MessageImportant(text);
11446 }
11447 }
11448
11450 {
11451 return true;
11452 }
11453
11454
11455 override bool KindOf(
string tag)
11456 {
11457 bool found = false;
11458 string item_name = this.
GetType();
11460 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11461
11462 int array_size = item_tag_array.Count();
11463 for (int i = 0; i < array_size; i++)
11464 {
11465 if (item_tag_array.Get(i) == tag)
11466 {
11467 found = true;
11468 break;
11469 }
11470 }
11471 return found;
11472 }
11473
11474
11476 {
11477
11478 super.OnRPC(sender, rpc_type,ctx);
11479
11480
11481 switch (rpc_type)
11482 {
11483 #ifndef SERVER
11484 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11485 Param2<bool, string> p = new Param2<bool, string>(false, "");
11486
11488 return;
11489
11490 bool play = p.param1;
11491 string soundSet = p.param2;
11492
11493 if (play)
11494 {
11496 {
11498 {
11500 }
11501 }
11502 else
11503 {
11505 }
11506 }
11507 else
11508 {
11510 }
11511
11512 break;
11513 #endif
11514
11515 }
11516
11518 {
11520 }
11521 }
11522
11523
11524
11525
11527 {
11528 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11529 return plugin.GetID(
name);
11530 }
11531
11533 {
11534 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11535 return plugin.GetName(id);
11536 }
11537
11540 {
11541
11542
11543 int varFlags;
11544 if (!ctx.
Read(varFlags))
11545 return;
11546
11547 if (varFlags & ItemVariableFlags.FLOAT)
11548 {
11550 }
11551 }
11552
11554 {
11555
11556 super.SerializeNumericalVars(floats_out);
11557
11558
11559
11561 {
11563 }
11564
11566 {
11568 }
11569
11571 {
11573 }
11574
11576 {
11581 }
11582
11584 {
11586 }
11587 }
11588
11590 {
11591
11592 super.DeSerializeNumericalVars(floats);
11593
11594
11595 int index = 0;
11596 int mask = Math.Round(floats.Get(index));
11597
11598 index++;
11599
11601 {
11603 {
11605 }
11606 else
11607 {
11608 float quantity = floats.Get(index);
11609 SetQuantity(quantity,
true,
false,
false,
false);
11610 }
11611 index++;
11612 }
11613
11615 {
11616 float wet = floats.Get(index);
11618 index++;
11619 }
11620
11622 {
11623 int liquidtype = Math.Round(floats.Get(index));
11625 index++;
11626 }
11627
11629 {
11631 index++;
11633 index++;
11635 index++;
11637 index++;
11638 }
11639
11641 {
11642 int cleanness = Math.Round(floats.Get(index));
11644 index++;
11645 }
11646 }
11647
11649 {
11650 super.WriteVarsToCTX(ctx);
11651
11652
11654 {
11656 }
11657
11659 {
11661 }
11662
11664 {
11666 }
11667
11669 {
11670 int r,g,b,a;
11676 }
11677
11679 {
11681 }
11682 }
11683
11685 {
11686 if (!super.ReadVarsFromCTX(ctx,version))
11687 return false;
11688
11689 int intValue;
11690 float value;
11691
11692 if (version < 140)
11693 {
11694 if (!ctx.
Read(intValue))
11695 return false;
11696
11697 m_VariablesMask = intValue;
11698 }
11699
11701 {
11702 if (!ctx.
Read(value))
11703 return false;
11704
11706 {
11708 }
11709 else
11710 {
11712 }
11713 }
11714
11715 if (version < 140)
11716 {
11718 {
11719 if (!ctx.
Read(value))
11720 return false;
11721 SetTemperatureDirect(value);
11722 }
11723 }
11724
11726 {
11727 if (!ctx.
Read(value))
11728 return false;
11730 }
11731
11733 {
11734 if (!ctx.
Read(intValue))
11735 return false;
11737 }
11738
11740 {
11741 int r,g,b,a;
11743 return false;
11745 return false;
11747 return false;
11749 return false;
11750
11752 }
11753
11755 {
11756 if (!ctx.
Read(intValue))
11757 return false;
11759 }
11760
11761 if (version >= 138 && version < 140)
11762 {
11764 {
11765 if (!ctx.
Read(intValue))
11766 return false;
11767 SetFrozen(intValue);
11768 }
11769 }
11770
11771 return true;
11772 }
11773
11774
11776 {
11779 {
11781 }
11782
11783 if (!super.OnStoreLoad(ctx, version))
11784 {
11786 return false;
11787 }
11788
11789 if (version >= 114)
11790 {
11791 bool hasQuickBarIndexSaved;
11792
11793 if (!ctx.
Read(hasQuickBarIndexSaved))
11794 {
11796 return false;
11797 }
11798
11799 if (hasQuickBarIndexSaved)
11800 {
11801 int itmQBIndex;
11802
11803
11804 if (!ctx.
Read(itmQBIndex))
11805 {
11807 return false;
11808 }
11809
11810 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11811 if (itmQBIndex != -1 && parentPlayer)
11812 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11813 }
11814 }
11815 else
11816 {
11817
11818 PlayerBase player;
11819 int itemQBIndex;
11820 if (version ==
int.
MAX)
11821 {
11822 if (!ctx.
Read(itemQBIndex))
11823 {
11825 return false;
11826 }
11827 }
11828 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11829 {
11830
11831 if (!ctx.
Read(itemQBIndex))
11832 {
11834 return false;
11835 }
11836 if (itemQBIndex != -1 && player)
11837 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11838 }
11839 }
11840
11841 if (version < 140)
11842 {
11843
11844 if (!LoadVariables(ctx, version))
11845 {
11847 return false;
11848 }
11849 }
11850
11851
11853 {
11855 return false;
11856 }
11857 if (version >= 132)
11858 {
11860 if (raib)
11861 {
11863 {
11865 return false;
11866 }
11867 }
11868 }
11869
11871 return true;
11872 }
11873
11874
11875
11877 {
11878 super.OnStoreSave(ctx);
11879
11880 PlayerBase player;
11881 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11882 {
11884
11885 int itemQBIndex = -1;
11886 itemQBIndex = player.FindQuickBarEntityIndex(this);
11887 ctx.
Write(itemQBIndex);
11888 }
11889 else
11890 {
11892 }
11893
11895
11897 if (raib)
11898 {
11900 }
11901 }
11902
11903
11905 {
11906 super.AfterStoreLoad();
11907
11909 {
11911 }
11912
11914 {
11917 }
11918 }
11919
11921 {
11922 super.EEOnAfterLoad();
11923
11925 {
11927 }
11928
11931 }
11932
11934 {
11935 return false;
11936 }
11937
11938
11939
11941 {
11943 {
11944 #ifdef PLATFORM_CONSOLE
11945
11947 {
11949 if (menu)
11950 {
11952 }
11953 }
11954 #endif
11955 }
11956
11958 {
11961 }
11962
11964 {
11965 SetWeightDirty();
11967 }
11969 {
11972 }
11973
11975 {
11978
11981 }
11983 {
11987 }
11988
11989 super.OnVariablesSynchronized();
11990 }
11991
11992
11993
11995 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11996 {
11997 if (!IsServerCheck(allow_client))
11998 return false;
11999
12001 return false;
12002
12005
12006 if (value <= (min + 0.001))
12007 value = min;
12008
12009 if (value == min)
12010 {
12011 if (destroy_config)
12012 {
12013 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12014 if (dstr)
12015 {
12017 this.Delete();
12018 return true;
12019 }
12020 }
12021 else if (destroy_forced)
12022 {
12024 this.Delete();
12025 return true;
12026 }
12027
12029 }
12030
12033
12035 {
12036 EntityAI parent = GetHierarchyRoot();
12037 InventoryLocation iLoc = new InventoryLocation();
12038 GetInventory().GetCurrentInventoryLocation(iLoc);
12040 {
12041 int iLocSlot = iLoc.
GetSlot();
12043 {
12045 }
12047 {
12049 }
12050 }
12051 }
12052
12054 {
12056
12057 if (delta)
12059 }
12060
12062
12063 return false;
12064 }
12065
12066
12068 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12069 {
12071 }
12072
12074 {
12077 }
12078
12080 {
12083 }
12084
12086 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12087 {
12088 float value_clamped = Math.Clamp(value, 0, 1);
12090 SetQuantity(result, destroy_config, destroy_forced);
12091 }
12092
12093
12096 {
12098 }
12099
12101 {
12103 }
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12115 {
12116 int slot = -1;
12117 GameInventory inventory = GetInventory();
12118 if (inventory)
12119 {
12120 InventoryLocation il = new InventoryLocation;
12123 }
12124
12126 }
12127
12129 {
12130 float quantity_max = 0;
12131
12133 {
12134 if (attSlotID != -1)
12135 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12136
12137 if (quantity_max <= 0)
12139 }
12140
12141 if (quantity_max <= 0)
12143
12144 return quantity_max;
12145 }
12146
12148 {
12150 }
12151
12153 {
12155 }
12156
12157
12159 {
12161 }
12162
12164 {
12166 }
12167
12169 {
12171 }
12172
12173
12175 {
12176
12177 float weightEx = GetWeightEx();
12178 float special = GetInventoryAndCargoWeight();
12179 return weightEx - special;
12180 }
12181
12182
12184 {
12186 }
12187
12189 {
12191 {
12192 #ifdef DEVELOPER
12193 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12194 {
12195 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12197 }
12198 #endif
12199
12200 return GetQuantity() * GetConfigWeightModified();
12201 }
12202 else if (HasEnergyManager())
12203 {
12204 #ifdef DEVELOPER
12205 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12206 {
12207 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12208 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12209 }
12210 #endif
12211 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12212 }
12213 else
12214 {
12215 #ifdef DEVELOPER
12216 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12217 {
12218 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12219 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12220 }
12221 #endif
12222 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12223 }
12224 }
12225
12228 {
12229 int item_count = 0;
12231
12232 GameInventory inventory = GetInventory();
12233 CargoBase cargo = inventory.
GetCargo();
12234 if (cargo != NULL)
12235 {
12237 }
12238
12240 for (int i = 0; i < nAttachments; ++i)
12241 {
12243 if (item)
12244 item_count += item.GetNumberOfItems();
12245 }
12246 return item_count;
12247 }
12248
12251 {
12252 float weight = 0;
12253 float wetness = 1;
12254 if (include_wetness)
12257 {
12258 weight = wetness * m_ConfigWeight;
12259 }
12261 {
12262 weight = 1;
12263 }
12264 return weight;
12265 }
12266
12267
12268
12270 {
12271 GameInventory inventory = GetInventory();
12272 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12273 {
12274 array<EntityAI> items = new array<EntityAI>;
12276 for (int i = 0; i < items.Count(); ++i)
12277 {
12279 if (item)
12280 {
12281 g_Game.ObjectDelete(item);
12282 }
12283 }
12284 }
12285 }
12286
12287
12288
12289
12291 {
12292 float energy = 0;
12293 if (HasEnergyManager())
12294 {
12295 energy = GetCompEM().GetEnergy();
12296 }
12297 return energy;
12298 }
12299
12300
12302 {
12303 super.OnEnergyConsumed();
12304
12306 }
12307
12309 {
12310 super.OnEnergyAdded();
12311
12313 }
12314
12315
12317 {
12318 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12319 {
12321 {
12322 float energy_0to1 = GetCompEM().GetEnergy0To1();
12324 }
12325 }
12326 }
12327
12328
12330 {
12331 return ConfigGetFloat("heatIsolation");
12332 }
12333
12335 {
12337 }
12338
12340 {
12341 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12342 if (
g_Game.ConfigIsExisting(paramPath))
12343 return g_Game.ConfigGetFloat(paramPath);
12344
12345 return 0.0;
12346 }
12347
12349 {
12350 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12351 if (
g_Game.ConfigIsExisting(paramPath))
12352 return g_Game.ConfigGetFloat(paramPath);
12353
12354 return 0.0;
12355 }
12356
12357 override void SetWet(
float value,
bool allow_client =
false)
12358 {
12359 if (!IsServerCheck(allow_client))
12360 return;
12361
12364
12366
12367 m_VarWet = Math.Clamp(value, min, max);
12368
12370 {
12373 }
12374 }
12375
12376 override void AddWet(
float value)
12377 {
12379 }
12380
12382 {
12384 }
12385
12387 {
12389 }
12390
12392 {
12394 }
12395
12397 {
12399 }
12400
12402 {
12404 }
12405
12406 override void OnWetChanged(
float newVal,
float oldVal)
12407 {
12410 if (newLevel != oldLevel)
12411 {
12413 }
12414 }
12415
12417 {
12418 SetWeightDirty();
12419 }
12420
12422 {
12423 return GetWetLevelInternal(
m_VarWet);
12424 }
12425
12426
12427
12429 {
12431 }
12432
12434 {
12436 }
12437
12439 {
12441 }
12442
12444 {
12446 }
12447
12448
12449
12451 {
12452 if (ConfigIsExisting("itemModelLength"))
12453 {
12454 return ConfigGetFloat("itemModelLength");
12455 }
12456 return 0;
12457 }
12458
12460 {
12461 if (ConfigIsExisting("itemAttachOffset"))
12462 {
12463 return ConfigGetFloat("itemAttachOffset");
12464 }
12465 return 0;
12466 }
12467
12468 override void SetCleanness(
int value,
bool allow_client =
false)
12469 {
12470 if (!IsServerCheck(allow_client))
12471 return;
12472
12474
12476
12479 }
12480
12482 {
12484 }
12485
12487 {
12488 return true;
12489 }
12490
12491
12492
12493
12495 {
12497 }
12498
12500 {
12502 }
12503
12504
12505
12506
12507 override void SetColor(
int r,
int g,
int b,
int a)
12508 {
12514 }
12516 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12517 {
12522 }
12523
12525 {
12527 }
12528
12531 {
12532 int r,g,b,a;
12534 r = r/255;
12535 g = g/255;
12536 b = b/255;
12537 a = a/255;
12538 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12539 }
12540
12541
12542
12543 override void SetLiquidType(
int value,
bool allow_client =
false)
12544 {
12545 if (!IsServerCheck(allow_client))
12546 return;
12547
12552 }
12553
12555 {
12556 return ConfigGetInt("varLiquidTypeInit");
12557 }
12558
12560 {
12562 }
12563
12565 {
12567 SetFrozen(false);
12568 }
12569
12572 {
12573 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12574 }
12575
12576
12579 {
12580 PlayerBase nplayer;
12581 if (PlayerBase.CastTo(nplayer, player))
12582 {
12584 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12585 }
12586 }
12587
12588
12591 {
12592 PlayerBase nplayer;
12593 if (PlayerBase.CastTo(nplayer,player))
12594 {
12595 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12596 }
12597
12598 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12599
12600 if (HasEnergyManager())
12601 {
12602 GetCompEM().UpdatePlugState();
12603 }
12604 }
12605
12606
12608 {
12609 super.OnPlacementStarted(player);
12610
12612 }
12613
12614 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12615 {
12617 {
12618 m_AdminLog.OnPlacementComplete(player,
this);
12619 }
12620
12621 super.OnPlacementComplete(player, position, orientation);
12622 }
12623
12624
12625
12626
12627
12629 {
12631 {
12632 return true;
12633 }
12634 else
12635 {
12636 return false;
12637 }
12638 }
12639
12640
12642 {
12644 {
12646 }
12647 }
12648
12649
12651 {
12653 }
12654
12656 {
12658 }
12659
12660 override void InsertAgent(
int agent,
float count = 1)
12661 {
12662 if (count < 1)
12663 return;
12664
12666 }
12667
12670 {
12672 }
12673
12674
12676 {
12678 }
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12722 {
12724 return false;
12725 return true;
12726 }
12727
12729 {
12730
12732 }
12733
12734
12737 {
12738 super.CheckForRoofLimited(timeTresholdMS);
12739
12740 float time =
g_Game.GetTime();
12741 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12742 {
12743 m_PreviousRoofTestTime = time;
12744 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12745 }
12746 }
12747
12748
12750 {
12752 {
12753 return 0;
12754 }
12755
12756 if (GetInventory().GetAttachmentSlotsCount() != 0)
12757 {
12758 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12759 if (filter)
12760 return filter.GetProtectionLevel(type, false, system);
12761 else
12762 return 0;
12763 }
12764
12765 string subclassPath, entryName;
12766
12767 switch (type)
12768 {
12770 entryName = "biological";
12771 break;
12773 entryName = "chemical";
12774 break;
12775 default:
12776 entryName = "biological";
12777 break;
12778 }
12779
12780 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12781
12782 return g_Game.ConfigGetFloat(subclassPath + entryName);
12783 }
12784
12785
12786
12789 {
12790 if (!IsMagazine())
12792
12794 }
12795
12796
12797
12798
12799
12804 {
12805 return true;
12806 }
12807
12809 {
12811 }
12812
12813
12814
12815
12816
12818 {
12819 if (parent)
12820 {
12821 if (parent.IsInherited(DayZInfected))
12822 return true;
12823
12824 if (!parent.IsRuined())
12825 return true;
12826 }
12827
12828 return true;
12829 }
12830
12832 {
12833 if (!super.CanPutAsAttachment(parent))
12834 {
12835 return false;
12836 }
12837
12838 if (!IsRuined() && !parent.IsRuined())
12839 {
12840 return true;
12841 }
12842
12843 return false;
12844 }
12845
12847 {
12848
12849
12850
12851
12852 return super.CanReceiveItemIntoCargo(item);
12853 }
12854
12856 {
12857
12858
12859
12860
12861 GameInventory attachmentInv = attachment.GetInventory();
12863 {
12864 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12865 return false;
12866 }
12867
12868 InventoryLocation loc = new InventoryLocation();
12869 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12870 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12871 return false;
12872
12873 return super.CanReceiveAttachment(attachment, slotId);
12874 }
12875
12877 {
12878 if (!super.CanReleaseAttachment(attachment))
12879 return false;
12880
12881 return GetInventory().AreChildrenAccessible();
12882 }
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12905 {
12906 int id = muzzle_owner.GetMuzzleID();
12907 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12908
12909 if (WPOF_array)
12910 {
12911 for (int i = 0; i < WPOF_array.Count(); i++)
12912 {
12913 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12914
12915 if (WPOF)
12916 {
12917 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12918 }
12919 }
12920 }
12921 }
12922
12923
12925 {
12926 int id = muzzle_owner.GetMuzzleID();
12928
12929 if (WPOBE_array)
12930 {
12931 for (int i = 0; i < WPOBE_array.Count(); i++)
12932 {
12933 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12934
12935 if (WPOBE)
12936 {
12937 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12938 }
12939 }
12940 }
12941 }
12942
12943
12945 {
12946 int id = muzzle_owner.GetMuzzleID();
12947 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12948
12949 if (WPOOH_array)
12950 {
12951 for (int i = 0; i < WPOOH_array.Count(); i++)
12952 {
12953 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12954
12955 if (WPOOH)
12956 {
12957 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12958 }
12959 }
12960 }
12961 }
12962
12963
12965 {
12966 int id = muzzle_owner.GetMuzzleID();
12967 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12968
12969 if (WPOOH_array)
12970 {
12971 for (int i = 0; i < WPOOH_array.Count(); i++)
12972 {
12973 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12974
12975 if (WPOOH)
12976 {
12977 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12978 }
12979 }
12980 }
12981 }
12982
12983
12985 {
12986 int id = muzzle_owner.GetMuzzleID();
12987 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12988
12989 if (WPOOH_array)
12990 {
12991 for (int i = 0; i < WPOOH_array.Count(); i++)
12992 {
12993 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12994
12995 if (WPOOH)
12996 {
12997 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12998 }
12999 }
13000 }
13001 }
13002
13003
13004
13006 {
13008 {
13009 return true;
13010 }
13011
13012 return false;
13013 }
13014
13016 {
13018 {
13019 return true;
13020 }
13021
13022 return false;
13023 }
13024
13026 {
13028 {
13029 return true;
13030 }
13031
13032 return false;
13033 }
13034
13036 {
13037 return false;
13038 }
13039
13042 {
13043 return UATimeSpent.DEFAULT_DEPLOY;
13044 }
13045
13046
13047
13048
13050 {
13052 SetSynchDirty();
13053 }
13054
13056 {
13058 }
13059
13060
13062 {
13063 return false;
13064 }
13065
13068 {
13069 string att_type = "None";
13070
13071 if (ConfigIsExisting("soundAttType"))
13072 {
13073 att_type = ConfigGetString("soundAttType");
13074 }
13075
13077 }
13078
13080 {
13082 }
13083
13084
13085
13086
13087
13093
13095 {
13098
13100 }
13101
13102
13104 {
13106 return;
13107
13109
13112
13115
13116 SoundParameters params = new SoundParameters();
13120 }
13121
13122
13124 {
13126 {
13129
13130 SetSynchDirty();
13131
13134 }
13135 }
13136
13138 {
13140 }
13141
13142
13144 {
13146 return;
13147
13149 SetSynchDirty();
13150
13153 }
13154
13156 {
13159 }
13160
13162 {
13164 }
13165
13166 void OnApply(PlayerBase player);
13167
13169 {
13170 return 1.0;
13171 };
13172
13174 {
13176 }
13177
13179 {
13181 }
13182
13184
13186 {
13187 SetDynamicPhysicsLifeTime(0.01);
13189 }
13190
13192 {
13193 array<string> zone_names = new array<string>;
13194 GetDamageZones(zone_names);
13195 for (int i = 0; i < zone_names.Count(); i++)
13196 {
13197 SetHealthMax(zone_names.Get(i),"Health");
13198 }
13199 SetHealthMax("","Health");
13200 }
13201
13204 {
13205 float global_health = GetHealth01("","Health");
13206 array<string> zones = new array<string>;
13207 GetDamageZones(zones);
13208
13209 for (int i = 0; i < zones.Count(); i++)
13210 {
13211 SetHealth01(zones.Get(i),"Health",global_health);
13212 }
13213 }
13214
13217 {
13218 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13219 }
13220
13222 {
13223 if (!hasRootAsPlayer)
13224 {
13225 if (refParentIB)
13226 {
13227
13228 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13229 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13230
13231 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13232 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13233
13236 }
13237 else
13238 {
13239
13242 }
13243 }
13244 }
13245
13247 {
13249 {
13250 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13251 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13252 {
13253 float heatPermCoef = 1.0;
13255 while (ent)
13256 {
13257 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13258 ent = ent.GetHierarchyParent();
13259 }
13260
13261 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13262 }
13263 }
13264 }
13265
13267 {
13268
13269 EntityAI parent = GetHierarchyParent();
13270 if (!parent)
13271 {
13272 hasParent = false;
13273 hasRootAsPlayer = false;
13274 }
13275 else
13276 {
13277 hasParent = true;
13278 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13279 refParentIB =
ItemBase.Cast(parent);
13280 }
13281 }
13282
13283 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13284 {
13285
13286 }
13287
13289 {
13290
13291 return false;
13292 }
13293
13295 {
13296
13297
13298 return false;
13299 }
13300
13302 {
13303
13304 return false;
13305 }
13306
13309 {
13310 return !GetIsFrozen() &&
IsOpen();
13311 }
13312
13314 {
13315 bool hasParent = false, hasRootAsPlayer = false;
13317
13318 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13319 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13320
13321 if (wwtu || foodDecay)
13322 {
13326
13327 if (processWetness || processTemperature || processDecay)
13328 {
13330
13331 if (processWetness)
13332 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13333
13334 if (processTemperature)
13336
13337 if (processDecay)
13338 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13339 }
13340 }
13341 }
13342
13345 {
13347 }
13348
13350 {
13353
13354 return super.GetTemperatureFreezeThreshold();
13355 }
13356
13358 {
13361
13362 return super.GetTemperatureThawThreshold();
13363 }
13364
13366 {
13369
13370 return super.GetItemOverheatThreshold();
13371 }
13372
13374 {
13376 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13377
13378 return super.GetTemperatureFreezeTime();
13379 }
13380
13382 {
13384 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13385
13386 return super.GetTemperatureThawTime();
13387 }
13388
13393
13395 {
13396 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13397 }
13398
13400 {
13401 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13402 }
13403
13406 {
13408 }
13409
13411 {
13413 }
13414
13416 {
13418 }
13419
13422 {
13423 return null;
13424 }
13425
13428 {
13429 return false;
13430 }
13431
13433 {
13435 {
13438 if (!trg)
13439 {
13441 explosive = this;
13442 }
13443
13444 explosive.PairRemote(trg);
13446
13447 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13448 trg.SetPersistentPairID(persistentID);
13449 explosive.SetPersistentPairID(persistentID);
13450
13451 return true;
13452 }
13453 return false;
13454 }
13455
13458 {
13459 float ret = 1.0;
13462 ret *= GetHealth01();
13463
13464 return ret;
13465 }
13466
13467 #ifdef DEVELOPER
13468 override void SetDebugItem()
13469 {
13470 super.SetDebugItem();
13471 _itemBase = this;
13472 }
13473
13475 {
13476 string text = super.GetDebugText();
13477
13479 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13480
13481 return text;
13482 }
13483 #endif
13484
13486 {
13487 return true;
13488 }
13489
13491
13493
13495 {
13498 }
13499
13500
13508
13524
13525 [
Obsolete(
"Use ItemSoundHandler instead")]
13528 {
13529 if (!
g_Game.IsDedicatedServer())
13530 {
13531 if (ConfigIsExisting("attachSoundSet"))
13532 {
13533 string cfg_path = "";
13534 string soundset = "";
13535 string type_name =
GetType();
13536
13539 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13540 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13541
13542 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13543 {
13544 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13545 {
13546 if (cfg_slot_array[i] == slot_type)
13547 {
13548 soundset = cfg_soundset_array[i];
13549 break;
13550 }
13551 }
13552 }
13553
13554 if (soundset != "")
13555 {
13556 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13558 }
13559 }
13560 }
13561 }
13562
13564}
13565
13567{
13569 if (entity)
13570 {
13571 bool is_item = entity.IsInherited(
ItemBase);
13572 if (is_item && full_quantity)
13573 {
13576 }
13577 }
13578 else
13579 {
13581 return NULL;
13582 }
13583 return entity;
13584}
13585
13587{
13588 if (item)
13589 {
13590 if (health > 0)
13591 item.SetHealth("", "", health);
13592
13593 if (item.CanHaveTemperature())
13594 {
13596 if (item.CanFreeze())
13597 item.SetFrozen(false);
13598 }
13599
13600 if (item.HasEnergyManager())
13601 {
13602 if (quantity >= 0)
13603 {
13604 item.GetCompEM().SetEnergy0To1(quantity);
13605 }
13606 else
13607 {
13609 }
13610 }
13611 else if (item.IsMagazine())
13612 {
13613 Magazine mag = Magazine.Cast(item);
13614 if (quantity >= 0)
13615 {
13616 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13617 }
13618 else
13619 {
13621 }
13622
13623 }
13624 else
13625 {
13626 if (quantity >= 0)
13627 {
13628 item.SetQuantityNormalized(quantity, false);
13629 }
13630 else
13631 {
13633 }
13634
13635 }
13636 }
13637}
13638
13639#ifdef DEVELOPER
13641#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.