8708{
8710 {
8711 return true;
8712 }
8713};
8714
8716{
8717
8718};
8719
8720
8721
8723{
8727
8729
8732
8733
8734
8735
8736
8745
8751
8756
8761
8782 protected bool m_IsResultOfSplit
8783
8785
8790
8791
8792
8794
8798
8799
8800
8802
8805
8806
8807
8813
8814
8822
8825
8826
8828
8829
8831
8832
8837
8838
8843
8845
8846
8848
8849
8851 {
8856
8857 if (!
g_Game.IsDedicatedServer())
8858 {
8860 {
8862
8864 {
8866 }
8867 }
8868
8871 }
8872
8873 m_OldLocation = null;
8874
8876 {
8878 }
8879
8880 if (ConfigIsExisting("headSelectionsToHide"))
8881 {
8884 }
8885
8887 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8888 {
8890 }
8891
8893
8894 m_IsResultOfSplit = false;
8895
8897 }
8898
8900 {
8901 super.InitItemVariables();
8902
8908 m_Count = ConfigGetInt(
"count");
8909
8912
8917
8920
8925
8937
8941
8942
8945 if (ConfigIsExisting("canBeSplit"))
8946 {
8949 }
8950
8952 if (ConfigIsExisting("itemBehaviour"))
8954
8955
8958 RegisterNetSyncVariableInt("m_VarLiquidType");
8959 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8960
8961 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8962 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8963 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8964
8965 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8966 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8967 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8968 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8969
8970 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8971 RegisterNetSyncVariableBool("m_IsTakeable");
8972 RegisterNetSyncVariableBool("m_IsHologram");
8973
8976 {
8979 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8980 }
8981
8983
8985 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8987
8989 }
8990
8992 {
8994 }
8995
8997 {
9000 {
9005 }
9006 }
9007
9008 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9009 {
9011 {
9014 }
9015
9017 }
9018
9020 {
9026 }
9027
9029
9031 {
9033
9034 if (!action)
9035 {
9036 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9037 return;
9038 }
9039
9041 if (!ai)
9042 {
9044 return;
9045 }
9046
9048 if (!action_array)
9049 {
9050 action_array = new array<ActionBase_Basic>;
9052 }
9053 if (LogManager.IsActionLogEnable())
9054 {
9055 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9056 }
9057
9058 if (action_array.Find(action) != -1)
9059 {
9060 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9061 }
9062 else
9063 {
9064 action_array.Insert(action);
9065 }
9066 }
9067
9069 {
9070 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9071 ActionBase action = player.GetActionManager().GetAction(actionName);
9074
9075 if (action_array)
9076 {
9077 action_array.RemoveItem(action);
9078 }
9079 }
9080
9081
9082
9084 {
9085 ActionOverrideData overrideData = new ActionOverrideData();
9089
9091 if (!actionMap)
9092 {
9095 }
9096
9097 actionMap.Insert(this.
Type(), overrideData);
9098
9099 }
9100
9102
9104
9105
9107 {
9110
9113
9114 string config_to_search = "CfgVehicles";
9115 string muzzle_owner_config;
9116
9118 {
9119 if (IsInherited(Weapon))
9120 config_to_search = "CfgWeapons";
9121
9122 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9123
9124 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9125
9126 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9127
9128 if (config_OnFire_subclass_count > 0)
9129 {
9130 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9131
9132 for (int i = 0; i < config_OnFire_subclass_count; i++)
9133 {
9134 string particle_class = "";
9135 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9136 string config_OnFire_entry = config_OnFire_class + particle_class;
9137 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9138 WPOF_array.Insert(WPOF);
9139 }
9140
9141
9143 }
9144 }
9145
9147 {
9148 config_to_search = "CfgWeapons";
9149 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9150
9151 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9152
9153 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9154
9155 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9156 {
9157 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9158
9159 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9160 {
9161 string particle_class2 = "";
9162 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9163 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9164 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9165 WPOBE_array.Insert(WPOBE);
9166 }
9167
9168
9170 }
9171 }
9172 }
9173
9174
9176 {
9179
9181 {
9182 string config_to_search = "CfgVehicles";
9183
9184 if (IsInherited(Weapon))
9185 config_to_search = "CfgWeapons";
9186
9187 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9188 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9189
9190 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9191 {
9192
9194
9196 {
9198 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9200 return;
9201 }
9202
9205
9206
9207
9208 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9209 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9210
9211 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9212 {
9213 string particle_class = "";
9214 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9215 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9216 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9217
9218 if (entry_type == CT_CLASS)
9219 {
9220 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9221 WPOOH_array.Insert(WPOF);
9222 }
9223 }
9224
9225
9227 }
9228 }
9229 }
9230
9232 {
9234 }
9235
9237 {
9239 {
9241
9244
9247
9248 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9249 }
9250 }
9251
9253 {
9255 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9256
9258 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9259
9261 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9262
9264 {
9266 }
9267 }
9268
9270 {
9272 }
9273
9275 {
9278 else
9280
9282 {
9285 }
9286 else
9287 {
9290
9293 }
9294
9296 }
9297
9299 {
9301 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9302 }
9303
9305 {
9307 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9309 }
9310
9312 {
9314 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9315 }
9316
9318 {
9321
9322 OverheatingParticle OP = new OverheatingParticle();
9327
9329 }
9330
9332 {
9335
9336 return -1;
9337 }
9338
9340 {
9342 {
9345
9346 for (int i = count; i > 0; --i)
9347 {
9348 int id = i - 1;
9351
9354
9355 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9356 {
9357 if (p)
9358 {
9361 }
9362 }
9363 }
9364 }
9365 }
9366
9368 {
9370 {
9372 {
9373 int id = i - 1;
9375
9376 if (OP)
9377 {
9379
9380 if (p)
9381 {
9383 }
9384
9385 delete OP;
9386 }
9387 }
9388
9391 }
9392 }
9393
9396 {
9397 return 0.0;
9398 }
9399
9400
9402 {
9403 return 250;
9404 }
9405
9407 {
9408 return 0;
9409 }
9410
9413 {
9415 return true;
9416
9417 return false;
9418 }
9419
9422 {
9425
9427 {
9429 }
9430 else
9431 {
9432
9434 }
9435
9437 }
9438
9445 {
9446 return -1;
9447 }
9448
9449
9450
9451
9453 {
9455 {
9456 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9457 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9458
9459 if (r_index >= 0)
9460 {
9461 InventoryLocation r_il = new InventoryLocation;
9462 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9463
9464 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9467 {
9468 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9469 }
9471 {
9472 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9473 }
9474
9475 }
9476
9477 player.GetHumanInventory().ClearUserReservedLocation(this);
9478 }
9479
9482 }
9483
9484
9485
9486
9488 {
9489 return ItemBase.m_DebugActionsMask;
9490 }
9491
9493 {
9494 return ItemBase.m_DebugActionsMask & mask;
9495 }
9496
9498 {
9499 ItemBase.m_DebugActionsMask = mask;
9500 }
9501
9503 {
9504 ItemBase.m_DebugActionsMask |= mask;
9505 }
9506
9508 {
9509 ItemBase.m_DebugActionsMask &= ~mask;
9510 }
9511
9513 {
9515 {
9517 }
9518 else
9519 {
9521 }
9522 }
9523
9524
9526 {
9527 if (GetEconomyProfile())
9528 {
9529 float q_max = GetEconomyProfile().GetQuantityMax();
9530 if (q_max > 0)
9531 {
9532 float q_min = GetEconomyProfile().GetQuantityMin();
9533 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9534
9536 {
9537 ComponentEnergyManager comp = GetCompEM();
9539 {
9541 }
9542 }
9544 {
9546
9547 }
9548
9549 }
9550 }
9551 }
9552
9555 {
9556 EntityAI parent = GetHierarchyParent();
9557
9558 if (parent)
9559 {
9560 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9561 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9562 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9563 }
9564 }
9565
9568 {
9569 EntityAI parent = GetHierarchyParent();
9570
9571 if (parent)
9572 {
9573 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9574 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9575 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9576 }
9577 }
9578
9580 {
9581
9582
9583
9584
9586
9588 {
9589 if (ScriptInputUserData.CanStoreInputUserData())
9590 {
9591 ScriptInputUserData ctx = new ScriptInputUserData;
9597 ctx.
Write(use_stack_max);
9600
9602 {
9603 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9604 }
9605 }
9606 }
9607 else if (!
g_Game.IsMultiplayer())
9608 {
9610 }
9611 }
9612
9614 {
9616 }
9617
9619 {
9621 }
9622
9624 {
9626 }
9627
9629 {
9630
9631 return false;
9632 }
9633
9635 {
9636 return false;
9637 }
9638
9642 {
9643 return false;
9644 }
9645
9647 {
9648 return "";
9649 }
9650
9652
9654 {
9655 return false;
9656 }
9657
9659 {
9660 return true;
9661 }
9662
9663
9664
9666 {
9667 return true;
9668 }
9669
9671 {
9672 return true;
9673 }
9674
9676 {
9677 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9679 }
9680
9682 {
9684 }
9685
9687 {
9689 if (!is_being_placed)
9691 SetSynchDirty();
9692 }
9693
9694
9696
9698 {
9700 }
9701
9703 {
9705 }
9706
9708 {
9709 return 1;
9710 }
9711
9713 {
9714 return false;
9715 }
9716
9718 {
9720 SetSynchDirty();
9721 }
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9758 {
9759 super.OnMovedInsideCargo(container);
9760
9761 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9762 }
9763
9764 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9765 {
9766 super.EEItemLocationChanged(oldLoc, newLoc);
9767
9768 PlayerBase newPlayer = null;
9769 PlayerBase oldPlayer = null;
9770
9771 if (newLoc.GetParent())
9772 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9773
9774 if (oldLoc.GetParent())
9775 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9776
9778 {
9779 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9780
9781 if (rIndex >= 0)
9782 {
9783 InventoryLocation rIl = new InventoryLocation;
9784 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9785
9786 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9789 {
9790 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9791 }
9793 {
9795 }
9796
9797 }
9798 }
9799
9801 {
9802 if (newPlayer)
9803 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9804
9805 if (newPlayer == oldPlayer)
9806 {
9807 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9808 {
9810 {
9811 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9812 {
9813 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9814 }
9815 }
9816 else
9817 {
9818 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9819 }
9820 }
9821
9822 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9823 {
9824 int type = oldLoc.GetType();
9826 {
9827 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9828 }
9830 {
9831 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9832 }
9833 }
9834 if (!m_OldLocation)
9835 {
9836 m_OldLocation = new InventoryLocation;
9837 }
9838 m_OldLocation.Copy(oldLoc);
9839 }
9840 else
9841 {
9842 if (m_OldLocation)
9843 {
9844 m_OldLocation.Reset();
9845 }
9846 }
9847
9848 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9849 }
9850 else
9851 {
9852 if (newPlayer)
9853 {
9854 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9855 if (resIndex >= 0)
9856 {
9857 InventoryLocation il = new InventoryLocation;
9858 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9860 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9863 {
9864 il.
GetParent().GetOnReleaseLock().Invoke(it);
9865 }
9867 {
9869 }
9870
9871 }
9872 }
9874 {
9875
9877 }
9878
9879 if (m_OldLocation)
9880 {
9881 m_OldLocation.Reset();
9882 }
9883 }
9884
9886 {
9887 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9888 }
9889
9891 {
9892 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9893 }
9894 }
9895
9896 override void EOnContact(IEntity other, Contact extra)
9897 {
9899 {
9900 int liquidType = -1;
9902 if (impactSpeed > 0.0)
9903 {
9905 #ifndef SERVER
9907 #else
9909 SetSynchDirty();
9910 #endif
9912 }
9913 }
9914
9915 #ifdef SERVER
9916 if (GetCompEM() && GetCompEM().IsPlugged())
9917 {
9918 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9919 GetCompEM().UnplugThis();
9920 }
9921 #endif
9922 }
9923
9925
9927 {
9929 }
9930
9932 {
9933
9934 }
9935
9937 {
9938 super.OnItemLocationChanged(old_owner, new_owner);
9939
9940 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9941 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9942
9943 if (!relatedPlayer && playerNew)
9944 relatedPlayer = playerNew;
9945
9946 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9947 {
9949 if (actionMgr)
9950 {
9951 ActionBase currentAction = actionMgr.GetRunningAction();
9952 if (currentAction)
9954 }
9955 }
9956
9957 Man ownerPlayerOld = null;
9958 Man ownerPlayerNew = null;
9959
9960 if (old_owner)
9961 {
9962 if (old_owner.
IsMan())
9963 {
9964 ownerPlayerOld = Man.Cast(old_owner);
9965 }
9966 else
9967 {
9968 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9969 }
9970 }
9971 else
9972 {
9974 {
9976
9977 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9978 {
9979 GetCompEM().UnplugThis();
9980 }
9981 }
9982 }
9983
9984 if (new_owner)
9985 {
9986 if (new_owner.
IsMan())
9987 {
9988 ownerPlayerNew = Man.Cast(new_owner);
9989 }
9990 else
9991 {
9992 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9993 }
9994 }
9995
9996 if (ownerPlayerOld != ownerPlayerNew)
9997 {
9998 if (ownerPlayerOld)
9999 {
10000 array<EntityAI> subItemsExit = new array<EntityAI>;
10002 for (int i = 0; i < subItemsExit.Count(); i++)
10003 {
10006 }
10007 }
10008
10009 if (ownerPlayerNew)
10010 {
10011 array<EntityAI> subItemsEnter = new array<EntityAI>;
10013 for (int j = 0; j < subItemsEnter.Count(); j++)
10014 {
10017 }
10018 }
10019 }
10020 else if (ownerPlayerNew != null)
10021 {
10022 PlayerBase nplayer;
10023 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10024 {
10025 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10027 for (int k = 0; k < subItemsUpdate.Count(); k++)
10028 {
10030 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10031 }
10032 }
10033 }
10034
10035 if (old_owner)
10036 old_owner.OnChildItemRemoved(this);
10037 if (new_owner)
10038 new_owner.OnChildItemReceived(this);
10039 }
10040
10041
10043 {
10044 super.EEDelete(parent);
10045 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10046 if (player)
10047 {
10049
10050 if (player.IsAlive())
10051 {
10052 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10053 if (r_index >= 0)
10054 {
10055 InventoryLocation r_il = new InventoryLocation;
10056 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10057
10058 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10061 {
10062 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10063 }
10065 {
10066 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10067 }
10068
10069 }
10070
10071 player.RemoveQuickBarEntityShortcut(this);
10072 }
10073 }
10074 }
10075
10077 {
10078 super.EEKilled(killer);
10079
10082 {
10083 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10084 {
10085 if (IsMagazine())
10086 {
10087 if (Magazine.Cast(this).GetAmmoCount() > 0)
10088 {
10090 }
10091 }
10092 else
10093 {
10095 }
10096 }
10097 }
10098 }
10099
10101 {
10102 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10103
10104 super.OnWasAttached(parent, slot_id);
10105
10108
10111 }
10112
10114 {
10115 super.OnWasDetached(parent, slot_id);
10116
10119
10122 }
10123
10125 {
10126 int idx;
10129
10130 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10131 if (inventory_slots.Count() < 1)
10132 {
10133 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10134 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10135 }
10136 else
10137 {
10138 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10139 }
10140
10141 idx = inventory_slots.Find(slot);
10142 if (idx < 0)
10143 return "";
10144
10145 return attach_types.Get(idx);
10146 }
10147
10149 {
10150 int idx = -1;
10151 string slot;
10152
10155
10156 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10157 if (inventory_slots.Count() < 1)
10158 {
10159 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10160 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10161 }
10162 else
10163 {
10164 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10165 if (detach_types.Count() < 1)
10166 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10167 }
10168
10169 for (int i = 0; i < inventory_slots.Count(); i++)
10170 {
10171 slot = inventory_slots.Get(i);
10172 }
10173
10174 if (slot != "")
10175 {
10176 if (detach_types.Count() == 1)
10177 idx = 0;
10178 else
10179 idx = inventory_slots.Find(slot);
10180 }
10181 if (idx < 0)
10182 return "";
10183
10184 return detach_types.Get(idx);
10185 }
10186
10188 {
10189
10191
10192
10193 float min_time = 1;
10194 float max_time = 3;
10195 float delay = Math.RandomFloat(min_time, max_time);
10196
10197 explode_timer.Run(delay, this, "DoAmmoExplosion");
10198 }
10199
10201 {
10202 Magazine magazine = Magazine.Cast(this);
10203 int pop_sounds_count = 6;
10204 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10205
10206
10207 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10208 string sound_name = pop_sounds[ sound_idx ];
10209 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10210
10211
10212 magazine.ServerAddAmmoCount(-1);
10213
10214
10215 float min_temp_to_explode = 100;
10216
10217 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10218 {
10220 }
10221 }
10222
10223
10224 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10225 {
10226 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10227
10228 const int CHANCE_DAMAGE_CARGO = 4;
10229 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10230 const int CHANCE_DAMAGE_NOTHING = 2;
10231
10233 {
10234 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10235 int chances;
10236 int rnd;
10237
10238 if (GetInventory().GetCargo())
10239 {
10240 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10241 rnd = Math.RandomInt(0,chances);
10242
10243 if (rnd < CHANCE_DAMAGE_CARGO)
10244 {
10246 }
10247 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10248 {
10250 }
10251 }
10252 else
10253 {
10254 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10255 rnd = Math.RandomInt(0,chances);
10256
10257 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10258 {
10260 }
10261 }
10262 }
10263 }
10264
10266 {
10267 CargoBase cargo = GetInventory().GetCargo();
10268 if (cargo)
10269 {
10271 if (item_count > 0)
10272 {
10273 int random_pick = Math.RandomInt(0, item_count);
10275 if (!item.IsExplosive())
10276 {
10277 item.AddHealth("","",damage);
10278 return true;
10279 }
10280 }
10281 }
10282 return false;
10283 }
10284
10286 {
10287 GameInventory inventory = GetInventory();
10289 if (attachment_count > 0)
10290 {
10291 int random_pick = Math.RandomInt(0, attachment_count);
10293 if (!attachment.IsExplosive())
10294 {
10295 attachment.AddHealth("","",damage);
10296 return true;
10297 }
10298 }
10299 return false;
10300 }
10301
10303 {
10305 }
10306
10308 {
10310 return GetInventory().CanRemoveEntity();
10311
10312 return false;
10313 }
10314
10316 {
10317
10319 return false;
10320
10321
10323 return false;
10324
10325
10326
10328 if (delta == 0)
10329 return false;
10330
10331
10332 return true;
10333 }
10334
10336 {
10338 {
10339 if (ScriptInputUserData.CanStoreInputUserData())
10340 {
10341 ScriptInputUserData ctx = new ScriptInputUserData;
10346 ctx.
Write(destination_entity);
10348 ctx.
Write(slot_id);
10350 }
10351 }
10352 else if (!
g_Game.IsMultiplayer())
10353 {
10355 }
10356 }
10357
10359 {
10360 float split_quantity_new;
10364 InventoryLocation loc = new InventoryLocation;
10365
10366 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10367 {
10369 split_quantity_new = stack_max;
10370 else
10372
10374 {
10375 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10376 if (new_item)
10377 {
10378 new_item.SetResultOfSplit(true);
10379 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10381 new_item.
SetQuantity(split_quantity_new,
false,
true);
10382 }
10383 }
10384 }
10385 else if (destination_entity && slot_id == -1)
10386 {
10387 if (quantity > stack_max)
10388 split_quantity_new = stack_max;
10389 else
10390 split_quantity_new = quantity;
10391
10393 {
10394 GameInventory destinationInventory = destination_entity.GetInventory();
10396 {
10399 }
10400
10401 if (new_item)
10402 {
10403 new_item.SetResultOfSplit(true);
10404 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10406 new_item.
SetQuantity(split_quantity_new,
false,
true);
10407 }
10408 }
10409 }
10410 else
10411 {
10412 if (stack_max != 0)
10413 {
10415 {
10417 }
10418
10419 if (split_quantity_new == 0)
10420 {
10421 if (!
g_Game.IsMultiplayer())
10422 player.PhysicalPredictiveDropItem(this);
10423 else
10424 player.ServerDropEntity(this);
10425 return;
10426 }
10427
10429 {
10431
10432 if (new_item)
10433 {
10434 new_item.SetResultOfSplit(true);
10435 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10438 new_item.PlaceOnSurface();
10439 }
10440 }
10441 }
10442 }
10443 }
10444
10446 {
10447 float split_quantity_new;
10451 InventoryLocation loc = new InventoryLocation;
10452
10453 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10454 {
10456 split_quantity_new = stack_max;
10457 else
10459
10461 {
10462 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10463 if (new_item)
10464 {
10465 new_item.SetResultOfSplit(true);
10466 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10468 new_item.
SetQuantity(split_quantity_new,
false,
true);
10469 }
10470 }
10471 }
10472 else if (destination_entity && slot_id == -1)
10473 {
10474 if (quantity > stack_max)
10475 split_quantity_new = stack_max;
10476 else
10477 split_quantity_new = quantity;
10478
10480 {
10481 GameInventory destinationInventory = destination_entity.GetInventory();
10483 {
10486 }
10487
10488 if (new_item)
10489 {
10490 new_item.SetResultOfSplit(true);
10491 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10493 new_item.
SetQuantity(split_quantity_new,
false,
true);
10494 }
10495 }
10496 }
10497 else
10498 {
10499 if (stack_max != 0)
10500 {
10502 {
10504 }
10505
10507 {
10509
10510 if (new_item)
10511 {
10512 new_item.SetResultOfSplit(true);
10513 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10516 new_item.PlaceOnSurface();
10517 }
10518 }
10519 }
10520 }
10521 }
10522
10524 {
10526 {
10527 if (ScriptInputUserData.CanStoreInputUserData())
10528 {
10529 ScriptInputUserData ctx = new ScriptInputUserData;
10534 dst.WriteToContext(ctx);
10536 }
10537 }
10538 else if (!
g_Game.IsMultiplayer())
10539 {
10541 }
10542 }
10543
10545 {
10547 {
10548 if (ScriptInputUserData.CanStoreInputUserData())
10549 {
10550 ScriptInputUserData ctx = new ScriptInputUserData;
10555 ctx.
Write(destination_entity);
10561 }
10562 }
10563 else if (!
g_Game.IsMultiplayer())
10564 {
10566 }
10567 }
10568
10570 {
10572 }
10573
10575 {
10577 float split_quantity_new;
10579 if (dst.IsValid())
10580 {
10581 int slot_id = dst.GetSlot();
10583
10584 if (quantity > stack_max)
10585 split_quantity_new = stack_max;
10586 else
10587 split_quantity_new = quantity;
10588
10590 {
10592
10593 if (new_item)
10594 {
10595 new_item.SetResultOfSplit(true);
10596 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10598 new_item.
SetQuantity(split_quantity_new,
false,
true);
10599 }
10600
10601 return new_item;
10602 }
10603 }
10604
10605 return null;
10606 }
10607
10609 {
10611 float split_quantity_new;
10613 if (destination_entity)
10614 {
10616 if (quantity > stackable)
10617 split_quantity_new = stackable;
10618 else
10619 split_quantity_new = quantity;
10620
10622 {
10623 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10624 if (new_item)
10625 {
10626 new_item.SetResultOfSplit(true);
10627 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10629 new_item.
SetQuantity(split_quantity_new,
false,
true);
10630 }
10631 }
10632 }
10633 }
10634
10636 {
10638 {
10639 if (ScriptInputUserData.CanStoreInputUserData())
10640 {
10641 ScriptInputUserData ctx = new ScriptInputUserData;
10646 ItemBase destination_entity =
this;
10647 ctx.
Write(destination_entity);
10651 }
10652 }
10653 else if (!
g_Game.IsMultiplayer())
10654 {
10656 }
10657 }
10658
10660 {
10662 float split_quantity_new;
10664 if (player)
10665 {
10667 if (quantity > stackable)
10668 split_quantity_new = stackable;
10669 else
10670 split_quantity_new = quantity;
10671
10673 {
10674 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10675 new_item =
ItemBase.Cast(in_hands);
10676 if (new_item)
10677 {
10678 new_item.SetResultOfSplit(true);
10679 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10681 new_item.SetQuantity(split_quantity_new, false, true);
10682 }
10683 }
10684 }
10685 }
10686
10688 {
10690 float split_quantity_new = Math.Floor(quantity * 0.5);
10691
10693 return;
10694
10696
10697 if (new_item)
10698 {
10699 if (new_item.GetQuantityMax() < split_quantity_new)
10700 {
10701 split_quantity_new = new_item.GetQuantityMax();
10702 }
10703
10704 new_item.SetResultOfSplit(true);
10705 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10706
10708 {
10711 }
10712 else
10713 {
10715 new_item.
SetQuantity(split_quantity_new,
false,
true);
10716 }
10717 }
10718 }
10719
10721 {
10723 float split_quantity_new = Math.Floor(quantity / 2);
10724
10726 return;
10727
10728 InventoryLocation invloc = new InventoryLocation;
10730
10732 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10733
10734 if (new_item)
10735 {
10736 if (new_item.GetQuantityMax() < split_quantity_new)
10737 {
10738 split_quantity_new = new_item.GetQuantityMax();
10739 }
10741 {
10744 }
10745 else if (split_quantity_new > 1)
10746 {
10748 new_item.
SetQuantity(split_quantity_new,
false,
true);
10749 }
10750 }
10751 }
10752
10755 {
10756 SetWeightDirty();
10758
10759 if (parent)
10760 parent.OnAttachmentQuantityChangedEx(this, delta);
10761
10763 {
10765 {
10767 }
10769 {
10770 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10772 }
10773 }
10774 }
10775
10778 {
10779
10780 }
10781
10784 {
10786 }
10787
10789 {
10790 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10791
10793 {
10794 if (newLevel == GameConstants.STATE_RUINED)
10795 {
10797 EntityAI parent = GetHierarchyParent();
10798 if (parent && parent.IsFireplace())
10799 {
10800 CargoBase cargo = GetInventory().GetCargo();
10801 if (cargo)
10802 {
10804 {
10806 }
10807 }
10808 }
10809 }
10810
10812 {
10813
10815 return;
10816 }
10817
10818 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10819 {
10821 }
10822 }
10823 }
10824
10825
10827 {
10828 super.OnRightClick();
10829
10831 {
10833 {
10834 if (ScriptInputUserData.CanStoreInputUserData())
10835 {
10836 EntityAI root = GetHierarchyRoot();
10837 Man playerOwner = GetHierarchyRootPlayer();
10838 InventoryLocation dst = new InventoryLocation;
10839
10840
10841 if (!playerOwner && root && root == this)
10842 {
10844 }
10845 else
10846 {
10847
10848 GetInventory().GetCurrentInventoryLocation(dst);
10850 {
10851 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10853 {
10855 }
10856 else
10857 {
10859
10860
10861 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10862 {
10864 }
10865 else
10866 {
10867 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10868 }
10869 }
10870 }
10871 }
10872
10873 ScriptInputUserData ctx = new ScriptInputUserData;
10881 }
10882 }
10883 else if (!
g_Game.IsMultiplayer())
10884 {
10886 }
10887 }
10888 }
10889
10891 {
10892 if (root)
10893 {
10894 vector m4[4];
10895 root.GetTransform(m4);
10896 dst.SetGround(this, m4);
10897 }
10898 else
10899 {
10900 GetInventory().GetCurrentInventoryLocation(dst);
10901 }
10902 }
10903
10904 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10905 {
10906
10907 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10908 return false;
10909
10910 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10911 return false;
10912
10913
10915 return false;
10916
10917
10918 Magazine mag = Magazine.Cast(this);
10919 if (mag)
10920 {
10921 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10922 return false;
10923
10924 if (stack_max_limit)
10925 {
10926 Magazine other_mag = Magazine.Cast(other_item);
10927 if (other_item)
10928 {
10929 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10930 return false;
10931 }
10932
10933 }
10934 }
10935 else
10936 {
10937
10939 return false;
10940
10942 return false;
10943 }
10944
10945 PlayerBase player = null;
10946 if (CastTo(player, GetHierarchyRootPlayer()))
10947 {
10948 if (player.GetInventory().HasAttachment(this))
10949 return false;
10950
10951 if (player.IsItemsToDelete())
10952 return false;
10953 }
10954
10955 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10956 return false;
10957
10958 int slotID;
10960 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10961 return false;
10962
10963 return true;
10964 }
10965
10967 {
10969 }
10970
10972 {
10973 return m_IsResultOfSplit;
10974 }
10975
10977 {
10978 m_IsResultOfSplit = value;
10979 }
10980
10982 {
10984 }
10985
10987 {
10988 float other_item_quantity = other_item.GetQuantity();
10989 float this_free_space;
10990
10992
10994
10995 if (other_item_quantity > this_free_space)
10996 {
10997 return this_free_space;
10998 }
10999 else
11000 {
11001 return other_item_quantity;
11002 }
11003 }
11004
11006 {
11008 }
11009
11011 {
11013 return;
11014
11015 if (!IsMagazine() && other_item)
11016 {
11018 if (quantity_used != 0)
11019 {
11020 float hp1 = GetHealth01("","");
11021 float hp2 = other_item.GetHealth01("","");
11022 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11023 hpResult = hpResult / (
GetQuantity() + quantity_used);
11024
11025 hpResult *= GetMaxHealth();
11026 Math.Round(hpResult);
11027 SetHealth("", "Health", hpResult);
11028
11030 other_item.AddQuantity(-quantity_used);
11031 }
11032 }
11034 }
11035
11037 {
11038 #ifdef SERVER
11039 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11040 GetHierarchyParent().IncreaseLifetimeUp();
11041 #endif
11042 };
11043
11045 {
11046 PlayerBase p = PlayerBase.Cast(player);
11047
11048 array<int> recipesIds = p.m_Recipes;
11049 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11050 if (moduleRecipesManager)
11051 {
11052 EntityAI itemInHands = player.GetEntityInHands();
11053 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11054 }
11055
11056 for (int i = 0;i < recipesIds.Count(); i++)
11057 {
11058 int key = recipesIds.Get(i);
11059 string recipeName = moduleRecipesManager.GetRecipeName(key);
11061 }
11062 }
11063
11064
11065 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11066 {
11067 super.GetDebugActions(outputList);
11068
11069
11075
11076
11081
11086
11087
11091
11092
11094 {
11098 }
11099
11102
11103
11107
11109
11110 InventoryLocation loc = new InventoryLocation();
11111 GetInventory().GetCurrentInventoryLocation(loc);
11113 {
11114 if (Gizmo_IsSupported())
11117 }
11118
11120 }
11121
11122
11123
11124
11126 {
11127 super.OnAction(action_id, player, ctx);
11128
11130 {
11131 switch (action_id)
11132 {
11136 return true;
11140 return true;
11141 }
11142 }
11143
11145 {
11146 switch (action_id)
11147 {
11149 Delete();
11150 return true;
11151 }
11152 }
11153
11154 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11155 {
11156 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11157 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11158 PlayerBase p = PlayerBase.Cast(player);
11159 if (
EActions.RECIPES_RANGE_START < 1000)
11160 {
11161 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11162 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11163 }
11164 }
11165 #ifndef SERVER
11166 else if (action_id ==
EActions.WATCH_PLAYER)
11167 {
11168 PluginDeveloper.SetDeveloperItemClientEx(player);
11169 }
11170 #endif
11172 {
11173 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11174 {
11175 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11176 OnDebugButtonPressServer(id + 1);
11177 }
11178
11179 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11180 {
11181 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11183 }
11184
11185 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11186 {
11187 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11189 }
11190
11191 else if (action_id ==
EActions.ADD_QUANTITY)
11192 {
11193 if (IsMagazine())
11194 {
11195 Magazine mag = Magazine.Cast(this);
11196 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11197 }
11198 else
11199 {
11201 }
11202
11203 if (m_EM)
11204 {
11205 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11206 }
11207
11208 }
11209
11210 else if (action_id ==
EActions.REMOVE_QUANTITY)
11211 {
11212 if (IsMagazine())
11213 {
11214 Magazine mag2 = Magazine.Cast(this);
11215 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11216 }
11217 else
11218 {
11220 }
11221 if (m_EM)
11222 {
11223 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11224 }
11225
11226 }
11227
11228 else if (action_id ==
EActions.SET_QUANTITY_0)
11229 {
11231
11232 if (m_EM)
11233 {
11234 m_EM.SetEnergy(0);
11235 }
11236 }
11237
11238 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11239 {
11241
11242 if (m_EM)
11243 {
11244 m_EM.SetEnergy(m_EM.GetEnergyMax());
11245 }
11246 }
11247
11248 else if (action_id ==
EActions.ADD_HEALTH)
11249 {
11250 AddHealth("","",GetMaxHealth("","Health")/5);
11251 }
11252 else if (action_id ==
EActions.REMOVE_HEALTH)
11253 {
11254 AddHealth("","",-GetMaxHealth("","Health")/5);
11255 }
11256 else if (action_id ==
EActions.DESTROY_HEALTH)
11257 {
11258 SetHealth01("","",0);
11259 }
11260 else if (action_id ==
EActions.WATCH_ITEM)
11261 {
11263 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11264 #ifdef DEVELOPER
11265 SetDebugDeveloper_item(this);
11266 #endif
11267 }
11268
11269 else if (action_id ==
EActions.ADD_TEMPERATURE)
11270 {
11271 AddTemperature(20);
11272
11273 }
11274
11275 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11276 {
11277 AddTemperature(-20);
11278
11279 }
11280
11281 else if (action_id ==
EActions.FLIP_FROZEN)
11282 {
11283 SetFrozen(!GetIsFrozen());
11284
11285 }
11286
11287 else if (action_id ==
EActions.ADD_WETNESS)
11288 {
11290
11291 }
11292
11293 else if (action_id ==
EActions.REMOVE_WETNESS)
11294 {
11296
11297 }
11298
11299 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11300 {
11303
11304
11305 }
11306
11307 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11308 {
11311 }
11312
11313 else if (action_id ==
EActions.MAKE_SPECIAL)
11314 {
11315 auto debugParams = DebugSpawnParams.WithPlayer(player);
11316 OnDebugSpawnEx(debugParams);
11317 }
11318
11319 }
11320
11321
11322 return false;
11323 }
11324
11325
11326
11327
11331
11334
11335
11336
11338 {
11339 return false;
11340 }
11341
11342
11344 {
11345 return true;
11346 }
11347
11348
11350 {
11351 return true;
11352 }
11353
11354
11355
11357 {
11358 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11359 return g_Game.ConfigIsExisting(config_path);
11360 }
11361
11364 {
11365 return null;
11366 }
11367
11369 {
11370 return false;
11371 }
11372
11374 {
11375 return false;
11376 }
11377
11381
11382
11384 {
11385 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11386 return module_repairing.CanRepair(this, item_repair_kit);
11387 }
11388
11389
11390 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11391 {
11392 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11393 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11394 }
11395
11396
11398 {
11399
11400
11401
11402
11403
11404
11405
11406
11407 return 1;
11408 }
11409
11410
11411
11413 {
11415 }
11416
11417
11418
11420 {
11422 }
11423
11424
11433 {
11434 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11435
11436 if (player)
11437 {
11438 player.MessageStatus(text);
11439 }
11440 }
11441
11442
11451 {
11452 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11453
11454 if (player)
11455 {
11456 player.MessageAction(text);
11457 }
11458 }
11459
11460
11469 {
11470 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11471
11472 if (player)
11473 {
11474 player.MessageFriendly(text);
11475 }
11476 }
11477
11478
11487 {
11488 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11489
11490 if (player)
11491 {
11492 player.MessageImportant(text);
11493 }
11494 }
11495
11497 {
11498 return true;
11499 }
11500
11501
11502 override bool KindOf(
string tag)
11503 {
11504 bool found = false;
11505 string item_name = this.
GetType();
11507 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11508
11509 int array_size = item_tag_array.Count();
11510 for (int i = 0; i < array_size; i++)
11511 {
11512 if (item_tag_array.Get(i) == tag)
11513 {
11514 found = true;
11515 break;
11516 }
11517 }
11518 return found;
11519 }
11520
11521
11523 {
11524
11525 super.OnRPC(sender, rpc_type,ctx);
11526
11527
11528 switch (rpc_type)
11529 {
11530 #ifndef SERVER
11531 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11532 Param2<bool, string> p = new Param2<bool, string>(false, "");
11533
11535 return;
11536
11537 bool play = p.param1;
11538 string soundSet = p.param2;
11539
11540 if (play)
11541 {
11543 {
11545 {
11547 }
11548 }
11549 else
11550 {
11552 }
11553 }
11554 else
11555 {
11557 }
11558
11559 break;
11560 #endif
11561
11562 }
11563
11565 {
11567 }
11568 }
11569
11570
11571
11572
11574 {
11575 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11576 return plugin.GetID(
name);
11577 }
11578
11580 {
11581 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11582 return plugin.GetName(id);
11583 }
11584
11587 {
11588
11589
11590 int varFlags;
11591 if (!ctx.
Read(varFlags))
11592 return;
11593
11594 if (varFlags & ItemVariableFlags.FLOAT)
11595 {
11597 }
11598 }
11599
11601 {
11602
11603 super.SerializeNumericalVars(floats_out);
11604
11605
11606
11608 {
11610 }
11611
11613 {
11615 }
11616
11618 {
11620 }
11621
11623 {
11628 }
11629
11631 {
11633 }
11634 }
11635
11637 {
11638
11639 super.DeSerializeNumericalVars(floats);
11640
11641
11642 int index = 0;
11643 int mask = Math.Round(floats.Get(index));
11644
11645 index++;
11646
11648 {
11650 {
11652 }
11653 else
11654 {
11655 float quantity = floats.Get(index);
11656 SetQuantity(quantity,
true,
false,
false,
false);
11657 }
11658 index++;
11659 }
11660
11662 {
11663 float wet = floats.Get(index);
11665 index++;
11666 }
11667
11669 {
11670 int liquidtype = Math.Round(floats.Get(index));
11672 index++;
11673 }
11674
11676 {
11678 index++;
11680 index++;
11682 index++;
11684 index++;
11685 }
11686
11688 {
11689 int cleanness = Math.Round(floats.Get(index));
11691 index++;
11692 }
11693 }
11694
11696 {
11697 super.WriteVarsToCTX(ctx);
11698
11699
11701 {
11703 }
11704
11706 {
11708 }
11709
11711 {
11713 }
11714
11716 {
11717 int r,g,b,a;
11723 }
11724
11726 {
11728 }
11729 }
11730
11732 {
11733 if (!super.ReadVarsFromCTX(ctx,version))
11734 return false;
11735
11736 int intValue;
11737 float value;
11738
11739 if (version < 140)
11740 {
11741 if (!ctx.
Read(intValue))
11742 return false;
11743
11744 m_VariablesMask = intValue;
11745 }
11746
11748 {
11749 if (!ctx.
Read(value))
11750 return false;
11751
11753 {
11755 }
11756 else
11757 {
11759 }
11760 }
11761
11762 if (version < 140)
11763 {
11765 {
11766 if (!ctx.
Read(value))
11767 return false;
11768 SetTemperatureDirect(value);
11769 }
11770 }
11771
11773 {
11774 if (!ctx.
Read(value))
11775 return false;
11777 }
11778
11780 {
11781 if (!ctx.
Read(intValue))
11782 return false;
11784 }
11785
11787 {
11788 int r,g,b,a;
11790 return false;
11792 return false;
11794 return false;
11796 return false;
11797
11799 }
11800
11802 {
11803 if (!ctx.
Read(intValue))
11804 return false;
11806 }
11807
11808 if (version >= 138 && version < 140)
11809 {
11811 {
11812 if (!ctx.
Read(intValue))
11813 return false;
11814 SetFrozen(intValue);
11815 }
11816 }
11817
11818 return true;
11819 }
11820
11821
11823 {
11826 {
11828 }
11829
11830 if (!super.OnStoreLoad(ctx, version))
11831 {
11833 return false;
11834 }
11835
11836 if (version >= 114)
11837 {
11838 bool hasQuickBarIndexSaved;
11839
11840 if (!ctx.
Read(hasQuickBarIndexSaved))
11841 {
11843 return false;
11844 }
11845
11846 if (hasQuickBarIndexSaved)
11847 {
11848 int itmQBIndex;
11849
11850
11851 if (!ctx.
Read(itmQBIndex))
11852 {
11854 return false;
11855 }
11856
11857 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11858 if (itmQBIndex != -1 && parentPlayer)
11859 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11860 }
11861 }
11862 else
11863 {
11864
11865 PlayerBase player;
11866 int itemQBIndex;
11867 if (version ==
int.
MAX)
11868 {
11869 if (!ctx.
Read(itemQBIndex))
11870 {
11872 return false;
11873 }
11874 }
11875 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11876 {
11877
11878 if (!ctx.
Read(itemQBIndex))
11879 {
11881 return false;
11882 }
11883 if (itemQBIndex != -1 && player)
11884 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11885 }
11886 }
11887
11888 if (version < 140)
11889 {
11890
11891 if (!LoadVariables(ctx, version))
11892 {
11894 return false;
11895 }
11896 }
11897
11898
11900 {
11902 return false;
11903 }
11904 if (version >= 132)
11905 {
11907 if (raib)
11908 {
11910 {
11912 return false;
11913 }
11914 }
11915 }
11916
11918 return true;
11919 }
11920
11921
11922
11924 {
11925 super.OnStoreSave(ctx);
11926
11927 PlayerBase player;
11928 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11929 {
11931
11932 int itemQBIndex = -1;
11933 itemQBIndex = player.FindQuickBarEntityIndex(this);
11934 ctx.
Write(itemQBIndex);
11935 }
11936 else
11937 {
11939 }
11940
11942
11944 if (raib)
11945 {
11947 }
11948 }
11949
11950
11952 {
11953 super.AfterStoreLoad();
11954
11956 {
11958 }
11959
11961 {
11964 }
11965 }
11966
11968 {
11969 super.EEOnAfterLoad();
11970
11972 {
11974 }
11975
11978 }
11979
11981 {
11982 return false;
11983 }
11984
11985
11986
11988 {
11990 {
11991 #ifdef PLATFORM_CONSOLE
11992
11994 {
11996 if (menu)
11997 {
11999 }
12000 }
12001 #endif
12002 }
12003
12005 {
12008 }
12009
12011 {
12012 SetWeightDirty();
12014 }
12016 {
12019 }
12020
12022 {
12025
12028 }
12030 {
12034 }
12035
12036 super.OnVariablesSynchronized();
12037 }
12038
12039
12040
12042 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12043 {
12044 if (!IsServerCheck(allow_client))
12045 return false;
12046
12048 return false;
12049
12052
12053 if (value <= (min + 0.001))
12054 value = min;
12055
12056 if (value == min)
12057 {
12058 if (destroy_config)
12059 {
12060 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12061 if (dstr)
12062 {
12064 this.Delete();
12065 return true;
12066 }
12067 }
12068 else if (destroy_forced)
12069 {
12071 this.Delete();
12072 return true;
12073 }
12074
12076 }
12077
12080
12082 {
12083 EntityAI parent = GetHierarchyRoot();
12084 InventoryLocation iLoc = new InventoryLocation();
12085 GetInventory().GetCurrentInventoryLocation(iLoc);
12087 {
12088 int iLocSlot = iLoc.
GetSlot();
12090 {
12092 }
12094 {
12096 }
12097 }
12098 }
12099
12101 {
12103
12104 if (delta)
12106 }
12107
12109
12110 return false;
12111 }
12112
12113
12115 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12116 {
12118 }
12119
12121 {
12124 }
12125
12127 {
12130 }
12131
12133 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12134 {
12135 float value_clamped = Math.Clamp(value, 0, 1);
12137 SetQuantity(result, destroy_config, destroy_forced);
12138 }
12139
12140
12143 {
12145 }
12146
12148 {
12150 }
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12162 {
12163 int slot = -1;
12164 GameInventory inventory = GetInventory();
12165 if (inventory)
12166 {
12167 InventoryLocation il = new InventoryLocation;
12170 }
12171
12173 }
12174
12176 {
12177 float quantity_max = 0;
12178
12180 {
12181 if (attSlotID != -1)
12182 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12183
12184 if (quantity_max <= 0)
12186 }
12187
12188 if (quantity_max <= 0)
12190
12191 return quantity_max;
12192 }
12193
12195 {
12197 }
12198
12200 {
12202 }
12203
12204
12206 {
12208 }
12209
12211 {
12213 }
12214
12216 {
12218 }
12219
12220
12222 {
12223
12224 float weightEx = GetWeightEx();
12225 float special = GetInventoryAndCargoWeight();
12226 return weightEx - special;
12227 }
12228
12229
12231 {
12233 }
12234
12236 {
12238 {
12239 #ifdef DEVELOPER
12240 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12241 {
12242 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12244 }
12245 #endif
12246
12247 return GetQuantity() * GetConfigWeightModified();
12248 }
12249 else if (HasEnergyManager())
12250 {
12251 #ifdef DEVELOPER
12252 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12253 {
12254 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12255 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12256 }
12257 #endif
12258 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12259 }
12260 else
12261 {
12262 #ifdef DEVELOPER
12263 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12264 {
12265 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12266 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12267 }
12268 #endif
12269 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12270 }
12271 }
12272
12275 {
12276 int item_count = 0;
12278
12279 GameInventory inventory = GetInventory();
12280 CargoBase cargo = inventory.
GetCargo();
12281 if (cargo != NULL)
12282 {
12284 }
12285
12287 for (int i = 0; i < nAttachments; ++i)
12288 {
12290 if (item)
12291 item_count += item.GetNumberOfItems();
12292 }
12293 return item_count;
12294 }
12295
12298 {
12299 float weight = 0;
12300 float wetness = 1;
12301 if (include_wetness)
12304 {
12305 weight = wetness * m_ConfigWeight;
12306 }
12308 {
12309 weight = 1;
12310 }
12311 return weight;
12312 }
12313
12314
12315
12317 {
12318 GameInventory inventory = GetInventory();
12319 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12320 {
12321 array<EntityAI> items = new array<EntityAI>;
12323 for (int i = 0; i < items.Count(); ++i)
12324 {
12326 if (item)
12327 {
12328 g_Game.ObjectDelete(item);
12329 }
12330 }
12331 }
12332 }
12333
12334
12335
12336
12338 {
12339 float energy = 0;
12340 if (HasEnergyManager())
12341 {
12342 energy = GetCompEM().GetEnergy();
12343 }
12344 return energy;
12345 }
12346
12347
12349 {
12350 super.OnEnergyConsumed();
12351
12353 }
12354
12356 {
12357 super.OnEnergyAdded();
12358
12360 }
12361
12362
12364 {
12365 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12366 {
12368 {
12369 float energy_0to1 = GetCompEM().GetEnergy0To1();
12371 }
12372 }
12373 }
12374
12375
12377 {
12378 return ConfigGetFloat("heatIsolation");
12379 }
12380
12382 {
12384 }
12385
12387 {
12388 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12389 if (
g_Game.ConfigIsExisting(paramPath))
12390 return g_Game.ConfigGetFloat(paramPath);
12391
12392 return 0.0;
12393 }
12394
12396 {
12397 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12398 if (
g_Game.ConfigIsExisting(paramPath))
12399 return g_Game.ConfigGetFloat(paramPath);
12400
12401 return 0.0;
12402 }
12403
12404 override void SetWet(
float value,
bool allow_client =
false)
12405 {
12406 if (!IsServerCheck(allow_client))
12407 return;
12408
12411
12413
12414 m_VarWet = Math.Clamp(value, min, max);
12415
12417 {
12420 }
12421 }
12422
12423 override void AddWet(
float value)
12424 {
12426 }
12427
12429 {
12431 }
12432
12434 {
12436 }
12437
12439 {
12441 }
12442
12444 {
12446 }
12447
12449 {
12451 }
12452
12453 override void OnWetChanged(
float newVal,
float oldVal)
12454 {
12457 if (newLevel != oldLevel)
12458 {
12460 }
12461 }
12462
12464 {
12465 SetWeightDirty();
12466 }
12467
12469 {
12470 return GetWetLevelInternal(
m_VarWet);
12471 }
12472
12473
12474
12476 {
12478 }
12479
12481 {
12483 }
12484
12486 {
12488 }
12489
12491 {
12493 }
12494
12495
12496
12498 {
12499 if (ConfigIsExisting("itemModelLength"))
12500 {
12501 return ConfigGetFloat("itemModelLength");
12502 }
12503 return 0;
12504 }
12505
12507 {
12508 if (ConfigIsExisting("itemAttachOffset"))
12509 {
12510 return ConfigGetFloat("itemAttachOffset");
12511 }
12512 return 0;
12513 }
12514
12515 override void SetCleanness(
int value,
bool allow_client =
false)
12516 {
12517 if (!IsServerCheck(allow_client))
12518 return;
12519
12521
12523
12526 }
12527
12529 {
12531 }
12532
12534 {
12535 return true;
12536 }
12537
12538
12539
12540
12542 {
12544 }
12545
12547 {
12549 }
12550
12551
12552
12553
12554 override void SetColor(
int r,
int g,
int b,
int a)
12555 {
12561 }
12563 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12564 {
12569 }
12570
12572 {
12574 }
12575
12578 {
12579 int r,g,b,a;
12581 r = r/255;
12582 g = g/255;
12583 b = b/255;
12584 a = a/255;
12585 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12586 }
12587
12588
12589
12590 override void SetLiquidType(
int value,
bool allow_client =
false)
12591 {
12592 if (!IsServerCheck(allow_client))
12593 return;
12594
12599 }
12600
12602 {
12603 return ConfigGetInt("varLiquidTypeInit");
12604 }
12605
12607 {
12609 }
12610
12612 {
12614 SetFrozen(false);
12615 }
12616
12619 {
12620 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12621 }
12622
12623
12626 {
12627 PlayerBase nplayer;
12628 if (PlayerBase.CastTo(nplayer, player))
12629 {
12631 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12632 }
12633 }
12634
12635
12638 {
12639 PlayerBase nplayer;
12640 if (PlayerBase.CastTo(nplayer,player))
12641 {
12642 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12643 }
12644
12645 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12646
12647 if (HasEnergyManager())
12648 {
12649 GetCompEM().UpdatePlugState();
12650 }
12651 }
12652
12653
12655 {
12656 super.OnPlacementStarted(player);
12657
12659 }
12660
12661 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12662 {
12664 {
12665 m_AdminLog.OnPlacementComplete(player,
this);
12666 }
12667
12668 super.OnPlacementComplete(player, position, orientation);
12669 }
12670
12671
12672
12673
12674
12676 {
12678 {
12679 return true;
12680 }
12681 else
12682 {
12683 return false;
12684 }
12685 }
12686
12687
12689 {
12691 {
12693 }
12694 }
12695
12696
12698 {
12700 }
12701
12703 {
12705 }
12706
12707 override void InsertAgent(
int agent,
float count = 1)
12708 {
12709 if (count < 1)
12710 return;
12711
12713 }
12714
12717 {
12719 }
12720
12721
12723 {
12725 }
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12769 {
12771 return false;
12772 return true;
12773 }
12774
12776 {
12777
12779 }
12780
12781
12784 {
12785 super.CheckForRoofLimited(timeTresholdMS);
12786
12787 float time =
g_Game.GetTime();
12788 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12789 {
12790 m_PreviousRoofTestTime = time;
12791 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12792 }
12793 }
12794
12795
12797 {
12799 {
12800 return 0;
12801 }
12802
12803 if (GetInventory().GetAttachmentSlotsCount() != 0)
12804 {
12805 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12806 if (filter)
12807 return filter.GetProtectionLevel(type, false, system);
12808 else
12809 return 0;
12810 }
12811
12812 string subclassPath, entryName;
12813
12814 switch (type)
12815 {
12817 entryName = "biological";
12818 break;
12820 entryName = "chemical";
12821 break;
12822 default:
12823 entryName = "biological";
12824 break;
12825 }
12826
12827 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12828
12829 return g_Game.ConfigGetFloat(subclassPath + entryName);
12830 }
12831
12832
12833
12836 {
12837 if (!IsMagazine())
12839
12841 }
12842
12843
12844
12845
12846
12851 {
12852 return true;
12853 }
12854
12856 {
12858 }
12859
12860
12861
12862
12863
12865 {
12866 if (parent)
12867 {
12868 if (parent.IsInherited(DayZInfected))
12869 return true;
12870
12871 if (!parent.IsRuined())
12872 return true;
12873 }
12874
12875 return true;
12876 }
12877
12879 {
12880 if (!super.CanPutAsAttachment(parent))
12881 {
12882 return false;
12883 }
12884
12885 if (!IsRuined() && !parent.IsRuined())
12886 {
12887 return true;
12888 }
12889
12890 return false;
12891 }
12892
12894 {
12895
12896
12897
12898
12899 return super.CanReceiveItemIntoCargo(item);
12900 }
12901
12903 {
12904
12905
12906
12907
12908 GameInventory attachmentInv = attachment.GetInventory();
12910 {
12911 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12912 return false;
12913 }
12914
12915 InventoryLocation loc = new InventoryLocation();
12916 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12917 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12918 return false;
12919
12920 return super.CanReceiveAttachment(attachment, slotId);
12921 }
12922
12924 {
12925 if (!super.CanReleaseAttachment(attachment))
12926 return false;
12927
12928 return GetInventory().AreChildrenAccessible();
12929 }
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
12945
12946
12947
12948
12949
12950
12952 {
12953 int id = muzzle_owner.GetMuzzleID();
12954 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12955
12956 if (WPOF_array)
12957 {
12958 for (int i = 0; i < WPOF_array.Count(); i++)
12959 {
12960 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12961
12962 if (WPOF)
12963 {
12964 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12965 }
12966 }
12967 }
12968 }
12969
12970
12972 {
12973 int id = muzzle_owner.GetMuzzleID();
12975
12976 if (WPOBE_array)
12977 {
12978 for (int i = 0; i < WPOBE_array.Count(); i++)
12979 {
12980 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12981
12982 if (WPOBE)
12983 {
12984 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12985 }
12986 }
12987 }
12988 }
12989
12990
12992 {
12993 int id = muzzle_owner.GetMuzzleID();
12994 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12995
12996 if (WPOOH_array)
12997 {
12998 for (int i = 0; i < WPOOH_array.Count(); i++)
12999 {
13000 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13001
13002 if (WPOOH)
13003 {
13004 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13005 }
13006 }
13007 }
13008 }
13009
13010
13012 {
13013 int id = muzzle_owner.GetMuzzleID();
13014 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13015
13016 if (WPOOH_array)
13017 {
13018 for (int i = 0; i < WPOOH_array.Count(); i++)
13019 {
13020 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13021
13022 if (WPOOH)
13023 {
13024 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13025 }
13026 }
13027 }
13028 }
13029
13030
13032 {
13033 int id = muzzle_owner.GetMuzzleID();
13034 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13035
13036 if (WPOOH_array)
13037 {
13038 for (int i = 0; i < WPOOH_array.Count(); i++)
13039 {
13040 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13041
13042 if (WPOOH)
13043 {
13044 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13045 }
13046 }
13047 }
13048 }
13049
13050
13051
13053 {
13055 {
13056 return true;
13057 }
13058
13059 return false;
13060 }
13061
13063 {
13065 {
13066 return true;
13067 }
13068
13069 return false;
13070 }
13071
13073 {
13075 {
13076 return true;
13077 }
13078
13079 return false;
13080 }
13081
13083 {
13084 return false;
13085 }
13086
13089 {
13090 return UATimeSpent.DEFAULT_DEPLOY;
13091 }
13092
13093
13094
13095
13097 {
13099 SetSynchDirty();
13100 }
13101
13103 {
13105 }
13106
13107
13109 {
13110 return false;
13111 }
13112
13115 {
13116 string att_type = "None";
13117
13118 if (ConfigIsExisting("soundAttType"))
13119 {
13120 att_type = ConfigGetString("soundAttType");
13121 }
13122
13124 }
13125
13127 {
13129 }
13130
13131
13132
13133
13134
13140
13142 {
13145
13147 }
13148
13149
13151 {
13153 return;
13154
13156
13159
13162
13163 SoundParameters params = new SoundParameters();
13167 }
13168
13169
13171 {
13173 {
13176
13177 SetSynchDirty();
13178
13181 }
13182 }
13183
13185 {
13187 }
13188
13189
13191 {
13193 return;
13194
13196 SetSynchDirty();
13197
13200 }
13201
13203 {
13206 }
13207
13209 {
13211 }
13212
13213 void OnApply(PlayerBase player);
13214
13216 {
13217 return 1.0;
13218 };
13219
13221 {
13223 }
13224
13226 {
13228 }
13229
13231
13233 {
13234 SetDynamicPhysicsLifeTime(0.01);
13236 }
13237
13239 {
13240 array<string> zone_names = new array<string>;
13241 GetDamageZones(zone_names);
13242 for (int i = 0; i < zone_names.Count(); i++)
13243 {
13244 SetHealthMax(zone_names.Get(i),"Health");
13245 }
13246 SetHealthMax("","Health");
13247 }
13248
13251 {
13252 float global_health = GetHealth01("","Health");
13253 array<string> zones = new array<string>;
13254 GetDamageZones(zones);
13255
13256 for (int i = 0; i < zones.Count(); i++)
13257 {
13258 SetHealth01(zones.Get(i),"Health",global_health);
13259 }
13260 }
13261
13264 {
13265 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13266 }
13267
13269 {
13270 if (!hasRootAsPlayer)
13271 {
13272 if (refParentIB)
13273 {
13274
13275 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13276 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13277
13278 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13279 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13280
13283 }
13284 else
13285 {
13286
13289 }
13290 }
13291 }
13292
13294 {
13296 {
13297 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13298 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13299 {
13300 float heatPermCoef = 1.0;
13302 while (ent)
13303 {
13304 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13305 ent = ent.GetHierarchyParent();
13306 }
13307
13308 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13309 }
13310 }
13311 }
13312
13314 {
13315
13316 EntityAI parent = GetHierarchyParent();
13317 if (!parent)
13318 {
13319 hasParent = false;
13320 hasRootAsPlayer = false;
13321 }
13322 else
13323 {
13324 hasParent = true;
13325 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13326 refParentIB =
ItemBase.Cast(parent);
13327 }
13328 }
13329
13330 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13331 {
13332
13333 }
13334
13336 {
13337
13338 return false;
13339 }
13340
13342 {
13343
13344
13345 return false;
13346 }
13347
13349 {
13350
13351 return false;
13352 }
13353
13356 {
13357 return !GetIsFrozen() &&
IsOpen();
13358 }
13359
13361 {
13362 bool hasParent = false, hasRootAsPlayer = false;
13364
13365 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13366 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13367
13368 if (wwtu || foodDecay)
13369 {
13373
13374 if (processWetness || processTemperature || processDecay)
13375 {
13377
13378 if (processWetness)
13379 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13380
13381 if (processTemperature)
13383
13384 if (processDecay)
13385 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13386 }
13387 }
13388 }
13389
13392 {
13394 }
13395
13397 {
13400
13401 return super.GetTemperatureFreezeThreshold();
13402 }
13403
13405 {
13408
13409 return super.GetTemperatureThawThreshold();
13410 }
13411
13413 {
13416
13417 return super.GetItemOverheatThreshold();
13418 }
13419
13421 {
13423 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13424
13425 return super.GetTemperatureFreezeTime();
13426 }
13427
13429 {
13431 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13432
13433 return super.GetTemperatureThawTime();
13434 }
13435
13440
13442 {
13443 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13444 }
13445
13447 {
13448 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13449 }
13450
13453 {
13455 }
13456
13458 {
13460 }
13461
13463 {
13465 }
13466
13469 {
13470 return null;
13471 }
13472
13475 {
13476 return false;
13477 }
13478
13480 {
13482 {
13485 if (!trg)
13486 {
13488 explosive = this;
13489 }
13490
13491 explosive.PairRemote(trg);
13493
13494 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13495 trg.SetPersistentPairID(persistentID);
13496 explosive.SetPersistentPairID(persistentID);
13497
13498 return true;
13499 }
13500 return false;
13501 }
13502
13505 {
13506 float ret = 1.0;
13509 ret *= GetHealth01();
13510
13511 return ret;
13512 }
13513
13514 #ifdef DEVELOPER
13515 override void SetDebugItem()
13516 {
13517 super.SetDebugItem();
13518 _itemBase = this;
13519 }
13520
13522 {
13523 string text = super.GetDebugText();
13524
13526 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13527
13528 return text;
13529 }
13530 #endif
13531
13533 {
13534 return true;
13535 }
13536
13538
13540
13542 {
13545 }
13546
13547
13555
13571
13572 [
Obsolete(
"Use ItemSoundHandler instead")]
13575 {
13576 if (!
g_Game.IsDedicatedServer())
13577 {
13578 if (ConfigIsExisting("attachSoundSet"))
13579 {
13580 string cfg_path = "";
13581 string soundset = "";
13582 string type_name =
GetType();
13583
13586 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13587 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13588
13589 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13590 {
13591 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13592 {
13593 if (cfg_slot_array[i] == slot_type)
13594 {
13595 soundset = cfg_soundset_array[i];
13596 break;
13597 }
13598 }
13599 }
13600
13601 if (soundset != "")
13602 {
13603 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13605 }
13606 }
13607 }
13608 }
13609
13611}
13612
13614{
13616 if (entity)
13617 {
13618 bool is_item = entity.IsInherited(
ItemBase);
13619 if (is_item && full_quantity)
13620 {
13623 }
13624 }
13625 else
13626 {
13628 return NULL;
13629 }
13630 return entity;
13631}
13632
13634{
13635 if (item)
13636 {
13637 if (health > 0)
13638 item.SetHealth("", "", health);
13639
13640 if (item.CanHaveTemperature())
13641 {
13643 if (item.CanFreeze())
13644 item.SetFrozen(false);
13645 }
13646
13647 if (item.HasEnergyManager())
13648 {
13649 if (quantity >= 0)
13650 {
13651 item.GetCompEM().SetEnergy0To1(quantity);
13652 }
13653 else
13654 {
13656 }
13657 }
13658 else if (item.IsMagazine())
13659 {
13660 Magazine mag = Magazine.Cast(item);
13661 if (quantity >= 0)
13662 {
13663 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13664 }
13665 else
13666 {
13668 }
13669
13670 }
13671 else
13672 {
13673 if (quantity >= 0)
13674 {
13675 item.SetQuantityNormalized(quantity, false);
13676 }
13677 else
13678 {
13680 }
13681
13682 }
13683 }
13684}
13685
13686#ifdef DEVELOPER
13688#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.