8721{
8723 {
8724 return true;
8725 }
8726};
8727
8729{
8730
8731};
8732
8733
8734
8736{
8740
8742
8745
8746
8747
8748
8749
8758
8764
8769
8774
8795 protected bool m_IsResultOfSplit
8796
8798
8803
8804
8805
8807
8811
8812
8813
8815
8818
8819
8820
8826
8827
8835
8838
8839
8841
8842
8844
8845
8850
8851
8856
8858
8859
8861
8862
8864 {
8869
8870 if (!
g_Game.IsDedicatedServer())
8871 {
8873 {
8875
8877 {
8879 }
8880 }
8881
8884 }
8885
8886 m_OldLocation = null;
8887
8889 {
8891 }
8892
8893 if (ConfigIsExisting("headSelectionsToHide"))
8894 {
8897 }
8898
8900 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8901 {
8903 }
8904
8906
8907 m_IsResultOfSplit = false;
8908
8910 }
8911
8913 {
8914 super.InitItemVariables();
8915
8921 m_Count = ConfigGetInt(
"count");
8922
8925
8930
8933
8938
8950
8954
8955
8958 if (ConfigIsExisting("canBeSplit"))
8959 {
8962 }
8963
8965 if (ConfigIsExisting("itemBehaviour"))
8967
8968
8971 RegisterNetSyncVariableInt("m_VarLiquidType");
8972 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8973
8974 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8975 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8976 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8977
8978 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8979 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8980 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8981 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8982
8983 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8984 RegisterNetSyncVariableBool("m_IsTakeable");
8985 RegisterNetSyncVariableBool("m_IsHologram");
8986
8989 {
8992 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8993 }
8994
8996
8998 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9000
9002 }
9003
9005 {
9007 }
9008
9010 {
9013 {
9018 }
9019 }
9020
9021 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9022 {
9024 {
9027 }
9028
9030 }
9031
9033 {
9039 }
9040
9042
9044 {
9046
9047 if (!action)
9048 {
9049 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9050 return;
9051 }
9052
9054 if (!ai)
9055 {
9057 return;
9058 }
9059
9061 if (!action_array)
9062 {
9063 action_array = new array<ActionBase_Basic>;
9065 }
9066 if (LogManager.IsActionLogEnable())
9067 {
9068 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9069 }
9070
9071 if (action_array.Find(action) != -1)
9072 {
9073 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9074 }
9075 else
9076 {
9077 action_array.Insert(action);
9078 }
9079 }
9080
9082 {
9083 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9084 ActionBase action = player.GetActionManager().GetAction(actionName);
9087
9088 if (action_array)
9089 {
9090 action_array.RemoveItem(action);
9091 }
9092 }
9093
9094
9095
9097 {
9098 ActionOverrideData overrideData = new ActionOverrideData();
9102
9104 if (!actionMap)
9105 {
9108 }
9109
9110 actionMap.Insert(this.
Type(), overrideData);
9111
9112 }
9113
9115
9117
9118
9120 {
9123
9126
9127 string config_to_search = "CfgVehicles";
9128 string muzzle_owner_config;
9129
9131 {
9132 if (IsInherited(Weapon))
9133 config_to_search = "CfgWeapons";
9134
9135 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9136
9137 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9138
9139 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9140
9141 if (config_OnFire_subclass_count > 0)
9142 {
9143 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9144
9145 for (int i = 0; i < config_OnFire_subclass_count; i++)
9146 {
9147 string particle_class = "";
9148 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9149 string config_OnFire_entry = config_OnFire_class + particle_class;
9150 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9151 WPOF_array.Insert(WPOF);
9152 }
9153
9154
9156 }
9157 }
9158
9160 {
9161 config_to_search = "CfgWeapons";
9162 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9163
9164 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9165
9166 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9167
9168 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9169 {
9170 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9171
9172 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9173 {
9174 string particle_class2 = "";
9175 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9176 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9177 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9178 WPOBE_array.Insert(WPOBE);
9179 }
9180
9181
9183 }
9184 }
9185 }
9186
9187
9189 {
9192
9194 {
9195 string config_to_search = "CfgVehicles";
9196
9197 if (IsInherited(Weapon))
9198 config_to_search = "CfgWeapons";
9199
9200 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9201 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9202
9203 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9204 {
9205
9207
9209 {
9211 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9213 return;
9214 }
9215
9218
9219
9220
9221 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9222 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9223
9224 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9225 {
9226 string particle_class = "";
9227 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9228 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9229 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9230
9231 if (entry_type == CT_CLASS)
9232 {
9233 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9234 WPOOH_array.Insert(WPOF);
9235 }
9236 }
9237
9238
9240 }
9241 }
9242 }
9243
9245 {
9247 }
9248
9250 {
9252 {
9254
9257
9260
9261 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9262 }
9263 }
9264
9266 {
9268 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9269
9271 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9272
9274 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9275
9277 {
9279 }
9280 }
9281
9283 {
9285 }
9286
9288 {
9291 else
9293
9295 {
9298 }
9299 else
9300 {
9303
9306 }
9307
9309 }
9310
9312 {
9314 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9315 }
9316
9318 {
9320 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9322 }
9323
9325 {
9327 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9328 }
9329
9331 {
9334
9335 OverheatingParticle OP = new OverheatingParticle();
9340
9342 }
9343
9345 {
9348
9349 return -1;
9350 }
9351
9353 {
9355 {
9358
9359 for (int i = count; i > 0; --i)
9360 {
9361 int id = i - 1;
9364
9367
9368 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9369 {
9370 if (p)
9371 {
9374 }
9375 }
9376 }
9377 }
9378 }
9379
9381 {
9383 {
9385 {
9386 int id = i - 1;
9388
9389 if (OP)
9390 {
9392
9393 if (p)
9394 {
9396 }
9397
9398 delete OP;
9399 }
9400 }
9401
9404 }
9405 }
9406
9409 {
9410 return 0.0;
9411 }
9412
9413
9415 {
9416 return 250;
9417 }
9418
9420 {
9421 return 0;
9422 }
9423
9426 {
9428 return true;
9429
9430 return false;
9431 }
9432
9435 {
9438
9440 {
9442 }
9443 else
9444 {
9445
9447 }
9448
9450 }
9451
9458 {
9459 return -1;
9460 }
9461
9462
9463
9464
9466 {
9468 {
9469 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9470 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9471
9472 if (r_index >= 0)
9473 {
9474 InventoryLocation r_il = new InventoryLocation;
9475 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9476
9477 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9480 {
9481 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9482 }
9484 {
9485 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9486 }
9487
9488 }
9489
9490 player.GetHumanInventory().ClearUserReservedLocation(this);
9491 }
9492
9495 }
9496
9497
9498
9499
9501 {
9502 return ItemBase.m_DebugActionsMask;
9503 }
9504
9506 {
9507 return ItemBase.m_DebugActionsMask & mask;
9508 }
9509
9511 {
9512 ItemBase.m_DebugActionsMask = mask;
9513 }
9514
9516 {
9517 ItemBase.m_DebugActionsMask |= mask;
9518 }
9519
9521 {
9522 ItemBase.m_DebugActionsMask &= ~mask;
9523 }
9524
9526 {
9528 {
9530 }
9531 else
9532 {
9534 }
9535 }
9536
9537
9539 {
9540 if (GetEconomyProfile())
9541 {
9542 float q_max = GetEconomyProfile().GetQuantityMax();
9543 if (q_max > 0)
9544 {
9545 float q_min = GetEconomyProfile().GetQuantityMin();
9546 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9547
9549 {
9550 ComponentEnergyManager comp = GetCompEM();
9552 {
9554 }
9555 }
9557 {
9559
9560 }
9561
9562 }
9563 }
9564 }
9565
9568 {
9569 EntityAI parent = GetHierarchyParent();
9570
9571 if (parent)
9572 {
9573 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9574 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9575 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9576 }
9577 }
9578
9581 {
9582 EntityAI parent = GetHierarchyParent();
9583
9584 if (parent)
9585 {
9586 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9587 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9588 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9589 }
9590 }
9591
9593 {
9594
9595
9596
9597
9599
9601 {
9602 if (ScriptInputUserData.CanStoreInputUserData())
9603 {
9604 ScriptInputUserData ctx = new ScriptInputUserData;
9610 ctx.
Write(use_stack_max);
9613
9615 {
9616 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9617 }
9618 }
9619 }
9620 else if (!
g_Game.IsMultiplayer())
9621 {
9623 }
9624 }
9625
9627 {
9629 }
9630
9632 {
9634 }
9635
9637 {
9639 }
9640
9642 {
9643
9644 return false;
9645 }
9646
9648 {
9649 return false;
9650 }
9651
9655 {
9656 return false;
9657 }
9658
9660 {
9661 return "";
9662 }
9663
9665
9667 {
9668 return false;
9669 }
9670
9672 {
9673 return true;
9674 }
9675
9676
9677
9679 {
9680 return true;
9681 }
9682
9684 {
9685 return true;
9686 }
9687
9689 {
9690 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9692 }
9693
9695 {
9697 }
9698
9700 {
9702 if (!is_being_placed)
9704 SetSynchDirty();
9705 }
9706
9707
9709
9711 {
9713 }
9714
9716 {
9718 }
9719
9721 {
9722 return 1;
9723 }
9724
9726 {
9727 return false;
9728 }
9729
9731 {
9733 SetSynchDirty();
9734 }
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9771 {
9772 super.OnMovedInsideCargo(container);
9773
9774 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9775 }
9776
9777 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9778 {
9779 super.EEItemLocationChanged(oldLoc, newLoc);
9780
9781 PlayerBase newPlayer = null;
9782 PlayerBase oldPlayer = null;
9783
9784 if (newLoc.GetParent())
9785 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9786
9787 if (oldLoc.GetParent())
9788 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9789
9791 {
9792 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9793
9794 if (rIndex >= 0)
9795 {
9796 InventoryLocation rIl = new InventoryLocation;
9797 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9798
9799 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9802 {
9803 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9804 }
9806 {
9808 }
9809
9810 }
9811 }
9812
9814 {
9815 if (newPlayer)
9816 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9817
9818 if (newPlayer == oldPlayer)
9819 {
9820 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9821 {
9823 {
9824 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9825 {
9826 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9827 }
9828 }
9829 else
9830 {
9831 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9832 }
9833 }
9834
9835 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9836 {
9837 int type = oldLoc.GetType();
9839 {
9840 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9841 }
9843 {
9844 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9845 }
9846 }
9847 if (!m_OldLocation)
9848 {
9849 m_OldLocation = new InventoryLocation;
9850 }
9851 m_OldLocation.Copy(oldLoc);
9852 }
9853 else
9854 {
9855 if (m_OldLocation)
9856 {
9857 m_OldLocation.Reset();
9858 }
9859 }
9860
9861 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9862 }
9863 else
9864 {
9865 if (newPlayer)
9866 {
9867 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9868 if (resIndex >= 0)
9869 {
9870 InventoryLocation il = new InventoryLocation;
9871 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9873 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9876 {
9877 il.
GetParent().GetOnReleaseLock().Invoke(it);
9878 }
9880 {
9882 }
9883
9884 }
9885 }
9887 {
9888
9890 }
9891
9892 if (m_OldLocation)
9893 {
9894 m_OldLocation.Reset();
9895 }
9896 }
9897
9899 {
9900 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9901 }
9902
9904 {
9905 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9906 }
9907 }
9908
9909 override void EOnContact(IEntity other, Contact extra)
9910 {
9912 {
9913 int liquidType = -1;
9915 if (impactSpeed > 0.0)
9916 {
9918 #ifndef SERVER
9920 #else
9922 SetSynchDirty();
9923 #endif
9925 }
9926 }
9927
9928 #ifdef SERVER
9929 if (GetCompEM() && GetCompEM().IsPlugged())
9930 {
9931 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9932 GetCompEM().UnplugThis();
9933 }
9934 #endif
9935 }
9936
9938
9940 {
9942 }
9943
9945 {
9946
9947 }
9948
9950 {
9951 super.OnItemLocationChanged(old_owner, new_owner);
9952
9953 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9954 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9955
9956 if (!relatedPlayer && playerNew)
9957 relatedPlayer = playerNew;
9958
9959 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9960 {
9962 if (actionMgr)
9963 {
9964 ActionBase currentAction = actionMgr.GetRunningAction();
9965 if (currentAction)
9967 }
9968 }
9969
9970 Man ownerPlayerOld = null;
9971 Man ownerPlayerNew = null;
9972
9973 if (old_owner)
9974 {
9975 if (old_owner.
IsMan())
9976 {
9977 ownerPlayerOld = Man.Cast(old_owner);
9978 }
9979 else
9980 {
9981 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9982 }
9983 }
9984 else
9985 {
9987 {
9989
9990 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9991 {
9992 GetCompEM().UnplugThis();
9993 }
9994 }
9995 }
9996
9997 if (new_owner)
9998 {
9999 if (new_owner.
IsMan())
10000 {
10001 ownerPlayerNew = Man.Cast(new_owner);
10002 }
10003 else
10004 {
10005 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10006 }
10007 }
10008
10009 if (ownerPlayerOld != ownerPlayerNew)
10010 {
10011 if (ownerPlayerOld)
10012 {
10013 array<EntityAI> subItemsExit = new array<EntityAI>;
10015 for (int i = 0; i < subItemsExit.Count(); i++)
10016 {
10019 }
10020 }
10021
10022 if (ownerPlayerNew)
10023 {
10024 array<EntityAI> subItemsEnter = new array<EntityAI>;
10026 for (int j = 0; j < subItemsEnter.Count(); j++)
10027 {
10030 }
10031 }
10032 }
10033 else if (ownerPlayerNew != null)
10034 {
10035 PlayerBase nplayer;
10036 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10037 {
10038 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10040 for (int k = 0; k < subItemsUpdate.Count(); k++)
10041 {
10043 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10044 }
10045 }
10046 }
10047
10048 if (old_owner)
10049 old_owner.OnChildItemRemoved(this);
10050 if (new_owner)
10051 new_owner.OnChildItemReceived(this);
10052 }
10053
10054
10056 {
10057 super.EEDelete(parent);
10058 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10059 if (player)
10060 {
10062
10063 if (player.IsAlive())
10064 {
10065 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10066 if (r_index >= 0)
10067 {
10068 InventoryLocation r_il = new InventoryLocation;
10069 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10070
10071 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10074 {
10075 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10076 }
10078 {
10079 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10080 }
10081
10082 }
10083
10084 player.RemoveQuickBarEntityShortcut(this);
10085 }
10086 }
10087 }
10088
10090 {
10091 super.EEKilled(killer);
10092
10095 {
10096 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10097 {
10098 if (IsMagazine())
10099 {
10100 if (Magazine.Cast(this).GetAmmoCount() > 0)
10101 {
10103 }
10104 }
10105 else
10106 {
10108 }
10109 }
10110 }
10111 }
10112
10114 {
10115 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10116
10117 super.OnWasAttached(parent, slot_id);
10118
10121
10124 }
10125
10127 {
10128 super.OnWasDetached(parent, slot_id);
10129
10132
10135 }
10136
10138 {
10139 int idx;
10142
10143 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10144 if (inventory_slots.Count() < 1)
10145 {
10146 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10147 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10148 }
10149 else
10150 {
10151 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10152 }
10153
10154 idx = inventory_slots.Find(slot);
10155 if (idx < 0)
10156 return "";
10157
10158 return attach_types.Get(idx);
10159 }
10160
10162 {
10163 int idx = -1;
10164 string slot;
10165
10168
10169 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10170 if (inventory_slots.Count() < 1)
10171 {
10172 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10173 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10174 }
10175 else
10176 {
10177 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10178 if (detach_types.Count() < 1)
10179 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10180 }
10181
10182 for (int i = 0; i < inventory_slots.Count(); i++)
10183 {
10184 slot = inventory_slots.Get(i);
10185 }
10186
10187 if (slot != "")
10188 {
10189 if (detach_types.Count() == 1)
10190 idx = 0;
10191 else
10192 idx = inventory_slots.Find(slot);
10193 }
10194 if (idx < 0)
10195 return "";
10196
10197 return detach_types.Get(idx);
10198 }
10199
10201 {
10202
10204
10205
10206 float min_time = 1;
10207 float max_time = 3;
10208 float delay = Math.RandomFloat(min_time, max_time);
10209
10210 explode_timer.Run(delay, this, "DoAmmoExplosion");
10211 }
10212
10214 {
10215 Magazine magazine = Magazine.Cast(this);
10216 int pop_sounds_count = 6;
10217 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10218
10219
10220 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10221 string sound_name = pop_sounds[ sound_idx ];
10222 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10223
10224
10225 magazine.ServerAddAmmoCount(-1);
10226
10227
10228 float min_temp_to_explode = 100;
10229
10230 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10231 {
10233 }
10234 }
10235
10236
10237 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10238 {
10239 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10240
10241 const int CHANCE_DAMAGE_CARGO = 4;
10242 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10243 const int CHANCE_DAMAGE_NOTHING = 2;
10244
10246 {
10247 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10248 int chances;
10249 int rnd;
10250
10251 if (GetInventory().GetCargo())
10252 {
10253 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10254 rnd = Math.RandomInt(0,chances);
10255
10256 if (rnd < CHANCE_DAMAGE_CARGO)
10257 {
10259 }
10260 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10261 {
10263 }
10264 }
10265 else
10266 {
10267 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10268 rnd = Math.RandomInt(0,chances);
10269
10270 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10271 {
10273 }
10274 }
10275 }
10276 }
10277
10279 {
10280 CargoBase cargo = GetInventory().GetCargo();
10281 if (cargo)
10282 {
10284 if (item_count > 0)
10285 {
10286 int random_pick = Math.RandomInt(0, item_count);
10288 if (!item.IsExplosive())
10289 {
10290 item.AddHealth("","",damage);
10291 return true;
10292 }
10293 }
10294 }
10295 return false;
10296 }
10297
10299 {
10300 GameInventory inventory = GetInventory();
10302 if (attachment_count > 0)
10303 {
10304 int random_pick = Math.RandomInt(0, attachment_count);
10306 if (!attachment.IsExplosive())
10307 {
10308 attachment.AddHealth("","",damage);
10309 return true;
10310 }
10311 }
10312 return false;
10313 }
10314
10316 {
10318 }
10319
10321 {
10323 return GetInventory().CanRemoveEntity();
10324
10325 return false;
10326 }
10327
10329 {
10330
10332 return false;
10333
10334
10336 return false;
10337
10338
10339
10341 if (delta == 0)
10342 return false;
10343
10344
10345 return true;
10346 }
10347
10349 {
10351 {
10352 if (ScriptInputUserData.CanStoreInputUserData())
10353 {
10354 ScriptInputUserData ctx = new ScriptInputUserData;
10359 ctx.
Write(destination_entity);
10361 ctx.
Write(slot_id);
10363 }
10364 }
10365 else if (!
g_Game.IsMultiplayer())
10366 {
10368 }
10369 }
10370
10372 {
10373 float split_quantity_new;
10377 InventoryLocation loc = new InventoryLocation;
10378
10379 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10380 {
10382 split_quantity_new = stack_max;
10383 else
10385
10387 {
10388 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10389 if (new_item)
10390 {
10391 new_item.SetResultOfSplit(true);
10392 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10394 new_item.
SetQuantity(split_quantity_new,
false,
true);
10395 }
10396 }
10397 }
10398 else if (destination_entity && slot_id == -1)
10399 {
10400 if (quantity > stack_max)
10401 split_quantity_new = stack_max;
10402 else
10403 split_quantity_new = quantity;
10404
10406 {
10407 GameInventory destinationInventory = destination_entity.GetInventory();
10409 {
10412 }
10413
10414 if (new_item)
10415 {
10416 new_item.SetResultOfSplit(true);
10417 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10419 new_item.
SetQuantity(split_quantity_new,
false,
true);
10420 }
10421 }
10422 }
10423 else
10424 {
10425 if (stack_max != 0)
10426 {
10428 {
10430 }
10431
10432 if (split_quantity_new == 0)
10433 {
10434 if (!
g_Game.IsMultiplayer())
10435 player.PhysicalPredictiveDropItem(this);
10436 else
10437 player.ServerDropEntity(this);
10438 return;
10439 }
10440
10442 {
10444
10445 if (new_item)
10446 {
10447 new_item.SetResultOfSplit(true);
10448 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10451 new_item.PlaceOnSurface();
10452 }
10453 }
10454 }
10455 }
10456 }
10457
10459 {
10460 float split_quantity_new;
10464 InventoryLocation loc = new InventoryLocation;
10465
10466 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10467 {
10469 split_quantity_new = stack_max;
10470 else
10472
10474 {
10475 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10476 if (new_item)
10477 {
10478 new_item.SetResultOfSplit(true);
10479 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10481 new_item.
SetQuantity(split_quantity_new,
false,
true);
10482 }
10483 }
10484 }
10485 else if (destination_entity && slot_id == -1)
10486 {
10487 if (quantity > stack_max)
10488 split_quantity_new = stack_max;
10489 else
10490 split_quantity_new = quantity;
10491
10493 {
10494 GameInventory destinationInventory = destination_entity.GetInventory();
10496 {
10499 }
10500
10501 if (new_item)
10502 {
10503 new_item.SetResultOfSplit(true);
10504 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10506 new_item.
SetQuantity(split_quantity_new,
false,
true);
10507 }
10508 }
10509 }
10510 else
10511 {
10512 if (stack_max != 0)
10513 {
10515 {
10517 }
10518
10520 {
10522
10523 if (new_item)
10524 {
10525 new_item.SetResultOfSplit(true);
10526 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10529 new_item.PlaceOnSurface();
10530 }
10531 }
10532 }
10533 }
10534 }
10535
10537 {
10539 {
10540 if (ScriptInputUserData.CanStoreInputUserData())
10541 {
10542 ScriptInputUserData ctx = new ScriptInputUserData;
10547 dst.WriteToContext(ctx);
10549 }
10550 }
10551 else if (!
g_Game.IsMultiplayer())
10552 {
10554 }
10555 }
10556
10558 {
10560 {
10561 if (ScriptInputUserData.CanStoreInputUserData())
10562 {
10563 ScriptInputUserData ctx = new ScriptInputUserData;
10568 ctx.
Write(destination_entity);
10574 }
10575 }
10576 else if (!
g_Game.IsMultiplayer())
10577 {
10579 }
10580 }
10581
10583 {
10585 }
10586
10588 {
10590 float split_quantity_new;
10592 if (dst.IsValid())
10593 {
10594 int slot_id = dst.GetSlot();
10596
10597 if (quantity > stack_max)
10598 split_quantity_new = stack_max;
10599 else
10600 split_quantity_new = quantity;
10601
10603 {
10605
10606 if (new_item)
10607 {
10608 new_item.SetResultOfSplit(true);
10609 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10611 new_item.
SetQuantity(split_quantity_new,
false,
true);
10612 }
10613
10614 return new_item;
10615 }
10616 }
10617
10618 return null;
10619 }
10620
10622 {
10624 float split_quantity_new;
10626 if (destination_entity)
10627 {
10629 if (quantity > stackable)
10630 split_quantity_new = stackable;
10631 else
10632 split_quantity_new = quantity;
10633
10635 {
10636 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10637 if (new_item)
10638 {
10639 new_item.SetResultOfSplit(true);
10640 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10642 new_item.
SetQuantity(split_quantity_new,
false,
true);
10643 }
10644 }
10645 }
10646 }
10647
10649 {
10651 {
10652 if (ScriptInputUserData.CanStoreInputUserData())
10653 {
10654 ScriptInputUserData ctx = new ScriptInputUserData;
10659 ItemBase destination_entity =
this;
10660 ctx.
Write(destination_entity);
10664 }
10665 }
10666 else if (!
g_Game.IsMultiplayer())
10667 {
10669 }
10670 }
10671
10673 {
10675 float split_quantity_new;
10677 if (player)
10678 {
10680 if (quantity > stackable)
10681 split_quantity_new = stackable;
10682 else
10683 split_quantity_new = quantity;
10684
10686 {
10687 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10688 new_item =
ItemBase.Cast(in_hands);
10689 if (new_item)
10690 {
10691 new_item.SetResultOfSplit(true);
10692 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10694 new_item.SetQuantity(split_quantity_new, false, true);
10695 }
10696 }
10697 }
10698 }
10699
10701 {
10703 float split_quantity_new = Math.Floor(quantity * 0.5);
10704
10706 return;
10707
10709
10710 if (new_item)
10711 {
10712 if (new_item.GetQuantityMax() < split_quantity_new)
10713 {
10714 split_quantity_new = new_item.GetQuantityMax();
10715 }
10716
10717 new_item.SetResultOfSplit(true);
10718 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10719
10721 {
10724 }
10725 else
10726 {
10728 new_item.
SetQuantity(split_quantity_new,
false,
true);
10729 }
10730 }
10731 }
10732
10734 {
10736 float split_quantity_new = Math.Floor(quantity / 2);
10737
10739 return;
10740
10741 InventoryLocation invloc = new InventoryLocation;
10743
10745 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10746
10747 if (new_item)
10748 {
10749 if (new_item.GetQuantityMax() < split_quantity_new)
10750 {
10751 split_quantity_new = new_item.GetQuantityMax();
10752 }
10754 {
10757 }
10758 else if (split_quantity_new > 1)
10759 {
10761 new_item.
SetQuantity(split_quantity_new,
false,
true);
10762 }
10763 }
10764 }
10765
10768 {
10769 SetWeightDirty();
10771
10772 if (parent)
10773 parent.OnAttachmentQuantityChangedEx(this, delta);
10774
10776 {
10778 {
10780 }
10782 {
10783 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10785 }
10786 }
10787 }
10788
10791 {
10792
10793 }
10794
10797 {
10799 }
10800
10802 {
10803 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10804
10806 {
10807 if (newLevel == GameConstants.STATE_RUINED)
10808 {
10810 EntityAI parent = GetHierarchyParent();
10811 if (parent && parent.IsFireplace())
10812 {
10813 CargoBase cargo = GetInventory().GetCargo();
10814 if (cargo)
10815 {
10817 {
10819 }
10820 }
10821 }
10822 }
10823
10825 {
10826
10828 return;
10829 }
10830
10831 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10832 {
10834 }
10835 }
10836 }
10837
10838
10840 {
10841 super.OnRightClick();
10842
10844 {
10846 {
10847 if (ScriptInputUserData.CanStoreInputUserData())
10848 {
10849 EntityAI root = GetHierarchyRoot();
10850 Man playerOwner = GetHierarchyRootPlayer();
10851 InventoryLocation dst = new InventoryLocation;
10852
10853
10854 if (!playerOwner && root && root == this)
10855 {
10857 }
10858 else
10859 {
10860
10861 GetInventory().GetCurrentInventoryLocation(dst);
10863 {
10864 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10866 {
10868 }
10869 else
10870 {
10872
10873
10874 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10875 {
10877 }
10878 else
10879 {
10880 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10881 }
10882 }
10883 }
10884 }
10885
10886 ScriptInputUserData ctx = new ScriptInputUserData;
10894 }
10895 }
10896 else if (!
g_Game.IsMultiplayer())
10897 {
10899 }
10900 }
10901 }
10902
10904 {
10905 if (root)
10906 {
10907 vector m4[4];
10908 root.GetTransform(m4);
10909 dst.SetGround(this, m4);
10910 }
10911 else
10912 {
10913 GetInventory().GetCurrentInventoryLocation(dst);
10914 }
10915 }
10916
10917 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10918 {
10919
10920 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10921 return false;
10922
10923 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10924 return false;
10925
10926
10928 return false;
10929
10930
10931 Magazine mag = Magazine.Cast(this);
10932 if (mag)
10933 {
10934 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10935 return false;
10936
10937 if (stack_max_limit)
10938 {
10939 Magazine other_mag = Magazine.Cast(other_item);
10940 if (other_item)
10941 {
10942 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10943 return false;
10944 }
10945
10946 }
10947 }
10948 else
10949 {
10950
10952 return false;
10953
10955 return false;
10956 }
10957
10958 PlayerBase player = null;
10959 if (CastTo(player, GetHierarchyRootPlayer()))
10960 {
10961 if (player.GetInventory().HasAttachment(this))
10962 return false;
10963
10964 if (player.IsItemsToDelete())
10965 return false;
10966 }
10967
10968 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10969 return false;
10970
10971 int slotID;
10973 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10974 return false;
10975
10976 return true;
10977 }
10978
10980 {
10982 }
10983
10985 {
10986 return m_IsResultOfSplit;
10987 }
10988
10990 {
10991 m_IsResultOfSplit = value;
10992 }
10993
10995 {
10997 }
10998
11000 {
11001 float other_item_quantity = other_item.GetQuantity();
11002 float this_free_space;
11003
11005
11007
11008 if (other_item_quantity > this_free_space)
11009 {
11010 return this_free_space;
11011 }
11012 else
11013 {
11014 return other_item_quantity;
11015 }
11016 }
11017
11019 {
11021 }
11022
11024 {
11026 return;
11027
11028 if (!IsMagazine() && other_item)
11029 {
11031 if (quantity_used != 0)
11032 {
11033 float hp1 = GetHealth01("","");
11034 float hp2 = other_item.GetHealth01("","");
11035 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11036 hpResult = hpResult / (
GetQuantity() + quantity_used);
11037
11038 hpResult *= GetMaxHealth();
11039 Math.Round(hpResult);
11040 SetHealth("", "Health", hpResult);
11041
11043 other_item.AddQuantity(-quantity_used);
11044 }
11045 }
11047 }
11048
11050 {
11051 #ifdef SERVER
11052 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11053 GetHierarchyParent().IncreaseLifetimeUp();
11054 #endif
11055 };
11056
11058 {
11059 PlayerBase p = PlayerBase.Cast(player);
11060
11061 array<int> recipesIds = p.m_Recipes;
11062 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11063 if (moduleRecipesManager)
11064 {
11065 EntityAI itemInHands = player.GetEntityInHands();
11066 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11067 }
11068
11069 for (int i = 0;i < recipesIds.Count(); i++)
11070 {
11071 int key = recipesIds.Get(i);
11072 string recipeName = moduleRecipesManager.GetRecipeName(key);
11074 }
11075 }
11076
11077
11078 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11079 {
11080 super.GetDebugActions(outputList);
11081
11082
11088
11089
11094
11099
11100
11104
11105
11107 {
11111 }
11112
11115
11116
11120
11122
11123 InventoryLocation loc = new InventoryLocation();
11124 GetInventory().GetCurrentInventoryLocation(loc);
11126 {
11127 if (Gizmo_IsSupported())
11130 }
11131
11133 }
11134
11135
11136
11137
11139 {
11140 super.OnAction(action_id, player, ctx);
11141
11143 {
11144 switch (action_id)
11145 {
11149 return true;
11153 return true;
11154 }
11155 }
11156
11158 {
11159 switch (action_id)
11160 {
11162 Delete();
11163 return true;
11164 }
11165 }
11166
11167 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11168 {
11169 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11170 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11171 PlayerBase p = PlayerBase.Cast(player);
11172 if (
EActions.RECIPES_RANGE_START < 1000)
11173 {
11174 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11175 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11176 }
11177 }
11178 #ifndef SERVER
11179 else if (action_id ==
EActions.WATCH_PLAYER)
11180 {
11181 PluginDeveloper.SetDeveloperItemClientEx(player);
11182 }
11183 #endif
11185 {
11186 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11187 {
11188 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11189 OnDebugButtonPressServer(id + 1);
11190 }
11191
11192 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11193 {
11194 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11196 }
11197
11198 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11199 {
11200 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11202 }
11203
11204 else if (action_id ==
EActions.ADD_QUANTITY)
11205 {
11206 if (IsMagazine())
11207 {
11208 Magazine mag = Magazine.Cast(this);
11209 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11210 }
11211 else
11212 {
11214 }
11215
11216 if (m_EM)
11217 {
11218 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11219 }
11220
11221 }
11222
11223 else if (action_id ==
EActions.REMOVE_QUANTITY)
11224 {
11225 if (IsMagazine())
11226 {
11227 Magazine mag2 = Magazine.Cast(this);
11228 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11229 }
11230 else
11231 {
11233 }
11234 if (m_EM)
11235 {
11236 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11237 }
11238
11239 }
11240
11241 else if (action_id ==
EActions.SET_QUANTITY_0)
11242 {
11244
11245 if (m_EM)
11246 {
11247 m_EM.SetEnergy(0);
11248 }
11249 }
11250
11251 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11252 {
11254
11255 if (m_EM)
11256 {
11257 m_EM.SetEnergy(m_EM.GetEnergyMax());
11258 }
11259 }
11260
11261 else if (action_id ==
EActions.ADD_HEALTH)
11262 {
11263 AddHealth("","",GetMaxHealth("","Health")/5);
11264 }
11265 else if (action_id ==
EActions.REMOVE_HEALTH)
11266 {
11267 AddHealth("","",-GetMaxHealth("","Health")/5);
11268 }
11269 else if (action_id ==
EActions.DESTROY_HEALTH)
11270 {
11271 SetHealth01("","",0);
11272 }
11273 else if (action_id ==
EActions.WATCH_ITEM)
11274 {
11276 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11277 #ifdef DEVELOPER
11278 SetDebugDeveloper_item(this);
11279 #endif
11280 }
11281
11282 else if (action_id ==
EActions.ADD_TEMPERATURE)
11283 {
11284 AddTemperature(20);
11285
11286 }
11287
11288 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11289 {
11290 AddTemperature(-20);
11291
11292 }
11293
11294 else if (action_id ==
EActions.FLIP_FROZEN)
11295 {
11296 SetFrozen(!GetIsFrozen());
11297
11298 }
11299
11300 else if (action_id ==
EActions.ADD_WETNESS)
11301 {
11303
11304 }
11305
11306 else if (action_id ==
EActions.REMOVE_WETNESS)
11307 {
11309
11310 }
11311
11312 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11313 {
11316
11317
11318 }
11319
11320 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11321 {
11324 }
11325
11326 else if (action_id ==
EActions.MAKE_SPECIAL)
11327 {
11328 auto debugParams = DebugSpawnParams.WithPlayer(player);
11329 OnDebugSpawnEx(debugParams);
11330 }
11331
11332 }
11333
11334
11335 return false;
11336 }
11337
11338
11339
11340
11344
11347
11348
11349
11351 {
11352 return false;
11353 }
11354
11355
11357 {
11358 return true;
11359 }
11360
11361
11363 {
11364 return true;
11365 }
11366
11367
11368
11370 {
11371 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11372 return g_Game.ConfigIsExisting(config_path);
11373 }
11374
11377 {
11378 return null;
11379 }
11380
11382 {
11383 return false;
11384 }
11385
11387 {
11388 return false;
11389 }
11390
11394
11395
11397 {
11398 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11399 return module_repairing.CanRepair(this, item_repair_kit);
11400 }
11401
11402
11403 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11404 {
11405 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11406 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11407 }
11408
11409
11411 {
11412
11413
11414
11415
11416
11417
11418
11419
11420 return 1;
11421 }
11422
11423
11424
11426 {
11428 }
11429
11430
11431
11433 {
11435 }
11436
11437
11446 {
11447 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11448
11449 if (player)
11450 {
11451 player.MessageStatus(text);
11452 }
11453 }
11454
11455
11464 {
11465 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11466
11467 if (player)
11468 {
11469 player.MessageAction(text);
11470 }
11471 }
11472
11473
11482 {
11483 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11484
11485 if (player)
11486 {
11487 player.MessageFriendly(text);
11488 }
11489 }
11490
11491
11500 {
11501 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11502
11503 if (player)
11504 {
11505 player.MessageImportant(text);
11506 }
11507 }
11508
11510 {
11511 return true;
11512 }
11513
11514
11515 override bool KindOf(
string tag)
11516 {
11517 bool found = false;
11518 string item_name = this.
GetType();
11520 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11521
11522 int array_size = item_tag_array.Count();
11523 for (int i = 0; i < array_size; i++)
11524 {
11525 if (item_tag_array.Get(i) == tag)
11526 {
11527 found = true;
11528 break;
11529 }
11530 }
11531 return found;
11532 }
11533
11534
11536 {
11537
11538 super.OnRPC(sender, rpc_type,ctx);
11539
11540
11541 switch (rpc_type)
11542 {
11543 #ifndef SERVER
11544 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11545 Param2<bool, string> p = new Param2<bool, string>(false, "");
11546
11548 return;
11549
11550 bool play = p.param1;
11551 string soundSet = p.param2;
11552
11553 if (play)
11554 {
11556 {
11558 {
11560 }
11561 }
11562 else
11563 {
11565 }
11566 }
11567 else
11568 {
11570 }
11571
11572 break;
11573 #endif
11574
11575 }
11576
11578 {
11580 }
11581 }
11582
11583
11584
11585
11587 {
11588 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11589 return plugin.GetID(
name);
11590 }
11591
11593 {
11594 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11595 return plugin.GetName(id);
11596 }
11597
11600 {
11601
11602
11603 int varFlags;
11604 if (!ctx.
Read(varFlags))
11605 return;
11606
11607 if (varFlags & ItemVariableFlags.FLOAT)
11608 {
11610 }
11611 }
11612
11614 {
11615
11616 super.SerializeNumericalVars(floats_out);
11617
11618
11619
11621 {
11623 }
11624
11626 {
11628 }
11629
11631 {
11633 }
11634
11636 {
11641 }
11642
11644 {
11646 }
11647 }
11648
11650 {
11651
11652 super.DeSerializeNumericalVars(floats);
11653
11654
11655 int index = 0;
11656 int mask = Math.Round(floats.Get(index));
11657
11658 index++;
11659
11661 {
11663 {
11665 }
11666 else
11667 {
11668 float quantity = floats.Get(index);
11669 SetQuantity(quantity,
true,
false,
false,
false);
11670 }
11671 index++;
11672 }
11673
11675 {
11676 float wet = floats.Get(index);
11678 index++;
11679 }
11680
11682 {
11683 int liquidtype = Math.Round(floats.Get(index));
11685 index++;
11686 }
11687
11689 {
11691 index++;
11693 index++;
11695 index++;
11697 index++;
11698 }
11699
11701 {
11702 int cleanness = Math.Round(floats.Get(index));
11704 index++;
11705 }
11706 }
11707
11709 {
11710 super.WriteVarsToCTX(ctx);
11711
11712
11714 {
11716 }
11717
11719 {
11721 }
11722
11724 {
11726 }
11727
11729 {
11730 int r,g,b,a;
11736 }
11737
11739 {
11741 }
11742 }
11743
11745 {
11746 if (!super.ReadVarsFromCTX(ctx,version))
11747 return false;
11748
11749 int intValue;
11750 float value;
11751
11752 if (version < 140)
11753 {
11754 if (!ctx.
Read(intValue))
11755 return false;
11756
11757 m_VariablesMask = intValue;
11758 }
11759
11761 {
11762 if (!ctx.
Read(value))
11763 return false;
11764
11766 {
11768 }
11769 else
11770 {
11772 }
11773 }
11774
11775 if (version < 140)
11776 {
11778 {
11779 if (!ctx.
Read(value))
11780 return false;
11781 SetTemperatureDirect(value);
11782 }
11783 }
11784
11786 {
11787 if (!ctx.
Read(value))
11788 return false;
11790 }
11791
11793 {
11794 if (!ctx.
Read(intValue))
11795 return false;
11797 }
11798
11800 {
11801 int r,g,b,a;
11803 return false;
11805 return false;
11807 return false;
11809 return false;
11810
11812 }
11813
11815 {
11816 if (!ctx.
Read(intValue))
11817 return false;
11819 }
11820
11821 if (version >= 138 && version < 140)
11822 {
11824 {
11825 if (!ctx.
Read(intValue))
11826 return false;
11827 SetFrozen(intValue);
11828 }
11829 }
11830
11831 return true;
11832 }
11833
11834
11836 {
11839 {
11841 }
11842
11843 if (!super.OnStoreLoad(ctx, version))
11844 {
11846 return false;
11847 }
11848
11849 if (version >= 114)
11850 {
11851 bool hasQuickBarIndexSaved;
11852
11853 if (!ctx.
Read(hasQuickBarIndexSaved))
11854 {
11856 return false;
11857 }
11858
11859 if (hasQuickBarIndexSaved)
11860 {
11861 int itmQBIndex;
11862
11863
11864 if (!ctx.
Read(itmQBIndex))
11865 {
11867 return false;
11868 }
11869
11870 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11871 if (itmQBIndex != -1 && parentPlayer)
11872 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11873 }
11874 }
11875 else
11876 {
11877
11878 PlayerBase player;
11879 int itemQBIndex;
11880 if (version ==
int.
MAX)
11881 {
11882 if (!ctx.
Read(itemQBIndex))
11883 {
11885 return false;
11886 }
11887 }
11888 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11889 {
11890
11891 if (!ctx.
Read(itemQBIndex))
11892 {
11894 return false;
11895 }
11896 if (itemQBIndex != -1 && player)
11897 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11898 }
11899 }
11900
11901 if (version < 140)
11902 {
11903
11904 if (!LoadVariables(ctx, version))
11905 {
11907 return false;
11908 }
11909 }
11910
11911
11913 {
11915 return false;
11916 }
11917 if (version >= 132)
11918 {
11920 if (raib)
11921 {
11923 {
11925 return false;
11926 }
11927 }
11928 }
11929
11931 return true;
11932 }
11933
11934
11935
11937 {
11938 super.OnStoreSave(ctx);
11939
11940 PlayerBase player;
11941 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11942 {
11944
11945 int itemQBIndex = -1;
11946 itemQBIndex = player.FindQuickBarEntityIndex(this);
11947 ctx.
Write(itemQBIndex);
11948 }
11949 else
11950 {
11952 }
11953
11955
11957 if (raib)
11958 {
11960 }
11961 }
11962
11963
11965 {
11966 super.AfterStoreLoad();
11967
11969 {
11971 }
11972
11974 {
11977 }
11978 }
11979
11981 {
11982 super.EEOnAfterLoad();
11983
11985 {
11987 }
11988
11991 }
11992
11994 {
11995 return false;
11996 }
11997
11998
11999
12001 {
12003 {
12004 #ifdef PLATFORM_CONSOLE
12005
12007 {
12009 if (menu)
12010 {
12012 }
12013 }
12014 #endif
12015 }
12016
12018 {
12021 }
12022
12024 {
12025 SetWeightDirty();
12027 }
12029 {
12032 }
12033
12035 {
12038
12041 }
12043 {
12047 }
12048
12049 super.OnVariablesSynchronized();
12050 }
12051
12052
12053
12055 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12056 {
12057 if (!IsServerCheck(allow_client))
12058 return false;
12059
12061 return false;
12062
12065
12066 if (value <= (min + 0.001))
12067 value = min;
12068
12069 if (value == min)
12070 {
12071 if (destroy_config)
12072 {
12073 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12074 if (dstr)
12075 {
12077 this.Delete();
12078 return true;
12079 }
12080 }
12081 else if (destroy_forced)
12082 {
12084 this.Delete();
12085 return true;
12086 }
12087
12089 }
12090
12093
12095 {
12096 EntityAI parent = GetHierarchyRoot();
12097 InventoryLocation iLoc = new InventoryLocation();
12098 GetInventory().GetCurrentInventoryLocation(iLoc);
12100 {
12101 int iLocSlot = iLoc.
GetSlot();
12103 {
12105 }
12107 {
12109 }
12110 }
12111 }
12112
12114 {
12116
12117 if (delta)
12119 }
12120
12122
12123 return false;
12124 }
12125
12126
12128 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12129 {
12131 }
12132
12134 {
12137 }
12138
12140 {
12143 }
12144
12146 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12147 {
12148 float value_clamped = Math.Clamp(value, 0, 1);
12150 SetQuantity(result, destroy_config, destroy_forced);
12151 }
12152
12153
12156 {
12158 }
12159
12161 {
12163 }
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12175 {
12176 int slot = -1;
12177 GameInventory inventory = GetInventory();
12178 if (inventory)
12179 {
12180 InventoryLocation il = new InventoryLocation;
12183 }
12184
12186 }
12187
12189 {
12190 float quantity_max = 0;
12191
12193 {
12194 if (attSlotID != -1)
12195 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12196
12197 if (quantity_max <= 0)
12199 }
12200
12201 if (quantity_max <= 0)
12203
12204 return quantity_max;
12205 }
12206
12208 {
12210 }
12211
12213 {
12215 }
12216
12217
12219 {
12221 }
12222
12224 {
12226 }
12227
12229 {
12231 }
12232
12233
12235 {
12236
12237 float weightEx = GetWeightEx();
12238 float special = GetInventoryAndCargoWeight();
12239 return weightEx - special;
12240 }
12241
12242
12244 {
12246 }
12247
12249 {
12251 {
12252 #ifdef DEVELOPER
12253 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12254 {
12255 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12257 }
12258 #endif
12259
12260 return GetQuantity() * GetConfigWeightModified();
12261 }
12262 else if (HasEnergyManager())
12263 {
12264 #ifdef DEVELOPER
12265 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12266 {
12267 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12268 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12269 }
12270 #endif
12271 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12272 }
12273 else
12274 {
12275 #ifdef DEVELOPER
12276 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12277 {
12278 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12279 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12280 }
12281 #endif
12282 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12283 }
12284 }
12285
12288 {
12289 int item_count = 0;
12291
12292 GameInventory inventory = GetInventory();
12293 CargoBase cargo = inventory.
GetCargo();
12294 if (cargo != NULL)
12295 {
12297 }
12298
12300 for (int i = 0; i < nAttachments; ++i)
12301 {
12303 if (item)
12304 item_count += item.GetNumberOfItems();
12305 }
12306 return item_count;
12307 }
12308
12311 {
12312 float weight = 0;
12313 float wetness = 1;
12314 if (include_wetness)
12317 {
12318 weight = wetness * m_ConfigWeight;
12319 }
12321 {
12322 weight = 1;
12323 }
12324 return weight;
12325 }
12326
12327
12328
12330 {
12331 GameInventory inventory = GetInventory();
12332 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12333 {
12334 array<EntityAI> items = new array<EntityAI>;
12336 for (int i = 0; i < items.Count(); ++i)
12337 {
12339 if (item)
12340 {
12341 g_Game.ObjectDelete(item);
12342 }
12343 }
12344 }
12345 }
12346
12347
12348
12349
12351 {
12352 float energy = 0;
12353 if (HasEnergyManager())
12354 {
12355 energy = GetCompEM().GetEnergy();
12356 }
12357 return energy;
12358 }
12359
12360
12362 {
12363 super.OnEnergyConsumed();
12364
12366 }
12367
12369 {
12370 super.OnEnergyAdded();
12371
12373 }
12374
12375
12377 {
12378 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12379 {
12381 {
12382 float energy_0to1 = GetCompEM().GetEnergy0To1();
12384 }
12385 }
12386 }
12387
12388
12390 {
12391 return ConfigGetFloat("heatIsolation");
12392 }
12393
12395 {
12397 }
12398
12400 {
12401 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12402 if (
g_Game.ConfigIsExisting(paramPath))
12403 return g_Game.ConfigGetFloat(paramPath);
12404
12405 return 0.0;
12406 }
12407
12409 {
12410 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12411 if (
g_Game.ConfigIsExisting(paramPath))
12412 return g_Game.ConfigGetFloat(paramPath);
12413
12414 return 0.0;
12415 }
12416
12417 override void SetWet(
float value,
bool allow_client =
false)
12418 {
12419 if (!IsServerCheck(allow_client))
12420 return;
12421
12424
12426
12427 m_VarWet = Math.Clamp(value, min, max);
12428
12430 {
12433 }
12434 }
12435
12436 override void AddWet(
float value)
12437 {
12439 }
12440
12442 {
12444 }
12445
12447 {
12449 }
12450
12452 {
12454 }
12455
12457 {
12459 }
12460
12462 {
12464 }
12465
12466 override void OnWetChanged(
float newVal,
float oldVal)
12467 {
12470 if (newLevel != oldLevel)
12471 {
12473 }
12474 }
12475
12477 {
12478 SetWeightDirty();
12479 }
12480
12482 {
12483 return GetWetLevelInternal(
m_VarWet);
12484 }
12485
12486
12487
12489 {
12491 }
12492
12494 {
12496 }
12497
12499 {
12501 }
12502
12504 {
12506 }
12507
12508
12509
12511 {
12512 if (ConfigIsExisting("itemModelLength"))
12513 {
12514 return ConfigGetFloat("itemModelLength");
12515 }
12516 return 0;
12517 }
12518
12520 {
12521 if (ConfigIsExisting("itemAttachOffset"))
12522 {
12523 return ConfigGetFloat("itemAttachOffset");
12524 }
12525 return 0;
12526 }
12527
12528 override void SetCleanness(
int value,
bool allow_client =
false)
12529 {
12530 if (!IsServerCheck(allow_client))
12531 return;
12532
12534
12536
12539 }
12540
12542 {
12544 }
12545
12547 {
12548 return true;
12549 }
12550
12551
12552
12553
12555 {
12557 }
12558
12560 {
12562 }
12563
12564
12565
12566
12567 override void SetColor(
int r,
int g,
int b,
int a)
12568 {
12574 }
12576 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12577 {
12582 }
12583
12585 {
12587 }
12588
12591 {
12592 int r,g,b,a;
12594 r = r/255;
12595 g = g/255;
12596 b = b/255;
12597 a = a/255;
12598 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12599 }
12600
12601
12602
12603 override void SetLiquidType(
int value,
bool allow_client =
false)
12604 {
12605 if (!IsServerCheck(allow_client))
12606 return;
12607
12612 }
12613
12615 {
12616 return ConfigGetInt("varLiquidTypeInit");
12617 }
12618
12620 {
12622 }
12623
12625 {
12627 SetFrozen(false);
12628 }
12629
12632 {
12633 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12634 }
12635
12636
12639 {
12640 PlayerBase nplayer;
12641 if (PlayerBase.CastTo(nplayer, player))
12642 {
12644 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12645 }
12646 }
12647
12648
12651 {
12652 PlayerBase nplayer;
12653 if (PlayerBase.CastTo(nplayer,player))
12654 {
12655 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12656 }
12657
12658 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12659
12660 if (HasEnergyManager())
12661 {
12662 GetCompEM().UpdatePlugState();
12663 }
12664 }
12665
12666
12668 {
12669 super.OnPlacementStarted(player);
12670
12672 }
12673
12674 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12675 {
12677 {
12678 m_AdminLog.OnPlacementComplete(player,
this);
12679 }
12680
12681 super.OnPlacementComplete(player, position, orientation);
12682 }
12683
12684
12685
12686
12687
12689 {
12691 {
12692 return true;
12693 }
12694 else
12695 {
12696 return false;
12697 }
12698 }
12699
12700
12702 {
12704 {
12706 }
12707 }
12708
12709
12711 {
12713 }
12714
12716 {
12718 }
12719
12720 override void InsertAgent(
int agent,
float count = 1)
12721 {
12722 if (count < 1)
12723 return;
12724
12726 }
12727
12730 {
12732 }
12733
12734
12736 {
12738 }
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12782 {
12784 return false;
12785 return true;
12786 }
12787
12789 {
12790
12792 }
12793
12794
12797 {
12798 super.CheckForRoofLimited(timeTresholdMS);
12799
12800 float time =
g_Game.GetTime();
12801 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12802 {
12803 m_PreviousRoofTestTime = time;
12804 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12805 }
12806 }
12807
12808
12810 {
12812 {
12813 return 0;
12814 }
12815
12816 if (GetInventory().GetAttachmentSlotsCount() != 0)
12817 {
12818 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12819 if (filter)
12820 return filter.GetProtectionLevel(type, false, system);
12821 else
12822 return 0;
12823 }
12824
12825 string subclassPath, entryName;
12826
12827 switch (type)
12828 {
12830 entryName = "biological";
12831 break;
12833 entryName = "chemical";
12834 break;
12835 default:
12836 entryName = "biological";
12837 break;
12838 }
12839
12840 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12841
12842 return g_Game.ConfigGetFloat(subclassPath + entryName);
12843 }
12844
12845
12846
12849 {
12850 if (!IsMagazine())
12852
12854 }
12855
12856
12857
12858
12859
12864 {
12865 return true;
12866 }
12867
12869 {
12871 }
12872
12873
12874
12875
12876
12878 {
12879 if (parent)
12880 {
12881 if (parent.IsInherited(DayZInfected))
12882 return true;
12883
12884 if (!parent.IsRuined())
12885 return true;
12886 }
12887
12888 return true;
12889 }
12890
12892 {
12893 if (!super.CanPutAsAttachment(parent))
12894 {
12895 return false;
12896 }
12897
12898 if (!IsRuined() && !parent.IsRuined())
12899 {
12900 return true;
12901 }
12902
12903 return false;
12904 }
12905
12907 {
12908
12909
12910
12911
12912 return super.CanReceiveItemIntoCargo(item);
12913 }
12914
12916 {
12917
12918
12919
12920
12921 GameInventory attachmentInv = attachment.GetInventory();
12923 {
12924 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12925 return false;
12926 }
12927
12928 InventoryLocation loc = new InventoryLocation();
12929 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12930 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12931 return false;
12932
12933 return super.CanReceiveAttachment(attachment, slotId);
12934 }
12935
12937 {
12938 if (!super.CanReleaseAttachment(attachment))
12939 return false;
12940
12941 return GetInventory().AreChildrenAccessible();
12942 }
12943
12944
12945
12946
12947
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12965 {
12966 int id = muzzle_owner.GetMuzzleID();
12967 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12968
12969 if (WPOF_array)
12970 {
12971 for (int i = 0; i < WPOF_array.Count(); i++)
12972 {
12973 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12974
12975 if (WPOF)
12976 {
12977 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12978 }
12979 }
12980 }
12981 }
12982
12983
12985 {
12986 int id = muzzle_owner.GetMuzzleID();
12988
12989 if (WPOBE_array)
12990 {
12991 for (int i = 0; i < WPOBE_array.Count(); i++)
12992 {
12993 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12994
12995 if (WPOBE)
12996 {
12997 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12998 }
12999 }
13000 }
13001 }
13002
13003
13005 {
13006 int id = muzzle_owner.GetMuzzleID();
13007 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13008
13009 if (WPOOH_array)
13010 {
13011 for (int i = 0; i < WPOOH_array.Count(); i++)
13012 {
13013 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13014
13015 if (WPOOH)
13016 {
13017 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13018 }
13019 }
13020 }
13021 }
13022
13023
13025 {
13026 int id = muzzle_owner.GetMuzzleID();
13027 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13028
13029 if (WPOOH_array)
13030 {
13031 for (int i = 0; i < WPOOH_array.Count(); i++)
13032 {
13033 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13034
13035 if (WPOOH)
13036 {
13037 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13038 }
13039 }
13040 }
13041 }
13042
13043
13045 {
13046 int id = muzzle_owner.GetMuzzleID();
13047 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13048
13049 if (WPOOH_array)
13050 {
13051 for (int i = 0; i < WPOOH_array.Count(); i++)
13052 {
13053 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13054
13055 if (WPOOH)
13056 {
13057 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13058 }
13059 }
13060 }
13061 }
13062
13063
13064
13066 {
13068 {
13069 return true;
13070 }
13071
13072 return false;
13073 }
13074
13076 {
13078 {
13079 return true;
13080 }
13081
13082 return false;
13083 }
13084
13086 {
13088 {
13089 return true;
13090 }
13091
13092 return false;
13093 }
13094
13096 {
13097 return false;
13098 }
13099
13102 {
13103 return UATimeSpent.DEFAULT_DEPLOY;
13104 }
13105
13106
13107
13108
13110 {
13112 SetSynchDirty();
13113 }
13114
13116 {
13118 }
13119
13120
13122 {
13123 return false;
13124 }
13125
13128 {
13129 string att_type = "None";
13130
13131 if (ConfigIsExisting("soundAttType"))
13132 {
13133 att_type = ConfigGetString("soundAttType");
13134 }
13135
13137 }
13138
13140 {
13142 }
13143
13144
13145
13146
13147
13153
13155 {
13158
13160 }
13161
13162
13164 {
13166 return;
13167
13169
13172
13175
13176 SoundParameters params = new SoundParameters();
13180 }
13181
13182
13184 {
13186 {
13189
13190 SetSynchDirty();
13191
13194 }
13195 }
13196
13198 {
13200 }
13201
13202
13204 {
13206 return;
13207
13209 SetSynchDirty();
13210
13213 }
13214
13216 {
13219 }
13220
13222 {
13224 }
13225
13226 void OnApply(PlayerBase player);
13227
13229 {
13230 return 1.0;
13231 };
13232
13234 {
13236 }
13237
13239 {
13241 }
13242
13244
13246 {
13247 SetDynamicPhysicsLifeTime(0.01);
13249 }
13250
13252 {
13253 array<string> zone_names = new array<string>;
13254 GetDamageZones(zone_names);
13255 for (int i = 0; i < zone_names.Count(); i++)
13256 {
13257 SetHealthMax(zone_names.Get(i),"Health");
13258 }
13259 SetHealthMax("","Health");
13260 }
13261
13264 {
13265 float global_health = GetHealth01("","Health");
13266 array<string> zones = new array<string>;
13267 GetDamageZones(zones);
13268
13269 for (int i = 0; i < zones.Count(); i++)
13270 {
13271 SetHealth01(zones.Get(i),"Health",global_health);
13272 }
13273 }
13274
13277 {
13278 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13279 }
13280
13282 {
13283 if (!hasRootAsPlayer)
13284 {
13285 if (refParentIB)
13286 {
13287
13288 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13289 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13290
13291 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13292 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13293
13296 }
13297 else
13298 {
13299
13302 }
13303 }
13304 }
13305
13307 {
13309 {
13310 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13311 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13312 {
13313 float heatPermCoef = 1.0;
13315 while (ent)
13316 {
13317 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13318 ent = ent.GetHierarchyParent();
13319 }
13320
13321 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13322 }
13323 }
13324 }
13325
13327 {
13328
13329 EntityAI parent = GetHierarchyParent();
13330 if (!parent)
13331 {
13332 hasParent = false;
13333 hasRootAsPlayer = false;
13334 }
13335 else
13336 {
13337 hasParent = true;
13338 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13339 refParentIB =
ItemBase.Cast(parent);
13340 }
13341 }
13342
13343 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13344 {
13345
13346 }
13347
13349 {
13350
13351 return false;
13352 }
13353
13355 {
13356
13357
13358 return false;
13359 }
13360
13362 {
13363
13364 return false;
13365 }
13366
13369 {
13370 return !GetIsFrozen() &&
IsOpen();
13371 }
13372
13374 {
13375 bool hasParent = false, hasRootAsPlayer = false;
13377
13378 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13379 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13380
13381 if (wwtu || foodDecay)
13382 {
13386
13387 if (processWetness || processTemperature || processDecay)
13388 {
13390
13391 if (processWetness)
13392 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13393
13394 if (processTemperature)
13396
13397 if (processDecay)
13398 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13399 }
13400 }
13401 }
13402
13405 {
13407 }
13408
13410 {
13413
13414 return super.GetTemperatureFreezeThreshold();
13415 }
13416
13418 {
13421
13422 return super.GetTemperatureThawThreshold();
13423 }
13424
13426 {
13429
13430 return super.GetItemOverheatThreshold();
13431 }
13432
13434 {
13436 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13437
13438 return super.GetTemperatureFreezeTime();
13439 }
13440
13442 {
13444 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13445
13446 return super.GetTemperatureThawTime();
13447 }
13448
13453
13455 {
13456 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13457 }
13458
13460 {
13461 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13462 }
13463
13466 {
13468 }
13469
13471 {
13473 }
13474
13476 {
13478 }
13479
13482 {
13483 return null;
13484 }
13485
13488 {
13489 return false;
13490 }
13491
13493 {
13495 {
13498 if (!trg)
13499 {
13501 explosive = this;
13502 }
13503
13504 explosive.PairRemote(trg);
13506
13507 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13508 trg.SetPersistentPairID(persistentID);
13509 explosive.SetPersistentPairID(persistentID);
13510
13511 return true;
13512 }
13513 return false;
13514 }
13515
13518 {
13519 float ret = 1.0;
13522 ret *= GetHealth01();
13523
13524 return ret;
13525 }
13526
13527 #ifdef DEVELOPER
13528 override void SetDebugItem()
13529 {
13530 super.SetDebugItem();
13531 _itemBase = this;
13532 }
13533
13535 {
13536 string text = super.GetDebugText();
13537
13539 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13540
13541 return text;
13542 }
13543 #endif
13544
13546 {
13547 return true;
13548 }
13549
13551
13553
13555 {
13558 }
13559
13560
13568
13584
13585 [
Obsolete(
"Use ItemSoundHandler instead")]
13588 {
13589 if (!
g_Game.IsDedicatedServer())
13590 {
13591 if (ConfigIsExisting("attachSoundSet"))
13592 {
13593 string cfg_path = "";
13594 string soundset = "";
13595 string type_name =
GetType();
13596
13599 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13600 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13601
13602 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13603 {
13604 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13605 {
13606 if (cfg_slot_array[i] == slot_type)
13607 {
13608 soundset = cfg_soundset_array[i];
13609 break;
13610 }
13611 }
13612 }
13613
13614 if (soundset != "")
13615 {
13616 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13618 }
13619 }
13620 }
13621 }
13622
13624}
13625
13627{
13629 if (entity)
13630 {
13631 bool is_item = entity.IsInherited(
ItemBase);
13632 if (is_item && full_quantity)
13633 {
13636 }
13637 }
13638 else
13639 {
13641 return NULL;
13642 }
13643 return entity;
13644}
13645
13647{
13648 if (item)
13649 {
13650 if (health > 0)
13651 item.SetHealth("", "", health);
13652
13653 if (item.CanHaveTemperature())
13654 {
13656 if (item.CanFreeze())
13657 item.SetFrozen(false);
13658 }
13659
13660 if (item.HasEnergyManager())
13661 {
13662 if (quantity >= 0)
13663 {
13664 item.GetCompEM().SetEnergy0To1(quantity);
13665 }
13666 else
13667 {
13669 }
13670 }
13671 else if (item.IsMagazine())
13672 {
13673 Magazine mag = Magazine.Cast(item);
13674 if (quantity >= 0)
13675 {
13676 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13677 }
13678 else
13679 {
13681 }
13682
13683 }
13684 else
13685 {
13686 if (quantity >= 0)
13687 {
13688 item.SetQuantityNormalized(quantity, false);
13689 }
13690 else
13691 {
13693 }
13694
13695 }
13696 }
13697}
13698
13699#ifdef DEVELOPER
13701#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.