8556{
8558 {
8559 return true;
8560 }
8561};
8562
8564{
8565
8566};
8567
8568
8569
8571{
8575
8577
8580
8581
8582
8583
8584
8593
8599
8604
8609
8630 protected bool m_IsResultOfSplit
8631
8633
8638
8639
8640
8642
8646
8647
8648
8650
8653
8654
8655
8661
8662
8670
8673
8674
8676
8677
8679
8680
8685
8686
8691
8693
8694
8696
8697
8699 {
8704
8705 if (!
g_Game.IsDedicatedServer())
8706 {
8708 {
8710
8712 {
8714 }
8715 }
8716
8719 }
8720
8721 m_OldLocation = null;
8722
8724 {
8726 }
8727
8728 if (ConfigIsExisting("headSelectionsToHide"))
8729 {
8732 }
8733
8735 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8736 {
8738 }
8739
8741
8742 m_IsResultOfSplit = false;
8743
8745 }
8746
8748 {
8749 super.InitItemVariables();
8750
8756 m_Count = ConfigGetInt(
"count");
8757
8760
8765
8768
8773
8785
8789
8790
8793 if (ConfigIsExisting("canBeSplit"))
8794 {
8797 }
8798
8800 if (ConfigIsExisting("itemBehaviour"))
8802
8803
8806 RegisterNetSyncVariableInt("m_VarLiquidType");
8807 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8808
8809 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8810 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8811 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8812
8813 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8814 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8815 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8816 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8817
8818 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8819 RegisterNetSyncVariableBool("m_IsTakeable");
8820 RegisterNetSyncVariableBool("m_IsHologram");
8821
8824 {
8827 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8828 }
8829
8831
8833 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8835
8837 }
8838
8840 {
8842 }
8843
8845 {
8848 {
8853 }
8854 }
8855
8856 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8857 {
8859 {
8862 }
8863
8865 }
8866
8868 {
8874 }
8875
8877
8879 {
8881
8882 if (!action)
8883 {
8884 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8885 return;
8886 }
8887
8889 if (!ai)
8890 {
8892 return;
8893 }
8894
8896 if (!action_array)
8897 {
8898 action_array = new array<ActionBase_Basic>;
8900 }
8901 if (LogManager.IsActionLogEnable())
8902 {
8903 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8904 }
8905
8906 if (action_array.Find(action) != -1)
8907 {
8908 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8909 }
8910 else
8911 {
8912 action_array.Insert(action);
8913 }
8914 }
8915
8917 {
8918 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8919 ActionBase action = player.GetActionManager().GetAction(actionName);
8922
8923 if (action_array)
8924 {
8925 action_array.RemoveItem(action);
8926 }
8927 }
8928
8929
8930
8932 {
8933 ActionOverrideData overrideData = new ActionOverrideData();
8937
8939 if (!actionMap)
8940 {
8943 }
8944
8945 actionMap.Insert(this.
Type(), overrideData);
8946
8947 }
8948
8950
8952
8953
8955 {
8958
8961
8962 string config_to_search = "CfgVehicles";
8963 string muzzle_owner_config;
8964
8966 {
8967 if (IsInherited(Weapon))
8968 config_to_search = "CfgWeapons";
8969
8970 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8971
8972 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8973
8974 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8975
8976 if (config_OnFire_subclass_count > 0)
8977 {
8978 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8979
8980 for (int i = 0; i < config_OnFire_subclass_count; i++)
8981 {
8982 string particle_class = "";
8983 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8984 string config_OnFire_entry = config_OnFire_class + particle_class;
8985 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8986 WPOF_array.Insert(WPOF);
8987 }
8988
8989
8991 }
8992 }
8993
8995 {
8996 config_to_search = "CfgWeapons";
8997 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8998
8999 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9000
9001 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9002
9003 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9004 {
9005 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9006
9007 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9008 {
9009 string particle_class2 = "";
9010 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9011 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9012 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9013 WPOBE_array.Insert(WPOBE);
9014 }
9015
9016
9018 }
9019 }
9020 }
9021
9022
9024 {
9027
9029 {
9030 string config_to_search = "CfgVehicles";
9031
9032 if (IsInherited(Weapon))
9033 config_to_search = "CfgWeapons";
9034
9035 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9036 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9037
9038 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9039 {
9040
9042
9044 {
9046 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9048 return;
9049 }
9050
9053
9054
9055
9056 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9057 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9058
9059 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9060 {
9061 string particle_class = "";
9062 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9063 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9064 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9065
9066 if (entry_type == CT_CLASS)
9067 {
9068 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9069 WPOOH_array.Insert(WPOF);
9070 }
9071 }
9072
9073
9075 }
9076 }
9077 }
9078
9080 {
9082 }
9083
9085 {
9087 {
9089
9092
9095
9096 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9097 }
9098 }
9099
9101 {
9103 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9104
9106 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9107
9109 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9110
9112 {
9114 }
9115 }
9116
9118 {
9120 }
9121
9123 {
9126 else
9128
9130 {
9133 }
9134 else
9135 {
9138
9141 }
9142
9144 }
9145
9147 {
9149 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9150 }
9151
9153 {
9155 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9157 }
9158
9160 {
9162 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9163 }
9164
9166 {
9169
9170 OverheatingParticle OP = new OverheatingParticle();
9175
9177 }
9178
9180 {
9183
9184 return -1;
9185 }
9186
9188 {
9190 {
9193
9194 for (int i = count; i > 0; --i)
9195 {
9196 int id = i - 1;
9199
9202
9203 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9204 {
9205 if (p)
9206 {
9209 }
9210 }
9211 }
9212 }
9213 }
9214
9216 {
9218 {
9220 {
9221 int id = i - 1;
9223
9224 if (OP)
9225 {
9227
9228 if (p)
9229 {
9231 }
9232
9233 delete OP;
9234 }
9235 }
9236
9239 }
9240 }
9241
9244 {
9245 return 0.0;
9246 }
9247
9248
9250 {
9251 return 250;
9252 }
9253
9255 {
9256 return 0;
9257 }
9258
9261 {
9263 return true;
9264
9265 return false;
9266 }
9267
9270 {
9273
9275 {
9277 }
9278 else
9279 {
9280
9282 }
9283
9285 }
9286
9293 {
9294 return -1;
9295 }
9296
9297
9298
9299
9301 {
9303 {
9304 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9305 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9306
9307 if (r_index >= 0)
9308 {
9309 InventoryLocation r_il = new InventoryLocation;
9310 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9311
9312 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9315 {
9316 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9317 }
9319 {
9320 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9321 }
9322
9323 }
9324
9325 player.GetHumanInventory().ClearUserReservedLocation(this);
9326 }
9327
9330 }
9331
9332
9333
9334
9336 {
9337 return ItemBase.m_DebugActionsMask;
9338 }
9339
9341 {
9342 return ItemBase.m_DebugActionsMask & mask;
9343 }
9344
9346 {
9347 ItemBase.m_DebugActionsMask = mask;
9348 }
9349
9351 {
9352 ItemBase.m_DebugActionsMask |= mask;
9353 }
9354
9356 {
9357 ItemBase.m_DebugActionsMask &= ~mask;
9358 }
9359
9361 {
9363 {
9365 }
9366 else
9367 {
9369 }
9370 }
9371
9372
9374 {
9375 if (GetEconomyProfile())
9376 {
9377 float q_max = GetEconomyProfile().GetQuantityMax();
9378 if (q_max > 0)
9379 {
9380 float q_min = GetEconomyProfile().GetQuantityMin();
9381 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9382
9384 {
9385 ComponentEnergyManager comp = GetCompEM();
9387 {
9389 }
9390 }
9392 {
9394
9395 }
9396
9397 }
9398 }
9399 }
9400
9403 {
9404 EntityAI parent = GetHierarchyParent();
9405
9406 if (parent)
9407 {
9408 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9409 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9410 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9411 }
9412 }
9413
9416 {
9417 EntityAI parent = GetHierarchyParent();
9418
9419 if (parent)
9420 {
9421 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9422 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9423 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9424 }
9425 }
9426
9428 {
9429
9430
9431
9432
9434
9436 {
9437 if (ScriptInputUserData.CanStoreInputUserData())
9438 {
9439 ScriptInputUserData ctx = new ScriptInputUserData;
9445 ctx.
Write(use_stack_max);
9448
9450 {
9451 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9452 }
9453 }
9454 }
9455 else if (!
g_Game.IsMultiplayer())
9456 {
9458 }
9459 }
9460
9462 {
9464 }
9465
9467 {
9469 }
9470
9472 {
9474 }
9475
9477 {
9478
9479 return false;
9480 }
9481
9483 {
9484 return false;
9485 }
9486
9490 {
9491 return false;
9492 }
9493
9495 {
9496 return "";
9497 }
9498
9500
9502 {
9503 return false;
9504 }
9505
9507 {
9508 return true;
9509 }
9510
9511
9512
9514 {
9515 return true;
9516 }
9517
9519 {
9520 return true;
9521 }
9522
9524 {
9525 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9527 }
9528
9530 {
9532 }
9533
9535 {
9537 if (!is_being_placed)
9539 SetSynchDirty();
9540 }
9541
9542
9544
9546 {
9548 }
9549
9551 {
9553 }
9554
9556 {
9557 return 1;
9558 }
9559
9561 {
9562 return false;
9563 }
9564
9566 {
9568 SetSynchDirty();
9569 }
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9606 {
9607 super.OnMovedInsideCargo(container);
9608
9609 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9610 }
9611
9612 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9613 {
9614 super.EEItemLocationChanged(oldLoc, newLoc);
9615
9616 PlayerBase newPlayer = null;
9617 PlayerBase oldPlayer = null;
9618
9619 if (newLoc.GetParent())
9620 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9621
9622 if (oldLoc.GetParent())
9623 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9624
9626 {
9627 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9628
9629 if (rIndex >= 0)
9630 {
9631 InventoryLocation rIl = new InventoryLocation;
9632 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9633
9634 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9637 {
9638 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9639 }
9641 {
9643 }
9644
9645 }
9646 }
9647
9649 {
9650 if (newPlayer)
9651 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9652
9653 if (newPlayer == oldPlayer)
9654 {
9655 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9656 {
9658 {
9659 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9660 {
9661 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9662 }
9663 }
9664 else
9665 {
9666 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9667 }
9668 }
9669
9670 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9671 {
9672 int type = oldLoc.GetType();
9674 {
9675 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9676 }
9678 {
9679 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9680 }
9681 }
9682 if (!m_OldLocation)
9683 {
9684 m_OldLocation = new InventoryLocation;
9685 }
9686 m_OldLocation.Copy(oldLoc);
9687 }
9688 else
9689 {
9690 if (m_OldLocation)
9691 {
9692 m_OldLocation.Reset();
9693 }
9694 }
9695
9696 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9697 }
9698 else
9699 {
9700 if (newPlayer)
9701 {
9702 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9703 if (resIndex >= 0)
9704 {
9705 InventoryLocation il = new InventoryLocation;
9706 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9708 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9711 {
9712 il.
GetParent().GetOnReleaseLock().Invoke(it);
9713 }
9715 {
9717 }
9718
9719 }
9720 }
9722 {
9723
9725 }
9726
9727 if (m_OldLocation)
9728 {
9729 m_OldLocation.Reset();
9730 }
9731 }
9732
9734 {
9735 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9736 }
9737
9739 {
9740 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9741 }
9742 }
9743
9744 override void EOnContact(IEntity other, Contact extra)
9745 {
9747 {
9748 int liquidType = -1;
9750 if (impactSpeed > 0.0)
9751 {
9753 #ifndef SERVER
9755 #else
9757 SetSynchDirty();
9758 #endif
9760 }
9761 }
9762
9763 #ifdef SERVER
9764 if (GetCompEM() && GetCompEM().IsPlugged())
9765 {
9766 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9767 GetCompEM().UnplugThis();
9768 }
9769 #endif
9770 }
9771
9773
9775 {
9777 }
9778
9780 {
9781
9782 }
9783
9785 {
9786 super.OnItemLocationChanged(old_owner, new_owner);
9787
9788 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9789 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9790
9791 if (!relatedPlayer && playerNew)
9792 relatedPlayer = playerNew;
9793
9794 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9795 {
9797 if (actionMgr)
9798 {
9799 ActionBase currentAction = actionMgr.GetRunningAction();
9800 if (currentAction)
9802 }
9803 }
9804
9805 Man ownerPlayerOld = null;
9806 Man ownerPlayerNew = null;
9807
9808 if (old_owner)
9809 {
9810 if (old_owner.
IsMan())
9811 {
9812 ownerPlayerOld = Man.Cast(old_owner);
9813 }
9814 else
9815 {
9816 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9817 }
9818 }
9819 else
9820 {
9822 {
9824
9825 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9826 {
9827 GetCompEM().UnplugThis();
9828 }
9829 }
9830 }
9831
9832 if (new_owner)
9833 {
9834 if (new_owner.
IsMan())
9835 {
9836 ownerPlayerNew = Man.Cast(new_owner);
9837 }
9838 else
9839 {
9840 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9841 }
9842 }
9843
9844 if (ownerPlayerOld != ownerPlayerNew)
9845 {
9846 if (ownerPlayerOld)
9847 {
9848 array<EntityAI> subItemsExit = new array<EntityAI>;
9850 for (int i = 0; i < subItemsExit.Count(); i++)
9851 {
9854 }
9855 }
9856
9857 if (ownerPlayerNew)
9858 {
9859 array<EntityAI> subItemsEnter = new array<EntityAI>;
9861 for (int j = 0; j < subItemsEnter.Count(); j++)
9862 {
9865 }
9866 }
9867 }
9868 else if (ownerPlayerNew != null)
9869 {
9870 PlayerBase nplayer;
9871 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9872 {
9873 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9875 for (int k = 0; k < subItemsUpdate.Count(); k++)
9876 {
9878 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9879 }
9880 }
9881 }
9882
9883 if (old_owner)
9884 old_owner.OnChildItemRemoved(this);
9885 if (new_owner)
9886 new_owner.OnChildItemReceived(this);
9887 }
9888
9889
9891 {
9892 super.EEDelete(parent);
9893 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9894 if (player)
9895 {
9897
9898 if (player.IsAlive())
9899 {
9900 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9901 if (r_index >= 0)
9902 {
9903 InventoryLocation r_il = new InventoryLocation;
9904 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9905
9906 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9909 {
9910 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9911 }
9913 {
9914 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9915 }
9916
9917 }
9918
9919 player.RemoveQuickBarEntityShortcut(this);
9920 }
9921 }
9922 }
9923
9925 {
9926 super.EEKilled(killer);
9927
9930 {
9931 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9932 {
9933 if (IsMagazine())
9934 {
9935 if (Magazine.Cast(this).GetAmmoCount() > 0)
9936 {
9938 }
9939 }
9940 else
9941 {
9943 }
9944 }
9945 }
9946 }
9947
9949 {
9950 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9951
9952 super.OnWasAttached(parent, slot_id);
9953
9956
9959 }
9960
9962 {
9963 super.OnWasDetached(parent, slot_id);
9964
9967
9970 }
9971
9973 {
9974 int idx;
9977
9978 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9979 if (inventory_slots.Count() < 1)
9980 {
9981 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9982 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9983 }
9984 else
9985 {
9986 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9987 }
9988
9989 idx = inventory_slots.Find(slot);
9990 if (idx < 0)
9991 return "";
9992
9993 return attach_types.Get(idx);
9994 }
9995
9997 {
9998 int idx = -1;
9999 string slot;
10000
10003
10004 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10005 if (inventory_slots.Count() < 1)
10006 {
10007 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10008 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10009 }
10010 else
10011 {
10012 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10013 if (detach_types.Count() < 1)
10014 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10015 }
10016
10017 for (int i = 0; i < inventory_slots.Count(); i++)
10018 {
10019 slot = inventory_slots.Get(i);
10020 }
10021
10022 if (slot != "")
10023 {
10024 if (detach_types.Count() == 1)
10025 idx = 0;
10026 else
10027 idx = inventory_slots.Find(slot);
10028 }
10029 if (idx < 0)
10030 return "";
10031
10032 return detach_types.Get(idx);
10033 }
10034
10036 {
10037
10039
10040
10041 float min_time = 1;
10042 float max_time = 3;
10043 float delay = Math.RandomFloat(min_time, max_time);
10044
10045 explode_timer.Run(delay, this, "DoAmmoExplosion");
10046 }
10047
10049 {
10050 Magazine magazine = Magazine.Cast(this);
10051 int pop_sounds_count = 6;
10052 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10053
10054
10055 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10056 string sound_name = pop_sounds[ sound_idx ];
10057 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10058
10059
10060 magazine.ServerAddAmmoCount(-1);
10061
10062
10063 float min_temp_to_explode = 100;
10064
10065 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10066 {
10068 }
10069 }
10070
10071
10072 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10073 {
10074 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10075
10076 const int CHANCE_DAMAGE_CARGO = 4;
10077 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10078 const int CHANCE_DAMAGE_NOTHING = 2;
10079
10081 {
10082 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10083 int chances;
10084 int rnd;
10085
10086 if (GetInventory().GetCargo())
10087 {
10088 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10089 rnd = Math.RandomInt(0,chances);
10090
10091 if (rnd < CHANCE_DAMAGE_CARGO)
10092 {
10094 }
10095 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10096 {
10098 }
10099 }
10100 else
10101 {
10102 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10103 rnd = Math.RandomInt(0,chances);
10104
10105 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10106 {
10108 }
10109 }
10110 }
10111 }
10112
10114 {
10115 CargoBase cargo = GetInventory().GetCargo();
10116 if (cargo)
10117 {
10119 if (item_count > 0)
10120 {
10121 int random_pick = Math.RandomInt(0, item_count);
10123 if (!item.IsExplosive())
10124 {
10125 item.AddHealth("","",damage);
10126 return true;
10127 }
10128 }
10129 }
10130 return false;
10131 }
10132
10134 {
10135 GameInventory inventory = GetInventory();
10137 if (attachment_count > 0)
10138 {
10139 int random_pick = Math.RandomInt(0, attachment_count);
10141 if (!attachment.IsExplosive())
10142 {
10143 attachment.AddHealth("","",damage);
10144 return true;
10145 }
10146 }
10147 return false;
10148 }
10149
10151 {
10153 }
10154
10156 {
10158 return GetInventory().CanRemoveEntity();
10159
10160 return false;
10161 }
10162
10164 {
10165
10167 return false;
10168
10169
10171 return false;
10172
10173
10174
10176 if (delta == 0)
10177 return false;
10178
10179
10180 return true;
10181 }
10182
10184 {
10186 {
10187 if (ScriptInputUserData.CanStoreInputUserData())
10188 {
10189 ScriptInputUserData ctx = new ScriptInputUserData;
10194 ctx.
Write(destination_entity);
10196 ctx.
Write(slot_id);
10198 }
10199 }
10200 else if (!
g_Game.IsMultiplayer())
10201 {
10203 }
10204 }
10205
10207 {
10208 float split_quantity_new;
10212 InventoryLocation loc = new InventoryLocation;
10213
10214 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10215 {
10217 split_quantity_new = stack_max;
10218 else
10220
10222 {
10223 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10224 if (new_item)
10225 {
10226 new_item.SetResultOfSplit(true);
10227 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10229 new_item.
SetQuantity(split_quantity_new,
false,
true);
10230 }
10231 }
10232 }
10233 else if (destination_entity && slot_id == -1)
10234 {
10235 if (quantity > stack_max)
10236 split_quantity_new = stack_max;
10237 else
10238 split_quantity_new = quantity;
10239
10241 {
10242 GameInventory destinationInventory = destination_entity.GetInventory();
10244 {
10247 }
10248
10249 if (new_item)
10250 {
10251 new_item.SetResultOfSplit(true);
10252 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10254 new_item.
SetQuantity(split_quantity_new,
false,
true);
10255 }
10256 }
10257 }
10258 else
10259 {
10260 if (stack_max != 0)
10261 {
10263 {
10265 }
10266
10267 if (split_quantity_new == 0)
10268 {
10269 if (!
g_Game.IsMultiplayer())
10270 player.PhysicalPredictiveDropItem(this);
10271 else
10272 player.ServerDropEntity(this);
10273 return;
10274 }
10275
10277 {
10279
10280 if (new_item)
10281 {
10282 new_item.SetResultOfSplit(true);
10283 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10286 new_item.PlaceOnSurface();
10287 }
10288 }
10289 }
10290 }
10291 }
10292
10294 {
10295 float split_quantity_new;
10299 InventoryLocation loc = new InventoryLocation;
10300
10301 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10302 {
10304 split_quantity_new = stack_max;
10305 else
10307
10309 {
10310 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10311 if (new_item)
10312 {
10313 new_item.SetResultOfSplit(true);
10314 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10316 new_item.
SetQuantity(split_quantity_new,
false,
true);
10317 }
10318 }
10319 }
10320 else if (destination_entity && slot_id == -1)
10321 {
10322 if (quantity > stack_max)
10323 split_quantity_new = stack_max;
10324 else
10325 split_quantity_new = quantity;
10326
10328 {
10329 GameInventory destinationInventory = destination_entity.GetInventory();
10331 {
10334 }
10335
10336 if (new_item)
10337 {
10338 new_item.SetResultOfSplit(true);
10339 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10341 new_item.
SetQuantity(split_quantity_new,
false,
true);
10342 }
10343 }
10344 }
10345 else
10346 {
10347 if (stack_max != 0)
10348 {
10350 {
10352 }
10353
10355 {
10357
10358 if (new_item)
10359 {
10360 new_item.SetResultOfSplit(true);
10361 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10364 new_item.PlaceOnSurface();
10365 }
10366 }
10367 }
10368 }
10369 }
10370
10372 {
10374 {
10375 if (ScriptInputUserData.CanStoreInputUserData())
10376 {
10377 ScriptInputUserData ctx = new ScriptInputUserData;
10382 dst.WriteToContext(ctx);
10384 }
10385 }
10386 else if (!
g_Game.IsMultiplayer())
10387 {
10389 }
10390 }
10391
10393 {
10395 {
10396 if (ScriptInputUserData.CanStoreInputUserData())
10397 {
10398 ScriptInputUserData ctx = new ScriptInputUserData;
10403 ctx.
Write(destination_entity);
10409 }
10410 }
10411 else if (!
g_Game.IsMultiplayer())
10412 {
10414 }
10415 }
10416
10418 {
10420 }
10421
10423 {
10425 float split_quantity_new;
10427 if (dst.IsValid())
10428 {
10429 int slot_id = dst.GetSlot();
10431
10432 if (quantity > stack_max)
10433 split_quantity_new = stack_max;
10434 else
10435 split_quantity_new = quantity;
10436
10438 {
10440
10441 if (new_item)
10442 {
10443 new_item.SetResultOfSplit(true);
10444 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10446 new_item.
SetQuantity(split_quantity_new,
false,
true);
10447 }
10448
10449 return new_item;
10450 }
10451 }
10452
10453 return null;
10454 }
10455
10457 {
10459 float split_quantity_new;
10461 if (destination_entity)
10462 {
10464 if (quantity > stackable)
10465 split_quantity_new = stackable;
10466 else
10467 split_quantity_new = quantity;
10468
10470 {
10471 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10472 if (new_item)
10473 {
10474 new_item.SetResultOfSplit(true);
10475 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10477 new_item.
SetQuantity(split_quantity_new,
false,
true);
10478 }
10479 }
10480 }
10481 }
10482
10484 {
10486 {
10487 if (ScriptInputUserData.CanStoreInputUserData())
10488 {
10489 ScriptInputUserData ctx = new ScriptInputUserData;
10494 ItemBase destination_entity =
this;
10495 ctx.
Write(destination_entity);
10499 }
10500 }
10501 else if (!
g_Game.IsMultiplayer())
10502 {
10504 }
10505 }
10506
10508 {
10510 float split_quantity_new;
10512 if (player)
10513 {
10515 if (quantity > stackable)
10516 split_quantity_new = stackable;
10517 else
10518 split_quantity_new = quantity;
10519
10521 {
10522 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10523 new_item =
ItemBase.Cast(in_hands);
10524 if (new_item)
10525 {
10526 new_item.SetResultOfSplit(true);
10527 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10529 new_item.SetQuantity(split_quantity_new, false, true);
10530 }
10531 }
10532 }
10533 }
10534
10536 {
10538 float split_quantity_new = Math.Floor(quantity * 0.5);
10539
10541 return;
10542
10544
10545 if (new_item)
10546 {
10547 if (new_item.GetQuantityMax() < split_quantity_new)
10548 {
10549 split_quantity_new = new_item.GetQuantityMax();
10550 }
10551
10552 new_item.SetResultOfSplit(true);
10553 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10554
10556 {
10559 }
10560 else
10561 {
10563 new_item.
SetQuantity(split_quantity_new,
false,
true);
10564 }
10565 }
10566 }
10567
10569 {
10571 float split_quantity_new = Math.Floor(quantity / 2);
10572
10574 return;
10575
10576 InventoryLocation invloc = new InventoryLocation;
10578
10580 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10581
10582 if (new_item)
10583 {
10584 if (new_item.GetQuantityMax() < split_quantity_new)
10585 {
10586 split_quantity_new = new_item.GetQuantityMax();
10587 }
10589 {
10592 }
10593 else if (split_quantity_new > 1)
10594 {
10596 new_item.
SetQuantity(split_quantity_new,
false,
true);
10597 }
10598 }
10599 }
10600
10603 {
10604 SetWeightDirty();
10606
10607 if (parent)
10608 parent.OnAttachmentQuantityChangedEx(this, delta);
10609
10611 {
10613 {
10615 }
10617 {
10618 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10620 }
10621 }
10622 }
10623
10626 {
10627
10628 }
10629
10632 {
10634 }
10635
10637 {
10638 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10639
10641 {
10642 if (newLevel == GameConstants.STATE_RUINED)
10643 {
10645 EntityAI parent = GetHierarchyParent();
10646 if (parent && parent.IsFireplace())
10647 {
10648 CargoBase cargo = GetInventory().GetCargo();
10649 if (cargo)
10650 {
10652 {
10654 }
10655 }
10656 }
10657 }
10658
10660 {
10661
10663 return;
10664 }
10665
10666 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10667 {
10669 }
10670 }
10671 }
10672
10673
10675 {
10676 super.OnRightClick();
10677
10679 {
10681 {
10682 if (ScriptInputUserData.CanStoreInputUserData())
10683 {
10684 EntityAI root = GetHierarchyRoot();
10685 Man playerOwner = GetHierarchyRootPlayer();
10686 InventoryLocation dst = new InventoryLocation;
10687
10688
10689 if (!playerOwner && root && root == this)
10690 {
10692 }
10693 else
10694 {
10695
10696 GetInventory().GetCurrentInventoryLocation(dst);
10698 {
10699 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10701 {
10703 }
10704 else
10705 {
10707
10708
10709 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10710 {
10712 }
10713 else
10714 {
10715 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10716 }
10717 }
10718 }
10719 }
10720
10721 ScriptInputUserData ctx = new ScriptInputUserData;
10729 }
10730 }
10731 else if (!
g_Game.IsMultiplayer())
10732 {
10734 }
10735 }
10736 }
10737
10739 {
10740 if (root)
10741 {
10742 vector m4[4];
10743 root.GetTransform(m4);
10744 dst.SetGround(this, m4);
10745 }
10746 else
10747 {
10748 GetInventory().GetCurrentInventoryLocation(dst);
10749 }
10750 }
10751
10752 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10753 {
10754
10755 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10756 return false;
10757
10758 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10759 return false;
10760
10761
10763 return false;
10764
10765
10766 Magazine mag = Magazine.Cast(this);
10767 if (mag)
10768 {
10769 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10770 return false;
10771
10772 if (stack_max_limit)
10773 {
10774 Magazine other_mag = Magazine.Cast(other_item);
10775 if (other_item)
10776 {
10777 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10778 return false;
10779 }
10780
10781 }
10782 }
10783 else
10784 {
10785
10787 return false;
10788
10790 return false;
10791 }
10792
10793 PlayerBase player = null;
10794 if (CastTo(player, GetHierarchyRootPlayer()))
10795 {
10796 if (player.GetInventory().HasAttachment(this))
10797 return false;
10798
10799 if (player.IsItemsToDelete())
10800 return false;
10801 }
10802
10803 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10804 return false;
10805
10806 int slotID;
10808 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10809 return false;
10810
10811 return true;
10812 }
10813
10815 {
10817 }
10818
10820 {
10821 return m_IsResultOfSplit;
10822 }
10823
10825 {
10826 m_IsResultOfSplit = value;
10827 }
10828
10830 {
10832 }
10833
10835 {
10836 float other_item_quantity = other_item.GetQuantity();
10837 float this_free_space;
10838
10840
10842
10843 if (other_item_quantity > this_free_space)
10844 {
10845 return this_free_space;
10846 }
10847 else
10848 {
10849 return other_item_quantity;
10850 }
10851 }
10852
10854 {
10856 }
10857
10859 {
10861 return;
10862
10863 if (!IsMagazine() && other_item)
10864 {
10866 if (quantity_used != 0)
10867 {
10868 float hp1 = GetHealth01("","");
10869 float hp2 = other_item.GetHealth01("","");
10870 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10871 hpResult = hpResult / (
GetQuantity() + quantity_used);
10872
10873 hpResult *= GetMaxHealth();
10874 Math.Round(hpResult);
10875 SetHealth("", "Health", hpResult);
10876
10878 other_item.AddQuantity(-quantity_used);
10879 }
10880 }
10882 }
10883
10885 {
10886 #ifdef SERVER
10887 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10888 GetHierarchyParent().IncreaseLifetimeUp();
10889 #endif
10890 };
10891
10893 {
10894 PlayerBase p = PlayerBase.Cast(player);
10895
10896 array<int> recipesIds = p.m_Recipes;
10897 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10898 if (moduleRecipesManager)
10899 {
10900 EntityAI itemInHands = player.GetEntityInHands();
10901 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10902 }
10903
10904 for (int i = 0;i < recipesIds.Count(); i++)
10905 {
10906 int key = recipesIds.Get(i);
10907 string recipeName = moduleRecipesManager.GetRecipeName(key);
10909 }
10910 }
10911
10912
10913 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10914 {
10915 super.GetDebugActions(outputList);
10916
10917
10923
10924
10929
10934
10935
10939
10940
10942 {
10946 }
10947
10950
10951
10955
10957
10958 InventoryLocation loc = new InventoryLocation();
10959 GetInventory().GetCurrentInventoryLocation(loc);
10961 {
10962 if (Gizmo_IsSupported())
10965 }
10966
10968 }
10969
10970
10971
10972
10974 {
10975 super.OnAction(action_id, player, ctx);
10976
10978 {
10979 switch (action_id)
10980 {
10984 return true;
10988 return true;
10989 }
10990 }
10991
10993 {
10994 switch (action_id)
10995 {
10997 Delete();
10998 return true;
10999 }
11000 }
11001
11002 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11003 {
11004 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11005 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11006 PlayerBase p = PlayerBase.Cast(player);
11007 if (
EActions.RECIPES_RANGE_START < 1000)
11008 {
11009 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11010 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11011 }
11012 }
11013 #ifndef SERVER
11014 else if (action_id ==
EActions.WATCH_PLAYER)
11015 {
11016 PluginDeveloper.SetDeveloperItemClientEx(player);
11017 }
11018 #endif
11020 {
11021 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11022 {
11023 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11024 OnDebugButtonPressServer(id + 1);
11025 }
11026
11027 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11028 {
11029 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11031 }
11032
11033 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11034 {
11035 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11037 }
11038
11039 else if (action_id ==
EActions.ADD_QUANTITY)
11040 {
11041 if (IsMagazine())
11042 {
11043 Magazine mag = Magazine.Cast(this);
11044 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11045 }
11046 else
11047 {
11049 }
11050
11051 if (m_EM)
11052 {
11053 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11054 }
11055
11056 }
11057
11058 else if (action_id ==
EActions.REMOVE_QUANTITY)
11059 {
11060 if (IsMagazine())
11061 {
11062 Magazine mag2 = Magazine.Cast(this);
11063 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11064 }
11065 else
11066 {
11068 }
11069 if (m_EM)
11070 {
11071 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11072 }
11073
11074 }
11075
11076 else if (action_id ==
EActions.SET_QUANTITY_0)
11077 {
11079
11080 if (m_EM)
11081 {
11082 m_EM.SetEnergy(0);
11083 }
11084 }
11085
11086 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11087 {
11089
11090 if (m_EM)
11091 {
11092 m_EM.SetEnergy(m_EM.GetEnergyMax());
11093 }
11094 }
11095
11096 else if (action_id ==
EActions.ADD_HEALTH)
11097 {
11098 AddHealth("","",GetMaxHealth("","Health")/5);
11099 }
11100 else if (action_id ==
EActions.REMOVE_HEALTH)
11101 {
11102 AddHealth("","",-GetMaxHealth("","Health")/5);
11103 }
11104 else if (action_id ==
EActions.DESTROY_HEALTH)
11105 {
11106 SetHealth01("","",0);
11107 }
11108 else if (action_id ==
EActions.WATCH_ITEM)
11109 {
11111 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11112 #ifdef DEVELOPER
11113 SetDebugDeveloper_item(this);
11114 #endif
11115 }
11116
11117 else if (action_id ==
EActions.ADD_TEMPERATURE)
11118 {
11119 AddTemperature(20);
11120
11121 }
11122
11123 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11124 {
11125 AddTemperature(-20);
11126
11127 }
11128
11129 else if (action_id ==
EActions.FLIP_FROZEN)
11130 {
11131 SetFrozen(!GetIsFrozen());
11132
11133 }
11134
11135 else if (action_id ==
EActions.ADD_WETNESS)
11136 {
11138
11139 }
11140
11141 else if (action_id ==
EActions.REMOVE_WETNESS)
11142 {
11144
11145 }
11146
11147 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11148 {
11151
11152
11153 }
11154
11155 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11156 {
11159 }
11160
11161 else if (action_id ==
EActions.MAKE_SPECIAL)
11162 {
11163 auto debugParams = DebugSpawnParams.WithPlayer(player);
11164 OnDebugSpawnEx(debugParams);
11165 }
11166
11167 }
11168
11169
11170 return false;
11171 }
11172
11173
11174
11175
11179
11182
11183
11184
11186 {
11187 return false;
11188 }
11189
11190
11192 {
11193 return true;
11194 }
11195
11196
11198 {
11199 return true;
11200 }
11201
11202
11203
11205 {
11206 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11207 return g_Game.ConfigIsExisting(config_path);
11208 }
11209
11212 {
11213 return null;
11214 }
11215
11217 {
11218 return false;
11219 }
11220
11222 {
11223 return false;
11224 }
11225
11229
11230
11232 {
11233 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11234 return module_repairing.CanRepair(this, item_repair_kit);
11235 }
11236
11237
11238 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11239 {
11240 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11241 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11242 }
11243
11244
11246 {
11247
11248
11249
11250
11251
11252
11253
11254
11255 return 1;
11256 }
11257
11258
11259
11261 {
11263 }
11264
11265
11266
11268 {
11270 }
11271
11272
11281 {
11282 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11283
11284 if (player)
11285 {
11286 player.MessageStatus(text);
11287 }
11288 }
11289
11290
11299 {
11300 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11301
11302 if (player)
11303 {
11304 player.MessageAction(text);
11305 }
11306 }
11307
11308
11317 {
11318 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11319
11320 if (player)
11321 {
11322 player.MessageFriendly(text);
11323 }
11324 }
11325
11326
11335 {
11336 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11337
11338 if (player)
11339 {
11340 player.MessageImportant(text);
11341 }
11342 }
11343
11345 {
11346 return true;
11347 }
11348
11349
11350 override bool KindOf(
string tag)
11351 {
11352 bool found = false;
11353 string item_name = this.
GetType();
11355 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11356
11357 int array_size = item_tag_array.Count();
11358 for (int i = 0; i < array_size; i++)
11359 {
11360 if (item_tag_array.Get(i) == tag)
11361 {
11362 found = true;
11363 break;
11364 }
11365 }
11366 return found;
11367 }
11368
11369
11371 {
11372
11373 super.OnRPC(sender, rpc_type,ctx);
11374
11375
11376 switch (rpc_type)
11377 {
11378 #ifndef SERVER
11379 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11380 Param2<bool, string> p = new Param2<bool, string>(false, "");
11381
11383 return;
11384
11385 bool play = p.param1;
11386 string soundSet = p.param2;
11387
11388 if (play)
11389 {
11391 {
11393 {
11395 }
11396 }
11397 else
11398 {
11400 }
11401 }
11402 else
11403 {
11405 }
11406
11407 break;
11408 #endif
11409
11410 }
11411
11413 {
11415 }
11416 }
11417
11418
11419
11420
11422 {
11423 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11424 return plugin.GetID(
name);
11425 }
11426
11428 {
11429 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11430 return plugin.GetName(id);
11431 }
11432
11435 {
11436
11437
11438 int varFlags;
11439 if (!ctx.
Read(varFlags))
11440 return;
11441
11442 if (varFlags & ItemVariableFlags.FLOAT)
11443 {
11445 }
11446 }
11447
11449 {
11450
11451 super.SerializeNumericalVars(floats_out);
11452
11453
11454
11456 {
11458 }
11459
11461 {
11463 }
11464
11466 {
11468 }
11469
11471 {
11476 }
11477
11479 {
11481 }
11482 }
11483
11485 {
11486
11487 super.DeSerializeNumericalVars(floats);
11488
11489
11490 int index = 0;
11491 int mask = Math.Round(floats.Get(index));
11492
11493 index++;
11494
11496 {
11498 {
11500 }
11501 else
11502 {
11503 float quantity = floats.Get(index);
11504 SetQuantity(quantity,
true,
false,
false,
false);
11505 }
11506 index++;
11507 }
11508
11510 {
11511 float wet = floats.Get(index);
11513 index++;
11514 }
11515
11517 {
11518 int liquidtype = Math.Round(floats.Get(index));
11520 index++;
11521 }
11522
11524 {
11526 index++;
11528 index++;
11530 index++;
11532 index++;
11533 }
11534
11536 {
11537 int cleanness = Math.Round(floats.Get(index));
11539 index++;
11540 }
11541 }
11542
11544 {
11545 super.WriteVarsToCTX(ctx);
11546
11547
11549 {
11551 }
11552
11554 {
11556 }
11557
11559 {
11561 }
11562
11564 {
11565 int r,g,b,a;
11571 }
11572
11574 {
11576 }
11577 }
11578
11580 {
11581 if (!super.ReadVarsFromCTX(ctx,version))
11582 return false;
11583
11584 int intValue;
11585 float value;
11586
11587 if (version < 140)
11588 {
11589 if (!ctx.
Read(intValue))
11590 return false;
11591
11592 m_VariablesMask = intValue;
11593 }
11594
11596 {
11597 if (!ctx.
Read(value))
11598 return false;
11599
11601 {
11603 }
11604 else
11605 {
11607 }
11608 }
11609
11610 if (version < 140)
11611 {
11613 {
11614 if (!ctx.
Read(value))
11615 return false;
11616 SetTemperatureDirect(value);
11617 }
11618 }
11619
11621 {
11622 if (!ctx.
Read(value))
11623 return false;
11625 }
11626
11628 {
11629 if (!ctx.
Read(intValue))
11630 return false;
11632 }
11633
11635 {
11636 int r,g,b,a;
11638 return false;
11640 return false;
11642 return false;
11644 return false;
11645
11647 }
11648
11650 {
11651 if (!ctx.
Read(intValue))
11652 return false;
11654 }
11655
11656 if (version >= 138 && version < 140)
11657 {
11659 {
11660 if (!ctx.
Read(intValue))
11661 return false;
11662 SetFrozen(intValue);
11663 }
11664 }
11665
11666 return true;
11667 }
11668
11669
11671 {
11674 {
11676 }
11677
11678 if (!super.OnStoreLoad(ctx, version))
11679 {
11681 return false;
11682 }
11683
11684 if (version >= 114)
11685 {
11686 bool hasQuickBarIndexSaved;
11687
11688 if (!ctx.
Read(hasQuickBarIndexSaved))
11689 {
11691 return false;
11692 }
11693
11694 if (hasQuickBarIndexSaved)
11695 {
11696 int itmQBIndex;
11697
11698
11699 if (!ctx.
Read(itmQBIndex))
11700 {
11702 return false;
11703 }
11704
11705 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11706 if (itmQBIndex != -1 && parentPlayer)
11707 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11708 }
11709 }
11710 else
11711 {
11712
11713 PlayerBase player;
11714 int itemQBIndex;
11715 if (version ==
int.
MAX)
11716 {
11717 if (!ctx.
Read(itemQBIndex))
11718 {
11720 return false;
11721 }
11722 }
11723 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11724 {
11725
11726 if (!ctx.
Read(itemQBIndex))
11727 {
11729 return false;
11730 }
11731 if (itemQBIndex != -1 && player)
11732 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11733 }
11734 }
11735
11736 if (version < 140)
11737 {
11738
11739 if (!LoadVariables(ctx, version))
11740 {
11742 return false;
11743 }
11744 }
11745
11746
11748 {
11750 return false;
11751 }
11752 if (version >= 132)
11753 {
11755 if (raib)
11756 {
11758 {
11760 return false;
11761 }
11762 }
11763 }
11764
11766 return true;
11767 }
11768
11769
11770
11772 {
11773 super.OnStoreSave(ctx);
11774
11775 PlayerBase player;
11776 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11777 {
11779
11780 int itemQBIndex = -1;
11781 itemQBIndex = player.FindQuickBarEntityIndex(this);
11782 ctx.
Write(itemQBIndex);
11783 }
11784 else
11785 {
11787 }
11788
11790
11792 if (raib)
11793 {
11795 }
11796 }
11797
11798
11800 {
11801 super.AfterStoreLoad();
11802
11804 {
11806 }
11807
11809 {
11812 }
11813 }
11814
11816 {
11817 super.EEOnAfterLoad();
11818
11820 {
11822 }
11823
11826 }
11827
11829 {
11830 return false;
11831 }
11832
11833
11834
11836 {
11838 {
11839 #ifdef PLATFORM_CONSOLE
11840
11842 {
11844 if (menu)
11845 {
11847 }
11848 }
11849 #endif
11850 }
11851
11853 {
11856 }
11857
11859 {
11860 SetWeightDirty();
11862 }
11864 {
11867 }
11868
11870 {
11873
11876 }
11878 {
11882 }
11883
11884 super.OnVariablesSynchronized();
11885 }
11886
11887
11888
11890 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11891 {
11892 if (!IsServerCheck(allow_client))
11893 return false;
11894
11896 return false;
11897
11900
11901 if (value <= (min + 0.001))
11902 value = min;
11903
11904 if (value == min)
11905 {
11906 if (destroy_config)
11907 {
11908 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11909 if (dstr)
11910 {
11912 this.Delete();
11913 return true;
11914 }
11915 }
11916 else if (destroy_forced)
11917 {
11919 this.Delete();
11920 return true;
11921 }
11922
11924 }
11925
11928
11930 {
11931 EntityAI parent = GetHierarchyRoot();
11932 InventoryLocation iLoc = new InventoryLocation();
11933 GetInventory().GetCurrentInventoryLocation(iLoc);
11935 {
11936 int iLocSlot = iLoc.
GetSlot();
11938 {
11940 }
11942 {
11944 }
11945 }
11946 }
11947
11949 {
11951
11952 if (delta)
11954 }
11955
11957
11958 return false;
11959 }
11960
11961
11963 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11964 {
11966 }
11967
11969 {
11972 }
11973
11975 {
11978 }
11979
11981 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11982 {
11983 float value_clamped = Math.Clamp(value, 0, 1);
11985 SetQuantity(result, destroy_config, destroy_forced);
11986 }
11987
11988
11991 {
11993 }
11994
11996 {
11998 }
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12010 {
12011 int slot = -1;
12012 GameInventory inventory = GetInventory();
12013 if (inventory)
12014 {
12015 InventoryLocation il = new InventoryLocation;
12018 }
12019
12021 }
12022
12024 {
12025 float quantity_max = 0;
12026
12028 {
12029 if (attSlotID != -1)
12030 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12031
12032 if (quantity_max <= 0)
12034 }
12035
12036 if (quantity_max <= 0)
12038
12039 return quantity_max;
12040 }
12041
12043 {
12045 }
12046
12048 {
12050 }
12051
12052
12054 {
12056 }
12057
12059 {
12061 }
12062
12064 {
12066 }
12067
12068
12070 {
12071
12072 float weightEx = GetWeightEx();
12073 float special = GetInventoryAndCargoWeight();
12074 return weightEx - special;
12075 }
12076
12077
12079 {
12081 }
12082
12084 {
12086 {
12087 #ifdef DEVELOPER
12088 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12089 {
12090 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12092 }
12093 #endif
12094
12095 return GetQuantity() * GetConfigWeightModified();
12096 }
12097 else if (HasEnergyManager())
12098 {
12099 #ifdef DEVELOPER
12100 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12101 {
12102 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12103 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12104 }
12105 #endif
12106 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12107 }
12108 else
12109 {
12110 #ifdef DEVELOPER
12111 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12112 {
12113 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12114 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12115 }
12116 #endif
12117 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12118 }
12119 }
12120
12123 {
12124 int item_count = 0;
12126
12127 GameInventory inventory = GetInventory();
12128 CargoBase cargo = inventory.
GetCargo();
12129 if (cargo != NULL)
12130 {
12132 }
12133
12135 for (int i = 0; i < nAttachments; ++i)
12136 {
12138 if (item)
12139 item_count += item.GetNumberOfItems();
12140 }
12141 return item_count;
12142 }
12143
12146 {
12147 float weight = 0;
12148 float wetness = 1;
12149 if (include_wetness)
12152 {
12153 weight = wetness * m_ConfigWeight;
12154 }
12156 {
12157 weight = 1;
12158 }
12159 return weight;
12160 }
12161
12162
12163
12165 {
12166 GameInventory inventory = GetInventory();
12167 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12168 {
12169 array<EntityAI> items = new array<EntityAI>;
12171 for (int i = 0; i < items.Count(); ++i)
12172 {
12174 if (item)
12175 {
12176 g_Game.ObjectDelete(item);
12177 }
12178 }
12179 }
12180 }
12181
12182
12183
12184
12186 {
12187 float energy = 0;
12188 if (HasEnergyManager())
12189 {
12190 energy = GetCompEM().GetEnergy();
12191 }
12192 return energy;
12193 }
12194
12195
12197 {
12198 super.OnEnergyConsumed();
12199
12201 }
12202
12204 {
12205 super.OnEnergyAdded();
12206
12208 }
12209
12210
12212 {
12213 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12214 {
12216 {
12217 float energy_0to1 = GetCompEM().GetEnergy0To1();
12219 }
12220 }
12221 }
12222
12223
12225 {
12226 return ConfigGetFloat("heatIsolation");
12227 }
12228
12230 {
12232 }
12233
12235 {
12236 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12237 if (
g_Game.ConfigIsExisting(paramPath))
12238 return g_Game.ConfigGetFloat(paramPath);
12239
12240 return 0.0;
12241 }
12242
12244 {
12245 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12246 if (
g_Game.ConfigIsExisting(paramPath))
12247 return g_Game.ConfigGetFloat(paramPath);
12248
12249 return 0.0;
12250 }
12251
12252 override void SetWet(
float value,
bool allow_client =
false)
12253 {
12254 if (!IsServerCheck(allow_client))
12255 return;
12256
12259
12261
12262 m_VarWet = Math.Clamp(value, min, max);
12263
12265 {
12268 }
12269 }
12270
12271 override void AddWet(
float value)
12272 {
12274 }
12275
12277 {
12279 }
12280
12282 {
12284 }
12285
12287 {
12289 }
12290
12292 {
12294 }
12295
12297 {
12299 }
12300
12301 override void OnWetChanged(
float newVal,
float oldVal)
12302 {
12305 if (newLevel != oldLevel)
12306 {
12308 }
12309 }
12310
12312 {
12313 SetWeightDirty();
12314 }
12315
12317 {
12318 return GetWetLevelInternal(
m_VarWet);
12319 }
12320
12321
12322
12324 {
12326 }
12327
12329 {
12331 }
12332
12334 {
12336 }
12337
12339 {
12341 }
12342
12343
12344
12346 {
12347 if (ConfigIsExisting("itemModelLength"))
12348 {
12349 return ConfigGetFloat("itemModelLength");
12350 }
12351 return 0;
12352 }
12353
12355 {
12356 if (ConfigIsExisting("itemAttachOffset"))
12357 {
12358 return ConfigGetFloat("itemAttachOffset");
12359 }
12360 return 0;
12361 }
12362
12363 override void SetCleanness(
int value,
bool allow_client =
false)
12364 {
12365 if (!IsServerCheck(allow_client))
12366 return;
12367
12369
12371
12374 }
12375
12377 {
12379 }
12380
12382 {
12383 return true;
12384 }
12385
12386
12387
12388
12390 {
12392 }
12393
12395 {
12397 }
12398
12399
12400
12401
12402 override void SetColor(
int r,
int g,
int b,
int a)
12403 {
12409 }
12411 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12412 {
12417 }
12418
12420 {
12422 }
12423
12426 {
12427 int r,g,b,a;
12429 r = r/255;
12430 g = g/255;
12431 b = b/255;
12432 a = a/255;
12433 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12434 }
12435
12436
12437
12438 override void SetLiquidType(
int value,
bool allow_client =
false)
12439 {
12440 if (!IsServerCheck(allow_client))
12441 return;
12442
12447 }
12448
12450 {
12451 return ConfigGetInt("varLiquidTypeInit");
12452 }
12453
12455 {
12457 }
12458
12460 {
12462 SetFrozen(false);
12463 }
12464
12467 {
12468 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12469 }
12470
12471
12474 {
12475 PlayerBase nplayer;
12476 if (PlayerBase.CastTo(nplayer, player))
12477 {
12479 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12480 }
12481 }
12482
12483
12486 {
12487 PlayerBase nplayer;
12488 if (PlayerBase.CastTo(nplayer,player))
12489 {
12490 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12491 }
12492
12493 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12494
12495 if (HasEnergyManager())
12496 {
12497 GetCompEM().UpdatePlugState();
12498 }
12499 }
12500
12501
12503 {
12504 super.OnPlacementStarted(player);
12505
12507 }
12508
12509 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12510 {
12512 {
12513 m_AdminLog.OnPlacementComplete(player,
this);
12514 }
12515
12516 super.OnPlacementComplete(player, position, orientation);
12517 }
12518
12519
12520
12521
12522
12524 {
12526 {
12527 return true;
12528 }
12529 else
12530 {
12531 return false;
12532 }
12533 }
12534
12535
12537 {
12539 {
12541 }
12542 }
12543
12544
12546 {
12548 }
12549
12551 {
12553 }
12554
12555 override void InsertAgent(
int agent,
float count = 1)
12556 {
12557 if (count < 1)
12558 return;
12559
12561 }
12562
12565 {
12567 }
12568
12569
12571 {
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
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12617 {
12619 return false;
12620 return true;
12621 }
12622
12624 {
12625
12627 }
12628
12629
12632 {
12633 super.CheckForRoofLimited(timeTresholdMS);
12634
12635 float time =
g_Game.GetTime();
12636 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12637 {
12638 m_PreviousRoofTestTime = time;
12639 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12640 }
12641 }
12642
12643
12645 {
12647 {
12648 return 0;
12649 }
12650
12651 if (GetInventory().GetAttachmentSlotsCount() != 0)
12652 {
12653 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12654 if (filter)
12655 return filter.GetProtectionLevel(type, false, system);
12656 else
12657 return 0;
12658 }
12659
12660 string subclassPath, entryName;
12661
12662 switch (type)
12663 {
12665 entryName = "biological";
12666 break;
12668 entryName = "chemical";
12669 break;
12670 default:
12671 entryName = "biological";
12672 break;
12673 }
12674
12675 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12676
12677 return g_Game.ConfigGetFloat(subclassPath + entryName);
12678 }
12679
12680
12681
12684 {
12685 if (!IsMagazine())
12687
12689 }
12690
12691
12692
12693
12694
12699 {
12700 return true;
12701 }
12702
12704 {
12706 }
12707
12708
12709
12710
12711
12713 {
12714 if (parent)
12715 {
12716 if (parent.IsInherited(DayZInfected))
12717 return true;
12718
12719 if (!parent.IsRuined())
12720 return true;
12721 }
12722
12723 return true;
12724 }
12725
12727 {
12728 if (!super.CanPutAsAttachment(parent))
12729 {
12730 return false;
12731 }
12732
12733 if (!IsRuined() && !parent.IsRuined())
12734 {
12735 return true;
12736 }
12737
12738 return false;
12739 }
12740
12742 {
12743
12744
12745
12746
12747 return super.CanReceiveItemIntoCargo(item);
12748 }
12749
12751 {
12752
12753
12754
12755
12756 GameInventory attachmentInv = attachment.GetInventory();
12758 {
12759 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12760 return false;
12761 }
12762
12763 InventoryLocation loc = new InventoryLocation();
12764 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12765 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12766 return false;
12767
12768 return super.CanReceiveAttachment(attachment, slotId);
12769 }
12770
12772 {
12773 if (!super.CanReleaseAttachment(attachment))
12774 return false;
12775
12776 return GetInventory().AreChildrenAccessible();
12777 }
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12800 {
12801 int id = muzzle_owner.GetMuzzleID();
12802 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12803
12804 if (WPOF_array)
12805 {
12806 for (int i = 0; i < WPOF_array.Count(); i++)
12807 {
12808 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12809
12810 if (WPOF)
12811 {
12812 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12813 }
12814 }
12815 }
12816 }
12817
12818
12820 {
12821 int id = muzzle_owner.GetMuzzleID();
12823
12824 if (WPOBE_array)
12825 {
12826 for (int i = 0; i < WPOBE_array.Count(); i++)
12827 {
12828 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12829
12830 if (WPOBE)
12831 {
12832 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12833 }
12834 }
12835 }
12836 }
12837
12838
12840 {
12841 int id = muzzle_owner.GetMuzzleID();
12842 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12843
12844 if (WPOOH_array)
12845 {
12846 for (int i = 0; i < WPOOH_array.Count(); i++)
12847 {
12848 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12849
12850 if (WPOOH)
12851 {
12852 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12853 }
12854 }
12855 }
12856 }
12857
12858
12860 {
12861 int id = muzzle_owner.GetMuzzleID();
12862 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12863
12864 if (WPOOH_array)
12865 {
12866 for (int i = 0; i < WPOOH_array.Count(); i++)
12867 {
12868 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12869
12870 if (WPOOH)
12871 {
12872 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12873 }
12874 }
12875 }
12876 }
12877
12878
12880 {
12881 int id = muzzle_owner.GetMuzzleID();
12882 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12883
12884 if (WPOOH_array)
12885 {
12886 for (int i = 0; i < WPOOH_array.Count(); i++)
12887 {
12888 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12889
12890 if (WPOOH)
12891 {
12892 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12893 }
12894 }
12895 }
12896 }
12897
12898
12899
12901 {
12903 {
12904 return true;
12905 }
12906
12907 return false;
12908 }
12909
12911 {
12913 {
12914 return true;
12915 }
12916
12917 return false;
12918 }
12919
12921 {
12923 {
12924 return true;
12925 }
12926
12927 return false;
12928 }
12929
12931 {
12932 return false;
12933 }
12934
12937 {
12938 return UATimeSpent.DEFAULT_DEPLOY;
12939 }
12940
12941
12942
12943
12945 {
12947 SetSynchDirty();
12948 }
12949
12951 {
12953 }
12954
12955
12957 {
12958 return false;
12959 }
12960
12963 {
12964 string att_type = "None";
12965
12966 if (ConfigIsExisting("soundAttType"))
12967 {
12968 att_type = ConfigGetString("soundAttType");
12969 }
12970
12972 }
12973
12975 {
12977 }
12978
12979
12980
12981
12982
12988
12990 {
12993
12995 }
12996
12997
12999 {
13001 return;
13002
13004
13007
13010
13011 SoundParameters params = new SoundParameters();
13015 }
13016
13017
13019 {
13021 {
13024
13025 SetSynchDirty();
13026
13029 }
13030 }
13031
13033 {
13035 }
13036
13037
13039 {
13041 return;
13042
13044 SetSynchDirty();
13045
13048 }
13049
13051 {
13054 }
13055
13057 {
13059 }
13060
13061 void OnApply(PlayerBase player);
13062
13064 {
13065 return 1.0;
13066 };
13067
13069 {
13071 }
13072
13074 {
13076 }
13077
13079
13081 {
13082 SetDynamicPhysicsLifeTime(0.01);
13084 }
13085
13087 {
13088 array<string> zone_names = new array<string>;
13089 GetDamageZones(zone_names);
13090 for (int i = 0; i < zone_names.Count(); i++)
13091 {
13092 SetHealthMax(zone_names.Get(i),"Health");
13093 }
13094 SetHealthMax("","Health");
13095 }
13096
13099 {
13100 float global_health = GetHealth01("","Health");
13101 array<string> zones = new array<string>;
13102 GetDamageZones(zones);
13103
13104 for (int i = 0; i < zones.Count(); i++)
13105 {
13106 SetHealth01(zones.Get(i),"Health",global_health);
13107 }
13108 }
13109
13112 {
13113 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13114 }
13115
13117 {
13118 if (!hasRootAsPlayer)
13119 {
13120 if (refParentIB)
13121 {
13122
13123 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13124 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13125
13126 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13127 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13128
13131 }
13132 else
13133 {
13134
13137 }
13138 }
13139 }
13140
13142 {
13144 {
13145 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13146 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13147 {
13148 float heatPermCoef = 1.0;
13150 while (ent)
13151 {
13152 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13153 ent = ent.GetHierarchyParent();
13154 }
13155
13156 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13157 }
13158 }
13159 }
13160
13162 {
13163
13164 EntityAI parent = GetHierarchyParent();
13165 if (!parent)
13166 {
13167 hasParent = false;
13168 hasRootAsPlayer = false;
13169 }
13170 else
13171 {
13172 hasParent = true;
13173 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13174 refParentIB =
ItemBase.Cast(parent);
13175 }
13176 }
13177
13178 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13179 {
13180
13181 }
13182
13184 {
13185
13186 return false;
13187 }
13188
13190 {
13191
13192
13193 return false;
13194 }
13195
13197 {
13198
13199 return false;
13200 }
13201
13204 {
13205 return !GetIsFrozen() &&
IsOpen();
13206 }
13207
13209 {
13210 bool hasParent = false, hasRootAsPlayer = false;
13212
13213 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13214 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13215
13216 if (wwtu || foodDecay)
13217 {
13221
13222 if (processWetness || processTemperature || processDecay)
13223 {
13225
13226 if (processWetness)
13227 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13228
13229 if (processTemperature)
13231
13232 if (processDecay)
13233 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13234 }
13235 }
13236 }
13237
13240 {
13242 }
13243
13245 {
13248
13249 return super.GetTemperatureFreezeThreshold();
13250 }
13251
13253 {
13256
13257 return super.GetTemperatureThawThreshold();
13258 }
13259
13261 {
13264
13265 return super.GetItemOverheatThreshold();
13266 }
13267
13269 {
13271 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13272
13273 return super.GetTemperatureFreezeTime();
13274 }
13275
13277 {
13279 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13280
13281 return super.GetTemperatureThawTime();
13282 }
13283
13288
13290 {
13291 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13292 }
13293
13295 {
13296 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13297 }
13298
13301 {
13303 }
13304
13306 {
13308 }
13309
13311 {
13313 }
13314
13317 {
13318 return null;
13319 }
13320
13323 {
13324 return false;
13325 }
13326
13328 {
13330 {
13333 if (!trg)
13334 {
13336 explosive = this;
13337 }
13338
13339 explosive.PairRemote(trg);
13341
13342 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13343 trg.SetPersistentPairID(persistentID);
13344 explosive.SetPersistentPairID(persistentID);
13345
13346 return true;
13347 }
13348 return false;
13349 }
13350
13353 {
13354 float ret = 1.0;
13357 ret *= GetHealth01();
13358
13359 return ret;
13360 }
13361
13362 #ifdef DEVELOPER
13363 override void SetDebugItem()
13364 {
13365 super.SetDebugItem();
13366 _itemBase = this;
13367 }
13368
13370 {
13371 string text = super.GetDebugText();
13372
13374 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13375
13376 return text;
13377 }
13378 #endif
13379
13381 {
13382 return true;
13383 }
13384
13386
13388
13390 {
13393 }
13394
13395
13403
13419
13420 [
Obsolete(
"Use ItemSoundHandler instead")]
13423 {
13424 if (!
g_Game.IsDedicatedServer())
13425 {
13426 if (ConfigIsExisting("attachSoundSet"))
13427 {
13428 string cfg_path = "";
13429 string soundset = "";
13430 string type_name =
GetType();
13431
13434 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13435 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13436
13437 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13438 {
13439 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13440 {
13441 if (cfg_slot_array[i] == slot_type)
13442 {
13443 soundset = cfg_soundset_array[i];
13444 break;
13445 }
13446 }
13447 }
13448
13449 if (soundset != "")
13450 {
13451 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13453 }
13454 }
13455 }
13456 }
13457
13459}
13460
13462{
13464 if (entity)
13465 {
13466 bool is_item = entity.IsInherited(
ItemBase);
13467 if (is_item && full_quantity)
13468 {
13471 }
13472 }
13473 else
13474 {
13476 return NULL;
13477 }
13478 return entity;
13479}
13480
13482{
13483 if (item)
13484 {
13485 if (health > 0)
13486 item.SetHealth("", "", health);
13487
13488 if (item.CanHaveTemperature())
13489 {
13491 if (item.CanFreeze())
13492 item.SetFrozen(false);
13493 }
13494
13495 if (item.HasEnergyManager())
13496 {
13497 if (quantity >= 0)
13498 {
13499 item.GetCompEM().SetEnergy0To1(quantity);
13500 }
13501 else
13502 {
13504 }
13505 }
13506 else if (item.IsMagazine())
13507 {
13508 Magazine mag = Magazine.Cast(item);
13509 if (quantity >= 0)
13510 {
13511 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13512 }
13513 else
13514 {
13516 }
13517
13518 }
13519 else
13520 {
13521 if (quantity >= 0)
13522 {
13523 item.SetQuantityNormalized(quantity, false);
13524 }
13525 else
13526 {
13528 }
13529
13530 }
13531 }
13532}
13533
13534#ifdef DEVELOPER
13536#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.