8783{
8785 {
8786 return true;
8787 }
8788};
8789
8791{
8792
8793};
8794
8795
8796
8798{
8802
8804
8807
8808
8809
8810
8811
8820
8826
8831
8836
8857 protected bool m_IsResultOfSplit
8858
8860
8865
8866
8867
8869
8873
8874
8875
8877
8880
8881
8882
8888
8889
8897
8900
8901
8903
8904
8906
8907
8912
8913
8918
8920
8921
8923
8924
8926 {
8931
8932 if (!
g_Game.IsDedicatedServer())
8933 {
8935 {
8937
8939 {
8941 }
8942 }
8943
8946 }
8947
8948 m_OldLocation = null;
8949
8951 {
8953 }
8954
8955 if (ConfigIsExisting("headSelectionsToHide"))
8956 {
8959 }
8960
8962 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8963 {
8965 }
8966
8968
8969 m_IsResultOfSplit = false;
8970
8972 }
8973
8975 {
8976 super.InitItemVariables();
8977
8983 m_Count = ConfigGetInt(
"count");
8984
8987
8992
8995
9000
9012
9016
9017
9020 if (ConfigIsExisting("canBeSplit"))
9021 {
9024 }
9025
9027 if (ConfigIsExisting("itemBehaviour"))
9029
9030
9033 RegisterNetSyncVariableInt("m_VarLiquidType");
9034 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9035
9036 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9037 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9038 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9039
9040 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9041 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9042 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9043 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9044
9045 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9046 RegisterNetSyncVariableBool("m_IsTakeable");
9047 RegisterNetSyncVariableBool("m_IsHologram");
9048
9051 {
9054 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9055 }
9056
9058
9060 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9062
9064 }
9065
9067 {
9069 }
9070
9072 {
9075 {
9080 }
9081 }
9082
9083 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9084 {
9086 {
9089 }
9090
9092 }
9093
9095 {
9101 }
9102
9104
9106 {
9108
9109 if (!action)
9110 {
9111 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9112 return;
9113 }
9114
9116 if (!ai)
9117 {
9119 return;
9120 }
9121
9123 if (!action_array)
9124 {
9125 action_array = new array<ActionBase_Basic>;
9127 }
9128 if (LogManager.IsActionLogEnable())
9129 {
9130 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9131 }
9132
9133 if (action_array.Find(action) != -1)
9134 {
9135 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9136 }
9137 else
9138 {
9139 action_array.Insert(action);
9140 }
9141 }
9142
9144 {
9145 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9146 ActionBase action = player.GetActionManager().GetAction(actionName);
9149
9150 if (action_array)
9151 {
9152 action_array.RemoveItem(action);
9153 }
9154 }
9155
9156
9157
9159 {
9160 ActionOverrideData overrideData = new ActionOverrideData();
9164
9166 if (!actionMap)
9167 {
9170 }
9171
9172 actionMap.Insert(this.
Type(), overrideData);
9173
9174 }
9175
9177
9179
9180
9182 {
9185
9188
9189 string config_to_search = "CfgVehicles";
9190 string muzzle_owner_config;
9191
9193 {
9194 if (IsInherited(Weapon))
9195 config_to_search = "CfgWeapons";
9196
9197 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9198
9199 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9200
9201 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9202
9203 if (config_OnFire_subclass_count > 0)
9204 {
9205 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9206
9207 for (int i = 0; i < config_OnFire_subclass_count; i++)
9208 {
9209 string particle_class = "";
9210 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9211 string config_OnFire_entry = config_OnFire_class + particle_class;
9212 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9213 WPOF_array.Insert(WPOF);
9214 }
9215
9216
9218 }
9219 }
9220
9222 {
9223 config_to_search = "CfgWeapons";
9224 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9225
9226 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9227
9228 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9229
9230 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9231 {
9232 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9233
9234 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9235 {
9236 string particle_class2 = "";
9237 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9238 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9239 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9240 WPOBE_array.Insert(WPOBE);
9241 }
9242
9243
9245 }
9246 }
9247 }
9248
9249
9251 {
9254
9256 {
9257 string config_to_search = "CfgVehicles";
9258
9259 if (IsInherited(Weapon))
9260 config_to_search = "CfgWeapons";
9261
9262 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9263 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9264
9265 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9266 {
9267
9269
9271 {
9273 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9275 return;
9276 }
9277
9280
9281
9282
9283 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9284 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9285
9286 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9287 {
9288 string particle_class = "";
9289 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9290 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9291 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9292
9293 if (entry_type == CT_CLASS)
9294 {
9295 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9296 WPOOH_array.Insert(WPOF);
9297 }
9298 }
9299
9300
9302 }
9303 }
9304 }
9305
9307 {
9309 }
9310
9312 {
9314 {
9316
9319
9322
9323 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9324 }
9325 }
9326
9328 {
9330 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9331
9333 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9334
9336 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9337
9339 {
9341 }
9342 }
9343
9345 {
9347 }
9348
9350 {
9353 else
9355
9357 {
9360 }
9361 else
9362 {
9365
9368 }
9369
9371 }
9372
9374 {
9376 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9377 }
9378
9380 {
9382 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9384 }
9385
9387 {
9389 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9390 }
9391
9393 {
9396
9397 OverheatingParticle OP = new OverheatingParticle();
9402
9404 }
9405
9407 {
9410
9411 return -1;
9412 }
9413
9415 {
9417 {
9420
9421 for (int i = count; i > 0; --i)
9422 {
9423 int id = i - 1;
9426
9429
9430 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9431 {
9432 if (p)
9433 {
9436 }
9437 }
9438 }
9439 }
9440 }
9441
9443 {
9445 {
9447 {
9448 int id = i - 1;
9450
9451 if (OP)
9452 {
9454
9455 if (p)
9456 {
9458 }
9459
9460 delete OP;
9461 }
9462 }
9463
9466 }
9467 }
9468
9471 {
9472 return 0.0;
9473 }
9474
9475
9477 {
9478 return 250;
9479 }
9480
9482 {
9483 return 0;
9484 }
9485
9488 {
9490 return true;
9491
9492 return false;
9493 }
9494
9497 {
9500
9502 {
9504 }
9505 else
9506 {
9507
9509 }
9510
9512 }
9513
9520 {
9521 return -1;
9522 }
9523
9524
9525
9526
9528 {
9530 {
9531 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9532 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9533
9534 if (r_index >= 0)
9535 {
9536 InventoryLocation r_il = new InventoryLocation;
9537 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9538
9539 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9542 {
9543 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9544 }
9546 {
9547 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9548 }
9549
9550 }
9551
9552 player.GetHumanInventory().ClearUserReservedLocation(this);
9553 }
9554
9557 }
9558
9559
9560
9561
9563 {
9564 return ItemBase.m_DebugActionsMask;
9565 }
9566
9568 {
9569 return ItemBase.m_DebugActionsMask & mask;
9570 }
9571
9573 {
9574 ItemBase.m_DebugActionsMask = mask;
9575 }
9576
9578 {
9579 ItemBase.m_DebugActionsMask |= mask;
9580 }
9581
9583 {
9584 ItemBase.m_DebugActionsMask &= ~mask;
9585 }
9586
9588 {
9590 {
9592 }
9593 else
9594 {
9596 }
9597 }
9598
9599
9601 {
9602 if (GetEconomyProfile())
9603 {
9604 float q_max = GetEconomyProfile().GetQuantityMax();
9605 if (q_max > 0)
9606 {
9607 float q_min = GetEconomyProfile().GetQuantityMin();
9608 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9609
9611 {
9612 ComponentEnergyManager comp = GetCompEM();
9614 {
9616 }
9617 }
9619 {
9621
9622 }
9623
9624 }
9625 }
9626 }
9627
9630 {
9631 EntityAI parent = GetHierarchyParent();
9632
9633 if (parent)
9634 {
9635 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9636 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9637 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9638 }
9639 }
9640
9643 {
9644 EntityAI parent = GetHierarchyParent();
9645
9646 if (parent)
9647 {
9648 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9649 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9650 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9651 }
9652 }
9653
9655 {
9656
9657
9658
9659
9661
9663 {
9664 if (ScriptInputUserData.CanStoreInputUserData())
9665 {
9666 ScriptInputUserData ctx = new ScriptInputUserData;
9672 ctx.
Write(use_stack_max);
9675
9677 {
9678 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9679 }
9680 }
9681 }
9682 else if (!
g_Game.IsMultiplayer())
9683 {
9685 }
9686 }
9687
9689 {
9691 }
9692
9694 {
9696 }
9697
9699 {
9701 }
9702
9704 {
9705
9706 return false;
9707 }
9708
9710 {
9711 return false;
9712 }
9713
9717 {
9718 return false;
9719 }
9720
9722 {
9723 return "";
9724 }
9725
9727
9729 {
9730 return false;
9731 }
9732
9734 {
9735 return true;
9736 }
9737
9738
9739
9741 {
9742 return true;
9743 }
9744
9746 {
9747 return true;
9748 }
9749
9751 {
9752 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9754 }
9755
9757 {
9759 }
9760
9762 {
9764 if (!is_being_placed)
9766 SetSynchDirty();
9767 }
9768
9769
9771
9773 {
9775 }
9776
9778 {
9780 }
9781
9783 {
9784 return 1;
9785 }
9786
9788 {
9789 return false;
9790 }
9791
9793 {
9795 SetSynchDirty();
9796 }
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9833 {
9834 super.OnMovedInsideCargo(container);
9835
9836 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9837 }
9838
9839 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9840 {
9841 super.EEItemLocationChanged(oldLoc, newLoc);
9842
9843 PlayerBase newPlayer = null;
9844 PlayerBase oldPlayer = null;
9845
9846 if (newLoc.GetParent())
9847 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9848
9849 if (oldLoc.GetParent())
9850 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9851
9853 {
9854 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9855
9856 if (rIndex >= 0)
9857 {
9858 InventoryLocation rIl = new InventoryLocation;
9859 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9860
9861 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9864 {
9865 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9866 }
9868 {
9870 }
9871
9872 }
9873 }
9874
9876 {
9877 if (newPlayer)
9878 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9879
9880 if (newPlayer == oldPlayer)
9881 {
9882 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9883 {
9885 {
9886 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9887 {
9888 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9889 }
9890 }
9891 else
9892 {
9893 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9894 }
9895 }
9896
9897 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9898 {
9899 int type = oldLoc.GetType();
9901 {
9902 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9903 }
9905 {
9906 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9907 }
9908 }
9909 if (!m_OldLocation)
9910 {
9911 m_OldLocation = new InventoryLocation;
9912 }
9913 m_OldLocation.Copy(oldLoc);
9914 }
9915 else
9916 {
9917 if (m_OldLocation)
9918 {
9919 m_OldLocation.Reset();
9920 }
9921 }
9922
9923 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9924 }
9925 else
9926 {
9927 if (newPlayer)
9928 {
9929 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9930 if (resIndex >= 0)
9931 {
9932 InventoryLocation il = new InventoryLocation;
9933 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9935 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9938 {
9939 il.
GetParent().GetOnReleaseLock().Invoke(it);
9940 }
9942 {
9944 }
9945
9946 }
9947 }
9949 {
9950
9952 }
9953
9954 if (m_OldLocation)
9955 {
9956 m_OldLocation.Reset();
9957 }
9958 }
9959
9961 {
9962 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9963 }
9964
9966 {
9967 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9968 }
9969 }
9970
9971 override void EOnContact(IEntity other, Contact extra)
9972 {
9974 {
9975 int liquidType = -1;
9977 if (impactSpeed > 0.0)
9978 {
9980 #ifndef SERVER
9982 #else
9984 SetSynchDirty();
9985 #endif
9987 }
9988 }
9989
9990 #ifdef SERVER
9991 if (GetCompEM() && GetCompEM().IsPlugged())
9992 {
9993 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9994 GetCompEM().UnplugThis();
9995 }
9996 #endif
9997 }
9998
10000
10002 {
10004 }
10005
10007 {
10008
10009 }
10010
10012 {
10013 super.OnItemLocationChanged(old_owner, new_owner);
10014
10015 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10016 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10017
10018 if (!relatedPlayer && playerNew)
10019 relatedPlayer = playerNew;
10020
10021 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10022 {
10024 if (actionMgr)
10025 {
10026 ActionBase currentAction = actionMgr.GetRunningAction();
10027 if (currentAction)
10029 }
10030 }
10031
10032 Man ownerPlayerOld = null;
10033 Man ownerPlayerNew = null;
10034
10035 if (old_owner)
10036 {
10037 if (old_owner.
IsMan())
10038 {
10039 ownerPlayerOld = Man.Cast(old_owner);
10040 }
10041 else
10042 {
10043 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10044 }
10045 }
10046 else
10047 {
10049 {
10051
10052 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10053 {
10054 GetCompEM().UnplugThis();
10055 }
10056 }
10057 }
10058
10059 if (new_owner)
10060 {
10061 if (new_owner.
IsMan())
10062 {
10063 ownerPlayerNew = Man.Cast(new_owner);
10064 }
10065 else
10066 {
10067 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10068 }
10069 }
10070
10071 if (ownerPlayerOld != ownerPlayerNew)
10072 {
10073 if (ownerPlayerOld)
10074 {
10075 array<EntityAI> subItemsExit = new array<EntityAI>;
10077 for (int i = 0; i < subItemsExit.Count(); i++)
10078 {
10081 }
10082 }
10083
10084 if (ownerPlayerNew)
10085 {
10086 array<EntityAI> subItemsEnter = new array<EntityAI>;
10088 for (int j = 0; j < subItemsEnter.Count(); j++)
10089 {
10092 }
10093 }
10094 }
10095 else if (ownerPlayerNew != null)
10096 {
10097 PlayerBase nplayer;
10098 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10099 {
10100 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10102 for (int k = 0; k < subItemsUpdate.Count(); k++)
10103 {
10105 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10106 }
10107 }
10108 }
10109
10110 if (old_owner)
10111 old_owner.OnChildItemRemoved(this);
10112 if (new_owner)
10113 new_owner.OnChildItemReceived(this);
10114 }
10115
10116
10118 {
10119 super.EEDelete(parent);
10120 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10121 if (player)
10122 {
10124
10125 if (player.IsAlive())
10126 {
10127 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10128 if (r_index >= 0)
10129 {
10130 InventoryLocation r_il = new InventoryLocation;
10131 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10132
10133 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10136 {
10137 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10138 }
10140 {
10141 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10142 }
10143
10144 }
10145
10146 player.RemoveQuickBarEntityShortcut(this);
10147 }
10148 }
10149 }
10150
10152 {
10153 super.EEKilled(killer);
10154
10157 {
10158 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10159 {
10160 if (IsMagazine())
10161 {
10162 if (Magazine.Cast(this).GetAmmoCount() > 0)
10163 {
10165 }
10166 }
10167 else
10168 {
10170 }
10171 }
10172 }
10173 }
10174
10176 {
10177 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10178
10179 super.OnWasAttached(parent, slot_id);
10180
10183
10186 }
10187
10189 {
10190 super.OnWasDetached(parent, slot_id);
10191
10194
10197 }
10198
10200 {
10201 int idx;
10204
10205 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10206 if (inventory_slots.Count() < 1)
10207 {
10208 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10209 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10210 }
10211 else
10212 {
10213 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10214 }
10215
10216 idx = inventory_slots.Find(slot);
10217 if (idx < 0)
10218 return "";
10219
10220 return attach_types.Get(idx);
10221 }
10222
10224 {
10225 int idx = -1;
10226 string slot;
10227
10230
10231 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10232 if (inventory_slots.Count() < 1)
10233 {
10234 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10235 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10236 }
10237 else
10238 {
10239 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10240 if (detach_types.Count() < 1)
10241 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10242 }
10243
10244 for (int i = 0; i < inventory_slots.Count(); i++)
10245 {
10246 slot = inventory_slots.Get(i);
10247 }
10248
10249 if (slot != "")
10250 {
10251 if (detach_types.Count() == 1)
10252 idx = 0;
10253 else
10254 idx = inventory_slots.Find(slot);
10255 }
10256 if (idx < 0)
10257 return "";
10258
10259 return detach_types.Get(idx);
10260 }
10261
10263 {
10264
10266
10267
10268 float min_time = 1;
10269 float max_time = 3;
10270 float delay = Math.RandomFloat(min_time, max_time);
10271
10272 explode_timer.Run(delay, this, "DoAmmoExplosion");
10273 }
10274
10276 {
10277 Magazine magazine = Magazine.Cast(this);
10278 int pop_sounds_count = 6;
10279 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10280
10281
10282 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10283 string sound_name = pop_sounds[ sound_idx ];
10284 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10285
10286
10287 magazine.ServerAddAmmoCount(-1);
10288
10289
10290 float min_temp_to_explode = 100;
10291
10292 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10293 {
10295 }
10296 }
10297
10298
10299 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10300 {
10301 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10302
10303 const int CHANCE_DAMAGE_CARGO = 4;
10304 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10305 const int CHANCE_DAMAGE_NOTHING = 2;
10306
10308 {
10309 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10310 int chances;
10311 int rnd;
10312
10313 if (GetInventory().GetCargo())
10314 {
10315 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10316 rnd = Math.RandomInt(0,chances);
10317
10318 if (rnd < CHANCE_DAMAGE_CARGO)
10319 {
10321 }
10322 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10323 {
10325 }
10326 }
10327 else
10328 {
10329 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10330 rnd = Math.RandomInt(0,chances);
10331
10332 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10333 {
10335 }
10336 }
10337 }
10338 }
10339
10341 {
10342 CargoBase cargo = GetInventory().GetCargo();
10343 if (cargo)
10344 {
10346 if (item_count > 0)
10347 {
10348 int random_pick = Math.RandomInt(0, item_count);
10350 if (!item.IsExplosive())
10351 {
10352 item.AddHealth("","",damage);
10353 return true;
10354 }
10355 }
10356 }
10357 return false;
10358 }
10359
10361 {
10362 GameInventory inventory = GetInventory();
10364 if (attachment_count > 0)
10365 {
10366 int random_pick = Math.RandomInt(0, attachment_count);
10368 if (!attachment.IsExplosive())
10369 {
10370 attachment.AddHealth("","",damage);
10371 return true;
10372 }
10373 }
10374 return false;
10375 }
10376
10378 {
10380 }
10381
10383 {
10385 return GetInventory().CanRemoveEntity();
10386
10387 return false;
10388 }
10389
10391 {
10392
10394 return false;
10395
10396
10398 return false;
10399
10400
10401
10403 if (delta == 0)
10404 return false;
10405
10406
10407 return true;
10408 }
10409
10411 {
10413 {
10414 if (ScriptInputUserData.CanStoreInputUserData())
10415 {
10416 ScriptInputUserData ctx = new ScriptInputUserData;
10421 ctx.
Write(destination_entity);
10423 ctx.
Write(slot_id);
10425 }
10426 }
10427 else if (!
g_Game.IsMultiplayer())
10428 {
10430 }
10431 }
10432
10434 {
10435 float split_quantity_new;
10439 InventoryLocation loc = new InventoryLocation;
10440
10441 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10442 {
10444 split_quantity_new = stack_max;
10445 else
10447
10449 {
10450 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10451 if (new_item)
10452 {
10453 new_item.SetResultOfSplit(true);
10454 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10456 new_item.
SetQuantity(split_quantity_new,
false,
true);
10457 }
10458 }
10459 }
10460 else if (destination_entity && slot_id == -1)
10461 {
10462 if (quantity > stack_max)
10463 split_quantity_new = stack_max;
10464 else
10465 split_quantity_new = quantity;
10466
10468 {
10469 GameInventory destinationInventory = destination_entity.GetInventory();
10471 {
10474 }
10475
10476 if (new_item)
10477 {
10478 new_item.SetResultOfSplit(true);
10479 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10481 new_item.
SetQuantity(split_quantity_new,
false,
true);
10482 }
10483 }
10484 }
10485 else
10486 {
10487 if (stack_max != 0)
10488 {
10490 {
10492 }
10493
10494 if (split_quantity_new == 0)
10495 {
10496 if (!
g_Game.IsMultiplayer())
10497 player.PhysicalPredictiveDropItem(this);
10498 else
10499 player.ServerDropEntity(this);
10500 return;
10501 }
10502
10504 {
10506
10507 if (new_item)
10508 {
10509 new_item.SetResultOfSplit(true);
10510 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10513 new_item.PlaceOnSurface();
10514 }
10515 }
10516 }
10517 }
10518 }
10519
10521 {
10522 float split_quantity_new;
10526 InventoryLocation loc = new InventoryLocation;
10527
10528 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10529 {
10531 split_quantity_new = stack_max;
10532 else
10534
10536 {
10537 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10538 if (new_item)
10539 {
10540 new_item.SetResultOfSplit(true);
10541 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10543 new_item.
SetQuantity(split_quantity_new,
false,
true);
10544 }
10545 }
10546 }
10547 else if (destination_entity && slot_id == -1)
10548 {
10549 if (quantity > stack_max)
10550 split_quantity_new = stack_max;
10551 else
10552 split_quantity_new = quantity;
10553
10555 {
10556 GameInventory destinationInventory = destination_entity.GetInventory();
10558 {
10561 }
10562
10563 if (new_item)
10564 {
10565 new_item.SetResultOfSplit(true);
10566 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10568 new_item.
SetQuantity(split_quantity_new,
false,
true);
10569 }
10570 }
10571 }
10572 else
10573 {
10574 if (stack_max != 0)
10575 {
10577 {
10579 }
10580
10582 {
10584
10585 if (new_item)
10586 {
10587 new_item.SetResultOfSplit(true);
10588 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10591 new_item.PlaceOnSurface();
10592 }
10593 }
10594 }
10595 }
10596 }
10597
10599 {
10601 {
10602 if (ScriptInputUserData.CanStoreInputUserData())
10603 {
10604 ScriptInputUserData ctx = new ScriptInputUserData;
10609 dst.WriteToContext(ctx);
10611 }
10612 }
10613 else if (!
g_Game.IsMultiplayer())
10614 {
10616 }
10617 }
10618
10620 {
10622 {
10623 if (ScriptInputUserData.CanStoreInputUserData())
10624 {
10625 ScriptInputUserData ctx = new ScriptInputUserData;
10630 ctx.
Write(destination_entity);
10636 }
10637 }
10638 else if (!
g_Game.IsMultiplayer())
10639 {
10641 }
10642 }
10643
10645 {
10647 }
10648
10650 {
10652 float split_quantity_new;
10654 if (dst.IsValid())
10655 {
10656 int slot_id = dst.GetSlot();
10658
10659 if (quantity > stack_max)
10660 split_quantity_new = stack_max;
10661 else
10662 split_quantity_new = quantity;
10663
10665 {
10667
10668 if (new_item)
10669 {
10670 new_item.SetResultOfSplit(true);
10671 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10673 new_item.
SetQuantity(split_quantity_new,
false,
true);
10674 }
10675
10676 return new_item;
10677 }
10678 }
10679
10680 return null;
10681 }
10682
10684 {
10686 float split_quantity_new;
10688 if (destination_entity)
10689 {
10691 if (quantity > stackable)
10692 split_quantity_new = stackable;
10693 else
10694 split_quantity_new = quantity;
10695
10697 {
10698 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10699 if (new_item)
10700 {
10701 new_item.SetResultOfSplit(true);
10702 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10704 new_item.
SetQuantity(split_quantity_new,
false,
true);
10705 }
10706 }
10707 }
10708 }
10709
10711 {
10713 {
10714 if (ScriptInputUserData.CanStoreInputUserData())
10715 {
10716 ScriptInputUserData ctx = new ScriptInputUserData;
10721 ItemBase destination_entity =
this;
10722 ctx.
Write(destination_entity);
10726 }
10727 }
10728 else if (!
g_Game.IsMultiplayer())
10729 {
10731 }
10732 }
10733
10735 {
10737 float split_quantity_new;
10739 if (player)
10740 {
10742 if (quantity > stackable)
10743 split_quantity_new = stackable;
10744 else
10745 split_quantity_new = quantity;
10746
10748 {
10749 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10750 new_item =
ItemBase.Cast(in_hands);
10751 if (new_item)
10752 {
10753 new_item.SetResultOfSplit(true);
10754 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10756 new_item.SetQuantity(split_quantity_new, false, true);
10757 }
10758 }
10759 }
10760 }
10761
10763 {
10765 float split_quantity_new = Math.Floor(quantity * 0.5);
10766
10768 return;
10769
10771
10772 if (new_item)
10773 {
10774 if (new_item.GetQuantityMax() < split_quantity_new)
10775 {
10776 split_quantity_new = new_item.GetQuantityMax();
10777 }
10778
10779 new_item.SetResultOfSplit(true);
10780 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10781
10783 {
10786 }
10787 else
10788 {
10790 new_item.
SetQuantity(split_quantity_new,
false,
true);
10791 }
10792 }
10793 }
10794
10796 {
10798 float split_quantity_new = Math.Floor(quantity / 2);
10799
10801 return;
10802
10803 InventoryLocation invloc = new InventoryLocation;
10805
10807 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10808
10809 if (new_item)
10810 {
10811 if (new_item.GetQuantityMax() < split_quantity_new)
10812 {
10813 split_quantity_new = new_item.GetQuantityMax();
10814 }
10816 {
10819 }
10820 else if (split_quantity_new > 1)
10821 {
10823 new_item.
SetQuantity(split_quantity_new,
false,
true);
10824 }
10825 }
10826 }
10827
10830 {
10831 SetWeightDirty();
10833
10834 if (parent)
10835 parent.OnAttachmentQuantityChangedEx(this, delta);
10836
10838 {
10840 {
10842 }
10844 {
10845 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10847 }
10848 }
10849 }
10850
10853 {
10854
10855 }
10856
10859 {
10861 }
10862
10864 {
10865 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10866
10868 {
10869 if (newLevel == GameConstants.STATE_RUINED)
10870 {
10872 EntityAI parent = GetHierarchyParent();
10873 if (parent && parent.IsFireplace())
10874 {
10875 CargoBase cargo = GetInventory().GetCargo();
10876 if (cargo)
10877 {
10879 {
10881 }
10882 }
10883 }
10884 }
10885
10887 {
10888
10890 return;
10891 }
10892
10893 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10894 {
10896 }
10897 }
10898 }
10899
10900
10902 {
10903 super.OnRightClick();
10904
10906 {
10908 {
10909 if (ScriptInputUserData.CanStoreInputUserData())
10910 {
10911 EntityAI root = GetHierarchyRoot();
10912 Man playerOwner = GetHierarchyRootPlayer();
10913 InventoryLocation dst = new InventoryLocation;
10914
10915
10916 if (!playerOwner && root && root == this)
10917 {
10919 }
10920 else
10921 {
10922
10923 GetInventory().GetCurrentInventoryLocation(dst);
10925 {
10926 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10928 {
10930 }
10931 else
10932 {
10934
10935
10936 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10937 {
10939 }
10940 else
10941 {
10942 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10943 }
10944 }
10945 }
10946 }
10947
10948 ScriptInputUserData ctx = new ScriptInputUserData;
10956 }
10957 }
10958 else if (!
g_Game.IsMultiplayer())
10959 {
10961 }
10962 }
10963 }
10964
10966 {
10967 if (root)
10968 {
10969 vector m4[4];
10970 root.GetTransform(m4);
10971 dst.SetGround(this, m4);
10972 }
10973 else
10974 {
10975 GetInventory().GetCurrentInventoryLocation(dst);
10976 }
10977 }
10978
10979 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10980 {
10981
10982 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10983 return false;
10984
10985 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10986 return false;
10987
10988
10990 return false;
10991
10992
10993 Magazine mag = Magazine.Cast(this);
10994 if (mag)
10995 {
10996 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10997 return false;
10998
10999 if (stack_max_limit)
11000 {
11001 Magazine other_mag = Magazine.Cast(other_item);
11002 if (other_item)
11003 {
11004 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11005 return false;
11006 }
11007
11008 }
11009 }
11010 else
11011 {
11012
11014 return false;
11015
11017 return false;
11018 }
11019
11020 PlayerBase player = null;
11021 if (CastTo(player, GetHierarchyRootPlayer()))
11022 {
11023 if (player.GetInventory().HasAttachment(this))
11024 return false;
11025
11026 if (player.IsItemsToDelete())
11027 return false;
11028 }
11029
11030 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11031 return false;
11032
11033 int slotID;
11035 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11036 return false;
11037
11038 return true;
11039 }
11040
11042 {
11044 }
11045
11047 {
11048 return m_IsResultOfSplit;
11049 }
11050
11052 {
11053 m_IsResultOfSplit = value;
11054 }
11055
11057 {
11059 }
11060
11062 {
11063 float other_item_quantity = other_item.GetQuantity();
11064 float this_free_space;
11065
11067
11069
11070 if (other_item_quantity > this_free_space)
11071 {
11072 return this_free_space;
11073 }
11074 else
11075 {
11076 return other_item_quantity;
11077 }
11078 }
11079
11081 {
11083 }
11084
11086 {
11088 return;
11089
11090 if (!IsMagazine() && other_item)
11091 {
11093 if (quantity_used != 0)
11094 {
11095 float hp1 = GetHealth01("","");
11096 float hp2 = other_item.GetHealth01("","");
11097 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11098 hpResult = hpResult / (
GetQuantity() + quantity_used);
11099
11100 hpResult *= GetMaxHealth();
11101 Math.Round(hpResult);
11102 SetHealth("", "Health", hpResult);
11103
11105 other_item.AddQuantity(-quantity_used);
11106 }
11107 }
11109 }
11110
11112 {
11113 #ifdef SERVER
11114 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11115 GetHierarchyParent().IncreaseLifetimeUp();
11116 #endif
11117 };
11118
11120 {
11121 PlayerBase p = PlayerBase.Cast(player);
11122
11123 array<int> recipesIds = p.m_Recipes;
11124 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11125 if (moduleRecipesManager)
11126 {
11127 EntityAI itemInHands = player.GetEntityInHands();
11128 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11129 }
11130
11131 for (int i = 0;i < recipesIds.Count(); i++)
11132 {
11133 int key = recipesIds.Get(i);
11134 string recipeName = moduleRecipesManager.GetRecipeName(key);
11136 }
11137 }
11138
11139
11140 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11141 {
11142 super.GetDebugActions(outputList);
11143
11144
11150
11151
11156
11161
11162
11166
11167
11169 {
11173 }
11174
11177
11178
11182
11184
11185 InventoryLocation loc = new InventoryLocation();
11186 GetInventory().GetCurrentInventoryLocation(loc);
11188 {
11189 if (Gizmo_IsSupported())
11192 }
11193
11195 }
11196
11197
11198
11199
11201 {
11202 super.OnAction(action_id, player, ctx);
11203
11205 {
11206 switch (action_id)
11207 {
11211 return true;
11215 return true;
11216 }
11217 }
11218
11220 {
11221 switch (action_id)
11222 {
11224 Delete();
11225 return true;
11226 }
11227 }
11228
11229 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11230 {
11231 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11232 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11233 PlayerBase p = PlayerBase.Cast(player);
11234 if (
EActions.RECIPES_RANGE_START < 1000)
11235 {
11236 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11237 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11238 }
11239 }
11240 #ifndef SERVER
11241 else if (action_id ==
EActions.WATCH_PLAYER)
11242 {
11243 PluginDeveloper.SetDeveloperItemClientEx(player);
11244 }
11245 #endif
11247 {
11248 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11249 {
11250 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11251 OnDebugButtonPressServer(id + 1);
11252 }
11253
11254 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11255 {
11256 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11258 }
11259
11260 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11261 {
11262 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11264 }
11265
11266 else if (action_id ==
EActions.ADD_QUANTITY)
11267 {
11268 if (IsMagazine())
11269 {
11270 Magazine mag = Magazine.Cast(this);
11271 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11272 }
11273 else
11274 {
11276 }
11277
11278 if (m_EM)
11279 {
11280 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11281 }
11282
11283 }
11284
11285 else if (action_id ==
EActions.REMOVE_QUANTITY)
11286 {
11287 if (IsMagazine())
11288 {
11289 Magazine mag2 = Magazine.Cast(this);
11290 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11291 }
11292 else
11293 {
11295 }
11296 if (m_EM)
11297 {
11298 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11299 }
11300
11301 }
11302
11303 else if (action_id ==
EActions.SET_QUANTITY_0)
11304 {
11306
11307 if (m_EM)
11308 {
11309 m_EM.SetEnergy(0);
11310 }
11311 }
11312
11313 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11314 {
11316
11317 if (m_EM)
11318 {
11319 m_EM.SetEnergy(m_EM.GetEnergyMax());
11320 }
11321 }
11322
11323 else if (action_id ==
EActions.ADD_HEALTH)
11324 {
11325 AddHealth("","",GetMaxHealth("","Health")/5);
11326 }
11327 else if (action_id ==
EActions.REMOVE_HEALTH)
11328 {
11329 AddHealth("","",-GetMaxHealth("","Health")/5);
11330 }
11331 else if (action_id ==
EActions.DESTROY_HEALTH)
11332 {
11333 SetHealth01("","",0);
11334 }
11335 else if (action_id ==
EActions.WATCH_ITEM)
11336 {
11338 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11339 #ifdef DEVELOPER
11340 SetDebugDeveloper_item(this);
11341 #endif
11342 }
11343
11344 else if (action_id ==
EActions.ADD_TEMPERATURE)
11345 {
11346 AddTemperature(20);
11347
11348 }
11349
11350 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11351 {
11352 AddTemperature(-20);
11353
11354 }
11355
11356 else if (action_id ==
EActions.FLIP_FROZEN)
11357 {
11358 SetFrozen(!GetIsFrozen());
11359
11360 }
11361
11362 else if (action_id ==
EActions.ADD_WETNESS)
11363 {
11365
11366 }
11367
11368 else if (action_id ==
EActions.REMOVE_WETNESS)
11369 {
11371
11372 }
11373
11374 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11375 {
11378
11379
11380 }
11381
11382 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11383 {
11386 }
11387
11388 else if (action_id ==
EActions.MAKE_SPECIAL)
11389 {
11390 auto debugParams = DebugSpawnParams.WithPlayer(player);
11391 OnDebugSpawnEx(debugParams);
11392 }
11393
11394 }
11395
11396
11397 return false;
11398 }
11399
11400
11401
11402
11406
11409
11410
11411
11413 {
11414 return false;
11415 }
11416
11417
11419 {
11420 return true;
11421 }
11422
11423
11425 {
11426 return true;
11427 }
11428
11429
11430
11432 {
11433 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11434 return g_Game.ConfigIsExisting(config_path);
11435 }
11436
11439 {
11440 return null;
11441 }
11442
11444 {
11445 return false;
11446 }
11447
11449 {
11450 return false;
11451 }
11452
11456
11457
11459 {
11460 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11461 return module_repairing.CanRepair(this, item_repair_kit);
11462 }
11463
11464
11465 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11466 {
11467 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11468 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11469 }
11470
11471
11473 {
11474
11475
11476
11477
11478
11479
11480
11481
11482 return 1;
11483 }
11484
11485
11486
11488 {
11490 }
11491
11492
11493
11495 {
11497 }
11498
11499
11508 {
11509 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11510
11511 if (player)
11512 {
11513 player.MessageStatus(text);
11514 }
11515 }
11516
11517
11526 {
11527 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11528
11529 if (player)
11530 {
11531 player.MessageAction(text);
11532 }
11533 }
11534
11535
11544 {
11545 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11546
11547 if (player)
11548 {
11549 player.MessageFriendly(text);
11550 }
11551 }
11552
11553
11562 {
11563 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11564
11565 if (player)
11566 {
11567 player.MessageImportant(text);
11568 }
11569 }
11570
11572 {
11573 return true;
11574 }
11575
11576
11577 override bool KindOf(
string tag)
11578 {
11579 bool found = false;
11580 string item_name = this.
GetType();
11582 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11583
11584 int array_size = item_tag_array.Count();
11585 for (int i = 0; i < array_size; i++)
11586 {
11587 if (item_tag_array.Get(i) == tag)
11588 {
11589 found = true;
11590 break;
11591 }
11592 }
11593 return found;
11594 }
11595
11596
11598 {
11599
11600 super.OnRPC(sender, rpc_type,ctx);
11601
11602
11603 switch (rpc_type)
11604 {
11605 #ifndef SERVER
11606 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11607 Param2<bool, string> p = new Param2<bool, string>(false, "");
11608
11610 return;
11611
11612 bool play = p.param1;
11613 string soundSet = p.param2;
11614
11615 if (play)
11616 {
11618 {
11620 {
11622 }
11623 }
11624 else
11625 {
11627 }
11628 }
11629 else
11630 {
11632 }
11633
11634 break;
11635 #endif
11636
11637 }
11638
11640 {
11642 }
11643 }
11644
11645
11646
11647
11649 {
11650 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11651 return plugin.GetID(
name);
11652 }
11653
11655 {
11656 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11657 return plugin.GetName(id);
11658 }
11659
11662 {
11663
11664
11665 int varFlags;
11666 if (!ctx.
Read(varFlags))
11667 return;
11668
11669 if (varFlags & ItemVariableFlags.FLOAT)
11670 {
11672 }
11673 }
11674
11676 {
11677
11678 super.SerializeNumericalVars(floats_out);
11679
11680
11681
11683 {
11685 }
11686
11688 {
11690 }
11691
11693 {
11695 }
11696
11698 {
11703 }
11704
11706 {
11708 }
11709 }
11710
11712 {
11713
11714 super.DeSerializeNumericalVars(floats);
11715
11716
11717 int index = 0;
11718 int mask = Math.Round(floats.Get(index));
11719
11720 index++;
11721
11723 {
11725 {
11727 }
11728 else
11729 {
11730 float quantity = floats.Get(index);
11731 SetQuantity(quantity,
true,
false,
false,
false);
11732 }
11733 index++;
11734 }
11735
11737 {
11738 float wet = floats.Get(index);
11740 index++;
11741 }
11742
11744 {
11745 int liquidtype = Math.Round(floats.Get(index));
11747 index++;
11748 }
11749
11751 {
11753 index++;
11755 index++;
11757 index++;
11759 index++;
11760 }
11761
11763 {
11764 int cleanness = Math.Round(floats.Get(index));
11766 index++;
11767 }
11768 }
11769
11771 {
11772 super.WriteVarsToCTX(ctx);
11773
11774
11776 {
11778 }
11779
11781 {
11783 }
11784
11786 {
11788 }
11789
11791 {
11792 int r,g,b,a;
11798 }
11799
11801 {
11803 }
11804 }
11805
11807 {
11808 if (!super.ReadVarsFromCTX(ctx,version))
11809 return false;
11810
11811 int intValue;
11812 float value;
11813
11814 if (version < 140)
11815 {
11816 if (!ctx.
Read(intValue))
11817 return false;
11818
11819 m_VariablesMask = intValue;
11820 }
11821
11823 {
11824 if (!ctx.
Read(value))
11825 return false;
11826
11828 {
11830 }
11831 else
11832 {
11834 }
11835 }
11836
11837 if (version < 140)
11838 {
11840 {
11841 if (!ctx.
Read(value))
11842 return false;
11843 SetTemperatureDirect(value);
11844 }
11845 }
11846
11848 {
11849 if (!ctx.
Read(value))
11850 return false;
11852 }
11853
11855 {
11856 if (!ctx.
Read(intValue))
11857 return false;
11859 }
11860
11862 {
11863 int r,g,b,a;
11865 return false;
11867 return false;
11869 return false;
11871 return false;
11872
11874 }
11875
11877 {
11878 if (!ctx.
Read(intValue))
11879 return false;
11881 }
11882
11883 if (version >= 138 && version < 140)
11884 {
11886 {
11887 if (!ctx.
Read(intValue))
11888 return false;
11889 SetFrozen(intValue);
11890 }
11891 }
11892
11893 return true;
11894 }
11895
11896
11898 {
11901 {
11903 }
11904
11905 if (!super.OnStoreLoad(ctx, version))
11906 {
11908 return false;
11909 }
11910
11911 if (version >= 114)
11912 {
11913 bool hasQuickBarIndexSaved;
11914
11915 if (!ctx.
Read(hasQuickBarIndexSaved))
11916 {
11918 return false;
11919 }
11920
11921 if (hasQuickBarIndexSaved)
11922 {
11923 int itmQBIndex;
11924
11925
11926 if (!ctx.
Read(itmQBIndex))
11927 {
11929 return false;
11930 }
11931
11932 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11933 if (itmQBIndex != -1 && parentPlayer)
11934 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11935 }
11936 }
11937 else
11938 {
11939
11940 PlayerBase player;
11941 int itemQBIndex;
11942 if (version ==
int.
MAX)
11943 {
11944 if (!ctx.
Read(itemQBIndex))
11945 {
11947 return false;
11948 }
11949 }
11950 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11951 {
11952
11953 if (!ctx.
Read(itemQBIndex))
11954 {
11956 return false;
11957 }
11958 if (itemQBIndex != -1 && player)
11959 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11960 }
11961 }
11962
11963 if (version < 140)
11964 {
11965
11966 if (!LoadVariables(ctx, version))
11967 {
11969 return false;
11970 }
11971 }
11972
11973
11975 {
11977 return false;
11978 }
11979 if (version >= 132)
11980 {
11982 if (raib)
11983 {
11985 {
11987 return false;
11988 }
11989 }
11990 }
11991
11993 return true;
11994 }
11995
11996
11997
11999 {
12000 super.OnStoreSave(ctx);
12001
12002 PlayerBase player;
12003 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12004 {
12006
12007 int itemQBIndex = -1;
12008 itemQBIndex = player.FindQuickBarEntityIndex(this);
12009 ctx.
Write(itemQBIndex);
12010 }
12011 else
12012 {
12014 }
12015
12017
12019 if (raib)
12020 {
12022 }
12023 }
12024
12025
12027 {
12028 super.AfterStoreLoad();
12029
12031 {
12033 }
12034
12036 {
12039 }
12040 }
12041
12043 {
12044 super.EEOnAfterLoad();
12045
12047 {
12049 }
12050
12053 }
12054
12056 {
12057 return false;
12058 }
12059
12060
12061
12063 {
12065 {
12066 #ifdef PLATFORM_CONSOLE
12067
12069 {
12071 if (menu)
12072 {
12074 }
12075 }
12076 #endif
12077 }
12078
12080 {
12083 }
12084
12086 {
12087 SetWeightDirty();
12089 }
12091 {
12094 }
12095
12097 {
12100
12103 }
12105 {
12109 }
12110
12111 super.OnVariablesSynchronized();
12112 }
12113
12114
12115
12117 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12118 {
12119 if (!IsServerCheck(allow_client))
12120 return false;
12121
12123 return false;
12124
12127
12128 if (value <= (min + 0.001))
12129 value = min;
12130
12131 if (value == min)
12132 {
12133 if (destroy_config)
12134 {
12135 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12136 if (dstr)
12137 {
12139 this.Delete();
12140 return true;
12141 }
12142 }
12143 else if (destroy_forced)
12144 {
12146 this.Delete();
12147 return true;
12148 }
12149
12151 }
12152
12155
12157 {
12158 EntityAI parent = GetHierarchyRoot();
12159 InventoryLocation iLoc = new InventoryLocation();
12160 GetInventory().GetCurrentInventoryLocation(iLoc);
12162 {
12163 int iLocSlot = iLoc.
GetSlot();
12165 {
12167 }
12169 {
12171 }
12172 }
12173 }
12174
12176 {
12178
12179 if (delta)
12181 }
12182
12184
12185 return false;
12186 }
12187
12188
12190 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12191 {
12193 }
12194
12196 {
12199 }
12200
12202 {
12205 }
12206
12208 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12209 {
12210 float value_clamped = Math.Clamp(value, 0, 1);
12212 SetQuantity(result, destroy_config, destroy_forced);
12213 }
12214
12215
12218 {
12220 }
12221
12223 {
12225 }
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12237 {
12238 int slot = -1;
12239 GameInventory inventory = GetInventory();
12240 if (inventory)
12241 {
12242 InventoryLocation il = new InventoryLocation;
12245 }
12246
12248 }
12249
12251 {
12252 float quantity_max = 0;
12253
12255 {
12256 if (attSlotID != -1)
12257 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12258
12259 if (quantity_max <= 0)
12261 }
12262
12263 if (quantity_max <= 0)
12265
12266 return quantity_max;
12267 }
12268
12270 {
12272 }
12273
12275 {
12277 }
12278
12279
12281 {
12283 }
12284
12286 {
12288 }
12289
12291 {
12293 }
12294
12295
12297 {
12298
12299 float weightEx = GetWeightEx();
12300 float special = GetInventoryAndCargoWeight();
12301 return weightEx - special;
12302 }
12303
12304
12306 {
12308 }
12309
12311 {
12313 {
12314 #ifdef DEVELOPER
12315 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12316 {
12317 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12319 }
12320 #endif
12321
12322 return GetQuantity() * GetConfigWeightModified();
12323 }
12324 else if (HasEnergyManager())
12325 {
12326 #ifdef DEVELOPER
12327 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12328 {
12329 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12330 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12331 }
12332 #endif
12333 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12334 }
12335 else
12336 {
12337 #ifdef DEVELOPER
12338 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12339 {
12340 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12341 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12342 }
12343 #endif
12344 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12345 }
12346 }
12347
12350 {
12351 int item_count = 0;
12353
12354 GameInventory inventory = GetInventory();
12355 CargoBase cargo = inventory.
GetCargo();
12356 if (cargo != NULL)
12357 {
12359 }
12360
12362 for (int i = 0; i < nAttachments; ++i)
12363 {
12365 if (item)
12366 item_count += item.GetNumberOfItems();
12367 }
12368 return item_count;
12369 }
12370
12373 {
12374 float weight = 0;
12375 float wetness = 1;
12376 if (include_wetness)
12379 {
12380 weight = wetness * m_ConfigWeight;
12381 }
12383 {
12384 weight = 1;
12385 }
12386 return weight;
12387 }
12388
12389
12390
12392 {
12393 GameInventory inventory = GetInventory();
12394 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12395 {
12396 array<EntityAI> items = new array<EntityAI>;
12398 for (int i = 0; i < items.Count(); ++i)
12399 {
12401 if (item)
12402 {
12403 g_Game.ObjectDelete(item);
12404 }
12405 }
12406 }
12407 }
12408
12409
12410
12411
12413 {
12414 float energy = 0;
12415 if (HasEnergyManager())
12416 {
12417 energy = GetCompEM().GetEnergy();
12418 }
12419 return energy;
12420 }
12421
12422
12424 {
12425 super.OnEnergyConsumed();
12426
12428 }
12429
12431 {
12432 super.OnEnergyAdded();
12433
12435 }
12436
12437
12439 {
12440 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12441 {
12443 {
12444 float energy_0to1 = GetCompEM().GetEnergy0To1();
12446 }
12447 }
12448 }
12449
12450
12452 {
12453 return ConfigGetFloat("heatIsolation");
12454 }
12455
12457 {
12459 }
12460
12462 {
12463 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12464 if (
g_Game.ConfigIsExisting(paramPath))
12465 return g_Game.ConfigGetFloat(paramPath);
12466
12467 return 0.0;
12468 }
12469
12471 {
12472 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12473 if (
g_Game.ConfigIsExisting(paramPath))
12474 return g_Game.ConfigGetFloat(paramPath);
12475
12476 return 0.0;
12477 }
12478
12479 override void SetWet(
float value,
bool allow_client =
false)
12480 {
12481 if (!IsServerCheck(allow_client))
12482 return;
12483
12486
12488
12489 m_VarWet = Math.Clamp(value, min, max);
12490
12492 {
12495 }
12496 }
12497
12498 override void AddWet(
float value)
12499 {
12501 }
12502
12504 {
12506 }
12507
12509 {
12511 }
12512
12514 {
12516 }
12517
12519 {
12521 }
12522
12524 {
12526 }
12527
12528 override void OnWetChanged(
float newVal,
float oldVal)
12529 {
12532 if (newLevel != oldLevel)
12533 {
12535 }
12536 }
12537
12539 {
12540 SetWeightDirty();
12541 }
12542
12544 {
12545 return GetWetLevelInternal(
m_VarWet);
12546 }
12547
12548
12549
12551 {
12553 }
12554
12556 {
12558 }
12559
12561 {
12563 }
12564
12566 {
12568 }
12569
12570
12571
12573 {
12574 if (ConfigIsExisting("itemModelLength"))
12575 {
12576 return ConfigGetFloat("itemModelLength");
12577 }
12578 return 0;
12579 }
12580
12582 {
12583 if (ConfigIsExisting("itemAttachOffset"))
12584 {
12585 return ConfigGetFloat("itemAttachOffset");
12586 }
12587 return 0;
12588 }
12589
12590 override void SetCleanness(
int value,
bool allow_client =
false)
12591 {
12592 if (!IsServerCheck(allow_client))
12593 return;
12594
12596
12598
12601 }
12602
12604 {
12606 }
12607
12609 {
12610 return true;
12611 }
12612
12613
12614
12615
12617 {
12619 }
12620
12622 {
12624 }
12625
12626
12627
12628
12629 override void SetColor(
int r,
int g,
int b,
int a)
12630 {
12636 }
12638 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12639 {
12644 }
12645
12647 {
12649 }
12650
12653 {
12654 int r,g,b,a;
12656 r = r/255;
12657 g = g/255;
12658 b = b/255;
12659 a = a/255;
12660 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12661 }
12662
12663
12664
12665 override void SetLiquidType(
int value,
bool allow_client =
false)
12666 {
12667 if (!IsServerCheck(allow_client))
12668 return;
12669
12674 }
12675
12677 {
12678 return ConfigGetInt("varLiquidTypeInit");
12679 }
12680
12682 {
12684 }
12685
12687 {
12689 SetFrozen(false);
12690 }
12691
12694 {
12695 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12696 }
12697
12698
12701 {
12702 PlayerBase nplayer;
12703 if (PlayerBase.CastTo(nplayer, player))
12704 {
12706 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12707 }
12708 }
12709
12710
12713 {
12714 PlayerBase nplayer;
12715 if (PlayerBase.CastTo(nplayer,player))
12716 {
12717 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12718 }
12719
12720 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12721
12722 if (HasEnergyManager())
12723 {
12724 GetCompEM().UpdatePlugState();
12725 }
12726 }
12727
12728
12730 {
12731 super.OnPlacementStarted(player);
12732
12734 }
12735
12736 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12737 {
12739 {
12740 m_AdminLog.OnPlacementComplete(player,
this);
12741 }
12742
12743 super.OnPlacementComplete(player, position, orientation);
12744 }
12745
12746
12747
12748
12749
12751 {
12753 {
12754 return true;
12755 }
12756 else
12757 {
12758 return false;
12759 }
12760 }
12761
12762
12764 {
12766 {
12768 }
12769 }
12770
12771
12773 {
12775 }
12776
12778 {
12780 }
12781
12782 override void InsertAgent(
int agent,
float count = 1)
12783 {
12784 if (count < 1)
12785 return;
12786
12788 }
12789
12792 {
12794 }
12795
12796
12798 {
12800 }
12801
12802
12803
12804
12805
12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12844 {
12846 return false;
12847 return true;
12848 }
12849
12851 {
12852
12854 }
12855
12856
12859 {
12860 super.CheckForRoofLimited(timeTresholdMS);
12861
12862 float time =
g_Game.GetTime();
12863 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12864 {
12865 m_PreviousRoofTestTime = time;
12866 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12867 }
12868 }
12869
12870
12872 {
12874 {
12875 return 0;
12876 }
12877
12878 if (GetInventory().GetAttachmentSlotsCount() != 0)
12879 {
12880 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12881 if (filter)
12882 return filter.GetProtectionLevel(type, false, system);
12883 else
12884 return 0;
12885 }
12886
12887 string subclassPath, entryName;
12888
12889 switch (type)
12890 {
12892 entryName = "biological";
12893 break;
12895 entryName = "chemical";
12896 break;
12897 default:
12898 entryName = "biological";
12899 break;
12900 }
12901
12902 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12903
12904 return g_Game.ConfigGetFloat(subclassPath + entryName);
12905 }
12906
12907
12908
12911 {
12912 if (!IsMagazine())
12914
12916 }
12917
12918
12919
12920
12921
12926 {
12927 return true;
12928 }
12929
12931 {
12933 }
12934
12935
12936
12937
12938
12940 {
12941 if (parent)
12942 {
12943 if (parent.IsInherited(DayZInfected))
12944 return true;
12945
12946 if (!parent.IsRuined())
12947 return true;
12948 }
12949
12950 return true;
12951 }
12952
12954 {
12955 if (!super.CanPutAsAttachment(parent))
12956 {
12957 return false;
12958 }
12959
12960 if (!IsRuined() && !parent.IsRuined())
12961 {
12962 return true;
12963 }
12964
12965 return false;
12966 }
12967
12969 {
12970
12971
12972
12973
12974 return super.CanReceiveItemIntoCargo(item);
12975 }
12976
12978 {
12979
12980
12981
12982
12983 GameInventory attachmentInv = attachment.GetInventory();
12985 {
12986 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12987 return false;
12988 }
12989
12990 InventoryLocation loc = new InventoryLocation();
12991 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12992 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12993 return false;
12994
12995 return super.CanReceiveAttachment(attachment, slotId);
12996 }
12997
12999 {
13000 if (!super.CanReleaseAttachment(attachment))
13001 return false;
13002
13003 return GetInventory().AreChildrenAccessible();
13004 }
13005
13006
13007
13008
13009
13010
13011
13012
13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13027 {
13028 int id = muzzle_owner.GetMuzzleID();
13029 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13030
13031 if (WPOF_array)
13032 {
13033 for (int i = 0; i < WPOF_array.Count(); i++)
13034 {
13035 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13036
13037 if (WPOF)
13038 {
13039 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13040 }
13041 }
13042 }
13043 }
13044
13045
13047 {
13048 int id = muzzle_owner.GetMuzzleID();
13050
13051 if (WPOBE_array)
13052 {
13053 for (int i = 0; i < WPOBE_array.Count(); i++)
13054 {
13055 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13056
13057 if (WPOBE)
13058 {
13059 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13060 }
13061 }
13062 }
13063 }
13064
13065
13067 {
13068 int id = muzzle_owner.GetMuzzleID();
13069 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13070
13071 if (WPOOH_array)
13072 {
13073 for (int i = 0; i < WPOOH_array.Count(); i++)
13074 {
13075 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13076
13077 if (WPOOH)
13078 {
13079 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13080 }
13081 }
13082 }
13083 }
13084
13085
13087 {
13088 int id = muzzle_owner.GetMuzzleID();
13089 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13090
13091 if (WPOOH_array)
13092 {
13093 for (int i = 0; i < WPOOH_array.Count(); i++)
13094 {
13095 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13096
13097 if (WPOOH)
13098 {
13099 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13100 }
13101 }
13102 }
13103 }
13104
13105
13107 {
13108 int id = muzzle_owner.GetMuzzleID();
13109 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13110
13111 if (WPOOH_array)
13112 {
13113 for (int i = 0; i < WPOOH_array.Count(); i++)
13114 {
13115 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13116
13117 if (WPOOH)
13118 {
13119 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13120 }
13121 }
13122 }
13123 }
13124
13125
13126
13128 {
13130 {
13131 return true;
13132 }
13133
13134 return false;
13135 }
13136
13138 {
13140 {
13141 return true;
13142 }
13143
13144 return false;
13145 }
13146
13148 {
13150 {
13151 return true;
13152 }
13153
13154 return false;
13155 }
13156
13158 {
13159 return false;
13160 }
13161
13164 {
13165 return UATimeSpent.DEFAULT_DEPLOY;
13166 }
13167
13168
13169
13170
13172 {
13174 SetSynchDirty();
13175 }
13176
13178 {
13180 }
13181
13182
13184 {
13185 return false;
13186 }
13187
13190 {
13191 string att_type = "None";
13192
13193 if (ConfigIsExisting("soundAttType"))
13194 {
13195 att_type = ConfigGetString("soundAttType");
13196 }
13197
13199 }
13200
13202 {
13204 }
13205
13206
13207
13208
13209
13215
13217 {
13220
13222 }
13223
13224
13226 {
13228 return;
13229
13231
13234
13237
13238 SoundParameters params = new SoundParameters();
13242 }
13243
13244
13246 {
13248 {
13251
13252 SetSynchDirty();
13253
13256 }
13257 }
13258
13260 {
13262 }
13263
13264
13266 {
13268 return;
13269
13271 SetSynchDirty();
13272
13275 }
13276
13278 {
13281 }
13282
13284 {
13286 }
13287
13288 void OnApply(PlayerBase player);
13289
13291 {
13292 return 1.0;
13293 };
13294
13296 {
13298 }
13299
13301 {
13303 }
13304
13306
13308 {
13309 SetDynamicPhysicsLifeTime(0.01);
13311 }
13312
13314 {
13315 array<string> zone_names = new array<string>;
13316 GetDamageZones(zone_names);
13317 for (int i = 0; i < zone_names.Count(); i++)
13318 {
13319 SetHealthMax(zone_names.Get(i),"Health");
13320 }
13321 SetHealthMax("","Health");
13322 }
13323
13326 {
13327 float global_health = GetHealth01("","Health");
13328 array<string> zones = new array<string>;
13329 GetDamageZones(zones);
13330
13331 for (int i = 0; i < zones.Count(); i++)
13332 {
13333 SetHealth01(zones.Get(i),"Health",global_health);
13334 }
13335 }
13336
13339 {
13340 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13341 }
13342
13344 {
13345 if (!hasRootAsPlayer)
13346 {
13347 if (refParentIB)
13348 {
13349
13350 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13351 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13352
13353 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13354 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13355
13358 }
13359 else
13360 {
13361
13364 }
13365 }
13366 }
13367
13369 {
13371 {
13372 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13373 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13374 {
13375 float heatPermCoef = 1.0;
13377 while (ent)
13378 {
13379 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13380 ent = ent.GetHierarchyParent();
13381 }
13382
13383 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13384 }
13385 }
13386 }
13387
13389 {
13390
13391 EntityAI parent = GetHierarchyParent();
13392 if (!parent)
13393 {
13394 hasParent = false;
13395 hasRootAsPlayer = false;
13396 }
13397 else
13398 {
13399 hasParent = true;
13400 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13401 refParentIB =
ItemBase.Cast(parent);
13402 }
13403 }
13404
13405 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13406 {
13407
13408 }
13409
13411 {
13412
13413 return false;
13414 }
13415
13417 {
13418
13419
13420 return false;
13421 }
13422
13424 {
13425
13426 return false;
13427 }
13428
13431 {
13432 return !GetIsFrozen() &&
IsOpen();
13433 }
13434
13436 {
13437 bool hasParent = false, hasRootAsPlayer = false;
13439
13440 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13441 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13442
13443 if (wwtu || foodDecay)
13444 {
13448
13449 if (processWetness || processTemperature || processDecay)
13450 {
13452
13453 if (processWetness)
13454 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13455
13456 if (processTemperature)
13458
13459 if (processDecay)
13460 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13461 }
13462 }
13463 }
13464
13467 {
13469 }
13470
13472 {
13475
13476 return super.GetTemperatureFreezeThreshold();
13477 }
13478
13480 {
13483
13484 return super.GetTemperatureThawThreshold();
13485 }
13486
13488 {
13491
13492 return super.GetItemOverheatThreshold();
13493 }
13494
13496 {
13498 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13499
13500 return super.GetTemperatureFreezeTime();
13501 }
13502
13504 {
13506 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13507
13508 return super.GetTemperatureThawTime();
13509 }
13510
13515
13517 {
13518 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13519 }
13520
13522 {
13523 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13524 }
13525
13528 {
13530 }
13531
13533 {
13535 }
13536
13538 {
13540 }
13541
13544 {
13545 return null;
13546 }
13547
13550 {
13551 return false;
13552 }
13553
13555 {
13557 {
13560 if (!trg)
13561 {
13563 explosive = this;
13564 }
13565
13566 explosive.PairRemote(trg);
13568
13569 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13570 trg.SetPersistentPairID(persistentID);
13571 explosive.SetPersistentPairID(persistentID);
13572
13573 return true;
13574 }
13575 return false;
13576 }
13577
13580 {
13581 float ret = 1.0;
13584 ret *= GetHealth01();
13585
13586 return ret;
13587 }
13588
13589 #ifdef DEVELOPER
13590 override void SetDebugItem()
13591 {
13592 super.SetDebugItem();
13593 _itemBase = this;
13594 }
13595
13597 {
13598 string text = super.GetDebugText();
13599
13601 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13602
13603 return text;
13604 }
13605 #endif
13606
13608 {
13609 return true;
13610 }
13611
13613
13615
13617 {
13620 }
13621
13622
13630
13646
13647 [
Obsolete(
"Use ItemSoundHandler instead")]
13650 {
13651 if (!
g_Game.IsDedicatedServer())
13652 {
13653 if (ConfigIsExisting("attachSoundSet"))
13654 {
13655 string cfg_path = "";
13656 string soundset = "";
13657 string type_name =
GetType();
13658
13661 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13662 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13663
13664 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13665 {
13666 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13667 {
13668 if (cfg_slot_array[i] == slot_type)
13669 {
13670 soundset = cfg_soundset_array[i];
13671 break;
13672 }
13673 }
13674 }
13675
13676 if (soundset != "")
13677 {
13678 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13680 }
13681 }
13682 }
13683 }
13684
13686}
13687
13689{
13691 if (entity)
13692 {
13693 bool is_item = entity.IsInherited(
ItemBase);
13694 if (is_item && full_quantity)
13695 {
13698 }
13699 }
13700 else
13701 {
13703 return NULL;
13704 }
13705 return entity;
13706}
13707
13709{
13710 if (item)
13711 {
13712 if (health > 0)
13713 item.SetHealth("", "", health);
13714
13715 if (item.CanHaveTemperature())
13716 {
13718 if (item.CanFreeze())
13719 item.SetFrozen(false);
13720 }
13721
13722 if (item.HasEnergyManager())
13723 {
13724 if (quantity >= 0)
13725 {
13726 item.GetCompEM().SetEnergy0To1(quantity);
13727 }
13728 else
13729 {
13731 }
13732 }
13733 else if (item.IsMagazine())
13734 {
13735 Magazine mag = Magazine.Cast(item);
13736 if (quantity >= 0)
13737 {
13738 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13739 }
13740 else
13741 {
13743 }
13744
13745 }
13746 else
13747 {
13748 if (quantity >= 0)
13749 {
13750 item.SetQuantityNormalized(quantity, false);
13751 }
13752 else
13753 {
13755 }
13756
13757 }
13758 }
13759}
13760
13761#ifdef DEVELOPER
13763#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.