8631{
8633 {
8634 return true;
8635 }
8636};
8637
8639{
8640
8641};
8642
8643
8644
8646{
8650
8652
8655
8656
8657
8658
8659
8668
8674
8679
8684
8705 protected bool m_IsResultOfSplit
8706
8708
8713
8714
8715
8717
8721
8722
8723
8725
8728
8729
8730
8736
8737
8745
8748
8749
8751
8752
8754
8755
8760
8761
8766
8768
8769
8771
8772
8774 {
8779
8780 if (!
g_Game.IsDedicatedServer())
8781 {
8783 {
8785
8787 {
8789 }
8790 }
8791
8794 }
8795
8796 m_OldLocation = null;
8797
8799 {
8801 }
8802
8803 if (ConfigIsExisting("headSelectionsToHide"))
8804 {
8807 }
8808
8810 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8811 {
8813 }
8814
8816
8817 m_IsResultOfSplit = false;
8818
8820 }
8821
8823 {
8824 super.InitItemVariables();
8825
8831 m_Count = ConfigGetInt(
"count");
8832
8835
8840
8843
8848
8860
8864
8865
8868 if (ConfigIsExisting("canBeSplit"))
8869 {
8872 }
8873
8875 if (ConfigIsExisting("itemBehaviour"))
8877
8878
8881 RegisterNetSyncVariableInt("m_VarLiquidType");
8882 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8883
8884 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8885 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8886 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8887
8888 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8889 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8890 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8891 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8892
8893 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8894 RegisterNetSyncVariableBool("m_IsTakeable");
8895 RegisterNetSyncVariableBool("m_IsHologram");
8896
8899 {
8902 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8903 }
8904
8906
8908 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8910
8912 }
8913
8915 {
8917 }
8918
8920 {
8923 {
8928 }
8929 }
8930
8931 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8932 {
8934 {
8937 }
8938
8940 }
8941
8943 {
8949 }
8950
8952
8954 {
8956
8957 if (!action)
8958 {
8959 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8960 return;
8961 }
8962
8964 if (!ai)
8965 {
8967 return;
8968 }
8969
8971 if (!action_array)
8972 {
8973 action_array = new array<ActionBase_Basic>;
8975 }
8976 if (LogManager.IsActionLogEnable())
8977 {
8978 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8979 }
8980
8981 if (action_array.Find(action) != -1)
8982 {
8983 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8984 }
8985 else
8986 {
8987 action_array.Insert(action);
8988 }
8989 }
8990
8992 {
8993 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8994 ActionBase action = player.GetActionManager().GetAction(actionName);
8997
8998 if (action_array)
8999 {
9000 action_array.RemoveItem(action);
9001 }
9002 }
9003
9004
9005
9007 {
9008 ActionOverrideData overrideData = new ActionOverrideData();
9012
9014 if (!actionMap)
9015 {
9018 }
9019
9020 actionMap.Insert(this.
Type(), overrideData);
9021
9022 }
9023
9025
9027
9028
9030 {
9033
9036
9037 string config_to_search = "CfgVehicles";
9038 string muzzle_owner_config;
9039
9041 {
9042 if (IsInherited(Weapon))
9043 config_to_search = "CfgWeapons";
9044
9045 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9046
9047 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9048
9049 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9050
9051 if (config_OnFire_subclass_count > 0)
9052 {
9053 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9054
9055 for (int i = 0; i < config_OnFire_subclass_count; i++)
9056 {
9057 string particle_class = "";
9058 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9059 string config_OnFire_entry = config_OnFire_class + particle_class;
9060 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9061 WPOF_array.Insert(WPOF);
9062 }
9063
9064
9066 }
9067 }
9068
9070 {
9071 config_to_search = "CfgWeapons";
9072 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9073
9074 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9075
9076 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9077
9078 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9079 {
9080 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9081
9082 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9083 {
9084 string particle_class2 = "";
9085 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9086 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9087 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9088 WPOBE_array.Insert(WPOBE);
9089 }
9090
9091
9093 }
9094 }
9095 }
9096
9097
9099 {
9102
9104 {
9105 string config_to_search = "CfgVehicles";
9106
9107 if (IsInherited(Weapon))
9108 config_to_search = "CfgWeapons";
9109
9110 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9111 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9112
9113 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9114 {
9115
9117
9119 {
9121 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9123 return;
9124 }
9125
9128
9129
9130
9131 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9132 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9133
9134 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9135 {
9136 string particle_class = "";
9137 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9138 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9139 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9140
9141 if (entry_type == CT_CLASS)
9142 {
9143 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9144 WPOOH_array.Insert(WPOF);
9145 }
9146 }
9147
9148
9150 }
9151 }
9152 }
9153
9155 {
9157 }
9158
9160 {
9162 {
9164
9167
9170
9171 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9172 }
9173 }
9174
9176 {
9178 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9179
9181 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9182
9184 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9185
9187 {
9189 }
9190 }
9191
9193 {
9195 }
9196
9198 {
9201 else
9203
9205 {
9208 }
9209 else
9210 {
9213
9216 }
9217
9219 }
9220
9222 {
9224 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9225 }
9226
9228 {
9230 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9232 }
9233
9235 {
9237 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9238 }
9239
9241 {
9244
9245 OverheatingParticle OP = new OverheatingParticle();
9250
9252 }
9253
9255 {
9258
9259 return -1;
9260 }
9261
9263 {
9265 {
9268
9269 for (int i = count; i > 0; --i)
9270 {
9271 int id = i - 1;
9274
9277
9278 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9279 {
9280 if (p)
9281 {
9284 }
9285 }
9286 }
9287 }
9288 }
9289
9291 {
9293 {
9295 {
9296 int id = i - 1;
9298
9299 if (OP)
9300 {
9302
9303 if (p)
9304 {
9306 }
9307
9308 delete OP;
9309 }
9310 }
9311
9314 }
9315 }
9316
9319 {
9320 return 0.0;
9321 }
9322
9323
9325 {
9326 return 250;
9327 }
9328
9330 {
9331 return 0;
9332 }
9333
9336 {
9338 return true;
9339
9340 return false;
9341 }
9342
9345 {
9348
9350 {
9352 }
9353 else
9354 {
9355
9357 }
9358
9360 }
9361
9368 {
9369 return -1;
9370 }
9371
9372
9373
9374
9376 {
9378 {
9379 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9380 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9381
9382 if (r_index >= 0)
9383 {
9384 InventoryLocation r_il = new InventoryLocation;
9385 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9386
9387 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9390 {
9391 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9392 }
9394 {
9395 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9396 }
9397
9398 }
9399
9400 player.GetHumanInventory().ClearUserReservedLocation(this);
9401 }
9402
9405 }
9406
9407
9408
9409
9411 {
9412 return ItemBase.m_DebugActionsMask;
9413 }
9414
9416 {
9417 return ItemBase.m_DebugActionsMask & mask;
9418 }
9419
9421 {
9422 ItemBase.m_DebugActionsMask = mask;
9423 }
9424
9426 {
9427 ItemBase.m_DebugActionsMask |= mask;
9428 }
9429
9431 {
9432 ItemBase.m_DebugActionsMask &= ~mask;
9433 }
9434
9436 {
9438 {
9440 }
9441 else
9442 {
9444 }
9445 }
9446
9447
9449 {
9450 if (GetEconomyProfile())
9451 {
9452 float q_max = GetEconomyProfile().GetQuantityMax();
9453 if (q_max > 0)
9454 {
9455 float q_min = GetEconomyProfile().GetQuantityMin();
9456 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9457
9459 {
9460 ComponentEnergyManager comp = GetCompEM();
9462 {
9464 }
9465 }
9467 {
9469
9470 }
9471
9472 }
9473 }
9474 }
9475
9478 {
9479 EntityAI parent = GetHierarchyParent();
9480
9481 if (parent)
9482 {
9483 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9484 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9485 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9486 }
9487 }
9488
9491 {
9492 EntityAI parent = GetHierarchyParent();
9493
9494 if (parent)
9495 {
9496 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9497 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9498 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9499 }
9500 }
9501
9503 {
9504
9505
9506
9507
9509
9511 {
9512 if (ScriptInputUserData.CanStoreInputUserData())
9513 {
9514 ScriptInputUserData ctx = new ScriptInputUserData;
9520 ctx.
Write(use_stack_max);
9523
9525 {
9526 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9527 }
9528 }
9529 }
9530 else if (!
g_Game.IsMultiplayer())
9531 {
9533 }
9534 }
9535
9537 {
9539 }
9540
9542 {
9544 }
9545
9547 {
9549 }
9550
9552 {
9553
9554 return false;
9555 }
9556
9558 {
9559 return false;
9560 }
9561
9565 {
9566 return false;
9567 }
9568
9570 {
9571 return "";
9572 }
9573
9575
9577 {
9578 return false;
9579 }
9580
9582 {
9583 return true;
9584 }
9585
9586
9587
9589 {
9590 return true;
9591 }
9592
9594 {
9595 return true;
9596 }
9597
9599 {
9600 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9602 }
9603
9605 {
9607 }
9608
9610 {
9612 if (!is_being_placed)
9614 SetSynchDirty();
9615 }
9616
9617
9619
9621 {
9623 }
9624
9626 {
9628 }
9629
9631 {
9632 return 1;
9633 }
9634
9636 {
9637 return false;
9638 }
9639
9641 {
9643 SetSynchDirty();
9644 }
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9681 {
9682 super.OnMovedInsideCargo(container);
9683
9684 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9685 }
9686
9687 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9688 {
9689 super.EEItemLocationChanged(oldLoc, newLoc);
9690
9691 PlayerBase newPlayer = null;
9692 PlayerBase oldPlayer = null;
9693
9694 if (newLoc.GetParent())
9695 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9696
9697 if (oldLoc.GetParent())
9698 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9699
9701 {
9702 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9703
9704 if (rIndex >= 0)
9705 {
9706 InventoryLocation rIl = new InventoryLocation;
9707 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9708
9709 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9712 {
9713 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9714 }
9716 {
9718 }
9719
9720 }
9721 }
9722
9724 {
9725 if (newPlayer)
9726 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9727
9728 if (newPlayer == oldPlayer)
9729 {
9730 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9731 {
9733 {
9734 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9735 {
9736 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9737 }
9738 }
9739 else
9740 {
9741 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9742 }
9743 }
9744
9745 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9746 {
9747 int type = oldLoc.GetType();
9749 {
9750 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9751 }
9753 {
9754 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9755 }
9756 }
9757 if (!m_OldLocation)
9758 {
9759 m_OldLocation = new InventoryLocation;
9760 }
9761 m_OldLocation.Copy(oldLoc);
9762 }
9763 else
9764 {
9765 if (m_OldLocation)
9766 {
9767 m_OldLocation.Reset();
9768 }
9769 }
9770
9771 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9772 }
9773 else
9774 {
9775 if (newPlayer)
9776 {
9777 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9778 if (resIndex >= 0)
9779 {
9780 InventoryLocation il = new InventoryLocation;
9781 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9783 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9786 {
9787 il.
GetParent().GetOnReleaseLock().Invoke(it);
9788 }
9790 {
9792 }
9793
9794 }
9795 }
9797 {
9798
9800 }
9801
9802 if (m_OldLocation)
9803 {
9804 m_OldLocation.Reset();
9805 }
9806 }
9807
9809 {
9810 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9811 }
9812
9814 {
9815 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9816 }
9817 }
9818
9819 override void EOnContact(IEntity other, Contact extra)
9820 {
9822 {
9823 int liquidType = -1;
9825 if (impactSpeed > 0.0)
9826 {
9828 #ifndef SERVER
9830 #else
9832 SetSynchDirty();
9833 #endif
9835 }
9836 }
9837
9838 #ifdef SERVER
9839 if (GetCompEM() && GetCompEM().IsPlugged())
9840 {
9841 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9842 GetCompEM().UnplugThis();
9843 }
9844 #endif
9845 }
9846
9848
9850 {
9852 }
9853
9855 {
9856
9857 }
9858
9860 {
9861 super.OnItemLocationChanged(old_owner, new_owner);
9862
9863 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9864 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9865
9866 if (!relatedPlayer && playerNew)
9867 relatedPlayer = playerNew;
9868
9869 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9870 {
9872 if (actionMgr)
9873 {
9874 ActionBase currentAction = actionMgr.GetRunningAction();
9875 if (currentAction)
9877 }
9878 }
9879
9880 Man ownerPlayerOld = null;
9881 Man ownerPlayerNew = null;
9882
9883 if (old_owner)
9884 {
9885 if (old_owner.
IsMan())
9886 {
9887 ownerPlayerOld = Man.Cast(old_owner);
9888 }
9889 else
9890 {
9891 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9892 }
9893 }
9894 else
9895 {
9897 {
9899
9900 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9901 {
9902 GetCompEM().UnplugThis();
9903 }
9904 }
9905 }
9906
9907 if (new_owner)
9908 {
9909 if (new_owner.
IsMan())
9910 {
9911 ownerPlayerNew = Man.Cast(new_owner);
9912 }
9913 else
9914 {
9915 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9916 }
9917 }
9918
9919 if (ownerPlayerOld != ownerPlayerNew)
9920 {
9921 if (ownerPlayerOld)
9922 {
9923 array<EntityAI> subItemsExit = new array<EntityAI>;
9925 for (int i = 0; i < subItemsExit.Count(); i++)
9926 {
9929 }
9930 }
9931
9932 if (ownerPlayerNew)
9933 {
9934 array<EntityAI> subItemsEnter = new array<EntityAI>;
9936 for (int j = 0; j < subItemsEnter.Count(); j++)
9937 {
9940 }
9941 }
9942 }
9943 else if (ownerPlayerNew != null)
9944 {
9945 PlayerBase nplayer;
9946 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9947 {
9948 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9950 for (int k = 0; k < subItemsUpdate.Count(); k++)
9951 {
9953 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9954 }
9955 }
9956 }
9957
9958 if (old_owner)
9959 old_owner.OnChildItemRemoved(this);
9960 if (new_owner)
9961 new_owner.OnChildItemReceived(this);
9962 }
9963
9964
9966 {
9967 super.EEDelete(parent);
9968 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9969 if (player)
9970 {
9972
9973 if (player.IsAlive())
9974 {
9975 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9976 if (r_index >= 0)
9977 {
9978 InventoryLocation r_il = new InventoryLocation;
9979 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9980
9981 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9984 {
9985 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9986 }
9988 {
9989 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9990 }
9991
9992 }
9993
9994 player.RemoveQuickBarEntityShortcut(this);
9995 }
9996 }
9997 }
9998
10000 {
10001 super.EEKilled(killer);
10002
10005 {
10006 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10007 {
10008 if (IsMagazine())
10009 {
10010 if (Magazine.Cast(this).GetAmmoCount() > 0)
10011 {
10013 }
10014 }
10015 else
10016 {
10018 }
10019 }
10020 }
10021 }
10022
10024 {
10025 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10026
10027 super.OnWasAttached(parent, slot_id);
10028
10031
10034 }
10035
10037 {
10038 super.OnWasDetached(parent, slot_id);
10039
10042
10045 }
10046
10048 {
10049 int idx;
10052
10053 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10054 if (inventory_slots.Count() < 1)
10055 {
10056 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10057 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10058 }
10059 else
10060 {
10061 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10062 }
10063
10064 idx = inventory_slots.Find(slot);
10065 if (idx < 0)
10066 return "";
10067
10068 return attach_types.Get(idx);
10069 }
10070
10072 {
10073 int idx = -1;
10074 string slot;
10075
10078
10079 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10080 if (inventory_slots.Count() < 1)
10081 {
10082 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10083 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10084 }
10085 else
10086 {
10087 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10088 if (detach_types.Count() < 1)
10089 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10090 }
10091
10092 for (int i = 0; i < inventory_slots.Count(); i++)
10093 {
10094 slot = inventory_slots.Get(i);
10095 }
10096
10097 if (slot != "")
10098 {
10099 if (detach_types.Count() == 1)
10100 idx = 0;
10101 else
10102 idx = inventory_slots.Find(slot);
10103 }
10104 if (idx < 0)
10105 return "";
10106
10107 return detach_types.Get(idx);
10108 }
10109
10111 {
10112
10114
10115
10116 float min_time = 1;
10117 float max_time = 3;
10118 float delay = Math.RandomFloat(min_time, max_time);
10119
10120 explode_timer.Run(delay, this, "DoAmmoExplosion");
10121 }
10122
10124 {
10125 Magazine magazine = Magazine.Cast(this);
10126 int pop_sounds_count = 6;
10127 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10128
10129
10130 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10131 string sound_name = pop_sounds[ sound_idx ];
10132 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10133
10134
10135 magazine.ServerAddAmmoCount(-1);
10136
10137
10138 float min_temp_to_explode = 100;
10139
10140 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10141 {
10143 }
10144 }
10145
10146
10147 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10148 {
10149 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10150
10151 const int CHANCE_DAMAGE_CARGO = 4;
10152 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10153 const int CHANCE_DAMAGE_NOTHING = 2;
10154
10156 {
10157 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10158 int chances;
10159 int rnd;
10160
10161 if (GetInventory().GetCargo())
10162 {
10163 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10164 rnd = Math.RandomInt(0,chances);
10165
10166 if (rnd < CHANCE_DAMAGE_CARGO)
10167 {
10169 }
10170 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10171 {
10173 }
10174 }
10175 else
10176 {
10177 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10178 rnd = Math.RandomInt(0,chances);
10179
10180 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10181 {
10183 }
10184 }
10185 }
10186 }
10187
10189 {
10190 CargoBase cargo = GetInventory().GetCargo();
10191 if (cargo)
10192 {
10194 if (item_count > 0)
10195 {
10196 int random_pick = Math.RandomInt(0, item_count);
10198 if (!item.IsExplosive())
10199 {
10200 item.AddHealth("","",damage);
10201 return true;
10202 }
10203 }
10204 }
10205 return false;
10206 }
10207
10209 {
10210 GameInventory inventory = GetInventory();
10212 if (attachment_count > 0)
10213 {
10214 int random_pick = Math.RandomInt(0, attachment_count);
10216 if (!attachment.IsExplosive())
10217 {
10218 attachment.AddHealth("","",damage);
10219 return true;
10220 }
10221 }
10222 return false;
10223 }
10224
10226 {
10228 }
10229
10231 {
10233 return GetInventory().CanRemoveEntity();
10234
10235 return false;
10236 }
10237
10239 {
10240
10242 return false;
10243
10244
10246 return false;
10247
10248
10249
10251 if (delta == 0)
10252 return false;
10253
10254
10255 return true;
10256 }
10257
10259 {
10261 {
10262 if (ScriptInputUserData.CanStoreInputUserData())
10263 {
10264 ScriptInputUserData ctx = new ScriptInputUserData;
10269 ctx.
Write(destination_entity);
10271 ctx.
Write(slot_id);
10273 }
10274 }
10275 else if (!
g_Game.IsMultiplayer())
10276 {
10278 }
10279 }
10280
10282 {
10283 float split_quantity_new;
10287 InventoryLocation loc = new InventoryLocation;
10288
10289 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10290 {
10292 split_quantity_new = stack_max;
10293 else
10295
10297 {
10298 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10299 if (new_item)
10300 {
10301 new_item.SetResultOfSplit(true);
10302 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10304 new_item.
SetQuantity(split_quantity_new,
false,
true);
10305 }
10306 }
10307 }
10308 else if (destination_entity && slot_id == -1)
10309 {
10310 if (quantity > stack_max)
10311 split_quantity_new = stack_max;
10312 else
10313 split_quantity_new = quantity;
10314
10316 {
10317 GameInventory destinationInventory = destination_entity.GetInventory();
10319 {
10322 }
10323
10324 if (new_item)
10325 {
10326 new_item.SetResultOfSplit(true);
10327 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10329 new_item.
SetQuantity(split_quantity_new,
false,
true);
10330 }
10331 }
10332 }
10333 else
10334 {
10335 if (stack_max != 0)
10336 {
10338 {
10340 }
10341
10342 if (split_quantity_new == 0)
10343 {
10344 if (!
g_Game.IsMultiplayer())
10345 player.PhysicalPredictiveDropItem(this);
10346 else
10347 player.ServerDropEntity(this);
10348 return;
10349 }
10350
10352 {
10354
10355 if (new_item)
10356 {
10357 new_item.SetResultOfSplit(true);
10358 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10361 new_item.PlaceOnSurface();
10362 }
10363 }
10364 }
10365 }
10366 }
10367
10369 {
10370 float split_quantity_new;
10374 InventoryLocation loc = new InventoryLocation;
10375
10376 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10377 {
10379 split_quantity_new = stack_max;
10380 else
10382
10384 {
10385 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10386 if (new_item)
10387 {
10388 new_item.SetResultOfSplit(true);
10389 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10391 new_item.
SetQuantity(split_quantity_new,
false,
true);
10392 }
10393 }
10394 }
10395 else if (destination_entity && slot_id == -1)
10396 {
10397 if (quantity > stack_max)
10398 split_quantity_new = stack_max;
10399 else
10400 split_quantity_new = quantity;
10401
10403 {
10404 GameInventory destinationInventory = destination_entity.GetInventory();
10406 {
10409 }
10410
10411 if (new_item)
10412 {
10413 new_item.SetResultOfSplit(true);
10414 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10416 new_item.
SetQuantity(split_quantity_new,
false,
true);
10417 }
10418 }
10419 }
10420 else
10421 {
10422 if (stack_max != 0)
10423 {
10425 {
10427 }
10428
10430 {
10432
10433 if (new_item)
10434 {
10435 new_item.SetResultOfSplit(true);
10436 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10439 new_item.PlaceOnSurface();
10440 }
10441 }
10442 }
10443 }
10444 }
10445
10447 {
10449 {
10450 if (ScriptInputUserData.CanStoreInputUserData())
10451 {
10452 ScriptInputUserData ctx = new ScriptInputUserData;
10457 dst.WriteToContext(ctx);
10459 }
10460 }
10461 else if (!
g_Game.IsMultiplayer())
10462 {
10464 }
10465 }
10466
10468 {
10470 {
10471 if (ScriptInputUserData.CanStoreInputUserData())
10472 {
10473 ScriptInputUserData ctx = new ScriptInputUserData;
10478 ctx.
Write(destination_entity);
10484 }
10485 }
10486 else if (!
g_Game.IsMultiplayer())
10487 {
10489 }
10490 }
10491
10493 {
10495 }
10496
10498 {
10500 float split_quantity_new;
10502 if (dst.IsValid())
10503 {
10504 int slot_id = dst.GetSlot();
10506
10507 if (quantity > stack_max)
10508 split_quantity_new = stack_max;
10509 else
10510 split_quantity_new = quantity;
10511
10513 {
10515
10516 if (new_item)
10517 {
10518 new_item.SetResultOfSplit(true);
10519 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10521 new_item.
SetQuantity(split_quantity_new,
false,
true);
10522 }
10523
10524 return new_item;
10525 }
10526 }
10527
10528 return null;
10529 }
10530
10532 {
10534 float split_quantity_new;
10536 if (destination_entity)
10537 {
10539 if (quantity > stackable)
10540 split_quantity_new = stackable;
10541 else
10542 split_quantity_new = quantity;
10543
10545 {
10546 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10547 if (new_item)
10548 {
10549 new_item.SetResultOfSplit(true);
10550 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10552 new_item.
SetQuantity(split_quantity_new,
false,
true);
10553 }
10554 }
10555 }
10556 }
10557
10559 {
10561 {
10562 if (ScriptInputUserData.CanStoreInputUserData())
10563 {
10564 ScriptInputUserData ctx = new ScriptInputUserData;
10569 ItemBase destination_entity =
this;
10570 ctx.
Write(destination_entity);
10574 }
10575 }
10576 else if (!
g_Game.IsMultiplayer())
10577 {
10579 }
10580 }
10581
10583 {
10585 float split_quantity_new;
10587 if (player)
10588 {
10590 if (quantity > stackable)
10591 split_quantity_new = stackable;
10592 else
10593 split_quantity_new = quantity;
10594
10596 {
10597 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10598 new_item =
ItemBase.Cast(in_hands);
10599 if (new_item)
10600 {
10601 new_item.SetResultOfSplit(true);
10602 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10604 new_item.SetQuantity(split_quantity_new, false, true);
10605 }
10606 }
10607 }
10608 }
10609
10611 {
10613 float split_quantity_new = Math.Floor(quantity * 0.5);
10614
10616 return;
10617
10619
10620 if (new_item)
10621 {
10622 if (new_item.GetQuantityMax() < split_quantity_new)
10623 {
10624 split_quantity_new = new_item.GetQuantityMax();
10625 }
10626
10627 new_item.SetResultOfSplit(true);
10628 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10629
10631 {
10634 }
10635 else
10636 {
10638 new_item.
SetQuantity(split_quantity_new,
false,
true);
10639 }
10640 }
10641 }
10642
10644 {
10646 float split_quantity_new = Math.Floor(quantity / 2);
10647
10649 return;
10650
10651 InventoryLocation invloc = new InventoryLocation;
10653
10655 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10656
10657 if (new_item)
10658 {
10659 if (new_item.GetQuantityMax() < split_quantity_new)
10660 {
10661 split_quantity_new = new_item.GetQuantityMax();
10662 }
10664 {
10667 }
10668 else if (split_quantity_new > 1)
10669 {
10671 new_item.
SetQuantity(split_quantity_new,
false,
true);
10672 }
10673 }
10674 }
10675
10678 {
10679 SetWeightDirty();
10681
10682 if (parent)
10683 parent.OnAttachmentQuantityChangedEx(this, delta);
10684
10686 {
10688 {
10690 }
10692 {
10693 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10695 }
10696 }
10697 }
10698
10701 {
10702
10703 }
10704
10707 {
10709 }
10710
10712 {
10713 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10714
10716 {
10717 if (newLevel == GameConstants.STATE_RUINED)
10718 {
10720 EntityAI parent = GetHierarchyParent();
10721 if (parent && parent.IsFireplace())
10722 {
10723 CargoBase cargo = GetInventory().GetCargo();
10724 if (cargo)
10725 {
10727 {
10729 }
10730 }
10731 }
10732 }
10733
10735 {
10736
10738 return;
10739 }
10740
10741 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10742 {
10744 }
10745 }
10746 }
10747
10748
10750 {
10751 super.OnRightClick();
10752
10754 {
10756 {
10757 if (ScriptInputUserData.CanStoreInputUserData())
10758 {
10759 EntityAI root = GetHierarchyRoot();
10760 Man playerOwner = GetHierarchyRootPlayer();
10761 InventoryLocation dst = new InventoryLocation;
10762
10763
10764 if (!playerOwner && root && root == this)
10765 {
10767 }
10768 else
10769 {
10770
10771 GetInventory().GetCurrentInventoryLocation(dst);
10773 {
10774 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10776 {
10778 }
10779 else
10780 {
10782
10783
10784 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10785 {
10787 }
10788 else
10789 {
10790 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10791 }
10792 }
10793 }
10794 }
10795
10796 ScriptInputUserData ctx = new ScriptInputUserData;
10804 }
10805 }
10806 else if (!
g_Game.IsMultiplayer())
10807 {
10809 }
10810 }
10811 }
10812
10814 {
10815 if (root)
10816 {
10817 vector m4[4];
10818 root.GetTransform(m4);
10819 dst.SetGround(this, m4);
10820 }
10821 else
10822 {
10823 GetInventory().GetCurrentInventoryLocation(dst);
10824 }
10825 }
10826
10827 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10828 {
10829
10830 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10831 return false;
10832
10833 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10834 return false;
10835
10836
10838 return false;
10839
10840
10841 Magazine mag = Magazine.Cast(this);
10842 if (mag)
10843 {
10844 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10845 return false;
10846
10847 if (stack_max_limit)
10848 {
10849 Magazine other_mag = Magazine.Cast(other_item);
10850 if (other_item)
10851 {
10852 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10853 return false;
10854 }
10855
10856 }
10857 }
10858 else
10859 {
10860
10862 return false;
10863
10865 return false;
10866 }
10867
10868 PlayerBase player = null;
10869 if (CastTo(player, GetHierarchyRootPlayer()))
10870 {
10871 if (player.GetInventory().HasAttachment(this))
10872 return false;
10873
10874 if (player.IsItemsToDelete())
10875 return false;
10876 }
10877
10878 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10879 return false;
10880
10881 int slotID;
10883 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10884 return false;
10885
10886 return true;
10887 }
10888
10890 {
10892 }
10893
10895 {
10896 return m_IsResultOfSplit;
10897 }
10898
10900 {
10901 m_IsResultOfSplit = value;
10902 }
10903
10905 {
10907 }
10908
10910 {
10911 float other_item_quantity = other_item.GetQuantity();
10912 float this_free_space;
10913
10915
10917
10918 if (other_item_quantity > this_free_space)
10919 {
10920 return this_free_space;
10921 }
10922 else
10923 {
10924 return other_item_quantity;
10925 }
10926 }
10927
10929 {
10931 }
10932
10934 {
10936 return;
10937
10938 if (!IsMagazine() && other_item)
10939 {
10941 if (quantity_used != 0)
10942 {
10943 float hp1 = GetHealth01("","");
10944 float hp2 = other_item.GetHealth01("","");
10945 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10946 hpResult = hpResult / (
GetQuantity() + quantity_used);
10947
10948 hpResult *= GetMaxHealth();
10949 Math.Round(hpResult);
10950 SetHealth("", "Health", hpResult);
10951
10953 other_item.AddQuantity(-quantity_used);
10954 }
10955 }
10957 }
10958
10960 {
10961 #ifdef SERVER
10962 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10963 GetHierarchyParent().IncreaseLifetimeUp();
10964 #endif
10965 };
10966
10968 {
10969 PlayerBase p = PlayerBase.Cast(player);
10970
10971 array<int> recipesIds = p.m_Recipes;
10972 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10973 if (moduleRecipesManager)
10974 {
10975 EntityAI itemInHands = player.GetEntityInHands();
10976 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10977 }
10978
10979 for (int i = 0;i < recipesIds.Count(); i++)
10980 {
10981 int key = recipesIds.Get(i);
10982 string recipeName = moduleRecipesManager.GetRecipeName(key);
10984 }
10985 }
10986
10987
10988 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10989 {
10990 super.GetDebugActions(outputList);
10991
10992
10998
10999
11004
11009
11010
11014
11015
11017 {
11021 }
11022
11025
11026
11030
11032
11033 InventoryLocation loc = new InventoryLocation();
11034 GetInventory().GetCurrentInventoryLocation(loc);
11036 {
11037 if (Gizmo_IsSupported())
11040 }
11041
11043 }
11044
11045
11046
11047
11049 {
11050 super.OnAction(action_id, player, ctx);
11051
11053 {
11054 switch (action_id)
11055 {
11059 return true;
11063 return true;
11064 }
11065 }
11066
11068 {
11069 switch (action_id)
11070 {
11072 Delete();
11073 return true;
11074 }
11075 }
11076
11077 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11078 {
11079 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11080 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11081 PlayerBase p = PlayerBase.Cast(player);
11082 if (
EActions.RECIPES_RANGE_START < 1000)
11083 {
11084 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11085 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11086 }
11087 }
11088 #ifndef SERVER
11089 else if (action_id ==
EActions.WATCH_PLAYER)
11090 {
11091 PluginDeveloper.SetDeveloperItemClientEx(player);
11092 }
11093 #endif
11095 {
11096 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11097 {
11098 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11099 OnDebugButtonPressServer(id + 1);
11100 }
11101
11102 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11103 {
11104 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11106 }
11107
11108 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11109 {
11110 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11112 }
11113
11114 else if (action_id ==
EActions.ADD_QUANTITY)
11115 {
11116 if (IsMagazine())
11117 {
11118 Magazine mag = Magazine.Cast(this);
11119 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11120 }
11121 else
11122 {
11124 }
11125
11126 if (m_EM)
11127 {
11128 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11129 }
11130
11131 }
11132
11133 else if (action_id ==
EActions.REMOVE_QUANTITY)
11134 {
11135 if (IsMagazine())
11136 {
11137 Magazine mag2 = Magazine.Cast(this);
11138 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11139 }
11140 else
11141 {
11143 }
11144 if (m_EM)
11145 {
11146 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11147 }
11148
11149 }
11150
11151 else if (action_id ==
EActions.SET_QUANTITY_0)
11152 {
11154
11155 if (m_EM)
11156 {
11157 m_EM.SetEnergy(0);
11158 }
11159 }
11160
11161 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11162 {
11164
11165 if (m_EM)
11166 {
11167 m_EM.SetEnergy(m_EM.GetEnergyMax());
11168 }
11169 }
11170
11171 else if (action_id ==
EActions.ADD_HEALTH)
11172 {
11173 AddHealth("","",GetMaxHealth("","Health")/5);
11174 }
11175 else if (action_id ==
EActions.REMOVE_HEALTH)
11176 {
11177 AddHealth("","",-GetMaxHealth("","Health")/5);
11178 }
11179 else if (action_id ==
EActions.DESTROY_HEALTH)
11180 {
11181 SetHealth01("","",0);
11182 }
11183 else if (action_id ==
EActions.WATCH_ITEM)
11184 {
11186 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11187 #ifdef DEVELOPER
11188 SetDebugDeveloper_item(this);
11189 #endif
11190 }
11191
11192 else if (action_id ==
EActions.ADD_TEMPERATURE)
11193 {
11194 AddTemperature(20);
11195
11196 }
11197
11198 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11199 {
11200 AddTemperature(-20);
11201
11202 }
11203
11204 else if (action_id ==
EActions.FLIP_FROZEN)
11205 {
11206 SetFrozen(!GetIsFrozen());
11207
11208 }
11209
11210 else if (action_id ==
EActions.ADD_WETNESS)
11211 {
11213
11214 }
11215
11216 else if (action_id ==
EActions.REMOVE_WETNESS)
11217 {
11219
11220 }
11221
11222 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11223 {
11226
11227
11228 }
11229
11230 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11231 {
11234 }
11235
11236 else if (action_id ==
EActions.MAKE_SPECIAL)
11237 {
11238 auto debugParams = DebugSpawnParams.WithPlayer(player);
11239 OnDebugSpawnEx(debugParams);
11240 }
11241
11242 }
11243
11244
11245 return false;
11246 }
11247
11248
11249
11250
11254
11257
11258
11259
11261 {
11262 return false;
11263 }
11264
11265
11267 {
11268 return true;
11269 }
11270
11271
11273 {
11274 return true;
11275 }
11276
11277
11278
11280 {
11281 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11282 return g_Game.ConfigIsExisting(config_path);
11283 }
11284
11287 {
11288 return null;
11289 }
11290
11292 {
11293 return false;
11294 }
11295
11297 {
11298 return false;
11299 }
11300
11304
11305
11307 {
11308 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11309 return module_repairing.CanRepair(this, item_repair_kit);
11310 }
11311
11312
11313 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11314 {
11315 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11316 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11317 }
11318
11319
11321 {
11322
11323
11324
11325
11326
11327
11328
11329
11330 return 1;
11331 }
11332
11333
11334
11336 {
11338 }
11339
11340
11341
11343 {
11345 }
11346
11347
11356 {
11357 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11358
11359 if (player)
11360 {
11361 player.MessageStatus(text);
11362 }
11363 }
11364
11365
11374 {
11375 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11376
11377 if (player)
11378 {
11379 player.MessageAction(text);
11380 }
11381 }
11382
11383
11392 {
11393 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11394
11395 if (player)
11396 {
11397 player.MessageFriendly(text);
11398 }
11399 }
11400
11401
11410 {
11411 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11412
11413 if (player)
11414 {
11415 player.MessageImportant(text);
11416 }
11417 }
11418
11420 {
11421 return true;
11422 }
11423
11424
11425 override bool KindOf(
string tag)
11426 {
11427 bool found = false;
11428 string item_name = this.
GetType();
11430 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11431
11432 int array_size = item_tag_array.Count();
11433 for (int i = 0; i < array_size; i++)
11434 {
11435 if (item_tag_array.Get(i) == tag)
11436 {
11437 found = true;
11438 break;
11439 }
11440 }
11441 return found;
11442 }
11443
11444
11446 {
11447
11448 super.OnRPC(sender, rpc_type,ctx);
11449
11450
11451 switch (rpc_type)
11452 {
11453 #ifndef SERVER
11454 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11455 Param2<bool, string> p = new Param2<bool, string>(false, "");
11456
11458 return;
11459
11460 bool play = p.param1;
11461 string soundSet = p.param2;
11462
11463 if (play)
11464 {
11466 {
11468 {
11470 }
11471 }
11472 else
11473 {
11475 }
11476 }
11477 else
11478 {
11480 }
11481
11482 break;
11483 #endif
11484
11485 }
11486
11488 {
11490 }
11491 }
11492
11493
11494
11495
11497 {
11498 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11499 return plugin.GetID(
name);
11500 }
11501
11503 {
11504 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11505 return plugin.GetName(id);
11506 }
11507
11510 {
11511
11512
11513 int varFlags;
11514 if (!ctx.
Read(varFlags))
11515 return;
11516
11517 if (varFlags & ItemVariableFlags.FLOAT)
11518 {
11520 }
11521 }
11522
11524 {
11525
11526 super.SerializeNumericalVars(floats_out);
11527
11528
11529
11531 {
11533 }
11534
11536 {
11538 }
11539
11541 {
11543 }
11544
11546 {
11551 }
11552
11554 {
11556 }
11557 }
11558
11560 {
11561
11562 super.DeSerializeNumericalVars(floats);
11563
11564
11565 int index = 0;
11566 int mask = Math.Round(floats.Get(index));
11567
11568 index++;
11569
11571 {
11573 {
11575 }
11576 else
11577 {
11578 float quantity = floats.Get(index);
11579 SetQuantity(quantity,
true,
false,
false,
false);
11580 }
11581 index++;
11582 }
11583
11585 {
11586 float wet = floats.Get(index);
11588 index++;
11589 }
11590
11592 {
11593 int liquidtype = Math.Round(floats.Get(index));
11595 index++;
11596 }
11597
11599 {
11601 index++;
11603 index++;
11605 index++;
11607 index++;
11608 }
11609
11611 {
11612 int cleanness = Math.Round(floats.Get(index));
11614 index++;
11615 }
11616 }
11617
11619 {
11620 super.WriteVarsToCTX(ctx);
11621
11622
11624 {
11626 }
11627
11629 {
11631 }
11632
11634 {
11636 }
11637
11639 {
11640 int r,g,b,a;
11646 }
11647
11649 {
11651 }
11652 }
11653
11655 {
11656 if (!super.ReadVarsFromCTX(ctx,version))
11657 return false;
11658
11659 int intValue;
11660 float value;
11661
11662 if (version < 140)
11663 {
11664 if (!ctx.
Read(intValue))
11665 return false;
11666
11667 m_VariablesMask = intValue;
11668 }
11669
11671 {
11672 if (!ctx.
Read(value))
11673 return false;
11674
11676 {
11678 }
11679 else
11680 {
11682 }
11683 }
11684
11685 if (version < 140)
11686 {
11688 {
11689 if (!ctx.
Read(value))
11690 return false;
11691 SetTemperatureDirect(value);
11692 }
11693 }
11694
11696 {
11697 if (!ctx.
Read(value))
11698 return false;
11700 }
11701
11703 {
11704 if (!ctx.
Read(intValue))
11705 return false;
11707 }
11708
11710 {
11711 int r,g,b,a;
11713 return false;
11715 return false;
11717 return false;
11719 return false;
11720
11722 }
11723
11725 {
11726 if (!ctx.
Read(intValue))
11727 return false;
11729 }
11730
11731 if (version >= 138 && version < 140)
11732 {
11734 {
11735 if (!ctx.
Read(intValue))
11736 return false;
11737 SetFrozen(intValue);
11738 }
11739 }
11740
11741 return true;
11742 }
11743
11744
11746 {
11749 {
11751 }
11752
11753 if (!super.OnStoreLoad(ctx, version))
11754 {
11756 return false;
11757 }
11758
11759 if (version >= 114)
11760 {
11761 bool hasQuickBarIndexSaved;
11762
11763 if (!ctx.
Read(hasQuickBarIndexSaved))
11764 {
11766 return false;
11767 }
11768
11769 if (hasQuickBarIndexSaved)
11770 {
11771 int itmQBIndex;
11772
11773
11774 if (!ctx.
Read(itmQBIndex))
11775 {
11777 return false;
11778 }
11779
11780 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11781 if (itmQBIndex != -1 && parentPlayer)
11782 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11783 }
11784 }
11785 else
11786 {
11787
11788 PlayerBase player;
11789 int itemQBIndex;
11790 if (version ==
int.
MAX)
11791 {
11792 if (!ctx.
Read(itemQBIndex))
11793 {
11795 return false;
11796 }
11797 }
11798 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11799 {
11800
11801 if (!ctx.
Read(itemQBIndex))
11802 {
11804 return false;
11805 }
11806 if (itemQBIndex != -1 && player)
11807 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11808 }
11809 }
11810
11811 if (version < 140)
11812 {
11813
11814 if (!LoadVariables(ctx, version))
11815 {
11817 return false;
11818 }
11819 }
11820
11821
11823 {
11825 return false;
11826 }
11827 if (version >= 132)
11828 {
11830 if (raib)
11831 {
11833 {
11835 return false;
11836 }
11837 }
11838 }
11839
11841 return true;
11842 }
11843
11844
11845
11847 {
11848 super.OnStoreSave(ctx);
11849
11850 PlayerBase player;
11851 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11852 {
11854
11855 int itemQBIndex = -1;
11856 itemQBIndex = player.FindQuickBarEntityIndex(this);
11857 ctx.
Write(itemQBIndex);
11858 }
11859 else
11860 {
11862 }
11863
11865
11867 if (raib)
11868 {
11870 }
11871 }
11872
11873
11875 {
11876 super.AfterStoreLoad();
11877
11879 {
11881 }
11882
11884 {
11887 }
11888 }
11889
11891 {
11892 super.EEOnAfterLoad();
11893
11895 {
11897 }
11898
11901 }
11902
11904 {
11905 return false;
11906 }
11907
11908
11909
11911 {
11913 {
11914 #ifdef PLATFORM_CONSOLE
11915
11917 {
11919 if (menu)
11920 {
11922 }
11923 }
11924 #endif
11925 }
11926
11928 {
11931 }
11932
11934 {
11935 SetWeightDirty();
11937 }
11939 {
11942 }
11943
11945 {
11948
11951 }
11953 {
11957 }
11958
11959 super.OnVariablesSynchronized();
11960 }
11961
11962
11963
11965 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11966 {
11967 if (!IsServerCheck(allow_client))
11968 return false;
11969
11971 return false;
11972
11975
11976 if (value <= (min + 0.001))
11977 value = min;
11978
11979 if (value == min)
11980 {
11981 if (destroy_config)
11982 {
11983 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11984 if (dstr)
11985 {
11987 this.Delete();
11988 return true;
11989 }
11990 }
11991 else if (destroy_forced)
11992 {
11994 this.Delete();
11995 return true;
11996 }
11997
11999 }
12000
12003
12005 {
12006 EntityAI parent = GetHierarchyRoot();
12007 InventoryLocation iLoc = new InventoryLocation();
12008 GetInventory().GetCurrentInventoryLocation(iLoc);
12010 {
12011 int iLocSlot = iLoc.
GetSlot();
12013 {
12015 }
12017 {
12019 }
12020 }
12021 }
12022
12024 {
12026
12027 if (delta)
12029 }
12030
12032
12033 return false;
12034 }
12035
12036
12038 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12039 {
12041 }
12042
12044 {
12047 }
12048
12050 {
12053 }
12054
12056 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12057 {
12058 float value_clamped = Math.Clamp(value, 0, 1);
12060 SetQuantity(result, destroy_config, destroy_forced);
12061 }
12062
12063
12066 {
12068 }
12069
12071 {
12073 }
12074
12075
12076
12077
12078
12079
12080
12081
12082
12083
12085 {
12086 int slot = -1;
12087 GameInventory inventory = GetInventory();
12088 if (inventory)
12089 {
12090 InventoryLocation il = new InventoryLocation;
12093 }
12094
12096 }
12097
12099 {
12100 float quantity_max = 0;
12101
12103 {
12104 if (attSlotID != -1)
12105 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12106
12107 if (quantity_max <= 0)
12109 }
12110
12111 if (quantity_max <= 0)
12113
12114 return quantity_max;
12115 }
12116
12118 {
12120 }
12121
12123 {
12125 }
12126
12127
12129 {
12131 }
12132
12134 {
12136 }
12137
12139 {
12141 }
12142
12143
12145 {
12146
12147 float weightEx = GetWeightEx();
12148 float special = GetInventoryAndCargoWeight();
12149 return weightEx - special;
12150 }
12151
12152
12154 {
12156 }
12157
12159 {
12161 {
12162 #ifdef DEVELOPER
12163 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12164 {
12165 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12167 }
12168 #endif
12169
12170 return GetQuantity() * GetConfigWeightModified();
12171 }
12172 else if (HasEnergyManager())
12173 {
12174 #ifdef DEVELOPER
12175 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12176 {
12177 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12178 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12179 }
12180 #endif
12181 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12182 }
12183 else
12184 {
12185 #ifdef DEVELOPER
12186 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12187 {
12188 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12189 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12190 }
12191 #endif
12192 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12193 }
12194 }
12195
12198 {
12199 int item_count = 0;
12201
12202 GameInventory inventory = GetInventory();
12203 CargoBase cargo = inventory.
GetCargo();
12204 if (cargo != NULL)
12205 {
12207 }
12208
12210 for (int i = 0; i < nAttachments; ++i)
12211 {
12213 if (item)
12214 item_count += item.GetNumberOfItems();
12215 }
12216 return item_count;
12217 }
12218
12221 {
12222 float weight = 0;
12223 float wetness = 1;
12224 if (include_wetness)
12227 {
12228 weight = wetness * m_ConfigWeight;
12229 }
12231 {
12232 weight = 1;
12233 }
12234 return weight;
12235 }
12236
12237
12238
12240 {
12241 GameInventory inventory = GetInventory();
12242 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12243 {
12244 array<EntityAI> items = new array<EntityAI>;
12246 for (int i = 0; i < items.Count(); ++i)
12247 {
12249 if (item)
12250 {
12251 g_Game.ObjectDelete(item);
12252 }
12253 }
12254 }
12255 }
12256
12257
12258
12259
12261 {
12262 float energy = 0;
12263 if (HasEnergyManager())
12264 {
12265 energy = GetCompEM().GetEnergy();
12266 }
12267 return energy;
12268 }
12269
12270
12272 {
12273 super.OnEnergyConsumed();
12274
12276 }
12277
12279 {
12280 super.OnEnergyAdded();
12281
12283 }
12284
12285
12287 {
12288 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12289 {
12291 {
12292 float energy_0to1 = GetCompEM().GetEnergy0To1();
12294 }
12295 }
12296 }
12297
12298
12300 {
12301 return ConfigGetFloat("heatIsolation");
12302 }
12303
12305 {
12307 }
12308
12310 {
12311 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12312 if (
g_Game.ConfigIsExisting(paramPath))
12313 return g_Game.ConfigGetFloat(paramPath);
12314
12315 return 0.0;
12316 }
12317
12319 {
12320 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12321 if (
g_Game.ConfigIsExisting(paramPath))
12322 return g_Game.ConfigGetFloat(paramPath);
12323
12324 return 0.0;
12325 }
12326
12327 override void SetWet(
float value,
bool allow_client =
false)
12328 {
12329 if (!IsServerCheck(allow_client))
12330 return;
12331
12334
12336
12337 m_VarWet = Math.Clamp(value, min, max);
12338
12340 {
12343 }
12344 }
12345
12346 override void AddWet(
float value)
12347 {
12349 }
12350
12352 {
12354 }
12355
12357 {
12359 }
12360
12362 {
12364 }
12365
12367 {
12369 }
12370
12372 {
12374 }
12375
12376 override void OnWetChanged(
float newVal,
float oldVal)
12377 {
12380 if (newLevel != oldLevel)
12381 {
12383 }
12384 }
12385
12387 {
12388 SetWeightDirty();
12389 }
12390
12392 {
12393 return GetWetLevelInternal(
m_VarWet);
12394 }
12395
12396
12397
12399 {
12401 }
12402
12404 {
12406 }
12407
12409 {
12411 }
12412
12414 {
12416 }
12417
12418
12419
12421 {
12422 if (ConfigIsExisting("itemModelLength"))
12423 {
12424 return ConfigGetFloat("itemModelLength");
12425 }
12426 return 0;
12427 }
12428
12430 {
12431 if (ConfigIsExisting("itemAttachOffset"))
12432 {
12433 return ConfigGetFloat("itemAttachOffset");
12434 }
12435 return 0;
12436 }
12437
12438 override void SetCleanness(
int value,
bool allow_client =
false)
12439 {
12440 if (!IsServerCheck(allow_client))
12441 return;
12442
12444
12446
12449 }
12450
12452 {
12454 }
12455
12457 {
12458 return true;
12459 }
12460
12461
12462
12463
12465 {
12467 }
12468
12470 {
12472 }
12473
12474
12475
12476
12477 override void SetColor(
int r,
int g,
int b,
int a)
12478 {
12484 }
12486 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12487 {
12492 }
12493
12495 {
12497 }
12498
12501 {
12502 int r,g,b,a;
12504 r = r/255;
12505 g = g/255;
12506 b = b/255;
12507 a = a/255;
12508 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12509 }
12510
12511
12512
12513 override void SetLiquidType(
int value,
bool allow_client =
false)
12514 {
12515 if (!IsServerCheck(allow_client))
12516 return;
12517
12522 }
12523
12525 {
12526 return ConfigGetInt("varLiquidTypeInit");
12527 }
12528
12530 {
12532 }
12533
12535 {
12537 SetFrozen(false);
12538 }
12539
12542 {
12543 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12544 }
12545
12546
12549 {
12550 PlayerBase nplayer;
12551 if (PlayerBase.CastTo(nplayer, player))
12552 {
12554 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12555 }
12556 }
12557
12558
12561 {
12562 PlayerBase nplayer;
12563 if (PlayerBase.CastTo(nplayer,player))
12564 {
12565 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12566 }
12567
12568 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12569
12570 if (HasEnergyManager())
12571 {
12572 GetCompEM().UpdatePlugState();
12573 }
12574 }
12575
12576
12578 {
12579 super.OnPlacementStarted(player);
12580
12582 }
12583
12584 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12585 {
12587 {
12588 m_AdminLog.OnPlacementComplete(player,
this);
12589 }
12590
12591 super.OnPlacementComplete(player, position, orientation);
12592 }
12593
12594
12595
12596
12597
12599 {
12601 {
12602 return true;
12603 }
12604 else
12605 {
12606 return false;
12607 }
12608 }
12609
12610
12612 {
12614 {
12616 }
12617 }
12618
12619
12621 {
12623 }
12624
12626 {
12628 }
12629
12630 override void InsertAgent(
int agent,
float count = 1)
12631 {
12632 if (count < 1)
12633 return;
12634
12636 }
12637
12640 {
12642 }
12643
12644
12646 {
12648 }
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12692 {
12694 return false;
12695 return true;
12696 }
12697
12699 {
12700
12702 }
12703
12704
12707 {
12708 super.CheckForRoofLimited(timeTresholdMS);
12709
12710 float time =
g_Game.GetTime();
12711 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12712 {
12713 m_PreviousRoofTestTime = time;
12714 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12715 }
12716 }
12717
12718
12720 {
12722 {
12723 return 0;
12724 }
12725
12726 if (GetInventory().GetAttachmentSlotsCount() != 0)
12727 {
12728 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12729 if (filter)
12730 return filter.GetProtectionLevel(type, false, system);
12731 else
12732 return 0;
12733 }
12734
12735 string subclassPath, entryName;
12736
12737 switch (type)
12738 {
12740 entryName = "biological";
12741 break;
12743 entryName = "chemical";
12744 break;
12745 default:
12746 entryName = "biological";
12747 break;
12748 }
12749
12750 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12751
12752 return g_Game.ConfigGetFloat(subclassPath + entryName);
12753 }
12754
12755
12756
12759 {
12760 if (!IsMagazine())
12762
12764 }
12765
12766
12767
12768
12769
12774 {
12775 return true;
12776 }
12777
12779 {
12781 }
12782
12783
12784
12785
12786
12788 {
12789 if (parent)
12790 {
12791 if (parent.IsInherited(DayZInfected))
12792 return true;
12793
12794 if (!parent.IsRuined())
12795 return true;
12796 }
12797
12798 return true;
12799 }
12800
12802 {
12803 if (!super.CanPutAsAttachment(parent))
12804 {
12805 return false;
12806 }
12807
12808 if (!IsRuined() && !parent.IsRuined())
12809 {
12810 return true;
12811 }
12812
12813 return false;
12814 }
12815
12817 {
12818
12819
12820
12821
12822 return super.CanReceiveItemIntoCargo(item);
12823 }
12824
12826 {
12827
12828
12829
12830
12831 GameInventory attachmentInv = attachment.GetInventory();
12833 {
12834 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12835 return false;
12836 }
12837
12838 InventoryLocation loc = new InventoryLocation();
12839 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12840 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12841 return false;
12842
12843 return super.CanReceiveAttachment(attachment, slotId);
12844 }
12845
12847 {
12848 if (!super.CanReleaseAttachment(attachment))
12849 return false;
12850
12851 return GetInventory().AreChildrenAccessible();
12852 }
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12875 {
12876 int id = muzzle_owner.GetMuzzleID();
12877 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12878
12879 if (WPOF_array)
12880 {
12881 for (int i = 0; i < WPOF_array.Count(); i++)
12882 {
12883 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12884
12885 if (WPOF)
12886 {
12887 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12888 }
12889 }
12890 }
12891 }
12892
12893
12895 {
12896 int id = muzzle_owner.GetMuzzleID();
12898
12899 if (WPOBE_array)
12900 {
12901 for (int i = 0; i < WPOBE_array.Count(); i++)
12902 {
12903 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12904
12905 if (WPOBE)
12906 {
12907 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12908 }
12909 }
12910 }
12911 }
12912
12913
12915 {
12916 int id = muzzle_owner.GetMuzzleID();
12917 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12918
12919 if (WPOOH_array)
12920 {
12921 for (int i = 0; i < WPOOH_array.Count(); i++)
12922 {
12923 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12924
12925 if (WPOOH)
12926 {
12927 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12928 }
12929 }
12930 }
12931 }
12932
12933
12935 {
12936 int id = muzzle_owner.GetMuzzleID();
12937 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12938
12939 if (WPOOH_array)
12940 {
12941 for (int i = 0; i < WPOOH_array.Count(); i++)
12942 {
12943 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12944
12945 if (WPOOH)
12946 {
12947 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12948 }
12949 }
12950 }
12951 }
12952
12953
12955 {
12956 int id = muzzle_owner.GetMuzzleID();
12957 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12958
12959 if (WPOOH_array)
12960 {
12961 for (int i = 0; i < WPOOH_array.Count(); i++)
12962 {
12963 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12964
12965 if (WPOOH)
12966 {
12967 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12968 }
12969 }
12970 }
12971 }
12972
12973
12974
12976 {
12978 {
12979 return true;
12980 }
12981
12982 return false;
12983 }
12984
12986 {
12988 {
12989 return true;
12990 }
12991
12992 return false;
12993 }
12994
12996 {
12998 {
12999 return true;
13000 }
13001
13002 return false;
13003 }
13004
13006 {
13007 return false;
13008 }
13009
13012 {
13013 return UATimeSpent.DEFAULT_DEPLOY;
13014 }
13015
13016
13017
13018
13020 {
13022 SetSynchDirty();
13023 }
13024
13026 {
13028 }
13029
13030
13032 {
13033 return false;
13034 }
13035
13038 {
13039 string att_type = "None";
13040
13041 if (ConfigIsExisting("soundAttType"))
13042 {
13043 att_type = ConfigGetString("soundAttType");
13044 }
13045
13047 }
13048
13050 {
13052 }
13053
13054
13055
13056
13057
13063
13065 {
13068
13070 }
13071
13072
13074 {
13076 return;
13077
13079
13082
13085
13086 SoundParameters params = new SoundParameters();
13090 }
13091
13092
13094 {
13096 {
13099
13100 SetSynchDirty();
13101
13104 }
13105 }
13106
13108 {
13110 }
13111
13112
13114 {
13116 return;
13117
13119 SetSynchDirty();
13120
13123 }
13124
13126 {
13129 }
13130
13132 {
13134 }
13135
13136 void OnApply(PlayerBase player);
13137
13139 {
13140 return 1.0;
13141 };
13142
13144 {
13146 }
13147
13149 {
13151 }
13152
13154
13156 {
13157 SetDynamicPhysicsLifeTime(0.01);
13159 }
13160
13162 {
13163 array<string> zone_names = new array<string>;
13164 GetDamageZones(zone_names);
13165 for (int i = 0; i < zone_names.Count(); i++)
13166 {
13167 SetHealthMax(zone_names.Get(i),"Health");
13168 }
13169 SetHealthMax("","Health");
13170 }
13171
13174 {
13175 float global_health = GetHealth01("","Health");
13176 array<string> zones = new array<string>;
13177 GetDamageZones(zones);
13178
13179 for (int i = 0; i < zones.Count(); i++)
13180 {
13181 SetHealth01(zones.Get(i),"Health",global_health);
13182 }
13183 }
13184
13187 {
13188 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13189 }
13190
13192 {
13193 if (!hasRootAsPlayer)
13194 {
13195 if (refParentIB)
13196 {
13197
13198 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13199 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13200
13201 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13202 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13203
13206 }
13207 else
13208 {
13209
13212 }
13213 }
13214 }
13215
13217 {
13219 {
13220 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13221 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13222 {
13223 float heatPermCoef = 1.0;
13225 while (ent)
13226 {
13227 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13228 ent = ent.GetHierarchyParent();
13229 }
13230
13231 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13232 }
13233 }
13234 }
13235
13237 {
13238
13239 EntityAI parent = GetHierarchyParent();
13240 if (!parent)
13241 {
13242 hasParent = false;
13243 hasRootAsPlayer = false;
13244 }
13245 else
13246 {
13247 hasParent = true;
13248 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13249 refParentIB =
ItemBase.Cast(parent);
13250 }
13251 }
13252
13253 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13254 {
13255
13256 }
13257
13259 {
13260
13261 return false;
13262 }
13263
13265 {
13266
13267
13268 return false;
13269 }
13270
13272 {
13273
13274 return false;
13275 }
13276
13279 {
13280 return !GetIsFrozen() &&
IsOpen();
13281 }
13282
13284 {
13285 bool hasParent = false, hasRootAsPlayer = false;
13287
13288 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13289 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13290
13291 if (wwtu || foodDecay)
13292 {
13296
13297 if (processWetness || processTemperature || processDecay)
13298 {
13300
13301 if (processWetness)
13302 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13303
13304 if (processTemperature)
13306
13307 if (processDecay)
13308 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13309 }
13310 }
13311 }
13312
13315 {
13317 }
13318
13320 {
13323
13324 return super.GetTemperatureFreezeThreshold();
13325 }
13326
13328 {
13331
13332 return super.GetTemperatureThawThreshold();
13333 }
13334
13336 {
13339
13340 return super.GetItemOverheatThreshold();
13341 }
13342
13344 {
13346 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13347
13348 return super.GetTemperatureFreezeTime();
13349 }
13350
13352 {
13354 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13355
13356 return super.GetTemperatureThawTime();
13357 }
13358
13363
13365 {
13366 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13367 }
13368
13370 {
13371 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13372 }
13373
13376 {
13378 }
13379
13381 {
13383 }
13384
13386 {
13388 }
13389
13392 {
13393 return null;
13394 }
13395
13398 {
13399 return false;
13400 }
13401
13403 {
13405 {
13408 if (!trg)
13409 {
13411 explosive = this;
13412 }
13413
13414 explosive.PairRemote(trg);
13416
13417 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13418 trg.SetPersistentPairID(persistentID);
13419 explosive.SetPersistentPairID(persistentID);
13420
13421 return true;
13422 }
13423 return false;
13424 }
13425
13428 {
13429 float ret = 1.0;
13432 ret *= GetHealth01();
13433
13434 return ret;
13435 }
13436
13437 #ifdef DEVELOPER
13438 override void SetDebugItem()
13439 {
13440 super.SetDebugItem();
13441 _itemBase = this;
13442 }
13443
13445 {
13446 string text = super.GetDebugText();
13447
13449 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13450
13451 return text;
13452 }
13453 #endif
13454
13456 {
13457 return true;
13458 }
13459
13461
13463
13465 {
13468 }
13469
13470
13478
13494
13495 [
Obsolete(
"Use ItemSoundHandler instead")]
13498 {
13499 if (!
g_Game.IsDedicatedServer())
13500 {
13501 if (ConfigIsExisting("attachSoundSet"))
13502 {
13503 string cfg_path = "";
13504 string soundset = "";
13505 string type_name =
GetType();
13506
13509 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13510 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13511
13512 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13513 {
13514 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13515 {
13516 if (cfg_slot_array[i] == slot_type)
13517 {
13518 soundset = cfg_soundset_array[i];
13519 break;
13520 }
13521 }
13522 }
13523
13524 if (soundset != "")
13525 {
13526 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13528 }
13529 }
13530 }
13531 }
13532
13534}
13535
13537{
13539 if (entity)
13540 {
13541 bool is_item = entity.IsInherited(
ItemBase);
13542 if (is_item && full_quantity)
13543 {
13546 }
13547 }
13548 else
13549 {
13551 return NULL;
13552 }
13553 return entity;
13554}
13555
13557{
13558 if (item)
13559 {
13560 if (health > 0)
13561 item.SetHealth("", "", health);
13562
13563 if (item.CanHaveTemperature())
13564 {
13566 if (item.CanFreeze())
13567 item.SetFrozen(false);
13568 }
13569
13570 if (item.HasEnergyManager())
13571 {
13572 if (quantity >= 0)
13573 {
13574 item.GetCompEM().SetEnergy0To1(quantity);
13575 }
13576 else
13577 {
13579 }
13580 }
13581 else if (item.IsMagazine())
13582 {
13583 Magazine mag = Magazine.Cast(item);
13584 if (quantity >= 0)
13585 {
13586 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13587 }
13588 else
13589 {
13591 }
13592
13593 }
13594 else
13595 {
13596 if (quantity >= 0)
13597 {
13598 item.SetQuantityNormalized(quantity, false);
13599 }
13600 else
13601 {
13603 }
13604
13605 }
13606 }
13607}
13608
13609#ifdef DEVELOPER
13611#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.