8636{
8638 {
8639 return true;
8640 }
8641};
8642
8644{
8645
8646};
8647
8648
8649
8651{
8655
8657
8660
8661
8662
8663
8664
8673
8679
8684
8689
8710 protected bool m_IsResultOfSplit
8711
8713
8718
8719
8720
8722
8726
8727
8728
8730
8733
8734
8735
8741
8742
8750
8753
8754
8756
8757
8759
8760
8765
8766
8771
8773
8774
8776
8777
8779 {
8784
8785 if (!
g_Game.IsDedicatedServer())
8786 {
8788 {
8790
8792 {
8794 }
8795 }
8796
8799 }
8800
8801 m_OldLocation = null;
8802
8804 {
8806 }
8807
8808 if (ConfigIsExisting("headSelectionsToHide"))
8809 {
8812 }
8813
8815 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8816 {
8818 }
8819
8821
8822 m_IsResultOfSplit = false;
8823
8825 }
8826
8828 {
8829 super.InitItemVariables();
8830
8836 m_Count = ConfigGetInt(
"count");
8837
8840
8845
8848
8853
8865
8869
8870
8873 if (ConfigIsExisting("canBeSplit"))
8874 {
8877 }
8878
8880 if (ConfigIsExisting("itemBehaviour"))
8882
8883
8886 RegisterNetSyncVariableInt("m_VarLiquidType");
8887 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8888
8889 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8890 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8891 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8892
8893 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8894 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8895 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8896 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8897
8898 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8899 RegisterNetSyncVariableBool("m_IsTakeable");
8900 RegisterNetSyncVariableBool("m_IsHologram");
8901
8904 {
8907 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8908 }
8909
8911
8913 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8915
8917 }
8918
8920 {
8922 }
8923
8925 {
8928 {
8933 }
8934 }
8935
8936 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8937 {
8939 {
8942 }
8943
8945 }
8946
8948 {
8954 }
8955
8957
8959 {
8961
8962 if (!action)
8963 {
8964 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8965 return;
8966 }
8967
8969 if (!ai)
8970 {
8972 return;
8973 }
8974
8976 if (!action_array)
8977 {
8978 action_array = new array<ActionBase_Basic>;
8980 }
8981 if (LogManager.IsActionLogEnable())
8982 {
8983 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8984 }
8985
8986 if (action_array.Find(action) != -1)
8987 {
8988 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8989 }
8990 else
8991 {
8992 action_array.Insert(action);
8993 }
8994 }
8995
8997 {
8998 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8999 ActionBase action = player.GetActionManager().GetAction(actionName);
9002
9003 if (action_array)
9004 {
9005 action_array.RemoveItem(action);
9006 }
9007 }
9008
9009
9010
9012 {
9013 ActionOverrideData overrideData = new ActionOverrideData();
9017
9019 if (!actionMap)
9020 {
9023 }
9024
9025 actionMap.Insert(this.
Type(), overrideData);
9026
9027 }
9028
9030
9032
9033
9035 {
9038
9041
9042 string config_to_search = "CfgVehicles";
9043 string muzzle_owner_config;
9044
9046 {
9047 if (IsInherited(Weapon))
9048 config_to_search = "CfgWeapons";
9049
9050 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9051
9052 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9053
9054 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9055
9056 if (config_OnFire_subclass_count > 0)
9057 {
9058 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9059
9060 for (int i = 0; i < config_OnFire_subclass_count; i++)
9061 {
9062 string particle_class = "";
9063 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9064 string config_OnFire_entry = config_OnFire_class + particle_class;
9065 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9066 WPOF_array.Insert(WPOF);
9067 }
9068
9069
9071 }
9072 }
9073
9075 {
9076 config_to_search = "CfgWeapons";
9077 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9078
9079 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9080
9081 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9082
9083 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9084 {
9085 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9086
9087 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9088 {
9089 string particle_class2 = "";
9090 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9091 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9092 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9093 WPOBE_array.Insert(WPOBE);
9094 }
9095
9096
9098 }
9099 }
9100 }
9101
9102
9104 {
9107
9109 {
9110 string config_to_search = "CfgVehicles";
9111
9112 if (IsInherited(Weapon))
9113 config_to_search = "CfgWeapons";
9114
9115 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9116 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9117
9118 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9119 {
9120
9122
9124 {
9126 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9128 return;
9129 }
9130
9133
9134
9135
9136 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9137 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9138
9139 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9140 {
9141 string particle_class = "";
9142 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9143 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9144 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9145
9146 if (entry_type == CT_CLASS)
9147 {
9148 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9149 WPOOH_array.Insert(WPOF);
9150 }
9151 }
9152
9153
9155 }
9156 }
9157 }
9158
9160 {
9162 }
9163
9165 {
9167 {
9169
9172
9175
9176 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9177 }
9178 }
9179
9181 {
9183 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9184
9186 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9187
9189 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9190
9192 {
9194 }
9195 }
9196
9198 {
9200 }
9201
9203 {
9206 else
9208
9210 {
9213 }
9214 else
9215 {
9218
9221 }
9222
9224 }
9225
9227 {
9229 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9230 }
9231
9233 {
9235 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9237 }
9238
9240 {
9242 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9243 }
9244
9246 {
9249
9250 OverheatingParticle OP = new OverheatingParticle();
9255
9257 }
9258
9260 {
9263
9264 return -1;
9265 }
9266
9268 {
9270 {
9273
9274 for (int i = count; i > 0; --i)
9275 {
9276 int id = i - 1;
9279
9282
9283 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9284 {
9285 if (p)
9286 {
9289 }
9290 }
9291 }
9292 }
9293 }
9294
9296 {
9298 {
9300 {
9301 int id = i - 1;
9303
9304 if (OP)
9305 {
9307
9308 if (p)
9309 {
9311 }
9312
9313 delete OP;
9314 }
9315 }
9316
9319 }
9320 }
9321
9324 {
9325 return 0.0;
9326 }
9327
9328
9330 {
9331 return 250;
9332 }
9333
9335 {
9336 return 0;
9337 }
9338
9341 {
9343 return true;
9344
9345 return false;
9346 }
9347
9350 {
9353
9355 {
9357 }
9358 else
9359 {
9360
9362 }
9363
9365 }
9366
9373 {
9374 return -1;
9375 }
9376
9377
9378
9379
9381 {
9383 {
9384 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9385 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9386
9387 if (r_index >= 0)
9388 {
9389 InventoryLocation r_il = new InventoryLocation;
9390 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9391
9392 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9395 {
9396 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9397 }
9399 {
9400 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9401 }
9402
9403 }
9404
9405 player.GetHumanInventory().ClearUserReservedLocation(this);
9406 }
9407
9410 }
9411
9412
9413
9414
9416 {
9417 return ItemBase.m_DebugActionsMask;
9418 }
9419
9421 {
9422 return ItemBase.m_DebugActionsMask & mask;
9423 }
9424
9426 {
9427 ItemBase.m_DebugActionsMask = mask;
9428 }
9429
9431 {
9432 ItemBase.m_DebugActionsMask |= mask;
9433 }
9434
9436 {
9437 ItemBase.m_DebugActionsMask &= ~mask;
9438 }
9439
9441 {
9443 {
9445 }
9446 else
9447 {
9449 }
9450 }
9451
9452
9454 {
9455 if (GetEconomyProfile())
9456 {
9457 float q_max = GetEconomyProfile().GetQuantityMax();
9458 if (q_max > 0)
9459 {
9460 float q_min = GetEconomyProfile().GetQuantityMin();
9461 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9462
9464 {
9465 ComponentEnergyManager comp = GetCompEM();
9467 {
9469 }
9470 }
9472 {
9474
9475 }
9476
9477 }
9478 }
9479 }
9480
9483 {
9484 EntityAI parent = GetHierarchyParent();
9485
9486 if (parent)
9487 {
9488 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9489 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9490 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9491 }
9492 }
9493
9496 {
9497 EntityAI parent = GetHierarchyParent();
9498
9499 if (parent)
9500 {
9501 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9502 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9503 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9504 }
9505 }
9506
9508 {
9509
9510
9511
9512
9514
9516 {
9517 if (ScriptInputUserData.CanStoreInputUserData())
9518 {
9519 ScriptInputUserData ctx = new ScriptInputUserData;
9525 ctx.
Write(use_stack_max);
9528
9530 {
9531 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9532 }
9533 }
9534 }
9535 else if (!
g_Game.IsMultiplayer())
9536 {
9538 }
9539 }
9540
9542 {
9544 }
9545
9547 {
9549 }
9550
9552 {
9554 }
9555
9557 {
9558
9559 return false;
9560 }
9561
9563 {
9564 return false;
9565 }
9566
9570 {
9571 return false;
9572 }
9573
9575 {
9576 return "";
9577 }
9578
9580
9582 {
9583 return false;
9584 }
9585
9587 {
9588 return true;
9589 }
9590
9591
9592
9594 {
9595 return true;
9596 }
9597
9599 {
9600 return true;
9601 }
9602
9604 {
9605 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9607 }
9608
9610 {
9612 }
9613
9615 {
9617 if (!is_being_placed)
9619 SetSynchDirty();
9620 }
9621
9622
9624
9626 {
9628 }
9629
9631 {
9633 }
9634
9636 {
9637 return 1;
9638 }
9639
9641 {
9642 return false;
9643 }
9644
9646 {
9648 SetSynchDirty();
9649 }
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9686 {
9687 super.OnMovedInsideCargo(container);
9688
9689 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9690 }
9691
9692 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9693 {
9694 super.EEItemLocationChanged(oldLoc, newLoc);
9695
9696 PlayerBase newPlayer = null;
9697 PlayerBase oldPlayer = null;
9698
9699 if (newLoc.GetParent())
9700 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9701
9702 if (oldLoc.GetParent())
9703 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9704
9706 {
9707 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9708
9709 if (rIndex >= 0)
9710 {
9711 InventoryLocation rIl = new InventoryLocation;
9712 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9713
9714 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9717 {
9718 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9719 }
9721 {
9723 }
9724
9725 }
9726 }
9727
9729 {
9730 if (newPlayer)
9731 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9732
9733 if (newPlayer == oldPlayer)
9734 {
9735 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9736 {
9738 {
9739 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9740 {
9741 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9742 }
9743 }
9744 else
9745 {
9746 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9747 }
9748 }
9749
9750 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9751 {
9752 int type = oldLoc.GetType();
9754 {
9755 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9756 }
9758 {
9759 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9760 }
9761 }
9762 if (!m_OldLocation)
9763 {
9764 m_OldLocation = new InventoryLocation;
9765 }
9766 m_OldLocation.Copy(oldLoc);
9767 }
9768 else
9769 {
9770 if (m_OldLocation)
9771 {
9772 m_OldLocation.Reset();
9773 }
9774 }
9775
9776 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9777 }
9778 else
9779 {
9780 if (newPlayer)
9781 {
9782 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9783 if (resIndex >= 0)
9784 {
9785 InventoryLocation il = new InventoryLocation;
9786 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9788 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9791 {
9792 il.
GetParent().GetOnReleaseLock().Invoke(it);
9793 }
9795 {
9797 }
9798
9799 }
9800 }
9802 {
9803
9805 }
9806
9807 if (m_OldLocation)
9808 {
9809 m_OldLocation.Reset();
9810 }
9811 }
9812
9814 {
9815 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9816 }
9817
9819 {
9820 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9821 }
9822 }
9823
9824 override void EOnContact(IEntity other, Contact extra)
9825 {
9827 {
9828 int liquidType = -1;
9830 if (impactSpeed > 0.0)
9831 {
9833 #ifndef SERVER
9835 #else
9837 SetSynchDirty();
9838 #endif
9840 }
9841 }
9842
9843 #ifdef SERVER
9844 if (GetCompEM() && GetCompEM().IsPlugged())
9845 {
9846 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9847 GetCompEM().UnplugThis();
9848 }
9849 #endif
9850 }
9851
9853
9855 {
9857 }
9858
9860 {
9861
9862 }
9863
9865 {
9866 super.OnItemLocationChanged(old_owner, new_owner);
9867
9868 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9869 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9870
9871 if (!relatedPlayer && playerNew)
9872 relatedPlayer = playerNew;
9873
9874 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9875 {
9877 if (actionMgr)
9878 {
9879 ActionBase currentAction = actionMgr.GetRunningAction();
9880 if (currentAction)
9882 }
9883 }
9884
9885 Man ownerPlayerOld = null;
9886 Man ownerPlayerNew = null;
9887
9888 if (old_owner)
9889 {
9890 if (old_owner.
IsMan())
9891 {
9892 ownerPlayerOld = Man.Cast(old_owner);
9893 }
9894 else
9895 {
9896 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9897 }
9898 }
9899 else
9900 {
9902 {
9904
9905 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9906 {
9907 GetCompEM().UnplugThis();
9908 }
9909 }
9910 }
9911
9912 if (new_owner)
9913 {
9914 if (new_owner.
IsMan())
9915 {
9916 ownerPlayerNew = Man.Cast(new_owner);
9917 }
9918 else
9919 {
9920 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9921 }
9922 }
9923
9924 if (ownerPlayerOld != ownerPlayerNew)
9925 {
9926 if (ownerPlayerOld)
9927 {
9928 array<EntityAI> subItemsExit = new array<EntityAI>;
9930 for (int i = 0; i < subItemsExit.Count(); i++)
9931 {
9934 }
9935 }
9936
9937 if (ownerPlayerNew)
9938 {
9939 array<EntityAI> subItemsEnter = new array<EntityAI>;
9941 for (int j = 0; j < subItemsEnter.Count(); j++)
9942 {
9945 }
9946 }
9947 }
9948 else if (ownerPlayerNew != null)
9949 {
9950 PlayerBase nplayer;
9951 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9952 {
9953 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9955 for (int k = 0; k < subItemsUpdate.Count(); k++)
9956 {
9958 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9959 }
9960 }
9961 }
9962
9963 if (old_owner)
9964 old_owner.OnChildItemRemoved(this);
9965 if (new_owner)
9966 new_owner.OnChildItemReceived(this);
9967 }
9968
9969
9971 {
9972 super.EEDelete(parent);
9973 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9974 if (player)
9975 {
9977
9978 if (player.IsAlive())
9979 {
9980 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9981 if (r_index >= 0)
9982 {
9983 InventoryLocation r_il = new InventoryLocation;
9984 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9985
9986 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9989 {
9990 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9991 }
9993 {
9994 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9995 }
9996
9997 }
9998
9999 player.RemoveQuickBarEntityShortcut(this);
10000 }
10001 }
10002 }
10003
10005 {
10006 super.EEKilled(killer);
10007
10010 {
10011 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10012 {
10013 if (IsMagazine())
10014 {
10015 if (Magazine.Cast(this).GetAmmoCount() > 0)
10016 {
10018 }
10019 }
10020 else
10021 {
10023 }
10024 }
10025 }
10026 }
10027
10029 {
10030 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10031
10032 super.OnWasAttached(parent, slot_id);
10033
10036
10039 }
10040
10042 {
10043 super.OnWasDetached(parent, slot_id);
10044
10047
10050 }
10051
10053 {
10054 int idx;
10057
10058 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10059 if (inventory_slots.Count() < 1)
10060 {
10061 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10062 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10063 }
10064 else
10065 {
10066 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10067 }
10068
10069 idx = inventory_slots.Find(slot);
10070 if (idx < 0)
10071 return "";
10072
10073 return attach_types.Get(idx);
10074 }
10075
10077 {
10078 int idx = -1;
10079 string slot;
10080
10083
10084 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10085 if (inventory_slots.Count() < 1)
10086 {
10087 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10088 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10089 }
10090 else
10091 {
10092 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10093 if (detach_types.Count() < 1)
10094 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10095 }
10096
10097 for (int i = 0; i < inventory_slots.Count(); i++)
10098 {
10099 slot = inventory_slots.Get(i);
10100 }
10101
10102 if (slot != "")
10103 {
10104 if (detach_types.Count() == 1)
10105 idx = 0;
10106 else
10107 idx = inventory_slots.Find(slot);
10108 }
10109 if (idx < 0)
10110 return "";
10111
10112 return detach_types.Get(idx);
10113 }
10114
10116 {
10117
10119
10120
10121 float min_time = 1;
10122 float max_time = 3;
10123 float delay = Math.RandomFloat(min_time, max_time);
10124
10125 explode_timer.Run(delay, this, "DoAmmoExplosion");
10126 }
10127
10129 {
10130 Magazine magazine = Magazine.Cast(this);
10131 int pop_sounds_count = 6;
10132 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10133
10134
10135 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10136 string sound_name = pop_sounds[ sound_idx ];
10137 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10138
10139
10140 magazine.ServerAddAmmoCount(-1);
10141
10142
10143 float min_temp_to_explode = 100;
10144
10145 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10146 {
10148 }
10149 }
10150
10151
10152 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10153 {
10154 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10155
10156 const int CHANCE_DAMAGE_CARGO = 4;
10157 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10158 const int CHANCE_DAMAGE_NOTHING = 2;
10159
10161 {
10162 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10163 int chances;
10164 int rnd;
10165
10166 if (GetInventory().GetCargo())
10167 {
10168 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10169 rnd = Math.RandomInt(0,chances);
10170
10171 if (rnd < CHANCE_DAMAGE_CARGO)
10172 {
10174 }
10175 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10176 {
10178 }
10179 }
10180 else
10181 {
10182 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10183 rnd = Math.RandomInt(0,chances);
10184
10185 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10186 {
10188 }
10189 }
10190 }
10191 }
10192
10194 {
10195 CargoBase cargo = GetInventory().GetCargo();
10196 if (cargo)
10197 {
10199 if (item_count > 0)
10200 {
10201 int random_pick = Math.RandomInt(0, item_count);
10203 if (!item.IsExplosive())
10204 {
10205 item.AddHealth("","",damage);
10206 return true;
10207 }
10208 }
10209 }
10210 return false;
10211 }
10212
10214 {
10215 GameInventory inventory = GetInventory();
10217 if (attachment_count > 0)
10218 {
10219 int random_pick = Math.RandomInt(0, attachment_count);
10221 if (!attachment.IsExplosive())
10222 {
10223 attachment.AddHealth("","",damage);
10224 return true;
10225 }
10226 }
10227 return false;
10228 }
10229
10231 {
10233 }
10234
10236 {
10238 return GetInventory().CanRemoveEntity();
10239
10240 return false;
10241 }
10242
10244 {
10245
10247 return false;
10248
10249
10251 return false;
10252
10253
10254
10256 if (delta == 0)
10257 return false;
10258
10259
10260 return true;
10261 }
10262
10264 {
10266 {
10267 if (ScriptInputUserData.CanStoreInputUserData())
10268 {
10269 ScriptInputUserData ctx = new ScriptInputUserData;
10274 ctx.
Write(destination_entity);
10276 ctx.
Write(slot_id);
10278 }
10279 }
10280 else if (!
g_Game.IsMultiplayer())
10281 {
10283 }
10284 }
10285
10287 {
10288 float split_quantity_new;
10292 InventoryLocation loc = new InventoryLocation;
10293
10294 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10295 {
10297 split_quantity_new = stack_max;
10298 else
10300
10302 {
10303 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10304 if (new_item)
10305 {
10306 new_item.SetResultOfSplit(true);
10307 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10309 new_item.
SetQuantity(split_quantity_new,
false,
true);
10310 }
10311 }
10312 }
10313 else if (destination_entity && slot_id == -1)
10314 {
10315 if (quantity > stack_max)
10316 split_quantity_new = stack_max;
10317 else
10318 split_quantity_new = quantity;
10319
10321 {
10322 GameInventory destinationInventory = destination_entity.GetInventory();
10324 {
10327 }
10328
10329 if (new_item)
10330 {
10331 new_item.SetResultOfSplit(true);
10332 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10334 new_item.
SetQuantity(split_quantity_new,
false,
true);
10335 }
10336 }
10337 }
10338 else
10339 {
10340 if (stack_max != 0)
10341 {
10343 {
10345 }
10346
10347 if (split_quantity_new == 0)
10348 {
10349 if (!
g_Game.IsMultiplayer())
10350 player.PhysicalPredictiveDropItem(this);
10351 else
10352 player.ServerDropEntity(this);
10353 return;
10354 }
10355
10357 {
10359
10360 if (new_item)
10361 {
10362 new_item.SetResultOfSplit(true);
10363 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10366 new_item.PlaceOnSurface();
10367 }
10368 }
10369 }
10370 }
10371 }
10372
10374 {
10375 float split_quantity_new;
10379 InventoryLocation loc = new InventoryLocation;
10380
10381 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10382 {
10384 split_quantity_new = stack_max;
10385 else
10387
10389 {
10390 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10391 if (new_item)
10392 {
10393 new_item.SetResultOfSplit(true);
10394 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10396 new_item.
SetQuantity(split_quantity_new,
false,
true);
10397 }
10398 }
10399 }
10400 else if (destination_entity && slot_id == -1)
10401 {
10402 if (quantity > stack_max)
10403 split_quantity_new = stack_max;
10404 else
10405 split_quantity_new = quantity;
10406
10408 {
10409 GameInventory destinationInventory = destination_entity.GetInventory();
10411 {
10414 }
10415
10416 if (new_item)
10417 {
10418 new_item.SetResultOfSplit(true);
10419 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10421 new_item.
SetQuantity(split_quantity_new,
false,
true);
10422 }
10423 }
10424 }
10425 else
10426 {
10427 if (stack_max != 0)
10428 {
10430 {
10432 }
10433
10435 {
10437
10438 if (new_item)
10439 {
10440 new_item.SetResultOfSplit(true);
10441 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10444 new_item.PlaceOnSurface();
10445 }
10446 }
10447 }
10448 }
10449 }
10450
10452 {
10454 {
10455 if (ScriptInputUserData.CanStoreInputUserData())
10456 {
10457 ScriptInputUserData ctx = new ScriptInputUserData;
10462 dst.WriteToContext(ctx);
10464 }
10465 }
10466 else if (!
g_Game.IsMultiplayer())
10467 {
10469 }
10470 }
10471
10473 {
10475 {
10476 if (ScriptInputUserData.CanStoreInputUserData())
10477 {
10478 ScriptInputUserData ctx = new ScriptInputUserData;
10483 ctx.
Write(destination_entity);
10489 }
10490 }
10491 else if (!
g_Game.IsMultiplayer())
10492 {
10494 }
10495 }
10496
10498 {
10500 }
10501
10503 {
10505 float split_quantity_new;
10507 if (dst.IsValid())
10508 {
10509 int slot_id = dst.GetSlot();
10511
10512 if (quantity > stack_max)
10513 split_quantity_new = stack_max;
10514 else
10515 split_quantity_new = quantity;
10516
10518 {
10520
10521 if (new_item)
10522 {
10523 new_item.SetResultOfSplit(true);
10524 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10526 new_item.
SetQuantity(split_quantity_new,
false,
true);
10527 }
10528
10529 return new_item;
10530 }
10531 }
10532
10533 return null;
10534 }
10535
10537 {
10539 float split_quantity_new;
10541 if (destination_entity)
10542 {
10544 if (quantity > stackable)
10545 split_quantity_new = stackable;
10546 else
10547 split_quantity_new = quantity;
10548
10550 {
10551 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10552 if (new_item)
10553 {
10554 new_item.SetResultOfSplit(true);
10555 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10557 new_item.
SetQuantity(split_quantity_new,
false,
true);
10558 }
10559 }
10560 }
10561 }
10562
10564 {
10566 {
10567 if (ScriptInputUserData.CanStoreInputUserData())
10568 {
10569 ScriptInputUserData ctx = new ScriptInputUserData;
10574 ItemBase destination_entity =
this;
10575 ctx.
Write(destination_entity);
10579 }
10580 }
10581 else if (!
g_Game.IsMultiplayer())
10582 {
10584 }
10585 }
10586
10588 {
10590 float split_quantity_new;
10592 if (player)
10593 {
10595 if (quantity > stackable)
10596 split_quantity_new = stackable;
10597 else
10598 split_quantity_new = quantity;
10599
10601 {
10602 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10603 new_item =
ItemBase.Cast(in_hands);
10604 if (new_item)
10605 {
10606 new_item.SetResultOfSplit(true);
10607 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10609 new_item.SetQuantity(split_quantity_new, false, true);
10610 }
10611 }
10612 }
10613 }
10614
10616 {
10618 float split_quantity_new = Math.Floor(quantity * 0.5);
10619
10621 return;
10622
10624
10625 if (new_item)
10626 {
10627 if (new_item.GetQuantityMax() < split_quantity_new)
10628 {
10629 split_quantity_new = new_item.GetQuantityMax();
10630 }
10631
10632 new_item.SetResultOfSplit(true);
10633 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10634
10636 {
10639 }
10640 else
10641 {
10643 new_item.
SetQuantity(split_quantity_new,
false,
true);
10644 }
10645 }
10646 }
10647
10649 {
10651 float split_quantity_new = Math.Floor(quantity / 2);
10652
10654 return;
10655
10656 InventoryLocation invloc = new InventoryLocation;
10658
10660 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10661
10662 if (new_item)
10663 {
10664 if (new_item.GetQuantityMax() < split_quantity_new)
10665 {
10666 split_quantity_new = new_item.GetQuantityMax();
10667 }
10669 {
10672 }
10673 else if (split_quantity_new > 1)
10674 {
10676 new_item.
SetQuantity(split_quantity_new,
false,
true);
10677 }
10678 }
10679 }
10680
10683 {
10684 SetWeightDirty();
10686
10687 if (parent)
10688 parent.OnAttachmentQuantityChangedEx(this, delta);
10689
10691 {
10693 {
10695 }
10697 {
10698 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10700 }
10701 }
10702 }
10703
10706 {
10707
10708 }
10709
10712 {
10714 }
10715
10717 {
10718 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10719
10721 {
10722 if (newLevel == GameConstants.STATE_RUINED)
10723 {
10725 EntityAI parent = GetHierarchyParent();
10726 if (parent && parent.IsFireplace())
10727 {
10728 CargoBase cargo = GetInventory().GetCargo();
10729 if (cargo)
10730 {
10732 {
10734 }
10735 }
10736 }
10737 }
10738
10740 {
10741
10743 return;
10744 }
10745
10746 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10747 {
10749 }
10750 }
10751 }
10752
10753
10755 {
10756 super.OnRightClick();
10757
10759 {
10761 {
10762 if (ScriptInputUserData.CanStoreInputUserData())
10763 {
10764 EntityAI root = GetHierarchyRoot();
10765 Man playerOwner = GetHierarchyRootPlayer();
10766 InventoryLocation dst = new InventoryLocation;
10767
10768
10769 if (!playerOwner && root && root == this)
10770 {
10772 }
10773 else
10774 {
10775
10776 GetInventory().GetCurrentInventoryLocation(dst);
10778 {
10779 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10781 {
10783 }
10784 else
10785 {
10787
10788
10789 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10790 {
10792 }
10793 else
10794 {
10795 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10796 }
10797 }
10798 }
10799 }
10800
10801 ScriptInputUserData ctx = new ScriptInputUserData;
10809 }
10810 }
10811 else if (!
g_Game.IsMultiplayer())
10812 {
10814 }
10815 }
10816 }
10817
10819 {
10820 if (root)
10821 {
10822 vector m4[4];
10823 root.GetTransform(m4);
10824 dst.SetGround(this, m4);
10825 }
10826 else
10827 {
10828 GetInventory().GetCurrentInventoryLocation(dst);
10829 }
10830 }
10831
10832 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10833 {
10834
10835 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10836 return false;
10837
10838 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10839 return false;
10840
10841
10843 return false;
10844
10845
10846 Magazine mag = Magazine.Cast(this);
10847 if (mag)
10848 {
10849 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10850 return false;
10851
10852 if (stack_max_limit)
10853 {
10854 Magazine other_mag = Magazine.Cast(other_item);
10855 if (other_item)
10856 {
10857 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10858 return false;
10859 }
10860
10861 }
10862 }
10863 else
10864 {
10865
10867 return false;
10868
10870 return false;
10871 }
10872
10873 PlayerBase player = null;
10874 if (CastTo(player, GetHierarchyRootPlayer()))
10875 {
10876 if (player.GetInventory().HasAttachment(this))
10877 return false;
10878
10879 if (player.IsItemsToDelete())
10880 return false;
10881 }
10882
10883 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10884 return false;
10885
10886 int slotID;
10888 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10889 return false;
10890
10891 return true;
10892 }
10893
10895 {
10897 }
10898
10900 {
10901 return m_IsResultOfSplit;
10902 }
10903
10905 {
10906 m_IsResultOfSplit = value;
10907 }
10908
10910 {
10912 }
10913
10915 {
10916 float other_item_quantity = other_item.GetQuantity();
10917 float this_free_space;
10918
10920
10922
10923 if (other_item_quantity > this_free_space)
10924 {
10925 return this_free_space;
10926 }
10927 else
10928 {
10929 return other_item_quantity;
10930 }
10931 }
10932
10934 {
10936 }
10937
10939 {
10941 return;
10942
10943 if (!IsMagazine() && other_item)
10944 {
10946 if (quantity_used != 0)
10947 {
10948 float hp1 = GetHealth01("","");
10949 float hp2 = other_item.GetHealth01("","");
10950 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10951 hpResult = hpResult / (
GetQuantity() + quantity_used);
10952
10953 hpResult *= GetMaxHealth();
10954 Math.Round(hpResult);
10955 SetHealth("", "Health", hpResult);
10956
10958 other_item.AddQuantity(-quantity_used);
10959 }
10960 }
10962 }
10963
10965 {
10966 #ifdef SERVER
10967 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10968 GetHierarchyParent().IncreaseLifetimeUp();
10969 #endif
10970 };
10971
10973 {
10974 PlayerBase p = PlayerBase.Cast(player);
10975
10976 array<int> recipesIds = p.m_Recipes;
10977 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10978 if (moduleRecipesManager)
10979 {
10980 EntityAI itemInHands = player.GetEntityInHands();
10981 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10982 }
10983
10984 for (int i = 0;i < recipesIds.Count(); i++)
10985 {
10986 int key = recipesIds.Get(i);
10987 string recipeName = moduleRecipesManager.GetRecipeName(key);
10989 }
10990 }
10991
10992
10993 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10994 {
10995 super.GetDebugActions(outputList);
10996
10997
11003
11004
11009
11014
11015
11019
11020
11022 {
11026 }
11027
11030
11031
11035
11037
11038 InventoryLocation loc = new InventoryLocation();
11039 GetInventory().GetCurrentInventoryLocation(loc);
11041 {
11042 if (Gizmo_IsSupported())
11045 }
11046
11048 }
11049
11050
11051
11052
11054 {
11055 super.OnAction(action_id, player, ctx);
11056
11058 {
11059 switch (action_id)
11060 {
11064 return true;
11068 return true;
11069 }
11070 }
11071
11073 {
11074 switch (action_id)
11075 {
11077 Delete();
11078 return true;
11079 }
11080 }
11081
11082 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11083 {
11084 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11085 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11086 PlayerBase p = PlayerBase.Cast(player);
11087 if (
EActions.RECIPES_RANGE_START < 1000)
11088 {
11089 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11090 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11091 }
11092 }
11093 #ifndef SERVER
11094 else if (action_id ==
EActions.WATCH_PLAYER)
11095 {
11096 PluginDeveloper.SetDeveloperItemClientEx(player);
11097 }
11098 #endif
11100 {
11101 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11102 {
11103 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11104 OnDebugButtonPressServer(id + 1);
11105 }
11106
11107 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11108 {
11109 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11111 }
11112
11113 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11114 {
11115 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11117 }
11118
11119 else if (action_id ==
EActions.ADD_QUANTITY)
11120 {
11121 if (IsMagazine())
11122 {
11123 Magazine mag = Magazine.Cast(this);
11124 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11125 }
11126 else
11127 {
11129 }
11130
11131 if (m_EM)
11132 {
11133 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11134 }
11135
11136 }
11137
11138 else if (action_id ==
EActions.REMOVE_QUANTITY)
11139 {
11140 if (IsMagazine())
11141 {
11142 Magazine mag2 = Magazine.Cast(this);
11143 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11144 }
11145 else
11146 {
11148 }
11149 if (m_EM)
11150 {
11151 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11152 }
11153
11154 }
11155
11156 else if (action_id ==
EActions.SET_QUANTITY_0)
11157 {
11159
11160 if (m_EM)
11161 {
11162 m_EM.SetEnergy(0);
11163 }
11164 }
11165
11166 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11167 {
11169
11170 if (m_EM)
11171 {
11172 m_EM.SetEnergy(m_EM.GetEnergyMax());
11173 }
11174 }
11175
11176 else if (action_id ==
EActions.ADD_HEALTH)
11177 {
11178 AddHealth("","",GetMaxHealth("","Health")/5);
11179 }
11180 else if (action_id ==
EActions.REMOVE_HEALTH)
11181 {
11182 AddHealth("","",-GetMaxHealth("","Health")/5);
11183 }
11184 else if (action_id ==
EActions.DESTROY_HEALTH)
11185 {
11186 SetHealth01("","",0);
11187 }
11188 else if (action_id ==
EActions.WATCH_ITEM)
11189 {
11191 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11192 #ifdef DEVELOPER
11193 SetDebugDeveloper_item(this);
11194 #endif
11195 }
11196
11197 else if (action_id ==
EActions.ADD_TEMPERATURE)
11198 {
11199 AddTemperature(20);
11200
11201 }
11202
11203 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11204 {
11205 AddTemperature(-20);
11206
11207 }
11208
11209 else if (action_id ==
EActions.FLIP_FROZEN)
11210 {
11211 SetFrozen(!GetIsFrozen());
11212
11213 }
11214
11215 else if (action_id ==
EActions.ADD_WETNESS)
11216 {
11218
11219 }
11220
11221 else if (action_id ==
EActions.REMOVE_WETNESS)
11222 {
11224
11225 }
11226
11227 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11228 {
11231
11232
11233 }
11234
11235 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11236 {
11239 }
11240
11241 else if (action_id ==
EActions.MAKE_SPECIAL)
11242 {
11243 auto debugParams = DebugSpawnParams.WithPlayer(player);
11244 OnDebugSpawnEx(debugParams);
11245 }
11246
11247 }
11248
11249
11250 return false;
11251 }
11252
11253
11254
11255
11259
11262
11263
11264
11266 {
11267 return false;
11268 }
11269
11270
11272 {
11273 return true;
11274 }
11275
11276
11278 {
11279 return true;
11280 }
11281
11282
11283
11285 {
11286 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11287 return g_Game.ConfigIsExisting(config_path);
11288 }
11289
11292 {
11293 return null;
11294 }
11295
11297 {
11298 return false;
11299 }
11300
11302 {
11303 return false;
11304 }
11305
11309
11310
11312 {
11313 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11314 return module_repairing.CanRepair(this, item_repair_kit);
11315 }
11316
11317
11318 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11319 {
11320 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11321 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11322 }
11323
11324
11326 {
11327
11328
11329
11330
11331
11332
11333
11334
11335 return 1;
11336 }
11337
11338
11339
11341 {
11343 }
11344
11345
11346
11348 {
11350 }
11351
11352
11361 {
11362 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11363
11364 if (player)
11365 {
11366 player.MessageStatus(text);
11367 }
11368 }
11369
11370
11379 {
11380 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11381
11382 if (player)
11383 {
11384 player.MessageAction(text);
11385 }
11386 }
11387
11388
11397 {
11398 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11399
11400 if (player)
11401 {
11402 player.MessageFriendly(text);
11403 }
11404 }
11405
11406
11415 {
11416 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11417
11418 if (player)
11419 {
11420 player.MessageImportant(text);
11421 }
11422 }
11423
11425 {
11426 return true;
11427 }
11428
11429
11430 override bool KindOf(
string tag)
11431 {
11432 bool found = false;
11433 string item_name = this.
GetType();
11435 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11436
11437 int array_size = item_tag_array.Count();
11438 for (int i = 0; i < array_size; i++)
11439 {
11440 if (item_tag_array.Get(i) == tag)
11441 {
11442 found = true;
11443 break;
11444 }
11445 }
11446 return found;
11447 }
11448
11449
11451 {
11452
11453 super.OnRPC(sender, rpc_type,ctx);
11454
11455
11456 switch (rpc_type)
11457 {
11458 #ifndef SERVER
11459 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11460 Param2<bool, string> p = new Param2<bool, string>(false, "");
11461
11463 return;
11464
11465 bool play = p.param1;
11466 string soundSet = p.param2;
11467
11468 if (play)
11469 {
11471 {
11473 {
11475 }
11476 }
11477 else
11478 {
11480 }
11481 }
11482 else
11483 {
11485 }
11486
11487 break;
11488 #endif
11489
11490 }
11491
11493 {
11495 }
11496 }
11497
11498
11499
11500
11502 {
11503 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11504 return plugin.GetID(
name);
11505 }
11506
11508 {
11509 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11510 return plugin.GetName(id);
11511 }
11512
11515 {
11516
11517
11518 int varFlags;
11519 if (!ctx.
Read(varFlags))
11520 return;
11521
11522 if (varFlags & ItemVariableFlags.FLOAT)
11523 {
11525 }
11526 }
11527
11529 {
11530
11531 super.SerializeNumericalVars(floats_out);
11532
11533
11534
11536 {
11538 }
11539
11541 {
11543 }
11544
11546 {
11548 }
11549
11551 {
11556 }
11557
11559 {
11561 }
11562 }
11563
11565 {
11566
11567 super.DeSerializeNumericalVars(floats);
11568
11569
11570 int index = 0;
11571 int mask = Math.Round(floats.Get(index));
11572
11573 index++;
11574
11576 {
11578 {
11580 }
11581 else
11582 {
11583 float quantity = floats.Get(index);
11584 SetQuantity(quantity,
true,
false,
false,
false);
11585 }
11586 index++;
11587 }
11588
11590 {
11591 float wet = floats.Get(index);
11593 index++;
11594 }
11595
11597 {
11598 int liquidtype = Math.Round(floats.Get(index));
11600 index++;
11601 }
11602
11604 {
11606 index++;
11608 index++;
11610 index++;
11612 index++;
11613 }
11614
11616 {
11617 int cleanness = Math.Round(floats.Get(index));
11619 index++;
11620 }
11621 }
11622
11624 {
11625 super.WriteVarsToCTX(ctx);
11626
11627
11629 {
11631 }
11632
11634 {
11636 }
11637
11639 {
11641 }
11642
11644 {
11645 int r,g,b,a;
11651 }
11652
11654 {
11656 }
11657 }
11658
11660 {
11661 if (!super.ReadVarsFromCTX(ctx,version))
11662 return false;
11663
11664 int intValue;
11665 float value;
11666
11667 if (version < 140)
11668 {
11669 if (!ctx.
Read(intValue))
11670 return false;
11671
11672 m_VariablesMask = intValue;
11673 }
11674
11676 {
11677 if (!ctx.
Read(value))
11678 return false;
11679
11681 {
11683 }
11684 else
11685 {
11687 }
11688 }
11689
11690 if (version < 140)
11691 {
11693 {
11694 if (!ctx.
Read(value))
11695 return false;
11696 SetTemperatureDirect(value);
11697 }
11698 }
11699
11701 {
11702 if (!ctx.
Read(value))
11703 return false;
11705 }
11706
11708 {
11709 if (!ctx.
Read(intValue))
11710 return false;
11712 }
11713
11715 {
11716 int r,g,b,a;
11718 return false;
11720 return false;
11722 return false;
11724 return false;
11725
11727 }
11728
11730 {
11731 if (!ctx.
Read(intValue))
11732 return false;
11734 }
11735
11736 if (version >= 138 && version < 140)
11737 {
11739 {
11740 if (!ctx.
Read(intValue))
11741 return false;
11742 SetFrozen(intValue);
11743 }
11744 }
11745
11746 return true;
11747 }
11748
11749
11751 {
11754 {
11756 }
11757
11758 if (!super.OnStoreLoad(ctx, version))
11759 {
11761 return false;
11762 }
11763
11764 if (version >= 114)
11765 {
11766 bool hasQuickBarIndexSaved;
11767
11768 if (!ctx.
Read(hasQuickBarIndexSaved))
11769 {
11771 return false;
11772 }
11773
11774 if (hasQuickBarIndexSaved)
11775 {
11776 int itmQBIndex;
11777
11778
11779 if (!ctx.
Read(itmQBIndex))
11780 {
11782 return false;
11783 }
11784
11785 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11786 if (itmQBIndex != -1 && parentPlayer)
11787 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11788 }
11789 }
11790 else
11791 {
11792
11793 PlayerBase player;
11794 int itemQBIndex;
11795 if (version ==
int.
MAX)
11796 {
11797 if (!ctx.
Read(itemQBIndex))
11798 {
11800 return false;
11801 }
11802 }
11803 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11804 {
11805
11806 if (!ctx.
Read(itemQBIndex))
11807 {
11809 return false;
11810 }
11811 if (itemQBIndex != -1 && player)
11812 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11813 }
11814 }
11815
11816 if (version < 140)
11817 {
11818
11819 if (!LoadVariables(ctx, version))
11820 {
11822 return false;
11823 }
11824 }
11825
11826
11828 {
11830 return false;
11831 }
11832 if (version >= 132)
11833 {
11835 if (raib)
11836 {
11838 {
11840 return false;
11841 }
11842 }
11843 }
11844
11846 return true;
11847 }
11848
11849
11850
11852 {
11853 super.OnStoreSave(ctx);
11854
11855 PlayerBase player;
11856 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11857 {
11859
11860 int itemQBIndex = -1;
11861 itemQBIndex = player.FindQuickBarEntityIndex(this);
11862 ctx.
Write(itemQBIndex);
11863 }
11864 else
11865 {
11867 }
11868
11870
11872 if (raib)
11873 {
11875 }
11876 }
11877
11878
11880 {
11881 super.AfterStoreLoad();
11882
11884 {
11886 }
11887
11889 {
11892 }
11893 }
11894
11896 {
11897 super.EEOnAfterLoad();
11898
11900 {
11902 }
11903
11906 }
11907
11909 {
11910 return false;
11911 }
11912
11913
11914
11916 {
11918 {
11919 #ifdef PLATFORM_CONSOLE
11920
11922 {
11924 if (menu)
11925 {
11927 }
11928 }
11929 #endif
11930 }
11931
11933 {
11936 }
11937
11939 {
11940 SetWeightDirty();
11942 }
11944 {
11947 }
11948
11950 {
11953
11956 }
11958 {
11962 }
11963
11964 super.OnVariablesSynchronized();
11965 }
11966
11967
11968
11970 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11971 {
11972 if (!IsServerCheck(allow_client))
11973 return false;
11974
11976 return false;
11977
11980
11981 if (value <= (min + 0.001))
11982 value = min;
11983
11984 if (value == min)
11985 {
11986 if (destroy_config)
11987 {
11988 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11989 if (dstr)
11990 {
11992 this.Delete();
11993 return true;
11994 }
11995 }
11996 else if (destroy_forced)
11997 {
11999 this.Delete();
12000 return true;
12001 }
12002
12004 }
12005
12008
12010 {
12011 EntityAI parent = GetHierarchyRoot();
12012 InventoryLocation iLoc = new InventoryLocation();
12013 GetInventory().GetCurrentInventoryLocation(iLoc);
12015 {
12016 int iLocSlot = iLoc.
GetSlot();
12018 {
12020 }
12022 {
12024 }
12025 }
12026 }
12027
12029 {
12031
12032 if (delta)
12034 }
12035
12037
12038 return false;
12039 }
12040
12041
12043 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12044 {
12046 }
12047
12049 {
12052 }
12053
12055 {
12058 }
12059
12061 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12062 {
12063 float value_clamped = Math.Clamp(value, 0, 1);
12065 SetQuantity(result, destroy_config, destroy_forced);
12066 }
12067
12068
12071 {
12073 }
12074
12076 {
12078 }
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12090 {
12091 int slot = -1;
12092 GameInventory inventory = GetInventory();
12093 if (inventory)
12094 {
12095 InventoryLocation il = new InventoryLocation;
12098 }
12099
12101 }
12102
12104 {
12105 float quantity_max = 0;
12106
12108 {
12109 if (attSlotID != -1)
12110 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12111
12112 if (quantity_max <= 0)
12114 }
12115
12116 if (quantity_max <= 0)
12118
12119 return quantity_max;
12120 }
12121
12123 {
12125 }
12126
12128 {
12130 }
12131
12132
12134 {
12136 }
12137
12139 {
12141 }
12142
12144 {
12146 }
12147
12148
12150 {
12151
12152 float weightEx = GetWeightEx();
12153 float special = GetInventoryAndCargoWeight();
12154 return weightEx - special;
12155 }
12156
12157
12159 {
12161 }
12162
12164 {
12166 {
12167 #ifdef DEVELOPER
12168 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12169 {
12170 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12172 }
12173 #endif
12174
12175 return GetQuantity() * GetConfigWeightModified();
12176 }
12177 else if (HasEnergyManager())
12178 {
12179 #ifdef DEVELOPER
12180 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12181 {
12182 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12183 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12184 }
12185 #endif
12186 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12187 }
12188 else
12189 {
12190 #ifdef DEVELOPER
12191 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12192 {
12193 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12194 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12195 }
12196 #endif
12197 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12198 }
12199 }
12200
12203 {
12204 int item_count = 0;
12206
12207 GameInventory inventory = GetInventory();
12208 CargoBase cargo = inventory.
GetCargo();
12209 if (cargo != NULL)
12210 {
12212 }
12213
12215 for (int i = 0; i < nAttachments; ++i)
12216 {
12218 if (item)
12219 item_count += item.GetNumberOfItems();
12220 }
12221 return item_count;
12222 }
12223
12226 {
12227 float weight = 0;
12228 float wetness = 1;
12229 if (include_wetness)
12232 {
12233 weight = wetness * m_ConfigWeight;
12234 }
12236 {
12237 weight = 1;
12238 }
12239 return weight;
12240 }
12241
12242
12243
12245 {
12246 GameInventory inventory = GetInventory();
12247 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12248 {
12249 array<EntityAI> items = new array<EntityAI>;
12251 for (int i = 0; i < items.Count(); ++i)
12252 {
12254 if (item)
12255 {
12256 g_Game.ObjectDelete(item);
12257 }
12258 }
12259 }
12260 }
12261
12262
12263
12264
12266 {
12267 float energy = 0;
12268 if (HasEnergyManager())
12269 {
12270 energy = GetCompEM().GetEnergy();
12271 }
12272 return energy;
12273 }
12274
12275
12277 {
12278 super.OnEnergyConsumed();
12279
12281 }
12282
12284 {
12285 super.OnEnergyAdded();
12286
12288 }
12289
12290
12292 {
12293 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12294 {
12296 {
12297 float energy_0to1 = GetCompEM().GetEnergy0To1();
12299 }
12300 }
12301 }
12302
12303
12305 {
12306 return ConfigGetFloat("heatIsolation");
12307 }
12308
12310 {
12312 }
12313
12315 {
12316 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12317 if (
g_Game.ConfigIsExisting(paramPath))
12318 return g_Game.ConfigGetFloat(paramPath);
12319
12320 return 0.0;
12321 }
12322
12324 {
12325 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12326 if (
g_Game.ConfigIsExisting(paramPath))
12327 return g_Game.ConfigGetFloat(paramPath);
12328
12329 return 0.0;
12330 }
12331
12332 override void SetWet(
float value,
bool allow_client =
false)
12333 {
12334 if (!IsServerCheck(allow_client))
12335 return;
12336
12339
12341
12342 m_VarWet = Math.Clamp(value, min, max);
12343
12345 {
12348 }
12349 }
12350
12351 override void AddWet(
float value)
12352 {
12354 }
12355
12357 {
12359 }
12360
12362 {
12364 }
12365
12367 {
12369 }
12370
12372 {
12374 }
12375
12377 {
12379 }
12380
12381 override void OnWetChanged(
float newVal,
float oldVal)
12382 {
12385 if (newLevel != oldLevel)
12386 {
12388 }
12389 }
12390
12392 {
12393 SetWeightDirty();
12394 }
12395
12397 {
12398 return GetWetLevelInternal(
m_VarWet);
12399 }
12400
12401
12402
12404 {
12406 }
12407
12409 {
12411 }
12412
12414 {
12416 }
12417
12419 {
12421 }
12422
12423
12424
12426 {
12427 if (ConfigIsExisting("itemModelLength"))
12428 {
12429 return ConfigGetFloat("itemModelLength");
12430 }
12431 return 0;
12432 }
12433
12435 {
12436 if (ConfigIsExisting("itemAttachOffset"))
12437 {
12438 return ConfigGetFloat("itemAttachOffset");
12439 }
12440 return 0;
12441 }
12442
12443 override void SetCleanness(
int value,
bool allow_client =
false)
12444 {
12445 if (!IsServerCheck(allow_client))
12446 return;
12447
12449
12451
12454 }
12455
12457 {
12459 }
12460
12462 {
12463 return true;
12464 }
12465
12466
12467
12468
12470 {
12472 }
12473
12475 {
12477 }
12478
12479
12480
12481
12482 override void SetColor(
int r,
int g,
int b,
int a)
12483 {
12489 }
12491 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12492 {
12497 }
12498
12500 {
12502 }
12503
12506 {
12507 int r,g,b,a;
12509 r = r/255;
12510 g = g/255;
12511 b = b/255;
12512 a = a/255;
12513 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12514 }
12515
12516
12517
12518 override void SetLiquidType(
int value,
bool allow_client =
false)
12519 {
12520 if (!IsServerCheck(allow_client))
12521 return;
12522
12527 }
12528
12530 {
12531 return ConfigGetInt("varLiquidTypeInit");
12532 }
12533
12535 {
12537 }
12538
12540 {
12542 SetFrozen(false);
12543 }
12544
12547 {
12548 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12549 }
12550
12551
12554 {
12555 PlayerBase nplayer;
12556 if (PlayerBase.CastTo(nplayer, player))
12557 {
12559 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12560 }
12561 }
12562
12563
12566 {
12567 PlayerBase nplayer;
12568 if (PlayerBase.CastTo(nplayer,player))
12569 {
12570 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12571 }
12572
12573 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12574
12575 if (HasEnergyManager())
12576 {
12577 GetCompEM().UpdatePlugState();
12578 }
12579 }
12580
12581
12583 {
12584 super.OnPlacementStarted(player);
12585
12587 }
12588
12589 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12590 {
12592 {
12593 m_AdminLog.OnPlacementComplete(player,
this);
12594 }
12595
12596 super.OnPlacementComplete(player, position, orientation);
12597 }
12598
12599
12600
12601
12602
12604 {
12606 {
12607 return true;
12608 }
12609 else
12610 {
12611 return false;
12612 }
12613 }
12614
12615
12617 {
12619 {
12621 }
12622 }
12623
12624
12626 {
12628 }
12629
12631 {
12633 }
12634
12635 override void InsertAgent(
int agent,
float count = 1)
12636 {
12637 if (count < 1)
12638 return;
12639
12641 }
12642
12645 {
12647 }
12648
12649
12651 {
12653 }
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12697 {
12699 return false;
12700 return true;
12701 }
12702
12704 {
12705
12707 }
12708
12709
12712 {
12713 super.CheckForRoofLimited(timeTresholdMS);
12714
12715 float time =
g_Game.GetTime();
12716 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12717 {
12718 m_PreviousRoofTestTime = time;
12719 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12720 }
12721 }
12722
12723
12725 {
12727 {
12728 return 0;
12729 }
12730
12731 if (GetInventory().GetAttachmentSlotsCount() != 0)
12732 {
12733 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12734 if (filter)
12735 return filter.GetProtectionLevel(type, false, system);
12736 else
12737 return 0;
12738 }
12739
12740 string subclassPath, entryName;
12741
12742 switch (type)
12743 {
12745 entryName = "biological";
12746 break;
12748 entryName = "chemical";
12749 break;
12750 default:
12751 entryName = "biological";
12752 break;
12753 }
12754
12755 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12756
12757 return g_Game.ConfigGetFloat(subclassPath + entryName);
12758 }
12759
12760
12761
12764 {
12765 if (!IsMagazine())
12767
12769 }
12770
12771
12772
12773
12774
12779 {
12780 return true;
12781 }
12782
12784 {
12786 }
12787
12788
12789
12790
12791
12793 {
12794 if (parent)
12795 {
12796 if (parent.IsInherited(DayZInfected))
12797 return true;
12798
12799 if (!parent.IsRuined())
12800 return true;
12801 }
12802
12803 return true;
12804 }
12805
12807 {
12808 if (!super.CanPutAsAttachment(parent))
12809 {
12810 return false;
12811 }
12812
12813 if (!IsRuined() && !parent.IsRuined())
12814 {
12815 return true;
12816 }
12817
12818 return false;
12819 }
12820
12822 {
12823
12824
12825
12826
12827 return super.CanReceiveItemIntoCargo(item);
12828 }
12829
12831 {
12832
12833
12834
12835
12836 GameInventory attachmentInv = attachment.GetInventory();
12838 {
12839 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12840 return false;
12841 }
12842
12843 InventoryLocation loc = new InventoryLocation();
12844 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12845 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12846 return false;
12847
12848 return super.CanReceiveAttachment(attachment, slotId);
12849 }
12850
12852 {
12853 if (!super.CanReleaseAttachment(attachment))
12854 return false;
12855
12856 return GetInventory().AreChildrenAccessible();
12857 }
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12880 {
12881 int id = muzzle_owner.GetMuzzleID();
12882 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12883
12884 if (WPOF_array)
12885 {
12886 for (int i = 0; i < WPOF_array.Count(); i++)
12887 {
12888 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12889
12890 if (WPOF)
12891 {
12892 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12893 }
12894 }
12895 }
12896 }
12897
12898
12900 {
12901 int id = muzzle_owner.GetMuzzleID();
12903
12904 if (WPOBE_array)
12905 {
12906 for (int i = 0; i < WPOBE_array.Count(); i++)
12907 {
12908 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12909
12910 if (WPOBE)
12911 {
12912 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12913 }
12914 }
12915 }
12916 }
12917
12918
12920 {
12921 int id = muzzle_owner.GetMuzzleID();
12922 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12923
12924 if (WPOOH_array)
12925 {
12926 for (int i = 0; i < WPOOH_array.Count(); i++)
12927 {
12928 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12929
12930 if (WPOOH)
12931 {
12932 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12933 }
12934 }
12935 }
12936 }
12937
12938
12940 {
12941 int id = muzzle_owner.GetMuzzleID();
12942 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12943
12944 if (WPOOH_array)
12945 {
12946 for (int i = 0; i < WPOOH_array.Count(); i++)
12947 {
12948 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12949
12950 if (WPOOH)
12951 {
12952 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12953 }
12954 }
12955 }
12956 }
12957
12958
12960 {
12961 int id = muzzle_owner.GetMuzzleID();
12962 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12963
12964 if (WPOOH_array)
12965 {
12966 for (int i = 0; i < WPOOH_array.Count(); i++)
12967 {
12968 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12969
12970 if (WPOOH)
12971 {
12972 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12973 }
12974 }
12975 }
12976 }
12977
12978
12979
12981 {
12983 {
12984 return true;
12985 }
12986
12987 return false;
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 {
13012 return false;
13013 }
13014
13017 {
13018 return UATimeSpent.DEFAULT_DEPLOY;
13019 }
13020
13021
13022
13023
13025 {
13027 SetSynchDirty();
13028 }
13029
13031 {
13033 }
13034
13035
13037 {
13038 return false;
13039 }
13040
13043 {
13044 string att_type = "None";
13045
13046 if (ConfigIsExisting("soundAttType"))
13047 {
13048 att_type = ConfigGetString("soundAttType");
13049 }
13050
13052 }
13053
13055 {
13057 }
13058
13059
13060
13061
13062
13068
13070 {
13073
13075 }
13076
13077
13079 {
13081 return;
13082
13084
13087
13090
13091 SoundParameters params = new SoundParameters();
13095 }
13096
13097
13099 {
13101 {
13104
13105 SetSynchDirty();
13106
13109 }
13110 }
13111
13113 {
13115 }
13116
13117
13119 {
13121 return;
13122
13124 SetSynchDirty();
13125
13128 }
13129
13131 {
13134 }
13135
13137 {
13139 }
13140
13141 void OnApply(PlayerBase player);
13142
13144 {
13145 return 1.0;
13146 };
13147
13149 {
13151 }
13152
13154 {
13156 }
13157
13159
13161 {
13162 SetDynamicPhysicsLifeTime(0.01);
13164 }
13165
13167 {
13168 array<string> zone_names = new array<string>;
13169 GetDamageZones(zone_names);
13170 for (int i = 0; i < zone_names.Count(); i++)
13171 {
13172 SetHealthMax(zone_names.Get(i),"Health");
13173 }
13174 SetHealthMax("","Health");
13175 }
13176
13179 {
13180 float global_health = GetHealth01("","Health");
13181 array<string> zones = new array<string>;
13182 GetDamageZones(zones);
13183
13184 for (int i = 0; i < zones.Count(); i++)
13185 {
13186 SetHealth01(zones.Get(i),"Health",global_health);
13187 }
13188 }
13189
13192 {
13193 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13194 }
13195
13197 {
13198 if (!hasRootAsPlayer)
13199 {
13200 if (refParentIB)
13201 {
13202
13203 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13204 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13205
13206 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13207 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13208
13211 }
13212 else
13213 {
13214
13217 }
13218 }
13219 }
13220
13222 {
13224 {
13225 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13226 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13227 {
13228 float heatPermCoef = 1.0;
13230 while (ent)
13231 {
13232 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13233 ent = ent.GetHierarchyParent();
13234 }
13235
13236 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13237 }
13238 }
13239 }
13240
13242 {
13243
13244 EntityAI parent = GetHierarchyParent();
13245 if (!parent)
13246 {
13247 hasParent = false;
13248 hasRootAsPlayer = false;
13249 }
13250 else
13251 {
13252 hasParent = true;
13253 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13254 refParentIB =
ItemBase.Cast(parent);
13255 }
13256 }
13257
13258 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13259 {
13260
13261 }
13262
13264 {
13265
13266 return false;
13267 }
13268
13270 {
13271
13272
13273 return false;
13274 }
13275
13277 {
13278
13279 return false;
13280 }
13281
13284 {
13285 return !GetIsFrozen() &&
IsOpen();
13286 }
13287
13289 {
13290 bool hasParent = false, hasRootAsPlayer = false;
13292
13293 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13294 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13295
13296 if (wwtu || foodDecay)
13297 {
13301
13302 if (processWetness || processTemperature || processDecay)
13303 {
13305
13306 if (processWetness)
13307 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13308
13309 if (processTemperature)
13311
13312 if (processDecay)
13313 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13314 }
13315 }
13316 }
13317
13320 {
13322 }
13323
13325 {
13328
13329 return super.GetTemperatureFreezeThreshold();
13330 }
13331
13333 {
13336
13337 return super.GetTemperatureThawThreshold();
13338 }
13339
13341 {
13344
13345 return super.GetItemOverheatThreshold();
13346 }
13347
13349 {
13351 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13352
13353 return super.GetTemperatureFreezeTime();
13354 }
13355
13357 {
13359 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13360
13361 return super.GetTemperatureThawTime();
13362 }
13363
13368
13370 {
13371 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13372 }
13373
13375 {
13376 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13377 }
13378
13381 {
13383 }
13384
13386 {
13388 }
13389
13391 {
13393 }
13394
13397 {
13398 return null;
13399 }
13400
13403 {
13404 return false;
13405 }
13406
13408 {
13410 {
13413 if (!trg)
13414 {
13416 explosive = this;
13417 }
13418
13419 explosive.PairRemote(trg);
13421
13422 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13423 trg.SetPersistentPairID(persistentID);
13424 explosive.SetPersistentPairID(persistentID);
13425
13426 return true;
13427 }
13428 return false;
13429 }
13430
13433 {
13434 float ret = 1.0;
13437 ret *= GetHealth01();
13438
13439 return ret;
13440 }
13441
13442 #ifdef DEVELOPER
13443 override void SetDebugItem()
13444 {
13445 super.SetDebugItem();
13446 _itemBase = this;
13447 }
13448
13450 {
13451 string text = super.GetDebugText();
13452
13454 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13455
13456 return text;
13457 }
13458 #endif
13459
13461 {
13462 return true;
13463 }
13464
13466
13468
13470 {
13473 }
13474
13475
13483
13499
13500 [
Obsolete(
"Use ItemSoundHandler instead")]
13503 {
13504 if (!
g_Game.IsDedicatedServer())
13505 {
13506 if (ConfigIsExisting("attachSoundSet"))
13507 {
13508 string cfg_path = "";
13509 string soundset = "";
13510 string type_name =
GetType();
13511
13514 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13515 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13516
13517 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13518 {
13519 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13520 {
13521 if (cfg_slot_array[i] == slot_type)
13522 {
13523 soundset = cfg_soundset_array[i];
13524 break;
13525 }
13526 }
13527 }
13528
13529 if (soundset != "")
13530 {
13531 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13533 }
13534 }
13535 }
13536 }
13537
13539}
13540
13542{
13544 if (entity)
13545 {
13546 bool is_item = entity.IsInherited(
ItemBase);
13547 if (is_item && full_quantity)
13548 {
13551 }
13552 }
13553 else
13554 {
13556 return NULL;
13557 }
13558 return entity;
13559}
13560
13562{
13563 if (item)
13564 {
13565 if (health > 0)
13566 item.SetHealth("", "", health);
13567
13568 if (item.CanHaveTemperature())
13569 {
13571 if (item.CanFreeze())
13572 item.SetFrozen(false);
13573 }
13574
13575 if (item.HasEnergyManager())
13576 {
13577 if (quantity >= 0)
13578 {
13579 item.GetCompEM().SetEnergy0To1(quantity);
13580 }
13581 else
13582 {
13584 }
13585 }
13586 else if (item.IsMagazine())
13587 {
13588 Magazine mag = Magazine.Cast(item);
13589 if (quantity >= 0)
13590 {
13591 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13592 }
13593 else
13594 {
13596 }
13597
13598 }
13599 else
13600 {
13601 if (quantity >= 0)
13602 {
13603 item.SetQuantityNormalized(quantity, false);
13604 }
13605 else
13606 {
13608 }
13609
13610 }
13611 }
13612}
13613
13614#ifdef DEVELOPER
13616#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.