8646{
8648 {
8649 return true;
8650 }
8651};
8652
8654{
8655
8656};
8657
8658
8659
8661{
8665
8667
8670
8671
8672
8673
8674
8683
8689
8694
8699
8720 protected bool m_IsResultOfSplit
8721
8723
8728
8729
8730
8732
8736
8737
8738
8740
8743
8744
8745
8751
8752
8760
8763
8764
8766
8767
8769
8770
8775
8776
8781
8783
8784
8786
8787
8789 {
8794
8795 if (!
g_Game.IsDedicatedServer())
8796 {
8798 {
8800
8802 {
8804 }
8805 }
8806
8809 }
8810
8811 m_OldLocation = null;
8812
8814 {
8816 }
8817
8818 if (ConfigIsExisting("headSelectionsToHide"))
8819 {
8822 }
8823
8825 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8826 {
8828 }
8829
8831
8832 m_IsResultOfSplit = false;
8833
8835 }
8836
8838 {
8839 super.InitItemVariables();
8840
8846 m_Count = ConfigGetInt(
"count");
8847
8850
8855
8858
8863
8875
8879
8880
8883 if (ConfigIsExisting("canBeSplit"))
8884 {
8887 }
8888
8890 if (ConfigIsExisting("itemBehaviour"))
8892
8893
8896 RegisterNetSyncVariableInt("m_VarLiquidType");
8897 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8898
8899 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8900 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8901 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8902
8903 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8904 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8905 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8906 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8907
8908 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8909 RegisterNetSyncVariableBool("m_IsTakeable");
8910 RegisterNetSyncVariableBool("m_IsHologram");
8911
8914 {
8917 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8918 }
8919
8921
8923 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8925
8927 }
8928
8930 {
8932 }
8933
8935 {
8938 {
8943 }
8944 }
8945
8946 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8947 {
8949 {
8952 }
8953
8955 }
8956
8958 {
8964 }
8965
8967
8969 {
8971
8972 if (!action)
8973 {
8974 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8975 return;
8976 }
8977
8979 if (!ai)
8980 {
8982 return;
8983 }
8984
8986 if (!action_array)
8987 {
8988 action_array = new array<ActionBase_Basic>;
8990 }
8991 if (LogManager.IsActionLogEnable())
8992 {
8993 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8994 }
8995
8996 if (action_array.Find(action) != -1)
8997 {
8998 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8999 }
9000 else
9001 {
9002 action_array.Insert(action);
9003 }
9004 }
9005
9007 {
9008 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9009 ActionBase action = player.GetActionManager().GetAction(actionName);
9012
9013 if (action_array)
9014 {
9015 action_array.RemoveItem(action);
9016 }
9017 }
9018
9019
9020
9022 {
9023 ActionOverrideData overrideData = new ActionOverrideData();
9027
9029 if (!actionMap)
9030 {
9033 }
9034
9035 actionMap.Insert(this.
Type(), overrideData);
9036
9037 }
9038
9040
9042
9043
9045 {
9048
9051
9052 string config_to_search = "CfgVehicles";
9053 string muzzle_owner_config;
9054
9056 {
9057 if (IsInherited(Weapon))
9058 config_to_search = "CfgWeapons";
9059
9060 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9061
9062 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9063
9064 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9065
9066 if (config_OnFire_subclass_count > 0)
9067 {
9068 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9069
9070 for (int i = 0; i < config_OnFire_subclass_count; i++)
9071 {
9072 string particle_class = "";
9073 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9074 string config_OnFire_entry = config_OnFire_class + particle_class;
9075 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9076 WPOF_array.Insert(WPOF);
9077 }
9078
9079
9081 }
9082 }
9083
9085 {
9086 config_to_search = "CfgWeapons";
9087 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9088
9089 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9090
9091 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9092
9093 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9094 {
9095 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9096
9097 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9098 {
9099 string particle_class2 = "";
9100 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9101 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9102 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9103 WPOBE_array.Insert(WPOBE);
9104 }
9105
9106
9108 }
9109 }
9110 }
9111
9112
9114 {
9117
9119 {
9120 string config_to_search = "CfgVehicles";
9121
9122 if (IsInherited(Weapon))
9123 config_to_search = "CfgWeapons";
9124
9125 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9126 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9127
9128 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9129 {
9130
9132
9134 {
9136 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9138 return;
9139 }
9140
9143
9144
9145
9146 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9147 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9148
9149 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9150 {
9151 string particle_class = "";
9152 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9153 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9154 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9155
9156 if (entry_type == CT_CLASS)
9157 {
9158 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9159 WPOOH_array.Insert(WPOF);
9160 }
9161 }
9162
9163
9165 }
9166 }
9167 }
9168
9170 {
9172 }
9173
9175 {
9177 {
9179
9182
9185
9186 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9187 }
9188 }
9189
9191 {
9193 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9194
9196 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9197
9199 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9200
9202 {
9204 }
9205 }
9206
9208 {
9210 }
9211
9213 {
9216 else
9218
9220 {
9223 }
9224 else
9225 {
9228
9231 }
9232
9234 }
9235
9237 {
9239 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9240 }
9241
9243 {
9245 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9247 }
9248
9250 {
9252 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9253 }
9254
9256 {
9259
9260 OverheatingParticle OP = new OverheatingParticle();
9265
9267 }
9268
9270 {
9273
9274 return -1;
9275 }
9276
9278 {
9280 {
9283
9284 for (int i = count; i > 0; --i)
9285 {
9286 int id = i - 1;
9289
9292
9293 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9294 {
9295 if (p)
9296 {
9299 }
9300 }
9301 }
9302 }
9303 }
9304
9306 {
9308 {
9310 {
9311 int id = i - 1;
9313
9314 if (OP)
9315 {
9317
9318 if (p)
9319 {
9321 }
9322
9323 delete OP;
9324 }
9325 }
9326
9329 }
9330 }
9331
9334 {
9335 return 0.0;
9336 }
9337
9338
9340 {
9341 return 250;
9342 }
9343
9345 {
9346 return 0;
9347 }
9348
9351 {
9353 return true;
9354
9355 return false;
9356 }
9357
9360 {
9363
9365 {
9367 }
9368 else
9369 {
9370
9372 }
9373
9375 }
9376
9383 {
9384 return -1;
9385 }
9386
9387
9388
9389
9391 {
9393 {
9394 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9395 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9396
9397 if (r_index >= 0)
9398 {
9399 InventoryLocation r_il = new InventoryLocation;
9400 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9401
9402 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9405 {
9406 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9407 }
9409 {
9410 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9411 }
9412
9413 }
9414
9415 player.GetHumanInventory().ClearUserReservedLocation(this);
9416 }
9417
9420 }
9421
9422
9423
9424
9426 {
9427 return ItemBase.m_DebugActionsMask;
9428 }
9429
9431 {
9432 return ItemBase.m_DebugActionsMask & mask;
9433 }
9434
9436 {
9437 ItemBase.m_DebugActionsMask = mask;
9438 }
9439
9441 {
9442 ItemBase.m_DebugActionsMask |= mask;
9443 }
9444
9446 {
9447 ItemBase.m_DebugActionsMask &= ~mask;
9448 }
9449
9451 {
9453 {
9455 }
9456 else
9457 {
9459 }
9460 }
9461
9462
9464 {
9465 if (GetEconomyProfile())
9466 {
9467 float q_max = GetEconomyProfile().GetQuantityMax();
9468 if (q_max > 0)
9469 {
9470 float q_min = GetEconomyProfile().GetQuantityMin();
9471 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9472
9474 {
9475 ComponentEnergyManager comp = GetCompEM();
9477 {
9479 }
9480 }
9482 {
9484
9485 }
9486
9487 }
9488 }
9489 }
9490
9493 {
9494 EntityAI parent = GetHierarchyParent();
9495
9496 if (parent)
9497 {
9498 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9499 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9500 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9501 }
9502 }
9503
9506 {
9507 EntityAI parent = GetHierarchyParent();
9508
9509 if (parent)
9510 {
9511 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9512 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9513 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9514 }
9515 }
9516
9518 {
9519
9520
9521
9522
9524
9526 {
9527 if (ScriptInputUserData.CanStoreInputUserData())
9528 {
9529 ScriptInputUserData ctx = new ScriptInputUserData;
9535 ctx.
Write(use_stack_max);
9538
9540 {
9541 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9542 }
9543 }
9544 }
9545 else if (!
g_Game.IsMultiplayer())
9546 {
9548 }
9549 }
9550
9552 {
9554 }
9555
9557 {
9559 }
9560
9562 {
9564 }
9565
9567 {
9568
9569 return false;
9570 }
9571
9573 {
9574 return false;
9575 }
9576
9580 {
9581 return false;
9582 }
9583
9585 {
9586 return "";
9587 }
9588
9590
9592 {
9593 return false;
9594 }
9595
9597 {
9598 return true;
9599 }
9600
9601
9602
9604 {
9605 return true;
9606 }
9607
9609 {
9610 return true;
9611 }
9612
9614 {
9615 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9617 }
9618
9620 {
9622 }
9623
9625 {
9627 if (!is_being_placed)
9629 SetSynchDirty();
9630 }
9631
9632
9634
9636 {
9638 }
9639
9641 {
9643 }
9644
9646 {
9647 return 1;
9648 }
9649
9651 {
9652 return false;
9653 }
9654
9656 {
9658 SetSynchDirty();
9659 }
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9696 {
9697 super.OnMovedInsideCargo(container);
9698
9699 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9700 }
9701
9702 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9703 {
9704 super.EEItemLocationChanged(oldLoc, newLoc);
9705
9706 PlayerBase newPlayer = null;
9707 PlayerBase oldPlayer = null;
9708
9709 if (newLoc.GetParent())
9710 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9711
9712 if (oldLoc.GetParent())
9713 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9714
9716 {
9717 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9718
9719 if (rIndex >= 0)
9720 {
9721 InventoryLocation rIl = new InventoryLocation;
9722 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9723
9724 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9727 {
9728 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9729 }
9731 {
9733 }
9734
9735 }
9736 }
9737
9739 {
9740 if (newPlayer)
9741 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9742
9743 if (newPlayer == oldPlayer)
9744 {
9745 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9746 {
9748 {
9749 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9750 {
9751 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9752 }
9753 }
9754 else
9755 {
9756 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9757 }
9758 }
9759
9760 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9761 {
9762 int type = oldLoc.GetType();
9764 {
9765 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9766 }
9768 {
9769 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9770 }
9771 }
9772 if (!m_OldLocation)
9773 {
9774 m_OldLocation = new InventoryLocation;
9775 }
9776 m_OldLocation.Copy(oldLoc);
9777 }
9778 else
9779 {
9780 if (m_OldLocation)
9781 {
9782 m_OldLocation.Reset();
9783 }
9784 }
9785
9786 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9787 }
9788 else
9789 {
9790 if (newPlayer)
9791 {
9792 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9793 if (resIndex >= 0)
9794 {
9795 InventoryLocation il = new InventoryLocation;
9796 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9798 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9801 {
9802 il.
GetParent().GetOnReleaseLock().Invoke(it);
9803 }
9805 {
9807 }
9808
9809 }
9810 }
9812 {
9813
9815 }
9816
9817 if (m_OldLocation)
9818 {
9819 m_OldLocation.Reset();
9820 }
9821 }
9822
9824 {
9825 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9826 }
9827
9829 {
9830 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9831 }
9832 }
9833
9834 override void EOnContact(IEntity other, Contact extra)
9835 {
9837 {
9838 int liquidType = -1;
9840 if (impactSpeed > 0.0)
9841 {
9843 #ifndef SERVER
9845 #else
9847 SetSynchDirty();
9848 #endif
9850 }
9851 }
9852
9853 #ifdef SERVER
9854 if (GetCompEM() && GetCompEM().IsPlugged())
9855 {
9856 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9857 GetCompEM().UnplugThis();
9858 }
9859 #endif
9860 }
9861
9863
9865 {
9867 }
9868
9870 {
9871
9872 }
9873
9875 {
9876 super.OnItemLocationChanged(old_owner, new_owner);
9877
9878 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9879 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9880
9881 if (!relatedPlayer && playerNew)
9882 relatedPlayer = playerNew;
9883
9884 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9885 {
9887 if (actionMgr)
9888 {
9889 ActionBase currentAction = actionMgr.GetRunningAction();
9890 if (currentAction)
9892 }
9893 }
9894
9895 Man ownerPlayerOld = null;
9896 Man ownerPlayerNew = null;
9897
9898 if (old_owner)
9899 {
9900 if (old_owner.
IsMan())
9901 {
9902 ownerPlayerOld = Man.Cast(old_owner);
9903 }
9904 else
9905 {
9906 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9907 }
9908 }
9909 else
9910 {
9912 {
9914
9915 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9916 {
9917 GetCompEM().UnplugThis();
9918 }
9919 }
9920 }
9921
9922 if (new_owner)
9923 {
9924 if (new_owner.
IsMan())
9925 {
9926 ownerPlayerNew = Man.Cast(new_owner);
9927 }
9928 else
9929 {
9930 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9931 }
9932 }
9933
9934 if (ownerPlayerOld != ownerPlayerNew)
9935 {
9936 if (ownerPlayerOld)
9937 {
9938 array<EntityAI> subItemsExit = new array<EntityAI>;
9940 for (int i = 0; i < subItemsExit.Count(); i++)
9941 {
9944 }
9945 }
9946
9947 if (ownerPlayerNew)
9948 {
9949 array<EntityAI> subItemsEnter = new array<EntityAI>;
9951 for (int j = 0; j < subItemsEnter.Count(); j++)
9952 {
9955 }
9956 }
9957 }
9958 else if (ownerPlayerNew != null)
9959 {
9960 PlayerBase nplayer;
9961 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9962 {
9963 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9965 for (int k = 0; k < subItemsUpdate.Count(); k++)
9966 {
9968 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9969 }
9970 }
9971 }
9972
9973 if (old_owner)
9974 old_owner.OnChildItemRemoved(this);
9975 if (new_owner)
9976 new_owner.OnChildItemReceived(this);
9977 }
9978
9979
9981 {
9982 super.EEDelete(parent);
9983 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9984 if (player)
9985 {
9987
9988 if (player.IsAlive())
9989 {
9990 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9991 if (r_index >= 0)
9992 {
9993 InventoryLocation r_il = new InventoryLocation;
9994 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9995
9996 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9999 {
10000 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10001 }
10003 {
10004 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10005 }
10006
10007 }
10008
10009 player.RemoveQuickBarEntityShortcut(this);
10010 }
10011 }
10012 }
10013
10015 {
10016 super.EEKilled(killer);
10017
10020 {
10021 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10022 {
10023 if (IsMagazine())
10024 {
10025 if (Magazine.Cast(this).GetAmmoCount() > 0)
10026 {
10028 }
10029 }
10030 else
10031 {
10033 }
10034 }
10035 }
10036 }
10037
10039 {
10040 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10041
10042 super.OnWasAttached(parent, slot_id);
10043
10046
10049 }
10050
10052 {
10053 super.OnWasDetached(parent, slot_id);
10054
10057
10060 }
10061
10063 {
10064 int idx;
10067
10068 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10069 if (inventory_slots.Count() < 1)
10070 {
10071 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10072 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10073 }
10074 else
10075 {
10076 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10077 }
10078
10079 idx = inventory_slots.Find(slot);
10080 if (idx < 0)
10081 return "";
10082
10083 return attach_types.Get(idx);
10084 }
10085
10087 {
10088 int idx = -1;
10089 string slot;
10090
10093
10094 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10095 if (inventory_slots.Count() < 1)
10096 {
10097 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10098 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10099 }
10100 else
10101 {
10102 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10103 if (detach_types.Count() < 1)
10104 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10105 }
10106
10107 for (int i = 0; i < inventory_slots.Count(); i++)
10108 {
10109 slot = inventory_slots.Get(i);
10110 }
10111
10112 if (slot != "")
10113 {
10114 if (detach_types.Count() == 1)
10115 idx = 0;
10116 else
10117 idx = inventory_slots.Find(slot);
10118 }
10119 if (idx < 0)
10120 return "";
10121
10122 return detach_types.Get(idx);
10123 }
10124
10126 {
10127
10129
10130
10131 float min_time = 1;
10132 float max_time = 3;
10133 float delay = Math.RandomFloat(min_time, max_time);
10134
10135 explode_timer.Run(delay, this, "DoAmmoExplosion");
10136 }
10137
10139 {
10140 Magazine magazine = Magazine.Cast(this);
10141 int pop_sounds_count = 6;
10142 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10143
10144
10145 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10146 string sound_name = pop_sounds[ sound_idx ];
10147 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10148
10149
10150 magazine.ServerAddAmmoCount(-1);
10151
10152
10153 float min_temp_to_explode = 100;
10154
10155 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10156 {
10158 }
10159 }
10160
10161
10162 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10163 {
10164 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10165
10166 const int CHANCE_DAMAGE_CARGO = 4;
10167 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10168 const int CHANCE_DAMAGE_NOTHING = 2;
10169
10171 {
10172 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10173 int chances;
10174 int rnd;
10175
10176 if (GetInventory().GetCargo())
10177 {
10178 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10179 rnd = Math.RandomInt(0,chances);
10180
10181 if (rnd < CHANCE_DAMAGE_CARGO)
10182 {
10184 }
10185 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10186 {
10188 }
10189 }
10190 else
10191 {
10192 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10193 rnd = Math.RandomInt(0,chances);
10194
10195 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10196 {
10198 }
10199 }
10200 }
10201 }
10202
10204 {
10205 CargoBase cargo = GetInventory().GetCargo();
10206 if (cargo)
10207 {
10209 if (item_count > 0)
10210 {
10211 int random_pick = Math.RandomInt(0, item_count);
10213 if (!item.IsExplosive())
10214 {
10215 item.AddHealth("","",damage);
10216 return true;
10217 }
10218 }
10219 }
10220 return false;
10221 }
10222
10224 {
10225 GameInventory inventory = GetInventory();
10227 if (attachment_count > 0)
10228 {
10229 int random_pick = Math.RandomInt(0, attachment_count);
10231 if (!attachment.IsExplosive())
10232 {
10233 attachment.AddHealth("","",damage);
10234 return true;
10235 }
10236 }
10237 return false;
10238 }
10239
10241 {
10243 }
10244
10246 {
10248 return GetInventory().CanRemoveEntity();
10249
10250 return false;
10251 }
10252
10254 {
10255
10257 return false;
10258
10259
10261 return false;
10262
10263
10264
10266 if (delta == 0)
10267 return false;
10268
10269
10270 return true;
10271 }
10272
10274 {
10276 {
10277 if (ScriptInputUserData.CanStoreInputUserData())
10278 {
10279 ScriptInputUserData ctx = new ScriptInputUserData;
10284 ctx.
Write(destination_entity);
10286 ctx.
Write(slot_id);
10288 }
10289 }
10290 else if (!
g_Game.IsMultiplayer())
10291 {
10293 }
10294 }
10295
10297 {
10298 float split_quantity_new;
10302 InventoryLocation loc = new InventoryLocation;
10303
10304 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10305 {
10307 split_quantity_new = stack_max;
10308 else
10310
10312 {
10313 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10314 if (new_item)
10315 {
10316 new_item.SetResultOfSplit(true);
10317 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10319 new_item.
SetQuantity(split_quantity_new,
false,
true);
10320 }
10321 }
10322 }
10323 else if (destination_entity && slot_id == -1)
10324 {
10325 if (quantity > stack_max)
10326 split_quantity_new = stack_max;
10327 else
10328 split_quantity_new = quantity;
10329
10331 {
10332 GameInventory destinationInventory = destination_entity.GetInventory();
10334 {
10337 }
10338
10339 if (new_item)
10340 {
10341 new_item.SetResultOfSplit(true);
10342 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10344 new_item.
SetQuantity(split_quantity_new,
false,
true);
10345 }
10346 }
10347 }
10348 else
10349 {
10350 if (stack_max != 0)
10351 {
10353 {
10355 }
10356
10357 if (split_quantity_new == 0)
10358 {
10359 if (!
g_Game.IsMultiplayer())
10360 player.PhysicalPredictiveDropItem(this);
10361 else
10362 player.ServerDropEntity(this);
10363 return;
10364 }
10365
10367 {
10369
10370 if (new_item)
10371 {
10372 new_item.SetResultOfSplit(true);
10373 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10376 new_item.PlaceOnSurface();
10377 }
10378 }
10379 }
10380 }
10381 }
10382
10384 {
10385 float split_quantity_new;
10389 InventoryLocation loc = new InventoryLocation;
10390
10391 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10392 {
10394 split_quantity_new = stack_max;
10395 else
10397
10399 {
10400 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
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 if (destination_entity && slot_id == -1)
10411 {
10412 if (quantity > stack_max)
10413 split_quantity_new = stack_max;
10414 else
10415 split_quantity_new = quantity;
10416
10418 {
10419 GameInventory destinationInventory = destination_entity.GetInventory();
10421 {
10424 }
10425
10426 if (new_item)
10427 {
10428 new_item.SetResultOfSplit(true);
10429 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10431 new_item.
SetQuantity(split_quantity_new,
false,
true);
10432 }
10433 }
10434 }
10435 else
10436 {
10437 if (stack_max != 0)
10438 {
10440 {
10442 }
10443
10445 {
10447
10448 if (new_item)
10449 {
10450 new_item.SetResultOfSplit(true);
10451 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10454 new_item.PlaceOnSurface();
10455 }
10456 }
10457 }
10458 }
10459 }
10460
10462 {
10464 {
10465 if (ScriptInputUserData.CanStoreInputUserData())
10466 {
10467 ScriptInputUserData ctx = new ScriptInputUserData;
10472 dst.WriteToContext(ctx);
10474 }
10475 }
10476 else if (!
g_Game.IsMultiplayer())
10477 {
10479 }
10480 }
10481
10483 {
10485 {
10486 if (ScriptInputUserData.CanStoreInputUserData())
10487 {
10488 ScriptInputUserData ctx = new ScriptInputUserData;
10493 ctx.
Write(destination_entity);
10499 }
10500 }
10501 else if (!
g_Game.IsMultiplayer())
10502 {
10504 }
10505 }
10506
10508 {
10510 }
10511
10513 {
10515 float split_quantity_new;
10517 if (dst.IsValid())
10518 {
10519 int slot_id = dst.GetSlot();
10521
10522 if (quantity > stack_max)
10523 split_quantity_new = stack_max;
10524 else
10525 split_quantity_new = quantity;
10526
10528 {
10530
10531 if (new_item)
10532 {
10533 new_item.SetResultOfSplit(true);
10534 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10536 new_item.
SetQuantity(split_quantity_new,
false,
true);
10537 }
10538
10539 return new_item;
10540 }
10541 }
10542
10543 return null;
10544 }
10545
10547 {
10549 float split_quantity_new;
10551 if (destination_entity)
10552 {
10554 if (quantity > stackable)
10555 split_quantity_new = stackable;
10556 else
10557 split_quantity_new = quantity;
10558
10560 {
10561 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10562 if (new_item)
10563 {
10564 new_item.SetResultOfSplit(true);
10565 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10567 new_item.
SetQuantity(split_quantity_new,
false,
true);
10568 }
10569 }
10570 }
10571 }
10572
10574 {
10576 {
10577 if (ScriptInputUserData.CanStoreInputUserData())
10578 {
10579 ScriptInputUserData ctx = new ScriptInputUserData;
10584 ItemBase destination_entity =
this;
10585 ctx.
Write(destination_entity);
10589 }
10590 }
10591 else if (!
g_Game.IsMultiplayer())
10592 {
10594 }
10595 }
10596
10598 {
10600 float split_quantity_new;
10602 if (player)
10603 {
10605 if (quantity > stackable)
10606 split_quantity_new = stackable;
10607 else
10608 split_quantity_new = quantity;
10609
10611 {
10612 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10613 new_item =
ItemBase.Cast(in_hands);
10614 if (new_item)
10615 {
10616 new_item.SetResultOfSplit(true);
10617 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10619 new_item.SetQuantity(split_quantity_new, false, true);
10620 }
10621 }
10622 }
10623 }
10624
10626 {
10628 float split_quantity_new = Math.Floor(quantity * 0.5);
10629
10631 return;
10632
10634
10635 if (new_item)
10636 {
10637 if (new_item.GetQuantityMax() < split_quantity_new)
10638 {
10639 split_quantity_new = new_item.GetQuantityMax();
10640 }
10641
10642 new_item.SetResultOfSplit(true);
10643 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10644
10646 {
10649 }
10650 else
10651 {
10653 new_item.
SetQuantity(split_quantity_new,
false,
true);
10654 }
10655 }
10656 }
10657
10659 {
10661 float split_quantity_new = Math.Floor(quantity / 2);
10662
10664 return;
10665
10666 InventoryLocation invloc = new InventoryLocation;
10668
10670 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10671
10672 if (new_item)
10673 {
10674 if (new_item.GetQuantityMax() < split_quantity_new)
10675 {
10676 split_quantity_new = new_item.GetQuantityMax();
10677 }
10679 {
10682 }
10683 else if (split_quantity_new > 1)
10684 {
10686 new_item.
SetQuantity(split_quantity_new,
false,
true);
10687 }
10688 }
10689 }
10690
10693 {
10694 SetWeightDirty();
10696
10697 if (parent)
10698 parent.OnAttachmentQuantityChangedEx(this, delta);
10699
10701 {
10703 {
10705 }
10707 {
10708 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10710 }
10711 }
10712 }
10713
10716 {
10717
10718 }
10719
10722 {
10724 }
10725
10727 {
10728 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10729
10731 {
10732 if (newLevel == GameConstants.STATE_RUINED)
10733 {
10735 EntityAI parent = GetHierarchyParent();
10736 if (parent && parent.IsFireplace())
10737 {
10738 CargoBase cargo = GetInventory().GetCargo();
10739 if (cargo)
10740 {
10742 {
10744 }
10745 }
10746 }
10747 }
10748
10750 {
10751
10753 return;
10754 }
10755
10756 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10757 {
10759 }
10760 }
10761 }
10762
10763
10765 {
10766 super.OnRightClick();
10767
10769 {
10771 {
10772 if (ScriptInputUserData.CanStoreInputUserData())
10773 {
10774 EntityAI root = GetHierarchyRoot();
10775 Man playerOwner = GetHierarchyRootPlayer();
10776 InventoryLocation dst = new InventoryLocation;
10777
10778
10779 if (!playerOwner && root && root == this)
10780 {
10782 }
10783 else
10784 {
10785
10786 GetInventory().GetCurrentInventoryLocation(dst);
10788 {
10789 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10791 {
10793 }
10794 else
10795 {
10797
10798
10799 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10800 {
10802 }
10803 else
10804 {
10805 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10806 }
10807 }
10808 }
10809 }
10810
10811 ScriptInputUserData ctx = new ScriptInputUserData;
10819 }
10820 }
10821 else if (!
g_Game.IsMultiplayer())
10822 {
10824 }
10825 }
10826 }
10827
10829 {
10830 if (root)
10831 {
10832 vector m4[4];
10833 root.GetTransform(m4);
10834 dst.SetGround(this, m4);
10835 }
10836 else
10837 {
10838 GetInventory().GetCurrentInventoryLocation(dst);
10839 }
10840 }
10841
10842 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10843 {
10844
10845 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10846 return false;
10847
10848 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10849 return false;
10850
10851
10853 return false;
10854
10855
10856 Magazine mag = Magazine.Cast(this);
10857 if (mag)
10858 {
10859 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10860 return false;
10861
10862 if (stack_max_limit)
10863 {
10864 Magazine other_mag = Magazine.Cast(other_item);
10865 if (other_item)
10866 {
10867 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10868 return false;
10869 }
10870
10871 }
10872 }
10873 else
10874 {
10875
10877 return false;
10878
10880 return false;
10881 }
10882
10883 PlayerBase player = null;
10884 if (CastTo(player, GetHierarchyRootPlayer()))
10885 {
10886 if (player.GetInventory().HasAttachment(this))
10887 return false;
10888
10889 if (player.IsItemsToDelete())
10890 return false;
10891 }
10892
10893 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10894 return false;
10895
10896 int slotID;
10898 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10899 return false;
10900
10901 return true;
10902 }
10903
10905 {
10907 }
10908
10910 {
10911 return m_IsResultOfSplit;
10912 }
10913
10915 {
10916 m_IsResultOfSplit = value;
10917 }
10918
10920 {
10922 }
10923
10925 {
10926 float other_item_quantity = other_item.GetQuantity();
10927 float this_free_space;
10928
10930
10932
10933 if (other_item_quantity > this_free_space)
10934 {
10935 return this_free_space;
10936 }
10937 else
10938 {
10939 return other_item_quantity;
10940 }
10941 }
10942
10944 {
10946 }
10947
10949 {
10951 return;
10952
10953 if (!IsMagazine() && other_item)
10954 {
10956 if (quantity_used != 0)
10957 {
10958 float hp1 = GetHealth01("","");
10959 float hp2 = other_item.GetHealth01("","");
10960 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10961 hpResult = hpResult / (
GetQuantity() + quantity_used);
10962
10963 hpResult *= GetMaxHealth();
10964 Math.Round(hpResult);
10965 SetHealth("", "Health", hpResult);
10966
10968 other_item.AddQuantity(-quantity_used);
10969 }
10970 }
10972 }
10973
10975 {
10976 #ifdef SERVER
10977 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10978 GetHierarchyParent().IncreaseLifetimeUp();
10979 #endif
10980 };
10981
10983 {
10984 PlayerBase p = PlayerBase.Cast(player);
10985
10986 array<int> recipesIds = p.m_Recipes;
10987 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10988 if (moduleRecipesManager)
10989 {
10990 EntityAI itemInHands = player.GetEntityInHands();
10991 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10992 }
10993
10994 for (int i = 0;i < recipesIds.Count(); i++)
10995 {
10996 int key = recipesIds.Get(i);
10997 string recipeName = moduleRecipesManager.GetRecipeName(key);
10999 }
11000 }
11001
11002
11003 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11004 {
11005 super.GetDebugActions(outputList);
11006
11007
11013
11014
11019
11024
11025
11029
11030
11032 {
11036 }
11037
11040
11041
11045
11047
11048 InventoryLocation loc = new InventoryLocation();
11049 GetInventory().GetCurrentInventoryLocation(loc);
11051 {
11052 if (Gizmo_IsSupported())
11055 }
11056
11058 }
11059
11060
11061
11062
11064 {
11065 super.OnAction(action_id, player, ctx);
11066
11068 {
11069 switch (action_id)
11070 {
11074 return true;
11078 return true;
11079 }
11080 }
11081
11083 {
11084 switch (action_id)
11085 {
11087 Delete();
11088 return true;
11089 }
11090 }
11091
11092 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11093 {
11094 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11095 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11096 PlayerBase p = PlayerBase.Cast(player);
11097 if (
EActions.RECIPES_RANGE_START < 1000)
11098 {
11099 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11100 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11101 }
11102 }
11103 #ifndef SERVER
11104 else if (action_id ==
EActions.WATCH_PLAYER)
11105 {
11106 PluginDeveloper.SetDeveloperItemClientEx(player);
11107 }
11108 #endif
11110 {
11111 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11112 {
11113 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11114 OnDebugButtonPressServer(id + 1);
11115 }
11116
11117 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11118 {
11119 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11121 }
11122
11123 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11124 {
11125 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11127 }
11128
11129 else if (action_id ==
EActions.ADD_QUANTITY)
11130 {
11131 if (IsMagazine())
11132 {
11133 Magazine mag = Magazine.Cast(this);
11134 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11135 }
11136 else
11137 {
11139 }
11140
11141 if (m_EM)
11142 {
11143 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11144 }
11145
11146 }
11147
11148 else if (action_id ==
EActions.REMOVE_QUANTITY)
11149 {
11150 if (IsMagazine())
11151 {
11152 Magazine mag2 = Magazine.Cast(this);
11153 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11154 }
11155 else
11156 {
11158 }
11159 if (m_EM)
11160 {
11161 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11162 }
11163
11164 }
11165
11166 else if (action_id ==
EActions.SET_QUANTITY_0)
11167 {
11169
11170 if (m_EM)
11171 {
11172 m_EM.SetEnergy(0);
11173 }
11174 }
11175
11176 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11177 {
11179
11180 if (m_EM)
11181 {
11182 m_EM.SetEnergy(m_EM.GetEnergyMax());
11183 }
11184 }
11185
11186 else if (action_id ==
EActions.ADD_HEALTH)
11187 {
11188 AddHealth("","",GetMaxHealth("","Health")/5);
11189 }
11190 else if (action_id ==
EActions.REMOVE_HEALTH)
11191 {
11192 AddHealth("","",-GetMaxHealth("","Health")/5);
11193 }
11194 else if (action_id ==
EActions.DESTROY_HEALTH)
11195 {
11196 SetHealth01("","",0);
11197 }
11198 else if (action_id ==
EActions.WATCH_ITEM)
11199 {
11201 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11202 #ifdef DEVELOPER
11203 SetDebugDeveloper_item(this);
11204 #endif
11205 }
11206
11207 else if (action_id ==
EActions.ADD_TEMPERATURE)
11208 {
11209 AddTemperature(20);
11210
11211 }
11212
11213 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11214 {
11215 AddTemperature(-20);
11216
11217 }
11218
11219 else if (action_id ==
EActions.FLIP_FROZEN)
11220 {
11221 SetFrozen(!GetIsFrozen());
11222
11223 }
11224
11225 else if (action_id ==
EActions.ADD_WETNESS)
11226 {
11228
11229 }
11230
11231 else if (action_id ==
EActions.REMOVE_WETNESS)
11232 {
11234
11235 }
11236
11237 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11238 {
11241
11242
11243 }
11244
11245 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11246 {
11249 }
11250
11251 else if (action_id ==
EActions.MAKE_SPECIAL)
11252 {
11253 auto debugParams = DebugSpawnParams.WithPlayer(player);
11254 OnDebugSpawnEx(debugParams);
11255 }
11256
11257 }
11258
11259
11260 return false;
11261 }
11262
11263
11264
11265
11269
11272
11273
11274
11276 {
11277 return false;
11278 }
11279
11280
11282 {
11283 return true;
11284 }
11285
11286
11288 {
11289 return true;
11290 }
11291
11292
11293
11295 {
11296 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11297 return g_Game.ConfigIsExisting(config_path);
11298 }
11299
11302 {
11303 return null;
11304 }
11305
11307 {
11308 return false;
11309 }
11310
11312 {
11313 return false;
11314 }
11315
11319
11320
11322 {
11323 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11324 return module_repairing.CanRepair(this, item_repair_kit);
11325 }
11326
11327
11328 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11329 {
11330 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11331 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11332 }
11333
11334
11336 {
11337
11338
11339
11340
11341
11342
11343
11344
11345 return 1;
11346 }
11347
11348
11349
11351 {
11353 }
11354
11355
11356
11358 {
11360 }
11361
11362
11371 {
11372 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11373
11374 if (player)
11375 {
11376 player.MessageStatus(text);
11377 }
11378 }
11379
11380
11389 {
11390 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11391
11392 if (player)
11393 {
11394 player.MessageAction(text);
11395 }
11396 }
11397
11398
11407 {
11408 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11409
11410 if (player)
11411 {
11412 player.MessageFriendly(text);
11413 }
11414 }
11415
11416
11425 {
11426 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11427
11428 if (player)
11429 {
11430 player.MessageImportant(text);
11431 }
11432 }
11433
11435 {
11436 return true;
11437 }
11438
11439
11440 override bool KindOf(
string tag)
11441 {
11442 bool found = false;
11443 string item_name = this.
GetType();
11445 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11446
11447 int array_size = item_tag_array.Count();
11448 for (int i = 0; i < array_size; i++)
11449 {
11450 if (item_tag_array.Get(i) == tag)
11451 {
11452 found = true;
11453 break;
11454 }
11455 }
11456 return found;
11457 }
11458
11459
11461 {
11462
11463 super.OnRPC(sender, rpc_type,ctx);
11464
11465
11466 switch (rpc_type)
11467 {
11468 #ifndef SERVER
11469 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11470 Param2<bool, string> p = new Param2<bool, string>(false, "");
11471
11473 return;
11474
11475 bool play = p.param1;
11476 string soundSet = p.param2;
11477
11478 if (play)
11479 {
11481 {
11483 {
11485 }
11486 }
11487 else
11488 {
11490 }
11491 }
11492 else
11493 {
11495 }
11496
11497 break;
11498 #endif
11499
11500 }
11501
11503 {
11505 }
11506 }
11507
11508
11509
11510
11512 {
11513 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11514 return plugin.GetID(
name);
11515 }
11516
11518 {
11519 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11520 return plugin.GetName(id);
11521 }
11522
11525 {
11526
11527
11528 int varFlags;
11529 if (!ctx.
Read(varFlags))
11530 return;
11531
11532 if (varFlags & ItemVariableFlags.FLOAT)
11533 {
11535 }
11536 }
11537
11539 {
11540
11541 super.SerializeNumericalVars(floats_out);
11542
11543
11544
11546 {
11548 }
11549
11551 {
11553 }
11554
11556 {
11558 }
11559
11561 {
11566 }
11567
11569 {
11571 }
11572 }
11573
11575 {
11576
11577 super.DeSerializeNumericalVars(floats);
11578
11579
11580 int index = 0;
11581 int mask = Math.Round(floats.Get(index));
11582
11583 index++;
11584
11586 {
11588 {
11590 }
11591 else
11592 {
11593 float quantity = floats.Get(index);
11594 SetQuantity(quantity,
true,
false,
false,
false);
11595 }
11596 index++;
11597 }
11598
11600 {
11601 float wet = floats.Get(index);
11603 index++;
11604 }
11605
11607 {
11608 int liquidtype = Math.Round(floats.Get(index));
11610 index++;
11611 }
11612
11614 {
11616 index++;
11618 index++;
11620 index++;
11622 index++;
11623 }
11624
11626 {
11627 int cleanness = Math.Round(floats.Get(index));
11629 index++;
11630 }
11631 }
11632
11634 {
11635 super.WriteVarsToCTX(ctx);
11636
11637
11639 {
11641 }
11642
11644 {
11646 }
11647
11649 {
11651 }
11652
11654 {
11655 int r,g,b,a;
11661 }
11662
11664 {
11666 }
11667 }
11668
11670 {
11671 if (!super.ReadVarsFromCTX(ctx,version))
11672 return false;
11673
11674 int intValue;
11675 float value;
11676
11677 if (version < 140)
11678 {
11679 if (!ctx.
Read(intValue))
11680 return false;
11681
11682 m_VariablesMask = intValue;
11683 }
11684
11686 {
11687 if (!ctx.
Read(value))
11688 return false;
11689
11691 {
11693 }
11694 else
11695 {
11697 }
11698 }
11699
11700 if (version < 140)
11701 {
11703 {
11704 if (!ctx.
Read(value))
11705 return false;
11706 SetTemperatureDirect(value);
11707 }
11708 }
11709
11711 {
11712 if (!ctx.
Read(value))
11713 return false;
11715 }
11716
11718 {
11719 if (!ctx.
Read(intValue))
11720 return false;
11722 }
11723
11725 {
11726 int r,g,b,a;
11728 return false;
11730 return false;
11732 return false;
11734 return false;
11735
11737 }
11738
11740 {
11741 if (!ctx.
Read(intValue))
11742 return false;
11744 }
11745
11746 if (version >= 138 && version < 140)
11747 {
11749 {
11750 if (!ctx.
Read(intValue))
11751 return false;
11752 SetFrozen(intValue);
11753 }
11754 }
11755
11756 return true;
11757 }
11758
11759
11761 {
11764 {
11766 }
11767
11768 if (!super.OnStoreLoad(ctx, version))
11769 {
11771 return false;
11772 }
11773
11774 if (version >= 114)
11775 {
11776 bool hasQuickBarIndexSaved;
11777
11778 if (!ctx.
Read(hasQuickBarIndexSaved))
11779 {
11781 return false;
11782 }
11783
11784 if (hasQuickBarIndexSaved)
11785 {
11786 int itmQBIndex;
11787
11788
11789 if (!ctx.
Read(itmQBIndex))
11790 {
11792 return false;
11793 }
11794
11795 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11796 if (itmQBIndex != -1 && parentPlayer)
11797 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11798 }
11799 }
11800 else
11801 {
11802
11803 PlayerBase player;
11804 int itemQBIndex;
11805 if (version ==
int.
MAX)
11806 {
11807 if (!ctx.
Read(itemQBIndex))
11808 {
11810 return false;
11811 }
11812 }
11813 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11814 {
11815
11816 if (!ctx.
Read(itemQBIndex))
11817 {
11819 return false;
11820 }
11821 if (itemQBIndex != -1 && player)
11822 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11823 }
11824 }
11825
11826 if (version < 140)
11827 {
11828
11829 if (!LoadVariables(ctx, version))
11830 {
11832 return false;
11833 }
11834 }
11835
11836
11838 {
11840 return false;
11841 }
11842 if (version >= 132)
11843 {
11845 if (raib)
11846 {
11848 {
11850 return false;
11851 }
11852 }
11853 }
11854
11856 return true;
11857 }
11858
11859
11860
11862 {
11863 super.OnStoreSave(ctx);
11864
11865 PlayerBase player;
11866 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11867 {
11869
11870 int itemQBIndex = -1;
11871 itemQBIndex = player.FindQuickBarEntityIndex(this);
11872 ctx.
Write(itemQBIndex);
11873 }
11874 else
11875 {
11877 }
11878
11880
11882 if (raib)
11883 {
11885 }
11886 }
11887
11888
11890 {
11891 super.AfterStoreLoad();
11892
11894 {
11896 }
11897
11899 {
11902 }
11903 }
11904
11906 {
11907 super.EEOnAfterLoad();
11908
11910 {
11912 }
11913
11916 }
11917
11919 {
11920 return false;
11921 }
11922
11923
11924
11926 {
11928 {
11929 #ifdef PLATFORM_CONSOLE
11930
11932 {
11934 if (menu)
11935 {
11937 }
11938 }
11939 #endif
11940 }
11941
11943 {
11946 }
11947
11949 {
11950 SetWeightDirty();
11952 }
11954 {
11957 }
11958
11960 {
11963
11966 }
11968 {
11972 }
11973
11974 super.OnVariablesSynchronized();
11975 }
11976
11977
11978
11980 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11981 {
11982 if (!IsServerCheck(allow_client))
11983 return false;
11984
11986 return false;
11987
11990
11991 if (value <= (min + 0.001))
11992 value = min;
11993
11994 if (value == min)
11995 {
11996 if (destroy_config)
11997 {
11998 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11999 if (dstr)
12000 {
12002 this.Delete();
12003 return true;
12004 }
12005 }
12006 else if (destroy_forced)
12007 {
12009 this.Delete();
12010 return true;
12011 }
12012
12014 }
12015
12018
12020 {
12021 EntityAI parent = GetHierarchyRoot();
12022 InventoryLocation iLoc = new InventoryLocation();
12023 GetInventory().GetCurrentInventoryLocation(iLoc);
12025 {
12026 int iLocSlot = iLoc.
GetSlot();
12028 {
12030 }
12032 {
12034 }
12035 }
12036 }
12037
12039 {
12041
12042 if (delta)
12044 }
12045
12047
12048 return false;
12049 }
12050
12051
12053 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12054 {
12056 }
12057
12059 {
12062 }
12063
12065 {
12068 }
12069
12071 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12072 {
12073 float value_clamped = Math.Clamp(value, 0, 1);
12075 SetQuantity(result, destroy_config, destroy_forced);
12076 }
12077
12078
12081 {
12083 }
12084
12086 {
12088 }
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12100 {
12101 int slot = -1;
12102 GameInventory inventory = GetInventory();
12103 if (inventory)
12104 {
12105 InventoryLocation il = new InventoryLocation;
12108 }
12109
12111 }
12112
12114 {
12115 float quantity_max = 0;
12116
12118 {
12119 if (attSlotID != -1)
12120 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12121
12122 if (quantity_max <= 0)
12124 }
12125
12126 if (quantity_max <= 0)
12128
12129 return quantity_max;
12130 }
12131
12133 {
12135 }
12136
12138 {
12140 }
12141
12142
12144 {
12146 }
12147
12149 {
12151 }
12152
12154 {
12156 }
12157
12158
12160 {
12161
12162 float weightEx = GetWeightEx();
12163 float special = GetInventoryAndCargoWeight();
12164 return weightEx - special;
12165 }
12166
12167
12169 {
12171 }
12172
12174 {
12176 {
12177 #ifdef DEVELOPER
12178 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12179 {
12180 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12182 }
12183 #endif
12184
12185 return GetQuantity() * GetConfigWeightModified();
12186 }
12187 else if (HasEnergyManager())
12188 {
12189 #ifdef DEVELOPER
12190 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12191 {
12192 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12193 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12194 }
12195 #endif
12196 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12197 }
12198 else
12199 {
12200 #ifdef DEVELOPER
12201 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12202 {
12203 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12204 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12205 }
12206 #endif
12207 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12208 }
12209 }
12210
12213 {
12214 int item_count = 0;
12216
12217 GameInventory inventory = GetInventory();
12218 CargoBase cargo = inventory.
GetCargo();
12219 if (cargo != NULL)
12220 {
12222 }
12223
12225 for (int i = 0; i < nAttachments; ++i)
12226 {
12228 if (item)
12229 item_count += item.GetNumberOfItems();
12230 }
12231 return item_count;
12232 }
12233
12236 {
12237 float weight = 0;
12238 float wetness = 1;
12239 if (include_wetness)
12242 {
12243 weight = wetness * m_ConfigWeight;
12244 }
12246 {
12247 weight = 1;
12248 }
12249 return weight;
12250 }
12251
12252
12253
12255 {
12256 GameInventory inventory = GetInventory();
12257 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12258 {
12259 array<EntityAI> items = new array<EntityAI>;
12261 for (int i = 0; i < items.Count(); ++i)
12262 {
12264 if (item)
12265 {
12266 g_Game.ObjectDelete(item);
12267 }
12268 }
12269 }
12270 }
12271
12272
12273
12274
12276 {
12277 float energy = 0;
12278 if (HasEnergyManager())
12279 {
12280 energy = GetCompEM().GetEnergy();
12281 }
12282 return energy;
12283 }
12284
12285
12287 {
12288 super.OnEnergyConsumed();
12289
12291 }
12292
12294 {
12295 super.OnEnergyAdded();
12296
12298 }
12299
12300
12302 {
12303 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12304 {
12306 {
12307 float energy_0to1 = GetCompEM().GetEnergy0To1();
12309 }
12310 }
12311 }
12312
12313
12315 {
12316 return ConfigGetFloat("heatIsolation");
12317 }
12318
12320 {
12322 }
12323
12325 {
12326 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12327 if (
g_Game.ConfigIsExisting(paramPath))
12328 return g_Game.ConfigGetFloat(paramPath);
12329
12330 return 0.0;
12331 }
12332
12334 {
12335 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12336 if (
g_Game.ConfigIsExisting(paramPath))
12337 return g_Game.ConfigGetFloat(paramPath);
12338
12339 return 0.0;
12340 }
12341
12342 override void SetWet(
float value,
bool allow_client =
false)
12343 {
12344 if (!IsServerCheck(allow_client))
12345 return;
12346
12349
12351
12352 m_VarWet = Math.Clamp(value, min, max);
12353
12355 {
12358 }
12359 }
12360
12361 override void AddWet(
float value)
12362 {
12364 }
12365
12367 {
12369 }
12370
12372 {
12374 }
12375
12377 {
12379 }
12380
12382 {
12384 }
12385
12387 {
12389 }
12390
12391 override void OnWetChanged(
float newVal,
float oldVal)
12392 {
12395 if (newLevel != oldLevel)
12396 {
12398 }
12399 }
12400
12402 {
12403 SetWeightDirty();
12404 }
12405
12407 {
12408 return GetWetLevelInternal(
m_VarWet);
12409 }
12410
12411
12412
12414 {
12416 }
12417
12419 {
12421 }
12422
12424 {
12426 }
12427
12429 {
12431 }
12432
12433
12434
12436 {
12437 if (ConfigIsExisting("itemModelLength"))
12438 {
12439 return ConfigGetFloat("itemModelLength");
12440 }
12441 return 0;
12442 }
12443
12445 {
12446 if (ConfigIsExisting("itemAttachOffset"))
12447 {
12448 return ConfigGetFloat("itemAttachOffset");
12449 }
12450 return 0;
12451 }
12452
12453 override void SetCleanness(
int value,
bool allow_client =
false)
12454 {
12455 if (!IsServerCheck(allow_client))
12456 return;
12457
12459
12461
12464 }
12465
12467 {
12469 }
12470
12472 {
12473 return true;
12474 }
12475
12476
12477
12478
12480 {
12482 }
12483
12485 {
12487 }
12488
12489
12490
12491
12492 override void SetColor(
int r,
int g,
int b,
int a)
12493 {
12499 }
12501 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12502 {
12507 }
12508
12510 {
12512 }
12513
12516 {
12517 int r,g,b,a;
12519 r = r/255;
12520 g = g/255;
12521 b = b/255;
12522 a = a/255;
12523 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12524 }
12525
12526
12527
12528 override void SetLiquidType(
int value,
bool allow_client =
false)
12529 {
12530 if (!IsServerCheck(allow_client))
12531 return;
12532
12537 }
12538
12540 {
12541 return ConfigGetInt("varLiquidTypeInit");
12542 }
12543
12545 {
12547 }
12548
12550 {
12552 SetFrozen(false);
12553 }
12554
12557 {
12558 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12559 }
12560
12561
12564 {
12565 PlayerBase nplayer;
12566 if (PlayerBase.CastTo(nplayer, player))
12567 {
12569 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12570 }
12571 }
12572
12573
12576 {
12577 PlayerBase nplayer;
12578 if (PlayerBase.CastTo(nplayer,player))
12579 {
12580 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12581 }
12582
12583 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12584
12585 if (HasEnergyManager())
12586 {
12587 GetCompEM().UpdatePlugState();
12588 }
12589 }
12590
12591
12593 {
12594 super.OnPlacementStarted(player);
12595
12597 }
12598
12599 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12600 {
12602 {
12603 m_AdminLog.OnPlacementComplete(player,
this);
12604 }
12605
12606 super.OnPlacementComplete(player, position, orientation);
12607 }
12608
12609
12610
12611
12612
12614 {
12616 {
12617 return true;
12618 }
12619 else
12620 {
12621 return false;
12622 }
12623 }
12624
12625
12627 {
12629 {
12631 }
12632 }
12633
12634
12636 {
12638 }
12639
12641 {
12643 }
12644
12645 override void InsertAgent(
int agent,
float count = 1)
12646 {
12647 if (count < 1)
12648 return;
12649
12651 }
12652
12655 {
12657 }
12658
12659
12661 {
12663 }
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12707 {
12709 return false;
12710 return true;
12711 }
12712
12714 {
12715
12717 }
12718
12719
12722 {
12723 super.CheckForRoofLimited(timeTresholdMS);
12724
12725 float time =
g_Game.GetTime();
12726 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12727 {
12728 m_PreviousRoofTestTime = time;
12729 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12730 }
12731 }
12732
12733
12735 {
12737 {
12738 return 0;
12739 }
12740
12741 if (GetInventory().GetAttachmentSlotsCount() != 0)
12742 {
12743 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12744 if (filter)
12745 return filter.GetProtectionLevel(type, false, system);
12746 else
12747 return 0;
12748 }
12749
12750 string subclassPath, entryName;
12751
12752 switch (type)
12753 {
12755 entryName = "biological";
12756 break;
12758 entryName = "chemical";
12759 break;
12760 default:
12761 entryName = "biological";
12762 break;
12763 }
12764
12765 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12766
12767 return g_Game.ConfigGetFloat(subclassPath + entryName);
12768 }
12769
12770
12771
12774 {
12775 if (!IsMagazine())
12777
12779 }
12780
12781
12782
12783
12784
12789 {
12790 return true;
12791 }
12792
12794 {
12796 }
12797
12798
12799
12800
12801
12803 {
12804 if (parent)
12805 {
12806 if (parent.IsInherited(DayZInfected))
12807 return true;
12808
12809 if (!parent.IsRuined())
12810 return true;
12811 }
12812
12813 return true;
12814 }
12815
12817 {
12818 if (!super.CanPutAsAttachment(parent))
12819 {
12820 return false;
12821 }
12822
12823 if (!IsRuined() && !parent.IsRuined())
12824 {
12825 return true;
12826 }
12827
12828 return false;
12829 }
12830
12832 {
12833
12834
12835
12836
12837 return super.CanReceiveItemIntoCargo(item);
12838 }
12839
12841 {
12842
12843
12844
12845
12846 GameInventory attachmentInv = attachment.GetInventory();
12848 {
12849 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12850 return false;
12851 }
12852
12853 InventoryLocation loc = new InventoryLocation();
12854 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12855 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12856 return false;
12857
12858 return super.CanReceiveAttachment(attachment, slotId);
12859 }
12860
12862 {
12863 if (!super.CanReleaseAttachment(attachment))
12864 return false;
12865
12866 return GetInventory().AreChildrenAccessible();
12867 }
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12890 {
12891 int id = muzzle_owner.GetMuzzleID();
12892 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12893
12894 if (WPOF_array)
12895 {
12896 for (int i = 0; i < WPOF_array.Count(); i++)
12897 {
12898 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12899
12900 if (WPOF)
12901 {
12902 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12903 }
12904 }
12905 }
12906 }
12907
12908
12910 {
12911 int id = muzzle_owner.GetMuzzleID();
12913
12914 if (WPOBE_array)
12915 {
12916 for (int i = 0; i < WPOBE_array.Count(); i++)
12917 {
12918 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12919
12920 if (WPOBE)
12921 {
12922 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12923 }
12924 }
12925 }
12926 }
12927
12928
12930 {
12931 int id = muzzle_owner.GetMuzzleID();
12932 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12933
12934 if (WPOOH_array)
12935 {
12936 for (int i = 0; i < WPOOH_array.Count(); i++)
12937 {
12938 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12939
12940 if (WPOOH)
12941 {
12942 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12943 }
12944 }
12945 }
12946 }
12947
12948
12950 {
12951 int id = muzzle_owner.GetMuzzleID();
12952 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12953
12954 if (WPOOH_array)
12955 {
12956 for (int i = 0; i < WPOOH_array.Count(); i++)
12957 {
12958 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12959
12960 if (WPOOH)
12961 {
12962 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12963 }
12964 }
12965 }
12966 }
12967
12968
12970 {
12971 int id = muzzle_owner.GetMuzzleID();
12972 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12973
12974 if (WPOOH_array)
12975 {
12976 for (int i = 0; i < WPOOH_array.Count(); i++)
12977 {
12978 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12979
12980 if (WPOOH)
12981 {
12982 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12983 }
12984 }
12985 }
12986 }
12987
12988
12989
12991 {
12993 {
12994 return true;
12995 }
12996
12997 return false;
12998 }
12999
13001 {
13003 {
13004 return true;
13005 }
13006
13007 return false;
13008 }
13009
13011 {
13013 {
13014 return true;
13015 }
13016
13017 return false;
13018 }
13019
13021 {
13022 return false;
13023 }
13024
13027 {
13028 return UATimeSpent.DEFAULT_DEPLOY;
13029 }
13030
13031
13032
13033
13035 {
13037 SetSynchDirty();
13038 }
13039
13041 {
13043 }
13044
13045
13047 {
13048 return false;
13049 }
13050
13053 {
13054 string att_type = "None";
13055
13056 if (ConfigIsExisting("soundAttType"))
13057 {
13058 att_type = ConfigGetString("soundAttType");
13059 }
13060
13062 }
13063
13065 {
13067 }
13068
13069
13070
13071
13072
13078
13080 {
13083
13085 }
13086
13087
13089 {
13091 return;
13092
13094
13097
13100
13101 SoundParameters params = new SoundParameters();
13105 }
13106
13107
13109 {
13111 {
13114
13115 SetSynchDirty();
13116
13119 }
13120 }
13121
13123 {
13125 }
13126
13127
13129 {
13131 return;
13132
13134 SetSynchDirty();
13135
13138 }
13139
13141 {
13144 }
13145
13147 {
13149 }
13150
13151 void OnApply(PlayerBase player);
13152
13154 {
13155 return 1.0;
13156 };
13157
13159 {
13161 }
13162
13164 {
13166 }
13167
13169
13171 {
13172 SetDynamicPhysicsLifeTime(0.01);
13174 }
13175
13177 {
13178 array<string> zone_names = new array<string>;
13179 GetDamageZones(zone_names);
13180 for (int i = 0; i < zone_names.Count(); i++)
13181 {
13182 SetHealthMax(zone_names.Get(i),"Health");
13183 }
13184 SetHealthMax("","Health");
13185 }
13186
13189 {
13190 float global_health = GetHealth01("","Health");
13191 array<string> zones = new array<string>;
13192 GetDamageZones(zones);
13193
13194 for (int i = 0; i < zones.Count(); i++)
13195 {
13196 SetHealth01(zones.Get(i),"Health",global_health);
13197 }
13198 }
13199
13202 {
13203 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13204 }
13205
13207 {
13208 if (!hasRootAsPlayer)
13209 {
13210 if (refParentIB)
13211 {
13212
13213 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13214 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13215
13216 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13217 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13218
13221 }
13222 else
13223 {
13224
13227 }
13228 }
13229 }
13230
13232 {
13234 {
13235 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13236 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13237 {
13238 float heatPermCoef = 1.0;
13240 while (ent)
13241 {
13242 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13243 ent = ent.GetHierarchyParent();
13244 }
13245
13246 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13247 }
13248 }
13249 }
13250
13252 {
13253
13254 EntityAI parent = GetHierarchyParent();
13255 if (!parent)
13256 {
13257 hasParent = false;
13258 hasRootAsPlayer = false;
13259 }
13260 else
13261 {
13262 hasParent = true;
13263 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13264 refParentIB =
ItemBase.Cast(parent);
13265 }
13266 }
13267
13268 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13269 {
13270
13271 }
13272
13274 {
13275
13276 return false;
13277 }
13278
13280 {
13281
13282
13283 return false;
13284 }
13285
13287 {
13288
13289 return false;
13290 }
13291
13294 {
13295 return !GetIsFrozen() &&
IsOpen();
13296 }
13297
13299 {
13300 bool hasParent = false, hasRootAsPlayer = false;
13302
13303 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13304 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13305
13306 if (wwtu || foodDecay)
13307 {
13311
13312 if (processWetness || processTemperature || processDecay)
13313 {
13315
13316 if (processWetness)
13317 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13318
13319 if (processTemperature)
13321
13322 if (processDecay)
13323 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13324 }
13325 }
13326 }
13327
13330 {
13332 }
13333
13335 {
13338
13339 return super.GetTemperatureFreezeThreshold();
13340 }
13341
13343 {
13346
13347 return super.GetTemperatureThawThreshold();
13348 }
13349
13351 {
13354
13355 return super.GetItemOverheatThreshold();
13356 }
13357
13359 {
13361 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13362
13363 return super.GetTemperatureFreezeTime();
13364 }
13365
13367 {
13369 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13370
13371 return super.GetTemperatureThawTime();
13372 }
13373
13378
13380 {
13381 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13382 }
13383
13385 {
13386 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13387 }
13388
13391 {
13393 }
13394
13396 {
13398 }
13399
13401 {
13403 }
13404
13407 {
13408 return null;
13409 }
13410
13413 {
13414 return false;
13415 }
13416
13418 {
13420 {
13423 if (!trg)
13424 {
13426 explosive = this;
13427 }
13428
13429 explosive.PairRemote(trg);
13431
13432 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13433 trg.SetPersistentPairID(persistentID);
13434 explosive.SetPersistentPairID(persistentID);
13435
13436 return true;
13437 }
13438 return false;
13439 }
13440
13443 {
13444 float ret = 1.0;
13447 ret *= GetHealth01();
13448
13449 return ret;
13450 }
13451
13452 #ifdef DEVELOPER
13453 override void SetDebugItem()
13454 {
13455 super.SetDebugItem();
13456 _itemBase = this;
13457 }
13458
13460 {
13461 string text = super.GetDebugText();
13462
13464 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13465
13466 return text;
13467 }
13468 #endif
13469
13471 {
13472 return true;
13473 }
13474
13476
13478
13480 {
13483 }
13484
13485
13493
13509
13510 [
Obsolete(
"Use ItemSoundHandler instead")]
13513 {
13514 if (!
g_Game.IsDedicatedServer())
13515 {
13516 if (ConfigIsExisting("attachSoundSet"))
13517 {
13518 string cfg_path = "";
13519 string soundset = "";
13520 string type_name =
GetType();
13521
13524 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13525 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13526
13527 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13528 {
13529 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13530 {
13531 if (cfg_slot_array[i] == slot_type)
13532 {
13533 soundset = cfg_soundset_array[i];
13534 break;
13535 }
13536 }
13537 }
13538
13539 if (soundset != "")
13540 {
13541 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13543 }
13544 }
13545 }
13546 }
13547
13549}
13550
13552{
13554 if (entity)
13555 {
13556 bool is_item = entity.IsInherited(
ItemBase);
13557 if (is_item && full_quantity)
13558 {
13561 }
13562 }
13563 else
13564 {
13566 return NULL;
13567 }
13568 return entity;
13569}
13570
13572{
13573 if (item)
13574 {
13575 if (health > 0)
13576 item.SetHealth("", "", health);
13577
13578 if (item.CanHaveTemperature())
13579 {
13581 if (item.CanFreeze())
13582 item.SetFrozen(false);
13583 }
13584
13585 if (item.HasEnergyManager())
13586 {
13587 if (quantity >= 0)
13588 {
13589 item.GetCompEM().SetEnergy0To1(quantity);
13590 }
13591 else
13592 {
13594 }
13595 }
13596 else if (item.IsMagazine())
13597 {
13598 Magazine mag = Magazine.Cast(item);
13599 if (quantity >= 0)
13600 {
13601 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13602 }
13603 else
13604 {
13606 }
13607
13608 }
13609 else
13610 {
13611 if (quantity >= 0)
13612 {
13613 item.SetQuantityNormalized(quantity, false);
13614 }
13615 else
13616 {
13618 }
13619
13620 }
13621 }
13622}
13623
13624#ifdef DEVELOPER
13626#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.