8673{
8675 {
8676 return true;
8677 }
8678};
8679
8681{
8682
8683};
8684
8685
8686
8688{
8692
8694
8697
8698
8699
8700
8701
8710
8716
8721
8726
8747 protected bool m_IsResultOfSplit
8748
8750
8755
8756
8757
8759
8763
8764
8765
8767
8770
8771
8772
8778
8779
8787
8790
8791
8793
8794
8796
8797
8802
8803
8808
8810
8811
8813
8814
8816 {
8821
8822 if (!
g_Game.IsDedicatedServer())
8823 {
8825 {
8827
8829 {
8831 }
8832 }
8833
8836 }
8837
8838 m_OldLocation = null;
8839
8841 {
8843 }
8844
8845 if (ConfigIsExisting("headSelectionsToHide"))
8846 {
8849 }
8850
8852 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8853 {
8855 }
8856
8858
8859 m_IsResultOfSplit = false;
8860
8862 }
8863
8865 {
8866 super.InitItemVariables();
8867
8873 m_Count = ConfigGetInt(
"count");
8874
8877
8882
8885
8890
8902
8906
8907
8910 if (ConfigIsExisting("canBeSplit"))
8911 {
8914 }
8915
8917 if (ConfigIsExisting("itemBehaviour"))
8919
8920
8923 RegisterNetSyncVariableInt("m_VarLiquidType");
8924 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8925
8926 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8927 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8928 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8929
8930 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8931 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8932 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8933 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8934
8935 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8936 RegisterNetSyncVariableBool("m_IsTakeable");
8937 RegisterNetSyncVariableBool("m_IsHologram");
8938
8941 {
8944 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8945 }
8946
8948
8950 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8952
8954 }
8955
8957 {
8959 }
8960
8962 {
8965 {
8970 }
8971 }
8972
8973 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8974 {
8976 {
8979 }
8980
8982 }
8983
8985 {
8991 }
8992
8994
8996 {
8998
8999 if (!action)
9000 {
9001 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9002 return;
9003 }
9004
9006 if (!ai)
9007 {
9009 return;
9010 }
9011
9013 if (!action_array)
9014 {
9015 action_array = new array<ActionBase_Basic>;
9017 }
9018 if (LogManager.IsActionLogEnable())
9019 {
9020 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9021 }
9022
9023 if (action_array.Find(action) != -1)
9024 {
9025 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9026 }
9027 else
9028 {
9029 action_array.Insert(action);
9030 }
9031 }
9032
9034 {
9035 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9036 ActionBase action = player.GetActionManager().GetAction(actionName);
9039
9040 if (action_array)
9041 {
9042 action_array.RemoveItem(action);
9043 }
9044 }
9045
9046
9047
9049 {
9050 ActionOverrideData overrideData = new ActionOverrideData();
9054
9056 if (!actionMap)
9057 {
9060 }
9061
9062 actionMap.Insert(this.
Type(), overrideData);
9063
9064 }
9065
9067
9069
9070
9072 {
9075
9078
9079 string config_to_search = "CfgVehicles";
9080 string muzzle_owner_config;
9081
9083 {
9084 if (IsInherited(Weapon))
9085 config_to_search = "CfgWeapons";
9086
9087 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9088
9089 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9090
9091 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9092
9093 if (config_OnFire_subclass_count > 0)
9094 {
9095 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9096
9097 for (int i = 0; i < config_OnFire_subclass_count; i++)
9098 {
9099 string particle_class = "";
9100 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9101 string config_OnFire_entry = config_OnFire_class + particle_class;
9102 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9103 WPOF_array.Insert(WPOF);
9104 }
9105
9106
9108 }
9109 }
9110
9112 {
9113 config_to_search = "CfgWeapons";
9114 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9115
9116 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9117
9118 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9119
9120 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9121 {
9122 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9123
9124 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9125 {
9126 string particle_class2 = "";
9127 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9128 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9129 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9130 WPOBE_array.Insert(WPOBE);
9131 }
9132
9133
9135 }
9136 }
9137 }
9138
9139
9141 {
9144
9146 {
9147 string config_to_search = "CfgVehicles";
9148
9149 if (IsInherited(Weapon))
9150 config_to_search = "CfgWeapons";
9151
9152 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9153 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9154
9155 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9156 {
9157
9159
9161 {
9163 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9165 return;
9166 }
9167
9170
9171
9172
9173 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9174 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9175
9176 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9177 {
9178 string particle_class = "";
9179 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9180 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9181 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9182
9183 if (entry_type == CT_CLASS)
9184 {
9185 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9186 WPOOH_array.Insert(WPOF);
9187 }
9188 }
9189
9190
9192 }
9193 }
9194 }
9195
9197 {
9199 }
9200
9202 {
9204 {
9206
9209
9212
9213 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9214 }
9215 }
9216
9218 {
9220 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9221
9223 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9224
9226 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9227
9229 {
9231 }
9232 }
9233
9235 {
9237 }
9238
9240 {
9243 else
9245
9247 {
9250 }
9251 else
9252 {
9255
9258 }
9259
9261 }
9262
9264 {
9266 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9267 }
9268
9270 {
9272 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9274 }
9275
9277 {
9279 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9280 }
9281
9283 {
9286
9287 OverheatingParticle OP = new OverheatingParticle();
9292
9294 }
9295
9297 {
9300
9301 return -1;
9302 }
9303
9305 {
9307 {
9310
9311 for (int i = count; i > 0; --i)
9312 {
9313 int id = i - 1;
9316
9319
9320 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9321 {
9322 if (p)
9323 {
9326 }
9327 }
9328 }
9329 }
9330 }
9331
9333 {
9335 {
9337 {
9338 int id = i - 1;
9340
9341 if (OP)
9342 {
9344
9345 if (p)
9346 {
9348 }
9349
9350 delete OP;
9351 }
9352 }
9353
9356 }
9357 }
9358
9361 {
9362 return 0.0;
9363 }
9364
9365
9367 {
9368 return 250;
9369 }
9370
9372 {
9373 return 0;
9374 }
9375
9378 {
9380 return true;
9381
9382 return false;
9383 }
9384
9387 {
9390
9392 {
9394 }
9395 else
9396 {
9397
9399 }
9400
9402 }
9403
9410 {
9411 return -1;
9412 }
9413
9414
9415
9416
9418 {
9420 {
9421 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9422 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9423
9424 if (r_index >= 0)
9425 {
9426 InventoryLocation r_il = new InventoryLocation;
9427 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9428
9429 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9432 {
9433 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9434 }
9436 {
9437 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9438 }
9439
9440 }
9441
9442 player.GetHumanInventory().ClearUserReservedLocation(this);
9443 }
9444
9447 }
9448
9449
9450
9451
9453 {
9454 return ItemBase.m_DebugActionsMask;
9455 }
9456
9458 {
9459 return ItemBase.m_DebugActionsMask & mask;
9460 }
9461
9463 {
9464 ItemBase.m_DebugActionsMask = mask;
9465 }
9466
9468 {
9469 ItemBase.m_DebugActionsMask |= mask;
9470 }
9471
9473 {
9474 ItemBase.m_DebugActionsMask &= ~mask;
9475 }
9476
9478 {
9480 {
9482 }
9483 else
9484 {
9486 }
9487 }
9488
9489
9491 {
9492 if (GetEconomyProfile())
9493 {
9494 float q_max = GetEconomyProfile().GetQuantityMax();
9495 if (q_max > 0)
9496 {
9497 float q_min = GetEconomyProfile().GetQuantityMin();
9498 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9499
9501 {
9502 ComponentEnergyManager comp = GetCompEM();
9504 {
9506 }
9507 }
9509 {
9511
9512 }
9513
9514 }
9515 }
9516 }
9517
9520 {
9521 EntityAI parent = GetHierarchyParent();
9522
9523 if (parent)
9524 {
9525 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9526 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9527 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9528 }
9529 }
9530
9533 {
9534 EntityAI parent = GetHierarchyParent();
9535
9536 if (parent)
9537 {
9538 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9539 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9540 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9541 }
9542 }
9543
9545 {
9546
9547
9548
9549
9551
9553 {
9554 if (ScriptInputUserData.CanStoreInputUserData())
9555 {
9556 ScriptInputUserData ctx = new ScriptInputUserData;
9562 ctx.
Write(use_stack_max);
9565
9567 {
9568 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9569 }
9570 }
9571 }
9572 else if (!
g_Game.IsMultiplayer())
9573 {
9575 }
9576 }
9577
9579 {
9581 }
9582
9584 {
9586 }
9587
9589 {
9591 }
9592
9594 {
9595
9596 return false;
9597 }
9598
9600 {
9601 return false;
9602 }
9603
9607 {
9608 return false;
9609 }
9610
9612 {
9613 return "";
9614 }
9615
9617
9619 {
9620 return false;
9621 }
9622
9624 {
9625 return true;
9626 }
9627
9628
9629
9631 {
9632 return true;
9633 }
9634
9636 {
9637 return true;
9638 }
9639
9641 {
9642 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9644 }
9645
9647 {
9649 }
9650
9652 {
9654 if (!is_being_placed)
9656 SetSynchDirty();
9657 }
9658
9659
9661
9663 {
9665 }
9666
9668 {
9670 }
9671
9673 {
9674 return 1;
9675 }
9676
9678 {
9679 return false;
9680 }
9681
9683 {
9685 SetSynchDirty();
9686 }
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9723 {
9724 super.OnMovedInsideCargo(container);
9725
9726 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9727 }
9728
9729 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9730 {
9731 super.EEItemLocationChanged(oldLoc, newLoc);
9732
9733 PlayerBase newPlayer = null;
9734 PlayerBase oldPlayer = null;
9735
9736 if (newLoc.GetParent())
9737 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9738
9739 if (oldLoc.GetParent())
9740 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9741
9743 {
9744 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9745
9746 if (rIndex >= 0)
9747 {
9748 InventoryLocation rIl = new InventoryLocation;
9749 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9750
9751 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9754 {
9755 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9756 }
9758 {
9760 }
9761
9762 }
9763 }
9764
9766 {
9767 if (newPlayer)
9768 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9769
9770 if (newPlayer == oldPlayer)
9771 {
9772 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9773 {
9775 {
9776 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9777 {
9778 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9779 }
9780 }
9781 else
9782 {
9783 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9784 }
9785 }
9786
9787 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9788 {
9789 int type = oldLoc.GetType();
9791 {
9792 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9793 }
9795 {
9796 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9797 }
9798 }
9799 if (!m_OldLocation)
9800 {
9801 m_OldLocation = new InventoryLocation;
9802 }
9803 m_OldLocation.Copy(oldLoc);
9804 }
9805 else
9806 {
9807 if (m_OldLocation)
9808 {
9809 m_OldLocation.Reset();
9810 }
9811 }
9812
9813 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9814 }
9815 else
9816 {
9817 if (newPlayer)
9818 {
9819 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9820 if (resIndex >= 0)
9821 {
9822 InventoryLocation il = new InventoryLocation;
9823 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9825 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9828 {
9829 il.
GetParent().GetOnReleaseLock().Invoke(it);
9830 }
9832 {
9834 }
9835
9836 }
9837 }
9839 {
9840
9842 }
9843
9844 if (m_OldLocation)
9845 {
9846 m_OldLocation.Reset();
9847 }
9848 }
9849
9851 {
9852 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9853 }
9854
9856 {
9857 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9858 }
9859 }
9860
9861 override void EOnContact(IEntity other, Contact extra)
9862 {
9864 {
9865 int liquidType = -1;
9867 if (impactSpeed > 0.0)
9868 {
9870 #ifndef SERVER
9872 #else
9874 SetSynchDirty();
9875 #endif
9877 }
9878 }
9879
9880 #ifdef SERVER
9881 if (GetCompEM() && GetCompEM().IsPlugged())
9882 {
9883 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9884 GetCompEM().UnplugThis();
9885 }
9886 #endif
9887 }
9888
9890
9892 {
9894 }
9895
9897 {
9898
9899 }
9900
9902 {
9903 super.OnItemLocationChanged(old_owner, new_owner);
9904
9905 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9906 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9907
9908 if (!relatedPlayer && playerNew)
9909 relatedPlayer = playerNew;
9910
9911 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9912 {
9914 if (actionMgr)
9915 {
9916 ActionBase currentAction = actionMgr.GetRunningAction();
9917 if (currentAction)
9919 }
9920 }
9921
9922 Man ownerPlayerOld = null;
9923 Man ownerPlayerNew = null;
9924
9925 if (old_owner)
9926 {
9927 if (old_owner.
IsMan())
9928 {
9929 ownerPlayerOld = Man.Cast(old_owner);
9930 }
9931 else
9932 {
9933 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9934 }
9935 }
9936 else
9937 {
9939 {
9941
9942 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9943 {
9944 GetCompEM().UnplugThis();
9945 }
9946 }
9947 }
9948
9949 if (new_owner)
9950 {
9951 if (new_owner.
IsMan())
9952 {
9953 ownerPlayerNew = Man.Cast(new_owner);
9954 }
9955 else
9956 {
9957 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9958 }
9959 }
9960
9961 if (ownerPlayerOld != ownerPlayerNew)
9962 {
9963 if (ownerPlayerOld)
9964 {
9965 array<EntityAI> subItemsExit = new array<EntityAI>;
9967 for (int i = 0; i < subItemsExit.Count(); i++)
9968 {
9971 }
9972 }
9973
9974 if (ownerPlayerNew)
9975 {
9976 array<EntityAI> subItemsEnter = new array<EntityAI>;
9978 for (int j = 0; j < subItemsEnter.Count(); j++)
9979 {
9982 }
9983 }
9984 }
9985 else if (ownerPlayerNew != null)
9986 {
9987 PlayerBase nplayer;
9988 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9989 {
9990 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9992 for (int k = 0; k < subItemsUpdate.Count(); k++)
9993 {
9995 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9996 }
9997 }
9998 }
9999
10000 if (old_owner)
10001 old_owner.OnChildItemRemoved(this);
10002 if (new_owner)
10003 new_owner.OnChildItemReceived(this);
10004 }
10005
10006
10008 {
10009 super.EEDelete(parent);
10010 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10011 if (player)
10012 {
10014
10015 if (player.IsAlive())
10016 {
10017 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10018 if (r_index >= 0)
10019 {
10020 InventoryLocation r_il = new InventoryLocation;
10021 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10022
10023 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10026 {
10027 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10028 }
10030 {
10031 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10032 }
10033
10034 }
10035
10036 player.RemoveQuickBarEntityShortcut(this);
10037 }
10038 }
10039 }
10040
10042 {
10043 super.EEKilled(killer);
10044
10047 {
10048 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10049 {
10050 if (IsMagazine())
10051 {
10052 if (Magazine.Cast(this).GetAmmoCount() > 0)
10053 {
10055 }
10056 }
10057 else
10058 {
10060 }
10061 }
10062 }
10063 }
10064
10066 {
10067 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10068
10069 super.OnWasAttached(parent, slot_id);
10070
10073
10076 }
10077
10079 {
10080 super.OnWasDetached(parent, slot_id);
10081
10084
10087 }
10088
10090 {
10091 int idx;
10094
10095 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10096 if (inventory_slots.Count() < 1)
10097 {
10098 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10099 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10100 }
10101 else
10102 {
10103 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10104 }
10105
10106 idx = inventory_slots.Find(slot);
10107 if (idx < 0)
10108 return "";
10109
10110 return attach_types.Get(idx);
10111 }
10112
10114 {
10115 int idx = -1;
10116 string slot;
10117
10120
10121 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10122 if (inventory_slots.Count() < 1)
10123 {
10124 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10125 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10126 }
10127 else
10128 {
10129 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10130 if (detach_types.Count() < 1)
10131 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10132 }
10133
10134 for (int i = 0; i < inventory_slots.Count(); i++)
10135 {
10136 slot = inventory_slots.Get(i);
10137 }
10138
10139 if (slot != "")
10140 {
10141 if (detach_types.Count() == 1)
10142 idx = 0;
10143 else
10144 idx = inventory_slots.Find(slot);
10145 }
10146 if (idx < 0)
10147 return "";
10148
10149 return detach_types.Get(idx);
10150 }
10151
10153 {
10154
10156
10157
10158 float min_time = 1;
10159 float max_time = 3;
10160 float delay = Math.RandomFloat(min_time, max_time);
10161
10162 explode_timer.Run(delay, this, "DoAmmoExplosion");
10163 }
10164
10166 {
10167 Magazine magazine = Magazine.Cast(this);
10168 int pop_sounds_count = 6;
10169 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10170
10171
10172 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10173 string sound_name = pop_sounds[ sound_idx ];
10174 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10175
10176
10177 magazine.ServerAddAmmoCount(-1);
10178
10179
10180 float min_temp_to_explode = 100;
10181
10182 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10183 {
10185 }
10186 }
10187
10188
10189 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10190 {
10191 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10192
10193 const int CHANCE_DAMAGE_CARGO = 4;
10194 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10195 const int CHANCE_DAMAGE_NOTHING = 2;
10196
10198 {
10199 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10200 int chances;
10201 int rnd;
10202
10203 if (GetInventory().GetCargo())
10204 {
10205 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10206 rnd = Math.RandomInt(0,chances);
10207
10208 if (rnd < CHANCE_DAMAGE_CARGO)
10209 {
10211 }
10212 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10213 {
10215 }
10216 }
10217 else
10218 {
10219 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10220 rnd = Math.RandomInt(0,chances);
10221
10222 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10223 {
10225 }
10226 }
10227 }
10228 }
10229
10231 {
10232 CargoBase cargo = GetInventory().GetCargo();
10233 if (cargo)
10234 {
10236 if (item_count > 0)
10237 {
10238 int random_pick = Math.RandomInt(0, item_count);
10240 if (!item.IsExplosive())
10241 {
10242 item.AddHealth("","",damage);
10243 return true;
10244 }
10245 }
10246 }
10247 return false;
10248 }
10249
10251 {
10252 GameInventory inventory = GetInventory();
10254 if (attachment_count > 0)
10255 {
10256 int random_pick = Math.RandomInt(0, attachment_count);
10258 if (!attachment.IsExplosive())
10259 {
10260 attachment.AddHealth("","",damage);
10261 return true;
10262 }
10263 }
10264 return false;
10265 }
10266
10268 {
10270 }
10271
10273 {
10275 return GetInventory().CanRemoveEntity();
10276
10277 return false;
10278 }
10279
10281 {
10282
10284 return false;
10285
10286
10288 return false;
10289
10290
10291
10293 if (delta == 0)
10294 return false;
10295
10296
10297 return true;
10298 }
10299
10301 {
10303 {
10304 if (ScriptInputUserData.CanStoreInputUserData())
10305 {
10306 ScriptInputUserData ctx = new ScriptInputUserData;
10311 ctx.
Write(destination_entity);
10313 ctx.
Write(slot_id);
10315 }
10316 }
10317 else if (!
g_Game.IsMultiplayer())
10318 {
10320 }
10321 }
10322
10324 {
10325 float split_quantity_new;
10329 InventoryLocation loc = new InventoryLocation;
10330
10331 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10332 {
10334 split_quantity_new = stack_max;
10335 else
10337
10339 {
10340 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10341 if (new_item)
10342 {
10343 new_item.SetResultOfSplit(true);
10344 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10346 new_item.
SetQuantity(split_quantity_new,
false,
true);
10347 }
10348 }
10349 }
10350 else if (destination_entity && slot_id == -1)
10351 {
10352 if (quantity > stack_max)
10353 split_quantity_new = stack_max;
10354 else
10355 split_quantity_new = quantity;
10356
10358 {
10359 GameInventory destinationInventory = destination_entity.GetInventory();
10361 {
10364 }
10365
10366 if (new_item)
10367 {
10368 new_item.SetResultOfSplit(true);
10369 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10371 new_item.
SetQuantity(split_quantity_new,
false,
true);
10372 }
10373 }
10374 }
10375 else
10376 {
10377 if (stack_max != 0)
10378 {
10380 {
10382 }
10383
10384 if (split_quantity_new == 0)
10385 {
10386 if (!
g_Game.IsMultiplayer())
10387 player.PhysicalPredictiveDropItem(this);
10388 else
10389 player.ServerDropEntity(this);
10390 return;
10391 }
10392
10394 {
10396
10397 if (new_item)
10398 {
10399 new_item.SetResultOfSplit(true);
10400 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10403 new_item.PlaceOnSurface();
10404 }
10405 }
10406 }
10407 }
10408 }
10409
10411 {
10412 float split_quantity_new;
10416 InventoryLocation loc = new InventoryLocation;
10417
10418 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10419 {
10421 split_quantity_new = stack_max;
10422 else
10424
10426 {
10427 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10428 if (new_item)
10429 {
10430 new_item.SetResultOfSplit(true);
10431 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10433 new_item.
SetQuantity(split_quantity_new,
false,
true);
10434 }
10435 }
10436 }
10437 else if (destination_entity && slot_id == -1)
10438 {
10439 if (quantity > stack_max)
10440 split_quantity_new = stack_max;
10441 else
10442 split_quantity_new = quantity;
10443
10445 {
10446 GameInventory destinationInventory = destination_entity.GetInventory();
10448 {
10451 }
10452
10453 if (new_item)
10454 {
10455 new_item.SetResultOfSplit(true);
10456 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10458 new_item.
SetQuantity(split_quantity_new,
false,
true);
10459 }
10460 }
10461 }
10462 else
10463 {
10464 if (stack_max != 0)
10465 {
10467 {
10469 }
10470
10472 {
10474
10475 if (new_item)
10476 {
10477 new_item.SetResultOfSplit(true);
10478 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10481 new_item.PlaceOnSurface();
10482 }
10483 }
10484 }
10485 }
10486 }
10487
10489 {
10491 {
10492 if (ScriptInputUserData.CanStoreInputUserData())
10493 {
10494 ScriptInputUserData ctx = new ScriptInputUserData;
10499 dst.WriteToContext(ctx);
10501 }
10502 }
10503 else if (!
g_Game.IsMultiplayer())
10504 {
10506 }
10507 }
10508
10510 {
10512 {
10513 if (ScriptInputUserData.CanStoreInputUserData())
10514 {
10515 ScriptInputUserData ctx = new ScriptInputUserData;
10520 ctx.
Write(destination_entity);
10526 }
10527 }
10528 else if (!
g_Game.IsMultiplayer())
10529 {
10531 }
10532 }
10533
10535 {
10537 }
10538
10540 {
10542 float split_quantity_new;
10544 if (dst.IsValid())
10545 {
10546 int slot_id = dst.GetSlot();
10548
10549 if (quantity > stack_max)
10550 split_quantity_new = stack_max;
10551 else
10552 split_quantity_new = quantity;
10553
10555 {
10557
10558 if (new_item)
10559 {
10560 new_item.SetResultOfSplit(true);
10561 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10563 new_item.
SetQuantity(split_quantity_new,
false,
true);
10564 }
10565
10566 return new_item;
10567 }
10568 }
10569
10570 return null;
10571 }
10572
10574 {
10576 float split_quantity_new;
10578 if (destination_entity)
10579 {
10581 if (quantity > stackable)
10582 split_quantity_new = stackable;
10583 else
10584 split_quantity_new = quantity;
10585
10587 {
10588 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10589 if (new_item)
10590 {
10591 new_item.SetResultOfSplit(true);
10592 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10594 new_item.
SetQuantity(split_quantity_new,
false,
true);
10595 }
10596 }
10597 }
10598 }
10599
10601 {
10603 {
10604 if (ScriptInputUserData.CanStoreInputUserData())
10605 {
10606 ScriptInputUserData ctx = new ScriptInputUserData;
10611 ItemBase destination_entity =
this;
10612 ctx.
Write(destination_entity);
10616 }
10617 }
10618 else if (!
g_Game.IsMultiplayer())
10619 {
10621 }
10622 }
10623
10625 {
10627 float split_quantity_new;
10629 if (player)
10630 {
10632 if (quantity > stackable)
10633 split_quantity_new = stackable;
10634 else
10635 split_quantity_new = quantity;
10636
10638 {
10639 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10640 new_item =
ItemBase.Cast(in_hands);
10641 if (new_item)
10642 {
10643 new_item.SetResultOfSplit(true);
10644 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10646 new_item.SetQuantity(split_quantity_new, false, true);
10647 }
10648 }
10649 }
10650 }
10651
10653 {
10655 float split_quantity_new = Math.Floor(quantity * 0.5);
10656
10658 return;
10659
10661
10662 if (new_item)
10663 {
10664 if (new_item.GetQuantityMax() < split_quantity_new)
10665 {
10666 split_quantity_new = new_item.GetQuantityMax();
10667 }
10668
10669 new_item.SetResultOfSplit(true);
10670 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10671
10673 {
10676 }
10677 else
10678 {
10680 new_item.
SetQuantity(split_quantity_new,
false,
true);
10681 }
10682 }
10683 }
10684
10686 {
10688 float split_quantity_new = Math.Floor(quantity / 2);
10689
10691 return;
10692
10693 InventoryLocation invloc = new InventoryLocation;
10695
10697 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10698
10699 if (new_item)
10700 {
10701 if (new_item.GetQuantityMax() < split_quantity_new)
10702 {
10703 split_quantity_new = new_item.GetQuantityMax();
10704 }
10706 {
10709 }
10710 else if (split_quantity_new > 1)
10711 {
10713 new_item.
SetQuantity(split_quantity_new,
false,
true);
10714 }
10715 }
10716 }
10717
10720 {
10721 SetWeightDirty();
10723
10724 if (parent)
10725 parent.OnAttachmentQuantityChangedEx(this, delta);
10726
10728 {
10730 {
10732 }
10734 {
10735 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10737 }
10738 }
10739 }
10740
10743 {
10744
10745 }
10746
10749 {
10751 }
10752
10754 {
10755 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10756
10758 {
10759 if (newLevel == GameConstants.STATE_RUINED)
10760 {
10762 EntityAI parent = GetHierarchyParent();
10763 if (parent && parent.IsFireplace())
10764 {
10765 CargoBase cargo = GetInventory().GetCargo();
10766 if (cargo)
10767 {
10769 {
10771 }
10772 }
10773 }
10774 }
10775
10777 {
10778
10780 return;
10781 }
10782
10783 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10784 {
10786 }
10787 }
10788 }
10789
10790
10792 {
10793 super.OnRightClick();
10794
10796 {
10798 {
10799 if (ScriptInputUserData.CanStoreInputUserData())
10800 {
10801 EntityAI root = GetHierarchyRoot();
10802 Man playerOwner = GetHierarchyRootPlayer();
10803 InventoryLocation dst = new InventoryLocation;
10804
10805
10806 if (!playerOwner && root && root == this)
10807 {
10809 }
10810 else
10811 {
10812
10813 GetInventory().GetCurrentInventoryLocation(dst);
10815 {
10816 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10818 {
10820 }
10821 else
10822 {
10824
10825
10826 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10827 {
10829 }
10830 else
10831 {
10832 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10833 }
10834 }
10835 }
10836 }
10837
10838 ScriptInputUserData ctx = new ScriptInputUserData;
10846 }
10847 }
10848 else if (!
g_Game.IsMultiplayer())
10849 {
10851 }
10852 }
10853 }
10854
10856 {
10857 if (root)
10858 {
10859 vector m4[4];
10860 root.GetTransform(m4);
10861 dst.SetGround(this, m4);
10862 }
10863 else
10864 {
10865 GetInventory().GetCurrentInventoryLocation(dst);
10866 }
10867 }
10868
10869 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10870 {
10871
10872 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10873 return false;
10874
10875 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10876 return false;
10877
10878
10880 return false;
10881
10882
10883 Magazine mag = Magazine.Cast(this);
10884 if (mag)
10885 {
10886 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10887 return false;
10888
10889 if (stack_max_limit)
10890 {
10891 Magazine other_mag = Magazine.Cast(other_item);
10892 if (other_item)
10893 {
10894 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10895 return false;
10896 }
10897
10898 }
10899 }
10900 else
10901 {
10902
10904 return false;
10905
10907 return false;
10908 }
10909
10910 PlayerBase player = null;
10911 if (CastTo(player, GetHierarchyRootPlayer()))
10912 {
10913 if (player.GetInventory().HasAttachment(this))
10914 return false;
10915
10916 if (player.IsItemsToDelete())
10917 return false;
10918 }
10919
10920 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10921 return false;
10922
10923 int slotID;
10925 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10926 return false;
10927
10928 return true;
10929 }
10930
10932 {
10934 }
10935
10937 {
10938 return m_IsResultOfSplit;
10939 }
10940
10942 {
10943 m_IsResultOfSplit = value;
10944 }
10945
10947 {
10949 }
10950
10952 {
10953 float other_item_quantity = other_item.GetQuantity();
10954 float this_free_space;
10955
10957
10959
10960 if (other_item_quantity > this_free_space)
10961 {
10962 return this_free_space;
10963 }
10964 else
10965 {
10966 return other_item_quantity;
10967 }
10968 }
10969
10971 {
10973 }
10974
10976 {
10978 return;
10979
10980 if (!IsMagazine() && other_item)
10981 {
10983 if (quantity_used != 0)
10984 {
10985 float hp1 = GetHealth01("","");
10986 float hp2 = other_item.GetHealth01("","");
10987 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10988 hpResult = hpResult / (
GetQuantity() + quantity_used);
10989
10990 hpResult *= GetMaxHealth();
10991 Math.Round(hpResult);
10992 SetHealth("", "Health", hpResult);
10993
10995 other_item.AddQuantity(-quantity_used);
10996 }
10997 }
10999 }
11000
11002 {
11003 #ifdef SERVER
11004 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11005 GetHierarchyParent().IncreaseLifetimeUp();
11006 #endif
11007 };
11008
11010 {
11011 PlayerBase p = PlayerBase.Cast(player);
11012
11013 array<int> recipesIds = p.m_Recipes;
11014 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11015 if (moduleRecipesManager)
11016 {
11017 EntityAI itemInHands = player.GetEntityInHands();
11018 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11019 }
11020
11021 for (int i = 0;i < recipesIds.Count(); i++)
11022 {
11023 int key = recipesIds.Get(i);
11024 string recipeName = moduleRecipesManager.GetRecipeName(key);
11026 }
11027 }
11028
11029
11030 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11031 {
11032 super.GetDebugActions(outputList);
11033
11034
11040
11041
11046
11051
11052
11056
11057
11059 {
11063 }
11064
11067
11068
11072
11074
11075 InventoryLocation loc = new InventoryLocation();
11076 GetInventory().GetCurrentInventoryLocation(loc);
11078 {
11079 if (Gizmo_IsSupported())
11082 }
11083
11085 }
11086
11087
11088
11089
11091 {
11092 super.OnAction(action_id, player, ctx);
11093
11095 {
11096 switch (action_id)
11097 {
11101 return true;
11105 return true;
11106 }
11107 }
11108
11110 {
11111 switch (action_id)
11112 {
11114 Delete();
11115 return true;
11116 }
11117 }
11118
11119 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11120 {
11121 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11122 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11123 PlayerBase p = PlayerBase.Cast(player);
11124 if (
EActions.RECIPES_RANGE_START < 1000)
11125 {
11126 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11127 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11128 }
11129 }
11130 #ifndef SERVER
11131 else if (action_id ==
EActions.WATCH_PLAYER)
11132 {
11133 PluginDeveloper.SetDeveloperItemClientEx(player);
11134 }
11135 #endif
11137 {
11138 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11139 {
11140 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11141 OnDebugButtonPressServer(id + 1);
11142 }
11143
11144 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11145 {
11146 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11148 }
11149
11150 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11151 {
11152 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11154 }
11155
11156 else if (action_id ==
EActions.ADD_QUANTITY)
11157 {
11158 if (IsMagazine())
11159 {
11160 Magazine mag = Magazine.Cast(this);
11161 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11162 }
11163 else
11164 {
11166 }
11167
11168 if (m_EM)
11169 {
11170 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11171 }
11172
11173 }
11174
11175 else if (action_id ==
EActions.REMOVE_QUANTITY)
11176 {
11177 if (IsMagazine())
11178 {
11179 Magazine mag2 = Magazine.Cast(this);
11180 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11181 }
11182 else
11183 {
11185 }
11186 if (m_EM)
11187 {
11188 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11189 }
11190
11191 }
11192
11193 else if (action_id ==
EActions.SET_QUANTITY_0)
11194 {
11196
11197 if (m_EM)
11198 {
11199 m_EM.SetEnergy(0);
11200 }
11201 }
11202
11203 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11204 {
11206
11207 if (m_EM)
11208 {
11209 m_EM.SetEnergy(m_EM.GetEnergyMax());
11210 }
11211 }
11212
11213 else if (action_id ==
EActions.ADD_HEALTH)
11214 {
11215 AddHealth("","",GetMaxHealth("","Health")/5);
11216 }
11217 else if (action_id ==
EActions.REMOVE_HEALTH)
11218 {
11219 AddHealth("","",-GetMaxHealth("","Health")/5);
11220 }
11221 else if (action_id ==
EActions.DESTROY_HEALTH)
11222 {
11223 SetHealth01("","",0);
11224 }
11225 else if (action_id ==
EActions.WATCH_ITEM)
11226 {
11228 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11229 #ifdef DEVELOPER
11230 SetDebugDeveloper_item(this);
11231 #endif
11232 }
11233
11234 else if (action_id ==
EActions.ADD_TEMPERATURE)
11235 {
11236 AddTemperature(20);
11237
11238 }
11239
11240 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11241 {
11242 AddTemperature(-20);
11243
11244 }
11245
11246 else if (action_id ==
EActions.FLIP_FROZEN)
11247 {
11248 SetFrozen(!GetIsFrozen());
11249
11250 }
11251
11252 else if (action_id ==
EActions.ADD_WETNESS)
11253 {
11255
11256 }
11257
11258 else if (action_id ==
EActions.REMOVE_WETNESS)
11259 {
11261
11262 }
11263
11264 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11265 {
11268
11269
11270 }
11271
11272 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11273 {
11276 }
11277
11278 else if (action_id ==
EActions.MAKE_SPECIAL)
11279 {
11280 auto debugParams = DebugSpawnParams.WithPlayer(player);
11281 OnDebugSpawnEx(debugParams);
11282 }
11283
11284 }
11285
11286
11287 return false;
11288 }
11289
11290
11291
11292
11296
11299
11300
11301
11303 {
11304 return false;
11305 }
11306
11307
11309 {
11310 return true;
11311 }
11312
11313
11315 {
11316 return true;
11317 }
11318
11319
11320
11322 {
11323 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11324 return g_Game.ConfigIsExisting(config_path);
11325 }
11326
11329 {
11330 return null;
11331 }
11332
11334 {
11335 return false;
11336 }
11337
11339 {
11340 return false;
11341 }
11342
11346
11347
11349 {
11350 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11351 return module_repairing.CanRepair(this, item_repair_kit);
11352 }
11353
11354
11355 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11356 {
11357 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11358 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11359 }
11360
11361
11363 {
11364
11365
11366
11367
11368
11369
11370
11371
11372 return 1;
11373 }
11374
11375
11376
11378 {
11380 }
11381
11382
11383
11385 {
11387 }
11388
11389
11398 {
11399 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11400
11401 if (player)
11402 {
11403 player.MessageStatus(text);
11404 }
11405 }
11406
11407
11416 {
11417 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11418
11419 if (player)
11420 {
11421 player.MessageAction(text);
11422 }
11423 }
11424
11425
11434 {
11435 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11436
11437 if (player)
11438 {
11439 player.MessageFriendly(text);
11440 }
11441 }
11442
11443
11452 {
11453 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11454
11455 if (player)
11456 {
11457 player.MessageImportant(text);
11458 }
11459 }
11460
11462 {
11463 return true;
11464 }
11465
11466
11467 override bool KindOf(
string tag)
11468 {
11469 bool found = false;
11470 string item_name = this.
GetType();
11472 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11473
11474 int array_size = item_tag_array.Count();
11475 for (int i = 0; i < array_size; i++)
11476 {
11477 if (item_tag_array.Get(i) == tag)
11478 {
11479 found = true;
11480 break;
11481 }
11482 }
11483 return found;
11484 }
11485
11486
11488 {
11489
11490 super.OnRPC(sender, rpc_type,ctx);
11491
11492
11493 switch (rpc_type)
11494 {
11495 #ifndef SERVER
11496 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11497 Param2<bool, string> p = new Param2<bool, string>(false, "");
11498
11500 return;
11501
11502 bool play = p.param1;
11503 string soundSet = p.param2;
11504
11505 if (play)
11506 {
11508 {
11510 {
11512 }
11513 }
11514 else
11515 {
11517 }
11518 }
11519 else
11520 {
11522 }
11523
11524 break;
11525 #endif
11526
11527 }
11528
11530 {
11532 }
11533 }
11534
11535
11536
11537
11539 {
11540 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11541 return plugin.GetID(
name);
11542 }
11543
11545 {
11546 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11547 return plugin.GetName(id);
11548 }
11549
11552 {
11553
11554
11555 int varFlags;
11556 if (!ctx.
Read(varFlags))
11557 return;
11558
11559 if (varFlags & ItemVariableFlags.FLOAT)
11560 {
11562 }
11563 }
11564
11566 {
11567
11568 super.SerializeNumericalVars(floats_out);
11569
11570
11571
11573 {
11575 }
11576
11578 {
11580 }
11581
11583 {
11585 }
11586
11588 {
11593 }
11594
11596 {
11598 }
11599 }
11600
11602 {
11603
11604 super.DeSerializeNumericalVars(floats);
11605
11606
11607 int index = 0;
11608 int mask = Math.Round(floats.Get(index));
11609
11610 index++;
11611
11613 {
11615 {
11617 }
11618 else
11619 {
11620 float quantity = floats.Get(index);
11621 SetQuantity(quantity,
true,
false,
false,
false);
11622 }
11623 index++;
11624 }
11625
11627 {
11628 float wet = floats.Get(index);
11630 index++;
11631 }
11632
11634 {
11635 int liquidtype = Math.Round(floats.Get(index));
11637 index++;
11638 }
11639
11641 {
11643 index++;
11645 index++;
11647 index++;
11649 index++;
11650 }
11651
11653 {
11654 int cleanness = Math.Round(floats.Get(index));
11656 index++;
11657 }
11658 }
11659
11661 {
11662 super.WriteVarsToCTX(ctx);
11663
11664
11666 {
11668 }
11669
11671 {
11673 }
11674
11676 {
11678 }
11679
11681 {
11682 int r,g,b,a;
11688 }
11689
11691 {
11693 }
11694 }
11695
11697 {
11698 if (!super.ReadVarsFromCTX(ctx,version))
11699 return false;
11700
11701 int intValue;
11702 float value;
11703
11704 if (version < 140)
11705 {
11706 if (!ctx.
Read(intValue))
11707 return false;
11708
11709 m_VariablesMask = intValue;
11710 }
11711
11713 {
11714 if (!ctx.
Read(value))
11715 return false;
11716
11718 {
11720 }
11721 else
11722 {
11724 }
11725 }
11726
11727 if (version < 140)
11728 {
11730 {
11731 if (!ctx.
Read(value))
11732 return false;
11733 SetTemperatureDirect(value);
11734 }
11735 }
11736
11738 {
11739 if (!ctx.
Read(value))
11740 return false;
11742 }
11743
11745 {
11746 if (!ctx.
Read(intValue))
11747 return false;
11749 }
11750
11752 {
11753 int r,g,b,a;
11755 return false;
11757 return false;
11759 return false;
11761 return false;
11762
11764 }
11765
11767 {
11768 if (!ctx.
Read(intValue))
11769 return false;
11771 }
11772
11773 if (version >= 138 && version < 140)
11774 {
11776 {
11777 if (!ctx.
Read(intValue))
11778 return false;
11779 SetFrozen(intValue);
11780 }
11781 }
11782
11783 return true;
11784 }
11785
11786
11788 {
11791 {
11793 }
11794
11795 if (!super.OnStoreLoad(ctx, version))
11796 {
11798 return false;
11799 }
11800
11801 if (version >= 114)
11802 {
11803 bool hasQuickBarIndexSaved;
11804
11805 if (!ctx.
Read(hasQuickBarIndexSaved))
11806 {
11808 return false;
11809 }
11810
11811 if (hasQuickBarIndexSaved)
11812 {
11813 int itmQBIndex;
11814
11815
11816 if (!ctx.
Read(itmQBIndex))
11817 {
11819 return false;
11820 }
11821
11822 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11823 if (itmQBIndex != -1 && parentPlayer)
11824 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11825 }
11826 }
11827 else
11828 {
11829
11830 PlayerBase player;
11831 int itemQBIndex;
11832 if (version ==
int.
MAX)
11833 {
11834 if (!ctx.
Read(itemQBIndex))
11835 {
11837 return false;
11838 }
11839 }
11840 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11841 {
11842
11843 if (!ctx.
Read(itemQBIndex))
11844 {
11846 return false;
11847 }
11848 if (itemQBIndex != -1 && player)
11849 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11850 }
11851 }
11852
11853 if (version < 140)
11854 {
11855
11856 if (!LoadVariables(ctx, version))
11857 {
11859 return false;
11860 }
11861 }
11862
11863
11865 {
11867 return false;
11868 }
11869 if (version >= 132)
11870 {
11872 if (raib)
11873 {
11875 {
11877 return false;
11878 }
11879 }
11880 }
11881
11883 return true;
11884 }
11885
11886
11887
11889 {
11890 super.OnStoreSave(ctx);
11891
11892 PlayerBase player;
11893 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11894 {
11896
11897 int itemQBIndex = -1;
11898 itemQBIndex = player.FindQuickBarEntityIndex(this);
11899 ctx.
Write(itemQBIndex);
11900 }
11901 else
11902 {
11904 }
11905
11907
11909 if (raib)
11910 {
11912 }
11913 }
11914
11915
11917 {
11918 super.AfterStoreLoad();
11919
11921 {
11923 }
11924
11926 {
11929 }
11930 }
11931
11933 {
11934 super.EEOnAfterLoad();
11935
11937 {
11939 }
11940
11943 }
11944
11946 {
11947 return false;
11948 }
11949
11950
11951
11953 {
11955 {
11956 #ifdef PLATFORM_CONSOLE
11957
11959 {
11961 if (menu)
11962 {
11964 }
11965 }
11966 #endif
11967 }
11968
11970 {
11973 }
11974
11976 {
11977 SetWeightDirty();
11979 }
11981 {
11984 }
11985
11987 {
11990
11993 }
11995 {
11999 }
12000
12001 super.OnVariablesSynchronized();
12002 }
12003
12004
12005
12007 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12008 {
12009 if (!IsServerCheck(allow_client))
12010 return false;
12011
12013 return false;
12014
12017
12018 if (value <= (min + 0.001))
12019 value = min;
12020
12021 if (value == min)
12022 {
12023 if (destroy_config)
12024 {
12025 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12026 if (dstr)
12027 {
12029 this.Delete();
12030 return true;
12031 }
12032 }
12033 else if (destroy_forced)
12034 {
12036 this.Delete();
12037 return true;
12038 }
12039
12041 }
12042
12045
12047 {
12048 EntityAI parent = GetHierarchyRoot();
12049 InventoryLocation iLoc = new InventoryLocation();
12050 GetInventory().GetCurrentInventoryLocation(iLoc);
12052 {
12053 int iLocSlot = iLoc.
GetSlot();
12055 {
12057 }
12059 {
12061 }
12062 }
12063 }
12064
12066 {
12068
12069 if (delta)
12071 }
12072
12074
12075 return false;
12076 }
12077
12078
12080 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12081 {
12083 }
12084
12086 {
12089 }
12090
12092 {
12095 }
12096
12098 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12099 {
12100 float value_clamped = Math.Clamp(value, 0, 1);
12102 SetQuantity(result, destroy_config, destroy_forced);
12103 }
12104
12105
12108 {
12110 }
12111
12113 {
12115 }
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12127 {
12128 int slot = -1;
12129 GameInventory inventory = GetInventory();
12130 if (inventory)
12131 {
12132 InventoryLocation il = new InventoryLocation;
12135 }
12136
12138 }
12139
12141 {
12142 float quantity_max = 0;
12143
12145 {
12146 if (attSlotID != -1)
12147 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12148
12149 if (quantity_max <= 0)
12151 }
12152
12153 if (quantity_max <= 0)
12155
12156 return quantity_max;
12157 }
12158
12160 {
12162 }
12163
12165 {
12167 }
12168
12169
12171 {
12173 }
12174
12176 {
12178 }
12179
12181 {
12183 }
12184
12185
12187 {
12188
12189 float weightEx = GetWeightEx();
12190 float special = GetInventoryAndCargoWeight();
12191 return weightEx - special;
12192 }
12193
12194
12196 {
12198 }
12199
12201 {
12203 {
12204 #ifdef DEVELOPER
12205 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12206 {
12207 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12209 }
12210 #endif
12211
12212 return GetQuantity() * GetConfigWeightModified();
12213 }
12214 else if (HasEnergyManager())
12215 {
12216 #ifdef DEVELOPER
12217 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12218 {
12219 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12220 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12221 }
12222 #endif
12223 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12224 }
12225 else
12226 {
12227 #ifdef DEVELOPER
12228 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12229 {
12230 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12231 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12232 }
12233 #endif
12234 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12235 }
12236 }
12237
12240 {
12241 int item_count = 0;
12243
12244 GameInventory inventory = GetInventory();
12245 CargoBase cargo = inventory.
GetCargo();
12246 if (cargo != NULL)
12247 {
12249 }
12250
12252 for (int i = 0; i < nAttachments; ++i)
12253 {
12255 if (item)
12256 item_count += item.GetNumberOfItems();
12257 }
12258 return item_count;
12259 }
12260
12263 {
12264 float weight = 0;
12265 float wetness = 1;
12266 if (include_wetness)
12269 {
12270 weight = wetness * m_ConfigWeight;
12271 }
12273 {
12274 weight = 1;
12275 }
12276 return weight;
12277 }
12278
12279
12280
12282 {
12283 GameInventory inventory = GetInventory();
12284 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12285 {
12286 array<EntityAI> items = new array<EntityAI>;
12288 for (int i = 0; i < items.Count(); ++i)
12289 {
12291 if (item)
12292 {
12293 g_Game.ObjectDelete(item);
12294 }
12295 }
12296 }
12297 }
12298
12299
12300
12301
12303 {
12304 float energy = 0;
12305 if (HasEnergyManager())
12306 {
12307 energy = GetCompEM().GetEnergy();
12308 }
12309 return energy;
12310 }
12311
12312
12314 {
12315 super.OnEnergyConsumed();
12316
12318 }
12319
12321 {
12322 super.OnEnergyAdded();
12323
12325 }
12326
12327
12329 {
12330 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12331 {
12333 {
12334 float energy_0to1 = GetCompEM().GetEnergy0To1();
12336 }
12337 }
12338 }
12339
12340
12342 {
12343 return ConfigGetFloat("heatIsolation");
12344 }
12345
12347 {
12349 }
12350
12352 {
12353 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12354 if (
g_Game.ConfigIsExisting(paramPath))
12355 return g_Game.ConfigGetFloat(paramPath);
12356
12357 return 0.0;
12358 }
12359
12361 {
12362 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12363 if (
g_Game.ConfigIsExisting(paramPath))
12364 return g_Game.ConfigGetFloat(paramPath);
12365
12366 return 0.0;
12367 }
12368
12369 override void SetWet(
float value,
bool allow_client =
false)
12370 {
12371 if (!IsServerCheck(allow_client))
12372 return;
12373
12376
12378
12379 m_VarWet = Math.Clamp(value, min, max);
12380
12382 {
12385 }
12386 }
12387
12388 override void AddWet(
float value)
12389 {
12391 }
12392
12394 {
12396 }
12397
12399 {
12401 }
12402
12404 {
12406 }
12407
12409 {
12411 }
12412
12414 {
12416 }
12417
12418 override void OnWetChanged(
float newVal,
float oldVal)
12419 {
12422 if (newLevel != oldLevel)
12423 {
12425 }
12426 }
12427
12429 {
12430 SetWeightDirty();
12431 }
12432
12434 {
12435 return GetWetLevelInternal(
m_VarWet);
12436 }
12437
12438
12439
12441 {
12443 }
12444
12446 {
12448 }
12449
12451 {
12453 }
12454
12456 {
12458 }
12459
12460
12461
12463 {
12464 if (ConfigIsExisting("itemModelLength"))
12465 {
12466 return ConfigGetFloat("itemModelLength");
12467 }
12468 return 0;
12469 }
12470
12472 {
12473 if (ConfigIsExisting("itemAttachOffset"))
12474 {
12475 return ConfigGetFloat("itemAttachOffset");
12476 }
12477 return 0;
12478 }
12479
12480 override void SetCleanness(
int value,
bool allow_client =
false)
12481 {
12482 if (!IsServerCheck(allow_client))
12483 return;
12484
12486
12488
12491 }
12492
12494 {
12496 }
12497
12499 {
12500 return true;
12501 }
12502
12503
12504
12505
12507 {
12509 }
12510
12512 {
12514 }
12515
12516
12517
12518
12519 override void SetColor(
int r,
int g,
int b,
int a)
12520 {
12526 }
12528 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12529 {
12534 }
12535
12537 {
12539 }
12540
12543 {
12544 int r,g,b,a;
12546 r = r/255;
12547 g = g/255;
12548 b = b/255;
12549 a = a/255;
12550 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12551 }
12552
12553
12554
12555 override void SetLiquidType(
int value,
bool allow_client =
false)
12556 {
12557 if (!IsServerCheck(allow_client))
12558 return;
12559
12564 }
12565
12567 {
12568 return ConfigGetInt("varLiquidTypeInit");
12569 }
12570
12572 {
12574 }
12575
12577 {
12579 SetFrozen(false);
12580 }
12581
12584 {
12585 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12586 }
12587
12588
12591 {
12592 PlayerBase nplayer;
12593 if (PlayerBase.CastTo(nplayer, player))
12594 {
12596 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12597 }
12598 }
12599
12600
12603 {
12604 PlayerBase nplayer;
12605 if (PlayerBase.CastTo(nplayer,player))
12606 {
12607 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12608 }
12609
12610 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12611
12612 if (HasEnergyManager())
12613 {
12614 GetCompEM().UpdatePlugState();
12615 }
12616 }
12617
12618
12620 {
12621 super.OnPlacementStarted(player);
12622
12624 }
12625
12626 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12627 {
12629 {
12630 m_AdminLog.OnPlacementComplete(player,
this);
12631 }
12632
12633 super.OnPlacementComplete(player, position, orientation);
12634 }
12635
12636
12637
12638
12639
12641 {
12643 {
12644 return true;
12645 }
12646 else
12647 {
12648 return false;
12649 }
12650 }
12651
12652
12654 {
12656 {
12658 }
12659 }
12660
12661
12663 {
12665 }
12666
12668 {
12670 }
12671
12672 override void InsertAgent(
int agent,
float count = 1)
12673 {
12674 if (count < 1)
12675 return;
12676
12678 }
12679
12682 {
12684 }
12685
12686
12688 {
12690 }
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12734 {
12736 return false;
12737 return true;
12738 }
12739
12741 {
12742
12744 }
12745
12746
12749 {
12750 super.CheckForRoofLimited(timeTresholdMS);
12751
12752 float time =
g_Game.GetTime();
12753 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12754 {
12755 m_PreviousRoofTestTime = time;
12756 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12757 }
12758 }
12759
12760
12762 {
12764 {
12765 return 0;
12766 }
12767
12768 if (GetInventory().GetAttachmentSlotsCount() != 0)
12769 {
12770 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12771 if (filter)
12772 return filter.GetProtectionLevel(type, false, system);
12773 else
12774 return 0;
12775 }
12776
12777 string subclassPath, entryName;
12778
12779 switch (type)
12780 {
12782 entryName = "biological";
12783 break;
12785 entryName = "chemical";
12786 break;
12787 default:
12788 entryName = "biological";
12789 break;
12790 }
12791
12792 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12793
12794 return g_Game.ConfigGetFloat(subclassPath + entryName);
12795 }
12796
12797
12798
12801 {
12802 if (!IsMagazine())
12804
12806 }
12807
12808
12809
12810
12811
12816 {
12817 return true;
12818 }
12819
12821 {
12823 }
12824
12825
12826
12827
12828
12830 {
12831 if (parent)
12832 {
12833 if (parent.IsInherited(DayZInfected))
12834 return true;
12835
12836 if (!parent.IsRuined())
12837 return true;
12838 }
12839
12840 return true;
12841 }
12842
12844 {
12845 if (!super.CanPutAsAttachment(parent))
12846 {
12847 return false;
12848 }
12849
12850 if (!IsRuined() && !parent.IsRuined())
12851 {
12852 return true;
12853 }
12854
12855 return false;
12856 }
12857
12859 {
12860
12861
12862
12863
12864 return super.CanReceiveItemIntoCargo(item);
12865 }
12866
12868 {
12869
12870
12871
12872
12873 GameInventory attachmentInv = attachment.GetInventory();
12875 {
12876 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12877 return false;
12878 }
12879
12880 InventoryLocation loc = new InventoryLocation();
12881 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12882 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12883 return false;
12884
12885 return super.CanReceiveAttachment(attachment, slotId);
12886 }
12887
12889 {
12890 if (!super.CanReleaseAttachment(attachment))
12891 return false;
12892
12893 return GetInventory().AreChildrenAccessible();
12894 }
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12917 {
12918 int id = muzzle_owner.GetMuzzleID();
12919 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12920
12921 if (WPOF_array)
12922 {
12923 for (int i = 0; i < WPOF_array.Count(); i++)
12924 {
12925 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12926
12927 if (WPOF)
12928 {
12929 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12930 }
12931 }
12932 }
12933 }
12934
12935
12937 {
12938 int id = muzzle_owner.GetMuzzleID();
12940
12941 if (WPOBE_array)
12942 {
12943 for (int i = 0; i < WPOBE_array.Count(); i++)
12944 {
12945 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12946
12947 if (WPOBE)
12948 {
12949 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12950 }
12951 }
12952 }
12953 }
12954
12955
12957 {
12958 int id = muzzle_owner.GetMuzzleID();
12959 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12960
12961 if (WPOOH_array)
12962 {
12963 for (int i = 0; i < WPOOH_array.Count(); i++)
12964 {
12965 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12966
12967 if (WPOOH)
12968 {
12969 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12970 }
12971 }
12972 }
12973 }
12974
12975
12977 {
12978 int id = muzzle_owner.GetMuzzleID();
12979 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12980
12981 if (WPOOH_array)
12982 {
12983 for (int i = 0; i < WPOOH_array.Count(); i++)
12984 {
12985 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12986
12987 if (WPOOH)
12988 {
12989 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12990 }
12991 }
12992 }
12993 }
12994
12995
12997 {
12998 int id = muzzle_owner.GetMuzzleID();
12999 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13000
13001 if (WPOOH_array)
13002 {
13003 for (int i = 0; i < WPOOH_array.Count(); i++)
13004 {
13005 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13006
13007 if (WPOOH)
13008 {
13009 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13010 }
13011 }
13012 }
13013 }
13014
13015
13016
13018 {
13020 {
13021 return true;
13022 }
13023
13024 return false;
13025 }
13026
13028 {
13030 {
13031 return true;
13032 }
13033
13034 return false;
13035 }
13036
13038 {
13040 {
13041 return true;
13042 }
13043
13044 return false;
13045 }
13046
13048 {
13049 return false;
13050 }
13051
13054 {
13055 return UATimeSpent.DEFAULT_DEPLOY;
13056 }
13057
13058
13059
13060
13062 {
13064 SetSynchDirty();
13065 }
13066
13068 {
13070 }
13071
13072
13074 {
13075 return false;
13076 }
13077
13080 {
13081 string att_type = "None";
13082
13083 if (ConfigIsExisting("soundAttType"))
13084 {
13085 att_type = ConfigGetString("soundAttType");
13086 }
13087
13089 }
13090
13092 {
13094 }
13095
13096
13097
13098
13099
13105
13107 {
13110
13112 }
13113
13114
13116 {
13118 return;
13119
13121
13124
13127
13128 SoundParameters params = new SoundParameters();
13132 }
13133
13134
13136 {
13138 {
13141
13142 SetSynchDirty();
13143
13146 }
13147 }
13148
13150 {
13152 }
13153
13154
13156 {
13158 return;
13159
13161 SetSynchDirty();
13162
13165 }
13166
13168 {
13171 }
13172
13174 {
13176 }
13177
13178 void OnApply(PlayerBase player);
13179
13181 {
13182 return 1.0;
13183 };
13184
13186 {
13188 }
13189
13191 {
13193 }
13194
13196
13198 {
13199 SetDynamicPhysicsLifeTime(0.01);
13201 }
13202
13204 {
13205 array<string> zone_names = new array<string>;
13206 GetDamageZones(zone_names);
13207 for (int i = 0; i < zone_names.Count(); i++)
13208 {
13209 SetHealthMax(zone_names.Get(i),"Health");
13210 }
13211 SetHealthMax("","Health");
13212 }
13213
13216 {
13217 float global_health = GetHealth01("","Health");
13218 array<string> zones = new array<string>;
13219 GetDamageZones(zones);
13220
13221 for (int i = 0; i < zones.Count(); i++)
13222 {
13223 SetHealth01(zones.Get(i),"Health",global_health);
13224 }
13225 }
13226
13229 {
13230 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13231 }
13232
13234 {
13235 if (!hasRootAsPlayer)
13236 {
13237 if (refParentIB)
13238 {
13239
13240 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13241 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13242
13243 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13244 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13245
13248 }
13249 else
13250 {
13251
13254 }
13255 }
13256 }
13257
13259 {
13261 {
13262 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13263 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13264 {
13265 float heatPermCoef = 1.0;
13267 while (ent)
13268 {
13269 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13270 ent = ent.GetHierarchyParent();
13271 }
13272
13273 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13274 }
13275 }
13276 }
13277
13279 {
13280
13281 EntityAI parent = GetHierarchyParent();
13282 if (!parent)
13283 {
13284 hasParent = false;
13285 hasRootAsPlayer = false;
13286 }
13287 else
13288 {
13289 hasParent = true;
13290 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13291 refParentIB =
ItemBase.Cast(parent);
13292 }
13293 }
13294
13295 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13296 {
13297
13298 }
13299
13301 {
13302
13303 return false;
13304 }
13305
13307 {
13308
13309
13310 return false;
13311 }
13312
13314 {
13315
13316 return false;
13317 }
13318
13321 {
13322 return !GetIsFrozen() &&
IsOpen();
13323 }
13324
13326 {
13327 bool hasParent = false, hasRootAsPlayer = false;
13329
13330 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13331 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13332
13333 if (wwtu || foodDecay)
13334 {
13338
13339 if (processWetness || processTemperature || processDecay)
13340 {
13342
13343 if (processWetness)
13344 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13345
13346 if (processTemperature)
13348
13349 if (processDecay)
13350 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13351 }
13352 }
13353 }
13354
13357 {
13359 }
13360
13362 {
13365
13366 return super.GetTemperatureFreezeThreshold();
13367 }
13368
13370 {
13373
13374 return super.GetTemperatureThawThreshold();
13375 }
13376
13378 {
13381
13382 return super.GetItemOverheatThreshold();
13383 }
13384
13386 {
13388 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13389
13390 return super.GetTemperatureFreezeTime();
13391 }
13392
13394 {
13396 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13397
13398 return super.GetTemperatureThawTime();
13399 }
13400
13405
13407 {
13408 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13409 }
13410
13412 {
13413 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13414 }
13415
13418 {
13420 }
13421
13423 {
13425 }
13426
13428 {
13430 }
13431
13434 {
13435 return null;
13436 }
13437
13440 {
13441 return false;
13442 }
13443
13445 {
13447 {
13450 if (!trg)
13451 {
13453 explosive = this;
13454 }
13455
13456 explosive.PairRemote(trg);
13458
13459 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13460 trg.SetPersistentPairID(persistentID);
13461 explosive.SetPersistentPairID(persistentID);
13462
13463 return true;
13464 }
13465 return false;
13466 }
13467
13470 {
13471 float ret = 1.0;
13474 ret *= GetHealth01();
13475
13476 return ret;
13477 }
13478
13479 #ifdef DEVELOPER
13480 override void SetDebugItem()
13481 {
13482 super.SetDebugItem();
13483 _itemBase = this;
13484 }
13485
13487 {
13488 string text = super.GetDebugText();
13489
13491 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13492
13493 return text;
13494 }
13495 #endif
13496
13498 {
13499 return true;
13500 }
13501
13503
13505
13507 {
13510 }
13511
13512
13520
13536
13537 [
Obsolete(
"Use ItemSoundHandler instead")]
13540 {
13541 if (!
g_Game.IsDedicatedServer())
13542 {
13543 if (ConfigIsExisting("attachSoundSet"))
13544 {
13545 string cfg_path = "";
13546 string soundset = "";
13547 string type_name =
GetType();
13548
13551 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13552 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13553
13554 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13555 {
13556 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13557 {
13558 if (cfg_slot_array[i] == slot_type)
13559 {
13560 soundset = cfg_soundset_array[i];
13561 break;
13562 }
13563 }
13564 }
13565
13566 if (soundset != "")
13567 {
13568 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13570 }
13571 }
13572 }
13573 }
13574
13576}
13577
13579{
13581 if (entity)
13582 {
13583 bool is_item = entity.IsInherited(
ItemBase);
13584 if (is_item && full_quantity)
13585 {
13588 }
13589 }
13590 else
13591 {
13593 return NULL;
13594 }
13595 return entity;
13596}
13597
13599{
13600 if (item)
13601 {
13602 if (health > 0)
13603 item.SetHealth("", "", health);
13604
13605 if (item.CanHaveTemperature())
13606 {
13608 if (item.CanFreeze())
13609 item.SetFrozen(false);
13610 }
13611
13612 if (item.HasEnergyManager())
13613 {
13614 if (quantity >= 0)
13615 {
13616 item.GetCompEM().SetEnergy0To1(quantity);
13617 }
13618 else
13619 {
13621 }
13622 }
13623 else if (item.IsMagazine())
13624 {
13625 Magazine mag = Magazine.Cast(item);
13626 if (quantity >= 0)
13627 {
13628 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13629 }
13630 else
13631 {
13633 }
13634
13635 }
13636 else
13637 {
13638 if (quantity >= 0)
13639 {
13640 item.SetQuantityNormalized(quantity, false);
13641 }
13642 else
13643 {
13645 }
13646
13647 }
13648 }
13649}
13650
13651#ifdef DEVELOPER
13653#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.