8541{
8543 {
8544 return true;
8545 }
8546};
8547
8549{
8550
8551};
8552
8553
8554
8556{
8560
8562
8565
8566
8567
8568
8569
8578
8584
8589
8594
8615 protected bool m_IsResultOfSplit
8616
8618
8623
8624
8625
8627
8631
8632
8633
8635
8638
8639
8640
8646
8647
8655
8658
8659
8661
8662
8664
8665
8670
8671
8676
8678
8679
8681
8682
8684 {
8689
8690 if (!
g_Game.IsDedicatedServer())
8691 {
8693 {
8695
8697 {
8699 }
8700 }
8701
8704 }
8705
8706 m_OldLocation = null;
8707
8709 {
8711 }
8712
8713 if (ConfigIsExisting("headSelectionsToHide"))
8714 {
8717 }
8718
8720 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8721 {
8723 }
8724
8726
8727 m_IsResultOfSplit = false;
8728
8730 }
8731
8733 {
8734 super.InitItemVariables();
8735
8741 m_Count = ConfigGetInt(
"count");
8742
8745
8750
8753
8758
8770
8774
8775
8778 if (ConfigIsExisting("canBeSplit"))
8779 {
8782 }
8783
8785 if (ConfigIsExisting("itemBehaviour"))
8787
8788
8791 RegisterNetSyncVariableInt("m_VarLiquidType");
8792 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8793
8794 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8795 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8796 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8797
8798 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8799 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8800 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8801 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8802
8803 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8804 RegisterNetSyncVariableBool("m_IsTakeable");
8805 RegisterNetSyncVariableBool("m_IsHologram");
8806
8809 {
8812 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8813 }
8814
8816
8818 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8820
8822 }
8823
8825 {
8827 }
8828
8830 {
8833 {
8838 }
8839 }
8840
8841 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8842 {
8844 {
8847 }
8848
8850 }
8851
8853 {
8859 }
8860
8862
8864 {
8866
8867 if (!action)
8868 {
8869 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8870 return;
8871 }
8872
8874 if (!ai)
8875 {
8877 return;
8878 }
8879
8881 if (!action_array)
8882 {
8883 action_array = new array<ActionBase_Basic>;
8885 }
8886 if (LogManager.IsActionLogEnable())
8887 {
8888 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8889 }
8890
8891 if (action_array.Find(action) != -1)
8892 {
8893 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8894 }
8895 else
8896 {
8897 action_array.Insert(action);
8898 }
8899 }
8900
8902 {
8903 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8904 ActionBase action = player.GetActionManager().GetAction(actionName);
8907
8908 if (action_array)
8909 {
8910 action_array.RemoveItem(action);
8911 }
8912 }
8913
8914
8915
8917 {
8918 ActionOverrideData overrideData = new ActionOverrideData();
8922
8924 if (!actionMap)
8925 {
8928 }
8929
8930 actionMap.Insert(this.
Type(), overrideData);
8931
8932 }
8933
8935
8937
8938
8940 {
8943
8946
8947 string config_to_search = "CfgVehicles";
8948 string muzzle_owner_config;
8949
8951 {
8952 if (IsInherited(Weapon))
8953 config_to_search = "CfgWeapons";
8954
8955 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8956
8957 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8958
8959 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8960
8961 if (config_OnFire_subclass_count > 0)
8962 {
8963 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8964
8965 for (int i = 0; i < config_OnFire_subclass_count; i++)
8966 {
8967 string particle_class = "";
8968 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8969 string config_OnFire_entry = config_OnFire_class + particle_class;
8970 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8971 WPOF_array.Insert(WPOF);
8972 }
8973
8974
8976 }
8977 }
8978
8980 {
8981 config_to_search = "CfgWeapons";
8982 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8983
8984 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8985
8986 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8987
8988 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8989 {
8990 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8991
8992 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8993 {
8994 string particle_class2 = "";
8995 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8996 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8997 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8998 WPOBE_array.Insert(WPOBE);
8999 }
9000
9001
9003 }
9004 }
9005 }
9006
9007
9009 {
9012
9014 {
9015 string config_to_search = "CfgVehicles";
9016
9017 if (IsInherited(Weapon))
9018 config_to_search = "CfgWeapons";
9019
9020 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9021 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9022
9023 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9024 {
9025
9027
9029 {
9031 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9033 return;
9034 }
9035
9038
9039
9040
9041 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9042 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9043
9044 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9045 {
9046 string particle_class = "";
9047 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9048 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9049 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9050
9051 if (entry_type == CT_CLASS)
9052 {
9053 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9054 WPOOH_array.Insert(WPOF);
9055 }
9056 }
9057
9058
9060 }
9061 }
9062 }
9063
9065 {
9067 }
9068
9070 {
9072 {
9074
9077
9080
9081 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9082 }
9083 }
9084
9086 {
9088 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9089
9091 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9092
9094 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9095
9097 {
9099 }
9100 }
9101
9103 {
9105 }
9106
9108 {
9111 else
9113
9115 {
9118 }
9119 else
9120 {
9123
9126 }
9127
9129 }
9130
9132 {
9134 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9135 }
9136
9138 {
9140 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9142 }
9143
9145 {
9147 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9148 }
9149
9151 {
9154
9155 OverheatingParticle OP = new OverheatingParticle();
9160
9162 }
9163
9165 {
9168
9169 return -1;
9170 }
9171
9173 {
9175 {
9178
9179 for (int i = count; i > 0; --i)
9180 {
9181 int id = i - 1;
9184
9187
9188 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9189 {
9190 if (p)
9191 {
9194 }
9195 }
9196 }
9197 }
9198 }
9199
9201 {
9203 {
9205 {
9206 int id = i - 1;
9208
9209 if (OP)
9210 {
9212
9213 if (p)
9214 {
9216 }
9217
9218 delete OP;
9219 }
9220 }
9221
9224 }
9225 }
9226
9229 {
9230 return 0.0;
9231 }
9232
9233
9235 {
9236 return 250;
9237 }
9238
9240 {
9241 return 0;
9242 }
9243
9246 {
9248 return true;
9249
9250 return false;
9251 }
9252
9255 {
9258
9260 {
9262 }
9263 else
9264 {
9265
9267 }
9268
9270 }
9271
9278 {
9279 return -1;
9280 }
9281
9282
9283
9284
9286 {
9288 {
9289 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9290 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9291
9292 if (r_index >= 0)
9293 {
9294 InventoryLocation r_il = new InventoryLocation;
9295 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9296
9297 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9300 {
9301 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9302 }
9304 {
9305 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9306 }
9307
9308 }
9309
9310 player.GetHumanInventory().ClearUserReservedLocation(this);
9311 }
9312
9315 }
9316
9317
9318
9319
9321 {
9322 return ItemBase.m_DebugActionsMask;
9323 }
9324
9326 {
9327 return ItemBase.m_DebugActionsMask & mask;
9328 }
9329
9331 {
9332 ItemBase.m_DebugActionsMask = mask;
9333 }
9334
9336 {
9337 ItemBase.m_DebugActionsMask |= mask;
9338 }
9339
9341 {
9342 ItemBase.m_DebugActionsMask &= ~mask;
9343 }
9344
9346 {
9348 {
9350 }
9351 else
9352 {
9354 }
9355 }
9356
9357
9359 {
9360 if (GetEconomyProfile())
9361 {
9362 float q_max = GetEconomyProfile().GetQuantityMax();
9363 if (q_max > 0)
9364 {
9365 float q_min = GetEconomyProfile().GetQuantityMin();
9366 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9367
9369 {
9370 ComponentEnergyManager comp = GetCompEM();
9372 {
9374 }
9375 }
9377 {
9379
9380 }
9381
9382 }
9383 }
9384 }
9385
9388 {
9389 EntityAI parent = GetHierarchyParent();
9390
9391 if (parent)
9392 {
9393 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9394 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9395 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9396 }
9397 }
9398
9401 {
9402 EntityAI parent = GetHierarchyParent();
9403
9404 if (parent)
9405 {
9406 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9407 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9408 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9409 }
9410 }
9411
9413 {
9414
9415
9416
9417
9419
9421 {
9422 if (ScriptInputUserData.CanStoreInputUserData())
9423 {
9424 ScriptInputUserData ctx = new ScriptInputUserData;
9430 ctx.
Write(use_stack_max);
9433
9435 {
9436 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9437 }
9438 }
9439 }
9440 else if (!
g_Game.IsMultiplayer())
9441 {
9443 }
9444 }
9445
9447 {
9449 }
9450
9452 {
9454 }
9455
9457 {
9459 }
9460
9462 {
9463
9464 return false;
9465 }
9466
9468 {
9469 return false;
9470 }
9471
9475 {
9476 return false;
9477 }
9478
9480 {
9481 return "";
9482 }
9483
9485
9487 {
9488 return false;
9489 }
9490
9492 {
9493 return true;
9494 }
9495
9496
9497
9499 {
9500 return true;
9501 }
9502
9504 {
9505 return true;
9506 }
9507
9509 {
9510 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9512 }
9513
9515 {
9517 }
9518
9520 {
9522 if (!is_being_placed)
9524 SetSynchDirty();
9525 }
9526
9527
9529
9531 {
9533 }
9534
9536 {
9538 }
9539
9541 {
9542 return 1;
9543 }
9544
9546 {
9547 return false;
9548 }
9549
9551 {
9553 SetSynchDirty();
9554 }
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9591 {
9592 super.OnMovedInsideCargo(container);
9593
9594 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9595 }
9596
9597 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9598 {
9599 super.EEItemLocationChanged(oldLoc, newLoc);
9600
9601 PlayerBase newPlayer = null;
9602 PlayerBase oldPlayer = null;
9603
9604 if (newLoc.GetParent())
9605 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9606
9607 if (oldLoc.GetParent())
9608 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9609
9611 {
9612 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9613
9614 if (rIndex >= 0)
9615 {
9616 InventoryLocation rIl = new InventoryLocation;
9617 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9618
9619 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9622 {
9623 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9624 }
9626 {
9628 }
9629
9630 }
9631 }
9632
9634 {
9635 if (newPlayer)
9636 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9637
9638 if (newPlayer == oldPlayer)
9639 {
9640 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9641 {
9643 {
9644 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9645 {
9646 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9647 }
9648 }
9649 else
9650 {
9651 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9652 }
9653 }
9654
9655 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9656 {
9657 int type = oldLoc.GetType();
9659 {
9660 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9661 }
9663 {
9664 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9665 }
9666 }
9667 if (!m_OldLocation)
9668 {
9669 m_OldLocation = new InventoryLocation;
9670 }
9671 m_OldLocation.Copy(oldLoc);
9672 }
9673 else
9674 {
9675 if (m_OldLocation)
9676 {
9677 m_OldLocation.Reset();
9678 }
9679 }
9680
9681 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9682 }
9683 else
9684 {
9685 if (newPlayer)
9686 {
9687 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9688 if (resIndex >= 0)
9689 {
9690 InventoryLocation il = new InventoryLocation;
9691 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9693 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9696 {
9697 il.
GetParent().GetOnReleaseLock().Invoke(it);
9698 }
9700 {
9702 }
9703
9704 }
9705 }
9707 {
9708
9710 }
9711
9712 if (m_OldLocation)
9713 {
9714 m_OldLocation.Reset();
9715 }
9716 }
9717
9719 {
9720 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9721 }
9722
9724 {
9725 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9726 }
9727 }
9728
9729 override void EOnContact(IEntity other, Contact extra)
9730 {
9732 {
9733 int liquidType = -1;
9735 if (impactSpeed > 0.0)
9736 {
9738 #ifndef SERVER
9740 #else
9742 SetSynchDirty();
9743 #endif
9745 }
9746 }
9747
9748 #ifdef SERVER
9749 if (GetCompEM() && GetCompEM().IsPlugged())
9750 {
9751 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9752 GetCompEM().UnplugThis();
9753 }
9754 #endif
9755 }
9756
9758
9760 {
9762 }
9763
9765 {
9766
9767 }
9768
9770 {
9771 super.OnItemLocationChanged(old_owner, new_owner);
9772
9773 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9774 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9775
9776 if (!relatedPlayer && playerNew)
9777 relatedPlayer = playerNew;
9778
9779 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9780 {
9782 if (actionMgr)
9783 {
9784 ActionBase currentAction = actionMgr.GetRunningAction();
9785 if (currentAction)
9787 }
9788 }
9789
9790 Man ownerPlayerOld = null;
9791 Man ownerPlayerNew = null;
9792
9793 if (old_owner)
9794 {
9795 if (old_owner.
IsMan())
9796 {
9797 ownerPlayerOld = Man.Cast(old_owner);
9798 }
9799 else
9800 {
9801 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9802 }
9803 }
9804 else
9805 {
9807 {
9809
9810 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9811 {
9812 GetCompEM().UnplugThis();
9813 }
9814 }
9815 }
9816
9817 if (new_owner)
9818 {
9819 if (new_owner.
IsMan())
9820 {
9821 ownerPlayerNew = Man.Cast(new_owner);
9822 }
9823 else
9824 {
9825 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9826 }
9827 }
9828
9829 if (ownerPlayerOld != ownerPlayerNew)
9830 {
9831 if (ownerPlayerOld)
9832 {
9833 array<EntityAI> subItemsExit = new array<EntityAI>;
9835 for (int i = 0; i < subItemsExit.Count(); i++)
9836 {
9839 }
9840 }
9841
9842 if (ownerPlayerNew)
9843 {
9844 array<EntityAI> subItemsEnter = new array<EntityAI>;
9846 for (int j = 0; j < subItemsEnter.Count(); j++)
9847 {
9850 }
9851 }
9852 }
9853 else if (ownerPlayerNew != null)
9854 {
9855 PlayerBase nplayer;
9856 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9857 {
9858 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9860 for (int k = 0; k < subItemsUpdate.Count(); k++)
9861 {
9863 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9864 }
9865 }
9866 }
9867
9868 if (old_owner)
9869 old_owner.OnChildItemRemoved(this);
9870 if (new_owner)
9871 new_owner.OnChildItemReceived(this);
9872 }
9873
9874
9876 {
9877 super.EEDelete(parent);
9878 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9879 if (player)
9880 {
9882
9883 if (player.IsAlive())
9884 {
9885 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9886 if (r_index >= 0)
9887 {
9888 InventoryLocation r_il = new InventoryLocation;
9889 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9890
9891 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9894 {
9895 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9896 }
9898 {
9899 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9900 }
9901
9902 }
9903
9904 player.RemoveQuickBarEntityShortcut(this);
9905 }
9906 }
9907 }
9908
9910 {
9911 super.EEKilled(killer);
9912
9915 {
9916 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9917 {
9918 if (IsMagazine())
9919 {
9920 if (Magazine.Cast(this).GetAmmoCount() > 0)
9921 {
9923 }
9924 }
9925 else
9926 {
9928 }
9929 }
9930 }
9931 }
9932
9934 {
9935 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9936
9937 super.OnWasAttached(parent, slot_id);
9938
9941
9944 }
9945
9947 {
9948 super.OnWasDetached(parent, slot_id);
9949
9952
9955 }
9956
9958 {
9959 int idx;
9962
9963 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9964 if (inventory_slots.Count() < 1)
9965 {
9966 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9967 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9968 }
9969 else
9970 {
9971 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9972 }
9973
9974 idx = inventory_slots.Find(slot);
9975 if (idx < 0)
9976 return "";
9977
9978 return attach_types.Get(idx);
9979 }
9980
9982 {
9983 int idx = -1;
9984 string slot;
9985
9988
9989 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9990 if (inventory_slots.Count() < 1)
9991 {
9992 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9993 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9994 }
9995 else
9996 {
9997 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9998 if (detach_types.Count() < 1)
9999 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10000 }
10001
10002 for (int i = 0; i < inventory_slots.Count(); i++)
10003 {
10004 slot = inventory_slots.Get(i);
10005 }
10006
10007 if (slot != "")
10008 {
10009 if (detach_types.Count() == 1)
10010 idx = 0;
10011 else
10012 idx = inventory_slots.Find(slot);
10013 }
10014 if (idx < 0)
10015 return "";
10016
10017 return detach_types.Get(idx);
10018 }
10019
10021 {
10022
10024
10025
10026 float min_time = 1;
10027 float max_time = 3;
10028 float delay = Math.RandomFloat(min_time, max_time);
10029
10030 explode_timer.Run(delay, this, "DoAmmoExplosion");
10031 }
10032
10034 {
10035 Magazine magazine = Magazine.Cast(this);
10036 int pop_sounds_count = 6;
10037 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10038
10039
10040 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10041 string sound_name = pop_sounds[ sound_idx ];
10042 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10043
10044
10045 magazine.ServerAddAmmoCount(-1);
10046
10047
10048 float min_temp_to_explode = 100;
10049
10050 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10051 {
10053 }
10054 }
10055
10056
10057 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10058 {
10059 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10060
10061 const int CHANCE_DAMAGE_CARGO = 4;
10062 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10063 const int CHANCE_DAMAGE_NOTHING = 2;
10064
10066 {
10067 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10068 int chances;
10069 int rnd;
10070
10071 if (GetInventory().GetCargo())
10072 {
10073 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10074 rnd = Math.RandomInt(0,chances);
10075
10076 if (rnd < CHANCE_DAMAGE_CARGO)
10077 {
10079 }
10080 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10081 {
10083 }
10084 }
10085 else
10086 {
10087 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10088 rnd = Math.RandomInt(0,chances);
10089
10090 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10091 {
10093 }
10094 }
10095 }
10096 }
10097
10099 {
10100 CargoBase cargo = GetInventory().GetCargo();
10101 if (cargo)
10102 {
10104 if (item_count > 0)
10105 {
10106 int random_pick = Math.RandomInt(0, item_count);
10108 if (!item.IsExplosive())
10109 {
10110 item.AddHealth("","",damage);
10111 return true;
10112 }
10113 }
10114 }
10115 return false;
10116 }
10117
10119 {
10120 GameInventory inventory = GetInventory();
10122 if (attachment_count > 0)
10123 {
10124 int random_pick = Math.RandomInt(0, attachment_count);
10126 if (!attachment.IsExplosive())
10127 {
10128 attachment.AddHealth("","",damage);
10129 return true;
10130 }
10131 }
10132 return false;
10133 }
10134
10136 {
10138 }
10139
10141 {
10143 return GetInventory().CanRemoveEntity();
10144
10145 return false;
10146 }
10147
10149 {
10150
10152 return false;
10153
10154
10156 return false;
10157
10158
10159
10161 if (delta == 0)
10162 return false;
10163
10164
10165 return true;
10166 }
10167
10169 {
10171 {
10172 if (ScriptInputUserData.CanStoreInputUserData())
10173 {
10174 ScriptInputUserData ctx = new ScriptInputUserData;
10179 ctx.
Write(destination_entity);
10181 ctx.
Write(slot_id);
10183 }
10184 }
10185 else if (!
g_Game.IsMultiplayer())
10186 {
10188 }
10189 }
10190
10192 {
10193 float split_quantity_new;
10197 InventoryLocation loc = new InventoryLocation;
10198
10199 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10200 {
10202 split_quantity_new = stack_max;
10203 else
10205
10207 {
10208 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10209 if (new_item)
10210 {
10211 new_item.SetResultOfSplit(true);
10212 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10214 new_item.
SetQuantity(split_quantity_new,
false,
true);
10215 }
10216 }
10217 }
10218 else if (destination_entity && slot_id == -1)
10219 {
10220 if (quantity > stack_max)
10221 split_quantity_new = stack_max;
10222 else
10223 split_quantity_new = quantity;
10224
10226 {
10227 GameInventory destinationInventory = destination_entity.GetInventory();
10229 {
10232 }
10233
10234 if (new_item)
10235 {
10236 new_item.SetResultOfSplit(true);
10237 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10239 new_item.
SetQuantity(split_quantity_new,
false,
true);
10240 }
10241 }
10242 }
10243 else
10244 {
10245 if (stack_max != 0)
10246 {
10248 {
10250 }
10251
10252 if (split_quantity_new == 0)
10253 {
10254 if (!
g_Game.IsMultiplayer())
10255 player.PhysicalPredictiveDropItem(this);
10256 else
10257 player.ServerDropEntity(this);
10258 return;
10259 }
10260
10262 {
10264
10265 if (new_item)
10266 {
10267 new_item.SetResultOfSplit(true);
10268 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10271 new_item.PlaceOnSurface();
10272 }
10273 }
10274 }
10275 }
10276 }
10277
10279 {
10280 float split_quantity_new;
10284 InventoryLocation loc = new InventoryLocation;
10285
10286 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10287 {
10289 split_quantity_new = stack_max;
10290 else
10292
10294 {
10295 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10296 if (new_item)
10297 {
10298 new_item.SetResultOfSplit(true);
10299 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10301 new_item.
SetQuantity(split_quantity_new,
false,
true);
10302 }
10303 }
10304 }
10305 else if (destination_entity && slot_id == -1)
10306 {
10307 if (quantity > stack_max)
10308 split_quantity_new = stack_max;
10309 else
10310 split_quantity_new = quantity;
10311
10313 {
10314 GameInventory destinationInventory = destination_entity.GetInventory();
10316 {
10319 }
10320
10321 if (new_item)
10322 {
10323 new_item.SetResultOfSplit(true);
10324 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10326 new_item.
SetQuantity(split_quantity_new,
false,
true);
10327 }
10328 }
10329 }
10330 else
10331 {
10332 if (stack_max != 0)
10333 {
10335 {
10337 }
10338
10340 {
10342
10343 if (new_item)
10344 {
10345 new_item.SetResultOfSplit(true);
10346 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10349 new_item.PlaceOnSurface();
10350 }
10351 }
10352 }
10353 }
10354 }
10355
10357 {
10359 {
10360 if (ScriptInputUserData.CanStoreInputUserData())
10361 {
10362 ScriptInputUserData ctx = new ScriptInputUserData;
10367 dst.WriteToContext(ctx);
10369 }
10370 }
10371 else if (!
g_Game.IsMultiplayer())
10372 {
10374 }
10375 }
10376
10378 {
10380 {
10381 if (ScriptInputUserData.CanStoreInputUserData())
10382 {
10383 ScriptInputUserData ctx = new ScriptInputUserData;
10388 ctx.
Write(destination_entity);
10394 }
10395 }
10396 else if (!
g_Game.IsMultiplayer())
10397 {
10399 }
10400 }
10401
10403 {
10405 }
10406
10408 {
10410 float split_quantity_new;
10412 if (dst.IsValid())
10413 {
10414 int slot_id = dst.GetSlot();
10416
10417 if (quantity > stack_max)
10418 split_quantity_new = stack_max;
10419 else
10420 split_quantity_new = quantity;
10421
10423 {
10425
10426 if (new_item)
10427 {
10428 new_item.SetResultOfSplit(true);
10429 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10431 new_item.
SetQuantity(split_quantity_new,
false,
true);
10432 }
10433
10434 return new_item;
10435 }
10436 }
10437
10438 return null;
10439 }
10440
10442 {
10444 float split_quantity_new;
10446 if (destination_entity)
10447 {
10449 if (quantity > stackable)
10450 split_quantity_new = stackable;
10451 else
10452 split_quantity_new = quantity;
10453
10455 {
10456 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10457 if (new_item)
10458 {
10459 new_item.SetResultOfSplit(true);
10460 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10462 new_item.
SetQuantity(split_quantity_new,
false,
true);
10463 }
10464 }
10465 }
10466 }
10467
10469 {
10471 {
10472 if (ScriptInputUserData.CanStoreInputUserData())
10473 {
10474 ScriptInputUserData ctx = new ScriptInputUserData;
10479 ItemBase destination_entity =
this;
10480 ctx.
Write(destination_entity);
10484 }
10485 }
10486 else if (!
g_Game.IsMultiplayer())
10487 {
10489 }
10490 }
10491
10493 {
10495 float split_quantity_new;
10497 if (player)
10498 {
10500 if (quantity > stackable)
10501 split_quantity_new = stackable;
10502 else
10503 split_quantity_new = quantity;
10504
10506 {
10507 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10508 new_item =
ItemBase.Cast(in_hands);
10509 if (new_item)
10510 {
10511 new_item.SetResultOfSplit(true);
10512 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10514 new_item.SetQuantity(split_quantity_new, false, true);
10515 }
10516 }
10517 }
10518 }
10519
10521 {
10523 float split_quantity_new = Math.Floor(quantity * 0.5);
10524
10526 return;
10527
10529
10530 if (new_item)
10531 {
10532 if (new_item.GetQuantityMax() < split_quantity_new)
10533 {
10534 split_quantity_new = new_item.GetQuantityMax();
10535 }
10536
10537 new_item.SetResultOfSplit(true);
10538 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10539
10541 {
10544 }
10545 else
10546 {
10548 new_item.
SetQuantity(split_quantity_new,
false,
true);
10549 }
10550 }
10551 }
10552
10554 {
10556 float split_quantity_new = Math.Floor(quantity / 2);
10557
10559 return;
10560
10561 InventoryLocation invloc = new InventoryLocation;
10563
10565 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10566
10567 if (new_item)
10568 {
10569 if (new_item.GetQuantityMax() < split_quantity_new)
10570 {
10571 split_quantity_new = new_item.GetQuantityMax();
10572 }
10574 {
10577 }
10578 else if (split_quantity_new > 1)
10579 {
10581 new_item.
SetQuantity(split_quantity_new,
false,
true);
10582 }
10583 }
10584 }
10585
10588 {
10589 SetWeightDirty();
10591
10592 if (parent)
10593 parent.OnAttachmentQuantityChangedEx(this, delta);
10594
10596 {
10598 {
10600 }
10602 {
10603 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10605 }
10606 }
10607 }
10608
10611 {
10612
10613 }
10614
10617 {
10619 }
10620
10622 {
10623 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10624
10626 {
10627 if (newLevel == GameConstants.STATE_RUINED)
10628 {
10630 EntityAI parent = GetHierarchyParent();
10631 if (parent && parent.IsFireplace())
10632 {
10633 CargoBase cargo = GetInventory().GetCargo();
10634 if (cargo)
10635 {
10637 {
10639 }
10640 }
10641 }
10642 }
10643
10645 {
10646
10648 return;
10649 }
10650
10651 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10652 {
10654 }
10655 }
10656 }
10657
10658
10660 {
10661 super.OnRightClick();
10662
10664 {
10666 {
10667 if (ScriptInputUserData.CanStoreInputUserData())
10668 {
10669 EntityAI root = GetHierarchyRoot();
10670 Man playerOwner = GetHierarchyRootPlayer();
10671 InventoryLocation dst = new InventoryLocation;
10672
10673
10674 if (!playerOwner && root && root == this)
10675 {
10677 }
10678 else
10679 {
10680
10681 GetInventory().GetCurrentInventoryLocation(dst);
10683 {
10684 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10686 {
10688 }
10689 else
10690 {
10692
10693
10694 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10695 {
10697 }
10698 else
10699 {
10700 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10701 }
10702 }
10703 }
10704 }
10705
10706 ScriptInputUserData ctx = new ScriptInputUserData;
10714 }
10715 }
10716 else if (!
g_Game.IsMultiplayer())
10717 {
10719 }
10720 }
10721 }
10722
10724 {
10725 if (root)
10726 {
10727 vector m4[4];
10728 root.GetTransform(m4);
10729 dst.SetGround(this, m4);
10730 }
10731 else
10732 {
10733 GetInventory().GetCurrentInventoryLocation(dst);
10734 }
10735 }
10736
10737 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10738 {
10739
10740 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10741 return false;
10742
10743 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10744 return false;
10745
10746
10748 return false;
10749
10750
10751 Magazine mag = Magazine.Cast(this);
10752 if (mag)
10753 {
10754 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10755 return false;
10756
10757 if (stack_max_limit)
10758 {
10759 Magazine other_mag = Magazine.Cast(other_item);
10760 if (other_item)
10761 {
10762 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10763 return false;
10764 }
10765
10766 }
10767 }
10768 else
10769 {
10770
10772 return false;
10773
10775 return false;
10776 }
10777
10778 PlayerBase player = null;
10779 if (CastTo(player, GetHierarchyRootPlayer()))
10780 {
10781 if (player.GetInventory().HasAttachment(this))
10782 return false;
10783
10784 if (player.IsItemsToDelete())
10785 return false;
10786 }
10787
10788 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10789 return false;
10790
10791 int slotID;
10793 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10794 return false;
10795
10796 return true;
10797 }
10798
10800 {
10802 }
10803
10805 {
10806 return m_IsResultOfSplit;
10807 }
10808
10810 {
10811 m_IsResultOfSplit = value;
10812 }
10813
10815 {
10817 }
10818
10820 {
10821 float other_item_quantity = other_item.GetQuantity();
10822 float this_free_space;
10823
10825
10827
10828 if (other_item_quantity > this_free_space)
10829 {
10830 return this_free_space;
10831 }
10832 else
10833 {
10834 return other_item_quantity;
10835 }
10836 }
10837
10839 {
10841 }
10842
10844 {
10846 return;
10847
10848 if (!IsMagazine() && other_item)
10849 {
10851 if (quantity_used != 0)
10852 {
10853 float hp1 = GetHealth01("","");
10854 float hp2 = other_item.GetHealth01("","");
10855 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10856 hpResult = hpResult / (
GetQuantity() + quantity_used);
10857
10858 hpResult *= GetMaxHealth();
10859 Math.Round(hpResult);
10860 SetHealth("", "Health", hpResult);
10861
10863 other_item.AddQuantity(-quantity_used);
10864 }
10865 }
10867 }
10868
10870 {
10871 #ifdef SERVER
10872 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10873 GetHierarchyParent().IncreaseLifetimeUp();
10874 #endif
10875 };
10876
10878 {
10879 PlayerBase p = PlayerBase.Cast(player);
10880
10881 array<int> recipesIds = p.m_Recipes;
10882 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10883 if (moduleRecipesManager)
10884 {
10885 EntityAI itemInHands = player.GetEntityInHands();
10886 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10887 }
10888
10889 for (int i = 0;i < recipesIds.Count(); i++)
10890 {
10891 int key = recipesIds.Get(i);
10892 string recipeName = moduleRecipesManager.GetRecipeName(key);
10894 }
10895 }
10896
10897
10898 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10899 {
10900 super.GetDebugActions(outputList);
10901
10902
10908
10909
10914
10919
10920
10924
10925
10927 {
10931 }
10932
10935
10936
10940
10942
10943 InventoryLocation loc = new InventoryLocation();
10944 GetInventory().GetCurrentInventoryLocation(loc);
10946 {
10947 if (Gizmo_IsSupported())
10950 }
10951
10953 }
10954
10955
10956
10957
10959 {
10960 super.OnAction(action_id, player, ctx);
10961
10963 {
10964 switch (action_id)
10965 {
10969 return true;
10973 return true;
10974 }
10975 }
10976
10978 {
10979 switch (action_id)
10980 {
10982 Delete();
10983 return true;
10984 }
10985 }
10986
10987 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10988 {
10989 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10990 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10991 PlayerBase p = PlayerBase.Cast(player);
10992 if (
EActions.RECIPES_RANGE_START < 1000)
10993 {
10994 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10995 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10996 }
10997 }
10998 #ifndef SERVER
10999 else if (action_id ==
EActions.WATCH_PLAYER)
11000 {
11001 PluginDeveloper.SetDeveloperItemClientEx(player);
11002 }
11003 #endif
11005 {
11006 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11007 {
11008 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11009 OnDebugButtonPressServer(id + 1);
11010 }
11011
11012 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11013 {
11014 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11016 }
11017
11018 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11019 {
11020 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11022 }
11023
11024 else if (action_id ==
EActions.ADD_QUANTITY)
11025 {
11026 if (IsMagazine())
11027 {
11028 Magazine mag = Magazine.Cast(this);
11029 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11030 }
11031 else
11032 {
11034 }
11035
11036 if (m_EM)
11037 {
11038 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11039 }
11040
11041 }
11042
11043 else if (action_id ==
EActions.REMOVE_QUANTITY)
11044 {
11045 if (IsMagazine())
11046 {
11047 Magazine mag2 = Magazine.Cast(this);
11048 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11049 }
11050 else
11051 {
11053 }
11054 if (m_EM)
11055 {
11056 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11057 }
11058
11059 }
11060
11061 else if (action_id ==
EActions.SET_QUANTITY_0)
11062 {
11064
11065 if (m_EM)
11066 {
11067 m_EM.SetEnergy(0);
11068 }
11069 }
11070
11071 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11072 {
11074
11075 if (m_EM)
11076 {
11077 m_EM.SetEnergy(m_EM.GetEnergyMax());
11078 }
11079 }
11080
11081 else if (action_id ==
EActions.ADD_HEALTH)
11082 {
11083 AddHealth("","",GetMaxHealth("","Health")/5);
11084 }
11085 else if (action_id ==
EActions.REMOVE_HEALTH)
11086 {
11087 AddHealth("","",-GetMaxHealth("","Health")/5);
11088 }
11089 else if (action_id ==
EActions.DESTROY_HEALTH)
11090 {
11091 SetHealth01("","",0);
11092 }
11093 else if (action_id ==
EActions.WATCH_ITEM)
11094 {
11096 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11097 #ifdef DEVELOPER
11098 SetDebugDeveloper_item(this);
11099 #endif
11100 }
11101
11102 else if (action_id ==
EActions.ADD_TEMPERATURE)
11103 {
11104 AddTemperature(20);
11105
11106 }
11107
11108 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11109 {
11110 AddTemperature(-20);
11111
11112 }
11113
11114 else if (action_id ==
EActions.FLIP_FROZEN)
11115 {
11116 SetFrozen(!GetIsFrozen());
11117
11118 }
11119
11120 else if (action_id ==
EActions.ADD_WETNESS)
11121 {
11123
11124 }
11125
11126 else if (action_id ==
EActions.REMOVE_WETNESS)
11127 {
11129
11130 }
11131
11132 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11133 {
11136
11137
11138 }
11139
11140 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11141 {
11144 }
11145
11146 else if (action_id ==
EActions.MAKE_SPECIAL)
11147 {
11148 auto debugParams = DebugSpawnParams.WithPlayer(player);
11149 OnDebugSpawnEx(debugParams);
11150 }
11151
11152 }
11153
11154
11155 return false;
11156 }
11157
11158
11159
11160
11164
11167
11168
11169
11171 {
11172 return false;
11173 }
11174
11175
11177 {
11178 return true;
11179 }
11180
11181
11183 {
11184 return true;
11185 }
11186
11187
11188
11190 {
11191 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11192 return g_Game.ConfigIsExisting(config_path);
11193 }
11194
11197 {
11198 return null;
11199 }
11200
11202 {
11203 return false;
11204 }
11205
11207 {
11208 return false;
11209 }
11210
11214
11215
11217 {
11218 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11219 return module_repairing.CanRepair(this, item_repair_kit);
11220 }
11221
11222
11223 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11224 {
11225 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11226 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11227 }
11228
11229
11231 {
11232
11233
11234
11235
11236
11237
11238
11239
11240 return 1;
11241 }
11242
11243
11244
11246 {
11248 }
11249
11250
11251
11253 {
11255 }
11256
11257
11266 {
11267 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11268
11269 if (player)
11270 {
11271 player.MessageStatus(text);
11272 }
11273 }
11274
11275
11284 {
11285 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11286
11287 if (player)
11288 {
11289 player.MessageAction(text);
11290 }
11291 }
11292
11293
11302 {
11303 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11304
11305 if (player)
11306 {
11307 player.MessageFriendly(text);
11308 }
11309 }
11310
11311
11320 {
11321 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11322
11323 if (player)
11324 {
11325 player.MessageImportant(text);
11326 }
11327 }
11328
11330 {
11331 return true;
11332 }
11333
11334
11335 override bool KindOf(
string tag)
11336 {
11337 bool found = false;
11338 string item_name = this.
GetType();
11340 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11341
11342 int array_size = item_tag_array.Count();
11343 for (int i = 0; i < array_size; i++)
11344 {
11345 if (item_tag_array.Get(i) == tag)
11346 {
11347 found = true;
11348 break;
11349 }
11350 }
11351 return found;
11352 }
11353
11354
11356 {
11357
11358 super.OnRPC(sender, rpc_type,ctx);
11359
11360
11361 switch (rpc_type)
11362 {
11363 #ifndef SERVER
11364 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11365 Param2<bool, string> p = new Param2<bool, string>(false, "");
11366
11368 return;
11369
11370 bool play = p.param1;
11371 string soundSet = p.param2;
11372
11373 if (play)
11374 {
11376 {
11378 {
11380 }
11381 }
11382 else
11383 {
11385 }
11386 }
11387 else
11388 {
11390 }
11391
11392 break;
11393 #endif
11394
11395 }
11396
11398 {
11400 }
11401 }
11402
11403
11404
11405
11407 {
11408 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11409 return plugin.GetID(
name);
11410 }
11411
11413 {
11414 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11415 return plugin.GetName(id);
11416 }
11417
11420 {
11421
11422
11423 int varFlags;
11424 if (!ctx.
Read(varFlags))
11425 return;
11426
11427 if (varFlags & ItemVariableFlags.FLOAT)
11428 {
11430 }
11431 }
11432
11434 {
11435
11436 super.SerializeNumericalVars(floats_out);
11437
11438
11439
11441 {
11443 }
11444
11446 {
11448 }
11449
11451 {
11453 }
11454
11456 {
11461 }
11462
11464 {
11466 }
11467 }
11468
11470 {
11471
11472 super.DeSerializeNumericalVars(floats);
11473
11474
11475 int index = 0;
11476 int mask = Math.Round(floats.Get(index));
11477
11478 index++;
11479
11481 {
11483 {
11485 }
11486 else
11487 {
11488 float quantity = floats.Get(index);
11489 SetQuantity(quantity,
true,
false,
false,
false);
11490 }
11491 index++;
11492 }
11493
11495 {
11496 float wet = floats.Get(index);
11498 index++;
11499 }
11500
11502 {
11503 int liquidtype = Math.Round(floats.Get(index));
11505 index++;
11506 }
11507
11509 {
11511 index++;
11513 index++;
11515 index++;
11517 index++;
11518 }
11519
11521 {
11522 int cleanness = Math.Round(floats.Get(index));
11524 index++;
11525 }
11526 }
11527
11529 {
11530 super.WriteVarsToCTX(ctx);
11531
11532
11534 {
11536 }
11537
11539 {
11541 }
11542
11544 {
11546 }
11547
11549 {
11550 int r,g,b,a;
11556 }
11557
11559 {
11561 }
11562 }
11563
11565 {
11566 if (!super.ReadVarsFromCTX(ctx,version))
11567 return false;
11568
11569 int intValue;
11570 float value;
11571
11572 if (version < 140)
11573 {
11574 if (!ctx.
Read(intValue))
11575 return false;
11576
11577 m_VariablesMask = intValue;
11578 }
11579
11581 {
11582 if (!ctx.
Read(value))
11583 return false;
11584
11586 {
11588 }
11589 else
11590 {
11592 }
11593 }
11594
11595 if (version < 140)
11596 {
11598 {
11599 if (!ctx.
Read(value))
11600 return false;
11601 SetTemperatureDirect(value);
11602 }
11603 }
11604
11606 {
11607 if (!ctx.
Read(value))
11608 return false;
11610 }
11611
11613 {
11614 if (!ctx.
Read(intValue))
11615 return false;
11617 }
11618
11620 {
11621 int r,g,b,a;
11623 return false;
11625 return false;
11627 return false;
11629 return false;
11630
11632 }
11633
11635 {
11636 if (!ctx.
Read(intValue))
11637 return false;
11639 }
11640
11641 if (version >= 138 && version < 140)
11642 {
11644 {
11645 if (!ctx.
Read(intValue))
11646 return false;
11647 SetFrozen(intValue);
11648 }
11649 }
11650
11651 return true;
11652 }
11653
11654
11656 {
11659 {
11661 }
11662
11663 if (!super.OnStoreLoad(ctx, version))
11664 {
11666 return false;
11667 }
11668
11669 if (version >= 114)
11670 {
11671 bool hasQuickBarIndexSaved;
11672
11673 if (!ctx.
Read(hasQuickBarIndexSaved))
11674 {
11676 return false;
11677 }
11678
11679 if (hasQuickBarIndexSaved)
11680 {
11681 int itmQBIndex;
11682
11683
11684 if (!ctx.
Read(itmQBIndex))
11685 {
11687 return false;
11688 }
11689
11690 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11691 if (itmQBIndex != -1 && parentPlayer)
11692 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11693 }
11694 }
11695 else
11696 {
11697
11698 PlayerBase player;
11699 int itemQBIndex;
11700 if (version ==
int.
MAX)
11701 {
11702 if (!ctx.
Read(itemQBIndex))
11703 {
11705 return false;
11706 }
11707 }
11708 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11709 {
11710
11711 if (!ctx.
Read(itemQBIndex))
11712 {
11714 return false;
11715 }
11716 if (itemQBIndex != -1 && player)
11717 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11718 }
11719 }
11720
11721 if (version < 140)
11722 {
11723
11724 if (!LoadVariables(ctx, version))
11725 {
11727 return false;
11728 }
11729 }
11730
11731
11733 {
11735 return false;
11736 }
11737 if (version >= 132)
11738 {
11740 if (raib)
11741 {
11743 {
11745 return false;
11746 }
11747 }
11748 }
11749
11751 return true;
11752 }
11753
11754
11755
11757 {
11758 super.OnStoreSave(ctx);
11759
11760 PlayerBase player;
11761 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11762 {
11764
11765 int itemQBIndex = -1;
11766 itemQBIndex = player.FindQuickBarEntityIndex(this);
11767 ctx.
Write(itemQBIndex);
11768 }
11769 else
11770 {
11772 }
11773
11775
11777 if (raib)
11778 {
11780 }
11781 }
11782
11783
11785 {
11786 super.AfterStoreLoad();
11787
11789 {
11791 }
11792
11794 {
11797 }
11798 }
11799
11801 {
11802 super.EEOnAfterLoad();
11803
11805 {
11807 }
11808
11811 }
11812
11814 {
11815 return false;
11816 }
11817
11818
11819
11821 {
11823 {
11824 #ifdef PLATFORM_CONSOLE
11825
11827 {
11829 if (menu)
11830 {
11832 }
11833 }
11834 #endif
11835 }
11836
11838 {
11841 }
11842
11844 {
11845 SetWeightDirty();
11847 }
11849 {
11852 }
11853
11855 {
11858
11861 }
11863 {
11867 }
11868
11869 super.OnVariablesSynchronized();
11870 }
11871
11872
11873
11875 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11876 {
11877 if (!IsServerCheck(allow_client))
11878 return false;
11879
11881 return false;
11882
11885
11886 if (value <= (min + 0.001))
11887 value = min;
11888
11889 if (value == min)
11890 {
11891 if (destroy_config)
11892 {
11893 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11894 if (dstr)
11895 {
11897 this.Delete();
11898 return true;
11899 }
11900 }
11901 else if (destroy_forced)
11902 {
11904 this.Delete();
11905 return true;
11906 }
11907
11909 }
11910
11913
11915 {
11916 EntityAI parent = GetHierarchyRoot();
11917 InventoryLocation iLoc = new InventoryLocation();
11918 GetInventory().GetCurrentInventoryLocation(iLoc);
11920 {
11921 int iLocSlot = iLoc.
GetSlot();
11923 {
11925 }
11927 {
11929 }
11930 }
11931 }
11932
11934 {
11936
11937 if (delta)
11939 }
11940
11942
11943 return false;
11944 }
11945
11946
11948 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11949 {
11951 }
11952
11954 {
11957 }
11958
11960 {
11963 }
11964
11966 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11967 {
11968 float value_clamped = Math.Clamp(value, 0, 1);
11970 SetQuantity(result, destroy_config, destroy_forced);
11971 }
11972
11973
11976 {
11978 }
11979
11981 {
11983 }
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11995 {
11996 int slot = -1;
11997 GameInventory inventory = GetInventory();
11998 if (inventory)
11999 {
12000 InventoryLocation il = new InventoryLocation;
12003 }
12004
12006 }
12007
12009 {
12010 float quantity_max = 0;
12011
12013 {
12014 if (attSlotID != -1)
12015 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12016
12017 if (quantity_max <= 0)
12019 }
12020
12021 if (quantity_max <= 0)
12023
12024 return quantity_max;
12025 }
12026
12028 {
12030 }
12031
12033 {
12035 }
12036
12037
12039 {
12041 }
12042
12044 {
12046 }
12047
12049 {
12051 }
12052
12053
12055 {
12056
12057 float weightEx = GetWeightEx();
12058 float special = GetInventoryAndCargoWeight();
12059 return weightEx - special;
12060 }
12061
12062
12064 {
12066 }
12067
12069 {
12071 {
12072 #ifdef DEVELOPER
12073 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12074 {
12075 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12077 }
12078 #endif
12079
12080 return GetQuantity() * GetConfigWeightModified();
12081 }
12082 else if (HasEnergyManager())
12083 {
12084 #ifdef DEVELOPER
12085 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12086 {
12087 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12088 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12089 }
12090 #endif
12091 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12092 }
12093 else
12094 {
12095 #ifdef DEVELOPER
12096 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12097 {
12098 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12099 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12100 }
12101 #endif
12102 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12103 }
12104 }
12105
12108 {
12109 int item_count = 0;
12111
12112 GameInventory inventory = GetInventory();
12113 CargoBase cargo = inventory.
GetCargo();
12114 if (cargo != NULL)
12115 {
12117 }
12118
12120 for (int i = 0; i < nAttachments; ++i)
12121 {
12123 if (item)
12124 item_count += item.GetNumberOfItems();
12125 }
12126 return item_count;
12127 }
12128
12131 {
12132 float weight = 0;
12133 float wetness = 1;
12134 if (include_wetness)
12137 {
12138 weight = wetness * m_ConfigWeight;
12139 }
12141 {
12142 weight = 1;
12143 }
12144 return weight;
12145 }
12146
12147
12148
12150 {
12151 GameInventory inventory = GetInventory();
12152 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12153 {
12154 array<EntityAI> items = new array<EntityAI>;
12156 for (int i = 0; i < items.Count(); ++i)
12157 {
12159 if (item)
12160 {
12161 g_Game.ObjectDelete(item);
12162 }
12163 }
12164 }
12165 }
12166
12167
12168
12169
12171 {
12172 float energy = 0;
12173 if (HasEnergyManager())
12174 {
12175 energy = GetCompEM().GetEnergy();
12176 }
12177 return energy;
12178 }
12179
12180
12182 {
12183 super.OnEnergyConsumed();
12184
12186 }
12187
12189 {
12190 super.OnEnergyAdded();
12191
12193 }
12194
12195
12197 {
12198 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12199 {
12201 {
12202 float energy_0to1 = GetCompEM().GetEnergy0To1();
12204 }
12205 }
12206 }
12207
12208
12210 {
12211 return ConfigGetFloat("heatIsolation");
12212 }
12213
12215 {
12217 }
12218
12220 {
12221 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12222 if (
g_Game.ConfigIsExisting(paramPath))
12223 return g_Game.ConfigGetFloat(paramPath);
12224
12225 return 0.0;
12226 }
12227
12229 {
12230 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12231 if (
g_Game.ConfigIsExisting(paramPath))
12232 return g_Game.ConfigGetFloat(paramPath);
12233
12234 return 0.0;
12235 }
12236
12237 override void SetWet(
float value,
bool allow_client =
false)
12238 {
12239 if (!IsServerCheck(allow_client))
12240 return;
12241
12244
12246
12247 m_VarWet = Math.Clamp(value, min, max);
12248
12250 {
12253 }
12254 }
12255
12256 override void AddWet(
float value)
12257 {
12259 }
12260
12262 {
12264 }
12265
12267 {
12269 }
12270
12272 {
12274 }
12275
12277 {
12279 }
12280
12282 {
12284 }
12285
12286 override void OnWetChanged(
float newVal,
float oldVal)
12287 {
12290 if (newLevel != oldLevel)
12291 {
12293 }
12294 }
12295
12297 {
12298 SetWeightDirty();
12299 }
12300
12302 {
12303 return GetWetLevelInternal(
m_VarWet);
12304 }
12305
12306
12307
12309 {
12311 }
12312
12314 {
12316 }
12317
12319 {
12321 }
12322
12324 {
12326 }
12327
12328
12329
12331 {
12332 if (ConfigIsExisting("itemModelLength"))
12333 {
12334 return ConfigGetFloat("itemModelLength");
12335 }
12336 return 0;
12337 }
12338
12340 {
12341 if (ConfigIsExisting("itemAttachOffset"))
12342 {
12343 return ConfigGetFloat("itemAttachOffset");
12344 }
12345 return 0;
12346 }
12347
12348 override void SetCleanness(
int value,
bool allow_client =
false)
12349 {
12350 if (!IsServerCheck(allow_client))
12351 return;
12352
12354
12356
12359 }
12360
12362 {
12364 }
12365
12367 {
12368 return true;
12369 }
12370
12371
12372
12373
12375 {
12377 }
12378
12380 {
12382 }
12383
12384
12385
12386
12387 override void SetColor(
int r,
int g,
int b,
int a)
12388 {
12394 }
12396 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12397 {
12402 }
12403
12405 {
12407 }
12408
12411 {
12412 int r,g,b,a;
12414 r = r/255;
12415 g = g/255;
12416 b = b/255;
12417 a = a/255;
12418 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12419 }
12420
12421
12422
12423 override void SetLiquidType(
int value,
bool allow_client =
false)
12424 {
12425 if (!IsServerCheck(allow_client))
12426 return;
12427
12432 }
12433
12435 {
12436 return ConfigGetInt("varLiquidTypeInit");
12437 }
12438
12440 {
12442 }
12443
12445 {
12447 SetFrozen(false);
12448 }
12449
12452 {
12453 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12454 }
12455
12456
12459 {
12460 PlayerBase nplayer;
12461 if (PlayerBase.CastTo(nplayer, player))
12462 {
12464 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12465 }
12466 }
12467
12468
12471 {
12472 PlayerBase nplayer;
12473 if (PlayerBase.CastTo(nplayer,player))
12474 {
12475 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12476 }
12477
12478 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12479
12480 if (HasEnergyManager())
12481 {
12482 GetCompEM().UpdatePlugState();
12483 }
12484 }
12485
12486
12488 {
12489 super.OnPlacementStarted(player);
12490
12492 }
12493
12494 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12495 {
12497 {
12498 m_AdminLog.OnPlacementComplete(player,
this);
12499 }
12500
12501 super.OnPlacementComplete(player, position, orientation);
12502 }
12503
12504
12505
12506
12507
12509 {
12511 {
12512 return true;
12513 }
12514 else
12515 {
12516 return false;
12517 }
12518 }
12519
12520
12522 {
12524 {
12526 }
12527 }
12528
12529
12531 {
12533 }
12534
12536 {
12538 }
12539
12540 override void InsertAgent(
int agent,
float count = 1)
12541 {
12542 if (count < 1)
12543 return;
12544
12546 }
12547
12550 {
12552 }
12553
12554
12556 {
12558 }
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12602 {
12604 return false;
12605 return true;
12606 }
12607
12609 {
12610
12612 }
12613
12614
12617 {
12618 super.CheckForRoofLimited(timeTresholdMS);
12619
12620 float time =
g_Game.GetTime();
12621 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12622 {
12623 m_PreviousRoofTestTime = time;
12624 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12625 }
12626 }
12627
12628
12630 {
12632 {
12633 return 0;
12634 }
12635
12636 if (GetInventory().GetAttachmentSlotsCount() != 0)
12637 {
12638 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12639 if (filter)
12640 return filter.GetProtectionLevel(type, false, system);
12641 else
12642 return 0;
12643 }
12644
12645 string subclassPath, entryName;
12646
12647 switch (type)
12648 {
12650 entryName = "biological";
12651 break;
12653 entryName = "chemical";
12654 break;
12655 default:
12656 entryName = "biological";
12657 break;
12658 }
12659
12660 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12661
12662 return g_Game.ConfigGetFloat(subclassPath + entryName);
12663 }
12664
12665
12666
12669 {
12670 if (!IsMagazine())
12672
12674 }
12675
12676
12677
12678
12679
12684 {
12685 return true;
12686 }
12687
12689 {
12691 }
12692
12693
12694
12695
12696
12698 {
12699 if (parent)
12700 {
12701 if (parent.IsInherited(DayZInfected))
12702 return true;
12703
12704 if (!parent.IsRuined())
12705 return true;
12706 }
12707
12708 return true;
12709 }
12710
12712 {
12713 if (!super.CanPutAsAttachment(parent))
12714 {
12715 return false;
12716 }
12717
12718 if (!IsRuined() && !parent.IsRuined())
12719 {
12720 return true;
12721 }
12722
12723 return false;
12724 }
12725
12727 {
12728
12729
12730
12731
12732 return super.CanReceiveItemIntoCargo(item);
12733 }
12734
12736 {
12737
12738
12739
12740
12741 GameInventory attachmentInv = attachment.GetInventory();
12743 {
12744 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12745 return false;
12746 }
12747
12748 InventoryLocation loc = new InventoryLocation();
12749 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12750 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12751 return false;
12752
12753 return super.CanReceiveAttachment(attachment, slotId);
12754 }
12755
12757 {
12758 if (!super.CanReleaseAttachment(attachment))
12759 return false;
12760
12761 return GetInventory().AreChildrenAccessible();
12762 }
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12785 {
12786 int id = muzzle_owner.GetMuzzleID();
12787 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12788
12789 if (WPOF_array)
12790 {
12791 for (int i = 0; i < WPOF_array.Count(); i++)
12792 {
12793 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12794
12795 if (WPOF)
12796 {
12797 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12798 }
12799 }
12800 }
12801 }
12802
12803
12805 {
12806 int id = muzzle_owner.GetMuzzleID();
12808
12809 if (WPOBE_array)
12810 {
12811 for (int i = 0; i < WPOBE_array.Count(); i++)
12812 {
12813 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12814
12815 if (WPOBE)
12816 {
12817 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12818 }
12819 }
12820 }
12821 }
12822
12823
12825 {
12826 int id = muzzle_owner.GetMuzzleID();
12827 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12828
12829 if (WPOOH_array)
12830 {
12831 for (int i = 0; i < WPOOH_array.Count(); i++)
12832 {
12833 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12834
12835 if (WPOOH)
12836 {
12837 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12838 }
12839 }
12840 }
12841 }
12842
12843
12845 {
12846 int id = muzzle_owner.GetMuzzleID();
12847 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12848
12849 if (WPOOH_array)
12850 {
12851 for (int i = 0; i < WPOOH_array.Count(); i++)
12852 {
12853 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12854
12855 if (WPOOH)
12856 {
12857 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12858 }
12859 }
12860 }
12861 }
12862
12863
12865 {
12866 int id = muzzle_owner.GetMuzzleID();
12867 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12868
12869 if (WPOOH_array)
12870 {
12871 for (int i = 0; i < WPOOH_array.Count(); i++)
12872 {
12873 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12874
12875 if (WPOOH)
12876 {
12877 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12878 }
12879 }
12880 }
12881 }
12882
12883
12884
12886 {
12888 {
12889 return true;
12890 }
12891
12892 return false;
12893 }
12894
12896 {
12898 {
12899 return true;
12900 }
12901
12902 return false;
12903 }
12904
12906 {
12908 {
12909 return true;
12910 }
12911
12912 return false;
12913 }
12914
12916 {
12917 return false;
12918 }
12919
12922 {
12923 return UATimeSpent.DEFAULT_DEPLOY;
12924 }
12925
12926
12927
12928
12930 {
12932 SetSynchDirty();
12933 }
12934
12936 {
12938 }
12939
12940
12942 {
12943 return false;
12944 }
12945
12948 {
12949 string att_type = "None";
12950
12951 if (ConfigIsExisting("soundAttType"))
12952 {
12953 att_type = ConfigGetString("soundAttType");
12954 }
12955
12957 }
12958
12960 {
12962 }
12963
12964
12965
12966
12967
12973
12975 {
12978
12980 }
12981
12982
12984 {
12986 return;
12987
12989
12992
12995
12996 SoundParameters params = new SoundParameters();
13000 }
13001
13002
13004 {
13006 {
13009
13010 SetSynchDirty();
13011
13014 }
13015 }
13016
13018 {
13020 }
13021
13022
13024 {
13026 return;
13027
13029 SetSynchDirty();
13030
13033 }
13034
13036 {
13039 }
13040
13042 {
13044 }
13045
13046 void OnApply(PlayerBase player);
13047
13049 {
13050 return 1.0;
13051 };
13052
13054 {
13056 }
13057
13059 {
13061 }
13062
13064
13066 {
13067 SetDynamicPhysicsLifeTime(0.01);
13069 }
13070
13072 {
13073 array<string> zone_names = new array<string>;
13074 GetDamageZones(zone_names);
13075 for (int i = 0; i < zone_names.Count(); i++)
13076 {
13077 SetHealthMax(zone_names.Get(i),"Health");
13078 }
13079 SetHealthMax("","Health");
13080 }
13081
13084 {
13085 float global_health = GetHealth01("","Health");
13086 array<string> zones = new array<string>;
13087 GetDamageZones(zones);
13088
13089 for (int i = 0; i < zones.Count(); i++)
13090 {
13091 SetHealth01(zones.Get(i),"Health",global_health);
13092 }
13093 }
13094
13097 {
13098 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13099 }
13100
13102 {
13103 if (!hasRootAsPlayer)
13104 {
13105 if (refParentIB)
13106 {
13107
13108 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13109 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13110
13111 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13112 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13113
13116 }
13117 else
13118 {
13119
13122 }
13123 }
13124 }
13125
13127 {
13129 {
13130 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13131 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13132 {
13133 float heatPermCoef = 1.0;
13135 while (ent)
13136 {
13137 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13138 ent = ent.GetHierarchyParent();
13139 }
13140
13141 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13142 }
13143 }
13144 }
13145
13147 {
13148
13149 EntityAI parent = GetHierarchyParent();
13150 if (!parent)
13151 {
13152 hasParent = false;
13153 hasRootAsPlayer = false;
13154 }
13155 else
13156 {
13157 hasParent = true;
13158 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13159 refParentIB =
ItemBase.Cast(parent);
13160 }
13161 }
13162
13163 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13164 {
13165
13166 }
13167
13169 {
13170
13171 return false;
13172 }
13173
13175 {
13176
13177
13178 return false;
13179 }
13180
13182 {
13183
13184 return false;
13185 }
13186
13189 {
13190 return !GetIsFrozen() &&
IsOpen();
13191 }
13192
13194 {
13195 bool hasParent = false, hasRootAsPlayer = false;
13197
13198 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13199 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13200
13201 if (wwtu || foodDecay)
13202 {
13206
13207 if (processWetness || processTemperature || processDecay)
13208 {
13210
13211 if (processWetness)
13212 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13213
13214 if (processTemperature)
13216
13217 if (processDecay)
13218 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13219 }
13220 }
13221 }
13222
13225 {
13227 }
13228
13230 {
13233
13234 return super.GetTemperatureFreezeThreshold();
13235 }
13236
13238 {
13241
13242 return super.GetTemperatureThawThreshold();
13243 }
13244
13246 {
13249
13250 return super.GetItemOverheatThreshold();
13251 }
13252
13254 {
13256 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13257
13258 return super.GetTemperatureFreezeTime();
13259 }
13260
13262 {
13264 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13265
13266 return super.GetTemperatureThawTime();
13267 }
13268
13273
13275 {
13276 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13277 }
13278
13280 {
13281 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13282 }
13283
13286 {
13288 }
13289
13291 {
13293 }
13294
13296 {
13298 }
13299
13302 {
13303 return null;
13304 }
13305
13308 {
13309 return false;
13310 }
13311
13313 {
13315 {
13318 if (!trg)
13319 {
13321 explosive = this;
13322 }
13323
13324 explosive.PairRemote(trg);
13326
13327 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13328 trg.SetPersistentPairID(persistentID);
13329 explosive.SetPersistentPairID(persistentID);
13330
13331 return true;
13332 }
13333 return false;
13334 }
13335
13338 {
13339 float ret = 1.0;
13342 ret *= GetHealth01();
13343
13344 return ret;
13345 }
13346
13347 #ifdef DEVELOPER
13348 override void SetDebugItem()
13349 {
13350 super.SetDebugItem();
13351 _itemBase = this;
13352 }
13353
13355 {
13356 string text = super.GetDebugText();
13357
13359 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13360
13361 return text;
13362 }
13363 #endif
13364
13366 {
13367 return true;
13368 }
13369
13371
13373
13375 {
13378 }
13379
13380
13388
13404
13405 [
Obsolete(
"Use ItemSoundHandler instead")]
13408 {
13409 if (!
g_Game.IsDedicatedServer())
13410 {
13411 if (ConfigIsExisting("attachSoundSet"))
13412 {
13413 string cfg_path = "";
13414 string soundset = "";
13415 string type_name =
GetType();
13416
13419 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13420 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13421
13422 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13423 {
13424 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13425 {
13426 if (cfg_slot_array[i] == slot_type)
13427 {
13428 soundset = cfg_soundset_array[i];
13429 break;
13430 }
13431 }
13432 }
13433
13434 if (soundset != "")
13435 {
13436 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13438 }
13439 }
13440 }
13441 }
13442
13444}
13445
13447{
13449 if (entity)
13450 {
13451 bool is_item = entity.IsInherited(
ItemBase);
13452 if (is_item && full_quantity)
13453 {
13456 }
13457 }
13458 else
13459 {
13461 return NULL;
13462 }
13463 return entity;
13464}
13465
13467{
13468 if (item)
13469 {
13470 if (health > 0)
13471 item.SetHealth("", "", health);
13472
13473 if (item.CanHaveTemperature())
13474 {
13476 if (item.CanFreeze())
13477 item.SetFrozen(false);
13478 }
13479
13480 if (item.HasEnergyManager())
13481 {
13482 if (quantity >= 0)
13483 {
13484 item.GetCompEM().SetEnergy0To1(quantity);
13485 }
13486 else
13487 {
13489 }
13490 }
13491 else if (item.IsMagazine())
13492 {
13493 Magazine mag = Magazine.Cast(item);
13494 if (quantity >= 0)
13495 {
13496 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13497 }
13498 else
13499 {
13501 }
13502
13503 }
13504 else
13505 {
13506 if (quantity >= 0)
13507 {
13508 item.SetQuantityNormalized(quantity, false);
13509 }
13510 else
13511 {
13513 }
13514
13515 }
13516 }
13517}
13518
13519#ifdef DEVELOPER
13521#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.