Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,0.15,0.15,1.0,CO)".
8770{
8772 {
8773 return true;
8774 }
8775};
8776
8778{
8779
8780};
8781
8782
8783
8785{
8789
8791
8794
8795
8796
8797
8798
8807
8813
8818
8823
8844 protected bool m_IsResultOfSplit
8845
8847
8852
8853
8854
8856
8860
8861
8862
8864
8867
8868
8869
8875
8876
8884
8887
8888
8890
8891
8893
8894
8899
8900
8905
8907
8908
8910
8911
8913 {
8918
8919 if (!
g_Game.IsDedicatedServer())
8920 {
8922 {
8924
8926 {
8928 }
8929 }
8930
8933 }
8934
8935 m_OldLocation = null;
8936
8938 {
8940 }
8941
8942 if (ConfigIsExisting("headSelectionsToHide"))
8943 {
8946 }
8947
8949 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8950 {
8952 }
8953
8955
8956 m_IsResultOfSplit = false;
8957
8959 }
8960
8962 {
8963 super.InitItemVariables();
8964
8970 m_Count = ConfigGetInt(
"count");
8971
8974
8979
8982
8987
8999
9003
9004
9007 if (ConfigIsExisting("canBeSplit"))
9008 {
9011 }
9012
9014 if (ConfigIsExisting("itemBehaviour"))
9016
9017
9020 RegisterNetSyncVariableInt("m_VarLiquidType");
9021 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9022
9023 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9024 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9025 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9026
9027 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9028 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9029 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9030 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9031
9032 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9033 RegisterNetSyncVariableBool("m_IsTakeable");
9034 RegisterNetSyncVariableBool("m_IsHologram");
9035
9038 {
9041 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9042 }
9043
9045
9047 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9049
9051 }
9052
9054 {
9056 }
9057
9059 {
9062 {
9067 }
9068 }
9069
9070 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9071 {
9073 {
9076 }
9077
9079 }
9080
9082 {
9088 }
9089
9091
9093 {
9095
9096 if (!action)
9097 {
9098 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9099 return;
9100 }
9101
9103 if (!ai)
9104 {
9106 return;
9107 }
9108
9110 if (!action_array)
9111 {
9112 action_array = new array<ActionBase_Basic>;
9114 }
9115 if (LogManager.IsActionLogEnable())
9116 {
9117 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9118 }
9119
9120 if (action_array.Find(action) != -1)
9121 {
9122 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9123 }
9124 else
9125 {
9126 action_array.Insert(action);
9127 }
9128 }
9129
9131 {
9132 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9133 ActionBase action = player.GetActionManager().GetAction(actionName);
9136
9137 if (action_array)
9138 {
9139 action_array.RemoveItem(action);
9140 }
9141 }
9142
9143
9144
9146 {
9147 ActionOverrideData overrideData = new ActionOverrideData();
9151
9153 if (!actionMap)
9154 {
9157 }
9158
9159 actionMap.Insert(this.
Type(), overrideData);
9160
9161 }
9162
9164
9166
9167
9169 {
9172
9175
9176 string config_to_search = "CfgVehicles";
9177 string muzzle_owner_config;
9178
9180 {
9181 if (IsInherited(Weapon))
9182 config_to_search = "CfgWeapons";
9183
9184 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9185
9186 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9187
9188 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9189
9190 if (config_OnFire_subclass_count > 0)
9191 {
9192 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9193
9194 for (int i = 0; i < config_OnFire_subclass_count; i++)
9195 {
9196 string particle_class = "";
9197 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9198 string config_OnFire_entry = config_OnFire_class + particle_class;
9199 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9200 WPOF_array.Insert(WPOF);
9201 }
9202
9203
9205 }
9206 }
9207
9209 {
9210 config_to_search = "CfgWeapons";
9211 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9212
9213 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9214
9215 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9216
9217 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9218 {
9219 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9220
9221 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9222 {
9223 string particle_class2 = "";
9224 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9225 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9226 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9227 WPOBE_array.Insert(WPOBE);
9228 }
9229
9230
9232 }
9233 }
9234 }
9235
9236
9238 {
9241
9243 {
9244 string config_to_search = "CfgVehicles";
9245
9246 if (IsInherited(Weapon))
9247 config_to_search = "CfgWeapons";
9248
9249 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9250 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9251
9252 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9253 {
9254
9256
9258 {
9260 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9262 return;
9263 }
9264
9267
9268
9269
9270 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9271 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9272
9273 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9274 {
9275 string particle_class = "";
9276 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9277 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9278 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9279
9280 if (entry_type == CT_CLASS)
9281 {
9282 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9283 WPOOH_array.Insert(WPOF);
9284 }
9285 }
9286
9287
9289 }
9290 }
9291 }
9292
9294 {
9296 }
9297
9299 {
9301 {
9303
9306
9309
9310 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9311 }
9312 }
9313
9315 {
9317 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9318
9320 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9321
9323 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9324
9326 {
9328 }
9329 }
9330
9332 {
9334 }
9335
9337 {
9340 else
9342
9344 {
9347 }
9348 else
9349 {
9352
9355 }
9356
9358 }
9359
9361 {
9363 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9364 }
9365
9367 {
9369 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9371 }
9372
9374 {
9376 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9377 }
9378
9380 {
9383
9384 OverheatingParticle OP = new OverheatingParticle();
9389
9391 }
9392
9394 {
9397
9398 return -1;
9399 }
9400
9402 {
9404 {
9407
9408 for (int i = count; i > 0; --i)
9409 {
9410 int id = i - 1;
9413
9416
9417 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9418 {
9419 if (p)
9420 {
9423 }
9424 }
9425 }
9426 }
9427 }
9428
9430 {
9432 {
9434 {
9435 int id = i - 1;
9437
9438 if (OP)
9439 {
9441
9442 if (p)
9443 {
9445 }
9446
9447 delete OP;
9448 }
9449 }
9450
9453 }
9454 }
9455
9458 {
9459 return 0.0;
9460 }
9461
9462
9464 {
9465 return 250;
9466 }
9467
9469 {
9470 return 0;
9471 }
9472
9475 {
9477 return true;
9478
9479 return false;
9480 }
9481
9484 {
9487
9489 {
9491 }
9492 else
9493 {
9494
9496 }
9497
9499 }
9500
9507 {
9508 return -1;
9509 }
9510
9511
9512
9513
9515 {
9517 {
9518 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9519 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9520
9521 if (r_index >= 0)
9522 {
9523 InventoryLocation r_il = new InventoryLocation;
9524 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9525
9526 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9529 {
9530 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9531 }
9533 {
9534 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9535 }
9536
9537 }
9538
9539 player.GetHumanInventory().ClearUserReservedLocation(this);
9540 }
9541
9544 }
9545
9546
9547
9548
9550 {
9551 return ItemBase.m_DebugActionsMask;
9552 }
9553
9555 {
9556 return ItemBase.m_DebugActionsMask & mask;
9557 }
9558
9560 {
9561 ItemBase.m_DebugActionsMask = mask;
9562 }
9563
9565 {
9566 ItemBase.m_DebugActionsMask |= mask;
9567 }
9568
9570 {
9571 ItemBase.m_DebugActionsMask &= ~mask;
9572 }
9573
9575 {
9577 {
9579 }
9580 else
9581 {
9583 }
9584 }
9585
9586
9588 {
9589 if (GetEconomyProfile())
9590 {
9591 float q_max = GetEconomyProfile().GetQuantityMax();
9592 if (q_max > 0)
9593 {
9594 float q_min = GetEconomyProfile().GetQuantityMin();
9595 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9596
9598 {
9599 ComponentEnergyManager comp = GetCompEM();
9601 {
9603 }
9604 }
9606 {
9608
9609 }
9610
9611 }
9612 }
9613 }
9614
9617 {
9618 EntityAI parent = GetHierarchyParent();
9619
9620 if (parent)
9621 {
9622 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9623 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9624 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9625 }
9626 }
9627
9630 {
9631 EntityAI parent = GetHierarchyParent();
9632
9633 if (parent)
9634 {
9635 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9636 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9637 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9638 }
9639 }
9640
9642 {
9643
9644
9645
9646
9648
9650 {
9651 if (ScriptInputUserData.CanStoreInputUserData())
9652 {
9653 ScriptInputUserData ctx = new ScriptInputUserData;
9659 ctx.
Write(use_stack_max);
9662
9664 {
9665 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9666 }
9667 }
9668 }
9669 else if (!
g_Game.IsMultiplayer())
9670 {
9672 }
9673 }
9674
9676 {
9678 }
9679
9681 {
9683 }
9684
9686 {
9688 }
9689
9691 {
9692
9693 return false;
9694 }
9695
9697 {
9698 return false;
9699 }
9700
9704 {
9705 return false;
9706 }
9707
9709 {
9710 return "";
9711 }
9712
9714
9716 {
9717 return false;
9718 }
9719
9721 {
9722 return true;
9723 }
9724
9725
9726
9728 {
9729 return true;
9730 }
9731
9733 {
9734 return true;
9735 }
9736
9738 {
9739 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9741 }
9742
9744 {
9746 }
9747
9749 {
9751 if (!is_being_placed)
9753 SetSynchDirty();
9754 }
9755
9756
9758
9760 {
9762 }
9763
9765 {
9767 }
9768
9770 {
9771 return 1;
9772 }
9773
9775 {
9776 return false;
9777 }
9778
9780 {
9782 SetSynchDirty();
9783 }
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9820 {
9821 super.OnMovedInsideCargo(container);
9822
9823 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9824 }
9825
9826 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9827 {
9828 super.EEItemLocationChanged(oldLoc, newLoc);
9829
9830 PlayerBase newPlayer = null;
9831 PlayerBase oldPlayer = null;
9832
9833 if (newLoc.GetParent())
9834 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9835
9836 if (oldLoc.GetParent())
9837 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9838
9840 {
9841 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9842
9843 if (rIndex >= 0)
9844 {
9845 InventoryLocation rIl = new InventoryLocation;
9846 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9847
9848 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9851 {
9852 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9853 }
9855 {
9857 }
9858
9859 }
9860 }
9861
9863 {
9864 if (newPlayer)
9865 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9866
9867 if (newPlayer == oldPlayer)
9868 {
9869 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9870 {
9872 {
9873 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9874 {
9875 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9876 }
9877 }
9878 else
9879 {
9880 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9881 }
9882 }
9883
9884 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9885 {
9886 int type = oldLoc.GetType();
9888 {
9889 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9890 }
9892 {
9893 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9894 }
9895 }
9896 if (!m_OldLocation)
9897 {
9898 m_OldLocation = new InventoryLocation;
9899 }
9900 m_OldLocation.Copy(oldLoc);
9901 }
9902 else
9903 {
9904 if (m_OldLocation)
9905 {
9906 m_OldLocation.Reset();
9907 }
9908 }
9909
9910 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9911 }
9912 else
9913 {
9914 if (newPlayer)
9915 {
9916 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9917 if (resIndex >= 0)
9918 {
9919 InventoryLocation il = new InventoryLocation;
9920 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9922 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9925 {
9926 il.
GetParent().GetOnReleaseLock().Invoke(it);
9927 }
9929 {
9931 }
9932
9933 }
9934 }
9936 {
9937
9939 }
9940
9941 if (m_OldLocation)
9942 {
9943 m_OldLocation.Reset();
9944 }
9945 }
9946
9948 {
9949 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9950 }
9951
9953 {
9954 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9955 }
9956 }
9957
9958 override void EOnContact(IEntity other, Contact extra)
9959 {
9961 {
9962 int liquidType = -1;
9964 if (impactSpeed > 0.0)
9965 {
9967 #ifndef SERVER
9969 #else
9971 SetSynchDirty();
9972 #endif
9974 }
9975 }
9976
9977 #ifdef SERVER
9978 if (GetCompEM() && GetCompEM().IsPlugged())
9979 {
9980 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9981 GetCompEM().UnplugThis();
9982 }
9983 #endif
9984 }
9985
9987
9989 {
9991 }
9992
9994 {
9995
9996 }
9997
9999 {
10000 super.OnItemLocationChanged(old_owner, new_owner);
10001
10002 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10003 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10004
10005 if (!relatedPlayer && playerNew)
10006 relatedPlayer = playerNew;
10007
10008 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10009 {
10011 if (actionMgr)
10012 {
10013 ActionBase currentAction = actionMgr.GetRunningAction();
10014 if (currentAction)
10016 }
10017 }
10018
10019 Man ownerPlayerOld = null;
10020 Man ownerPlayerNew = null;
10021
10022 if (old_owner)
10023 {
10024 if (old_owner.
IsMan())
10025 {
10026 ownerPlayerOld = Man.Cast(old_owner);
10027 }
10028 else
10029 {
10030 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10031 }
10032 }
10033 else
10034 {
10036 {
10038
10039 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10040 {
10041 GetCompEM().UnplugThis();
10042 }
10043 }
10044 }
10045
10046 if (new_owner)
10047 {
10048 if (new_owner.
IsMan())
10049 {
10050 ownerPlayerNew = Man.Cast(new_owner);
10051 }
10052 else
10053 {
10054 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10055 }
10056 }
10057
10058 if (ownerPlayerOld != ownerPlayerNew)
10059 {
10060 if (ownerPlayerOld)
10061 {
10062 array<EntityAI> subItemsExit = new array<EntityAI>;
10064 for (int i = 0; i < subItemsExit.Count(); i++)
10065 {
10068 }
10069 }
10070
10071 if (ownerPlayerNew)
10072 {
10073 array<EntityAI> subItemsEnter = new array<EntityAI>;
10075 for (int j = 0; j < subItemsEnter.Count(); j++)
10076 {
10079 }
10080 }
10081 }
10082 else if (ownerPlayerNew != null)
10083 {
10084 PlayerBase nplayer;
10085 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10086 {
10087 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10089 for (int k = 0; k < subItemsUpdate.Count(); k++)
10090 {
10092 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10093 }
10094 }
10095 }
10096
10097 if (old_owner)
10098 old_owner.OnChildItemRemoved(this);
10099 if (new_owner)
10100 new_owner.OnChildItemReceived(this);
10101 }
10102
10103
10105 {
10106 super.EEDelete(parent);
10107 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10108 if (player)
10109 {
10111
10112 if (player.IsAlive())
10113 {
10114 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10115 if (r_index >= 0)
10116 {
10117 InventoryLocation r_il = new InventoryLocation;
10118 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10119
10120 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10123 {
10124 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10125 }
10127 {
10128 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10129 }
10130
10131 }
10132
10133 player.RemoveQuickBarEntityShortcut(this);
10134 }
10135 }
10136 }
10137
10139 {
10140 super.EEKilled(killer);
10141
10144 {
10145 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10146 {
10147 if (IsMagazine())
10148 {
10149 if (Magazine.Cast(this).GetAmmoCount() > 0)
10150 {
10152 }
10153 }
10154 else
10155 {
10157 }
10158 }
10159 }
10160 }
10161
10163 {
10164 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10165
10166 super.OnWasAttached(parent, slot_id);
10167
10170
10173 }
10174
10176 {
10177 super.OnWasDetached(parent, slot_id);
10178
10181
10184 }
10185
10187 {
10188 int idx;
10191
10192 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10193 if (inventory_slots.Count() < 1)
10194 {
10195 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10196 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10197 }
10198 else
10199 {
10200 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10201 }
10202
10203 idx = inventory_slots.Find(slot);
10204 if (idx < 0)
10205 return "";
10206
10207 return attach_types.Get(idx);
10208 }
10209
10211 {
10212 int idx = -1;
10213 string slot;
10214
10217
10218 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10219 if (inventory_slots.Count() < 1)
10220 {
10221 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10222 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10223 }
10224 else
10225 {
10226 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10227 if (detach_types.Count() < 1)
10228 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10229 }
10230
10231 for (int i = 0; i < inventory_slots.Count(); i++)
10232 {
10233 slot = inventory_slots.Get(i);
10234 }
10235
10236 if (slot != "")
10237 {
10238 if (detach_types.Count() == 1)
10239 idx = 0;
10240 else
10241 idx = inventory_slots.Find(slot);
10242 }
10243 if (idx < 0)
10244 return "";
10245
10246 return detach_types.Get(idx);
10247 }
10248
10250 {
10251
10253
10254
10255 float min_time = 1;
10256 float max_time = 3;
10257 float delay = Math.RandomFloat(min_time, max_time);
10258
10259 explode_timer.Run(delay, this, "DoAmmoExplosion");
10260 }
10261
10263 {
10264 Magazine magazine = Magazine.Cast(this);
10265 int pop_sounds_count = 6;
10266 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10267
10268
10269 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10270 string sound_name = pop_sounds[ sound_idx ];
10271 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10272
10273
10274 magazine.ServerAddAmmoCount(-1);
10275
10276
10277 float min_temp_to_explode = 100;
10278
10279 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10280 {
10282 }
10283 }
10284
10285
10286 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10287 {
10288 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10289
10290 const int CHANCE_DAMAGE_CARGO = 4;
10291 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10292 const int CHANCE_DAMAGE_NOTHING = 2;
10293
10295 {
10296 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10297 int chances;
10298 int rnd;
10299
10300 if (GetInventory().GetCargo())
10301 {
10302 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10303 rnd = Math.RandomInt(0,chances);
10304
10305 if (rnd < CHANCE_DAMAGE_CARGO)
10306 {
10308 }
10309 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10310 {
10312 }
10313 }
10314 else
10315 {
10316 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10317 rnd = Math.RandomInt(0,chances);
10318
10319 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10320 {
10322 }
10323 }
10324 }
10325 }
10326
10328 {
10329 CargoBase cargo = GetInventory().GetCargo();
10330 if (cargo)
10331 {
10333 if (item_count > 0)
10334 {
10335 int random_pick = Math.RandomInt(0, item_count);
10337 if (!item.IsExplosive())
10338 {
10339 item.AddHealth("","",damage);
10340 return true;
10341 }
10342 }
10343 }
10344 return false;
10345 }
10346
10348 {
10349 GameInventory inventory = GetInventory();
10351 if (attachment_count > 0)
10352 {
10353 int random_pick = Math.RandomInt(0, attachment_count);
10355 if (!attachment.IsExplosive())
10356 {
10357 attachment.AddHealth("","",damage);
10358 return true;
10359 }
10360 }
10361 return false;
10362 }
10363
10365 {
10367 }
10368
10370 {
10372 return GetInventory().CanRemoveEntity();
10373
10374 return false;
10375 }
10376
10378 {
10379
10381 return false;
10382
10383
10385 return false;
10386
10387
10388
10390 if (delta == 0)
10391 return false;
10392
10393
10394 return true;
10395 }
10396
10398 {
10400 {
10401 if (ScriptInputUserData.CanStoreInputUserData())
10402 {
10403 ScriptInputUserData ctx = new ScriptInputUserData;
10408 ctx.
Write(destination_entity);
10410 ctx.
Write(slot_id);
10412 }
10413 }
10414 else if (!
g_Game.IsMultiplayer())
10415 {
10417 }
10418 }
10419
10421 {
10422 float split_quantity_new;
10426 InventoryLocation loc = new InventoryLocation;
10427
10428 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10429 {
10431 split_quantity_new = stack_max;
10432 else
10434
10436 {
10437 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10438 if (new_item)
10439 {
10440 new_item.SetResultOfSplit(true);
10441 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10443 new_item.
SetQuantity(split_quantity_new,
false,
true);
10444 }
10445 }
10446 }
10447 else if (destination_entity && slot_id == -1)
10448 {
10449 if (quantity > stack_max)
10450 split_quantity_new = stack_max;
10451 else
10452 split_quantity_new = quantity;
10453
10455 {
10456 GameInventory destinationInventory = destination_entity.GetInventory();
10458 {
10461 }
10462
10463 if (new_item)
10464 {
10465 new_item.SetResultOfSplit(true);
10466 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10468 new_item.
SetQuantity(split_quantity_new,
false,
true);
10469 }
10470 }
10471 }
10472 else
10473 {
10474 if (stack_max != 0)
10475 {
10477 {
10479 }
10480
10481 if (split_quantity_new == 0)
10482 {
10483 if (!
g_Game.IsMultiplayer())
10484 player.PhysicalPredictiveDropItem(this);
10485 else
10486 player.ServerDropEntity(this);
10487 return;
10488 }
10489
10491 {
10493
10494 if (new_item)
10495 {
10496 new_item.SetResultOfSplit(true);
10497 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10500 new_item.PlaceOnSurface();
10501 }
10502 }
10503 }
10504 }
10505 }
10506
10508 {
10509 float split_quantity_new;
10513 InventoryLocation loc = new InventoryLocation;
10514
10515 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10516 {
10518 split_quantity_new = stack_max;
10519 else
10521
10523 {
10524 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10525 if (new_item)
10526 {
10527 new_item.SetResultOfSplit(true);
10528 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10530 new_item.
SetQuantity(split_quantity_new,
false,
true);
10531 }
10532 }
10533 }
10534 else if (destination_entity && slot_id == -1)
10535 {
10536 if (quantity > stack_max)
10537 split_quantity_new = stack_max;
10538 else
10539 split_quantity_new = quantity;
10540
10542 {
10543 GameInventory destinationInventory = destination_entity.GetInventory();
10545 {
10548 }
10549
10550 if (new_item)
10551 {
10552 new_item.SetResultOfSplit(true);
10553 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10555 new_item.
SetQuantity(split_quantity_new,
false,
true);
10556 }
10557 }
10558 }
10559 else
10560 {
10561 if (stack_max != 0)
10562 {
10564 {
10566 }
10567
10569 {
10571
10572 if (new_item)
10573 {
10574 new_item.SetResultOfSplit(true);
10575 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10578 new_item.PlaceOnSurface();
10579 }
10580 }
10581 }
10582 }
10583 }
10584
10586 {
10588 {
10589 if (ScriptInputUserData.CanStoreInputUserData())
10590 {
10591 ScriptInputUserData ctx = new ScriptInputUserData;
10596 dst.WriteToContext(ctx);
10598 }
10599 }
10600 else if (!
g_Game.IsMultiplayer())
10601 {
10603 }
10604 }
10605
10607 {
10609 {
10610 if (ScriptInputUserData.CanStoreInputUserData())
10611 {
10612 ScriptInputUserData ctx = new ScriptInputUserData;
10617 ctx.
Write(destination_entity);
10623 }
10624 }
10625 else if (!
g_Game.IsMultiplayer())
10626 {
10628 }
10629 }
10630
10632 {
10634 }
10635
10637 {
10639 float split_quantity_new;
10641 if (dst.IsValid())
10642 {
10643 int slot_id = dst.GetSlot();
10645
10646 if (quantity > stack_max)
10647 split_quantity_new = stack_max;
10648 else
10649 split_quantity_new = quantity;
10650
10652 {
10654
10655 if (new_item)
10656 {
10657 new_item.SetResultOfSplit(true);
10658 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10660 new_item.
SetQuantity(split_quantity_new,
false,
true);
10661 }
10662
10663 return new_item;
10664 }
10665 }
10666
10667 return null;
10668 }
10669
10671 {
10673 float split_quantity_new;
10675 if (destination_entity)
10676 {
10678 if (quantity > stackable)
10679 split_quantity_new = stackable;
10680 else
10681 split_quantity_new = quantity;
10682
10684 {
10685 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10686 if (new_item)
10687 {
10688 new_item.SetResultOfSplit(true);
10689 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10691 new_item.
SetQuantity(split_quantity_new,
false,
true);
10692 }
10693 }
10694 }
10695 }
10696
10698 {
10700 {
10701 if (ScriptInputUserData.CanStoreInputUserData())
10702 {
10703 ScriptInputUserData ctx = new ScriptInputUserData;
10708 ItemBase destination_entity =
this;
10709 ctx.
Write(destination_entity);
10713 }
10714 }
10715 else if (!
g_Game.IsMultiplayer())
10716 {
10718 }
10719 }
10720
10722 {
10724 float split_quantity_new;
10726 if (player)
10727 {
10729 if (quantity > stackable)
10730 split_quantity_new = stackable;
10731 else
10732 split_quantity_new = quantity;
10733
10735 {
10736 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10737 new_item =
ItemBase.Cast(in_hands);
10738 if (new_item)
10739 {
10740 new_item.SetResultOfSplit(true);
10741 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10743 new_item.SetQuantity(split_quantity_new, false, true);
10744 }
10745 }
10746 }
10747 }
10748
10750 {
10752 float split_quantity_new = Math.Floor(quantity * 0.5);
10753
10755 return;
10756
10758
10759 if (new_item)
10760 {
10761 if (new_item.GetQuantityMax() < split_quantity_new)
10762 {
10763 split_quantity_new = new_item.GetQuantityMax();
10764 }
10765
10766 new_item.SetResultOfSplit(true);
10767 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10768
10770 {
10773 }
10774 else
10775 {
10777 new_item.
SetQuantity(split_quantity_new,
false,
true);
10778 }
10779 }
10780 }
10781
10783 {
10785 float split_quantity_new = Math.Floor(quantity / 2);
10786
10788 return;
10789
10790 InventoryLocation invloc = new InventoryLocation;
10792
10794 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10795
10796 if (new_item)
10797 {
10798 if (new_item.GetQuantityMax() < split_quantity_new)
10799 {
10800 split_quantity_new = new_item.GetQuantityMax();
10801 }
10803 {
10806 }
10807 else if (split_quantity_new > 1)
10808 {
10810 new_item.
SetQuantity(split_quantity_new,
false,
true);
10811 }
10812 }
10813 }
10814
10817 {
10818 SetWeightDirty();
10820
10821 if (parent)
10822 parent.OnAttachmentQuantityChangedEx(this, delta);
10823
10825 {
10827 {
10829 }
10831 {
10832 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10834 }
10835 }
10836 }
10837
10840 {
10841
10842 }
10843
10846 {
10848 }
10849
10851 {
10852 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10853
10855 {
10856 if (newLevel == GameConstants.STATE_RUINED)
10857 {
10859 EntityAI parent = GetHierarchyParent();
10860 if (parent && parent.IsFireplace())
10861 {
10862 CargoBase cargo = GetInventory().GetCargo();
10863 if (cargo)
10864 {
10866 {
10868 }
10869 }
10870 }
10871 }
10872
10874 {
10875
10877 return;
10878 }
10879
10880 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10881 {
10883 }
10884 }
10885 }
10886
10887
10889 {
10890 super.OnRightClick();
10891
10893 {
10895 {
10896 if (ScriptInputUserData.CanStoreInputUserData())
10897 {
10898 EntityAI root = GetHierarchyRoot();
10899 Man playerOwner = GetHierarchyRootPlayer();
10900 InventoryLocation dst = new InventoryLocation;
10901
10902
10903 if (!playerOwner && root && root == this)
10904 {
10906 }
10907 else
10908 {
10909
10910 GetInventory().GetCurrentInventoryLocation(dst);
10912 {
10913 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10915 {
10917 }
10918 else
10919 {
10921
10922
10923 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10924 {
10926 }
10927 else
10928 {
10929 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10930 }
10931 }
10932 }
10933 }
10934
10935 ScriptInputUserData ctx = new ScriptInputUserData;
10943 }
10944 }
10945 else if (!
g_Game.IsMultiplayer())
10946 {
10948 }
10949 }
10950 }
10951
10953 {
10954 if (root)
10955 {
10956 vector m4[4];
10957 root.GetTransform(m4);
10958 dst.SetGround(this, m4);
10959 }
10960 else
10961 {
10962 GetInventory().GetCurrentInventoryLocation(dst);
10963 }
10964 }
10965
10966 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10967 {
10968
10969 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10970 return false;
10971
10972 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10973 return false;
10974
10975
10977 return false;
10978
10979
10980 Magazine mag = Magazine.Cast(this);
10981 if (mag)
10982 {
10983 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10984 return false;
10985
10986 if (stack_max_limit)
10987 {
10988 Magazine other_mag = Magazine.Cast(other_item);
10989 if (other_item)
10990 {
10991 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10992 return false;
10993 }
10994
10995 }
10996 }
10997 else
10998 {
10999
11001 return false;
11002
11004 return false;
11005 }
11006
11007 PlayerBase player = null;
11008 if (CastTo(player, GetHierarchyRootPlayer()))
11009 {
11010 if (player.GetInventory().HasAttachment(this))
11011 return false;
11012
11013 if (player.IsItemsToDelete())
11014 return false;
11015 }
11016
11017 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11018 return false;
11019
11020 int slotID;
11022 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11023 return false;
11024
11025 return true;
11026 }
11027
11029 {
11031 }
11032
11034 {
11035 return m_IsResultOfSplit;
11036 }
11037
11039 {
11040 m_IsResultOfSplit = value;
11041 }
11042
11044 {
11046 }
11047
11049 {
11050 float other_item_quantity = other_item.GetQuantity();
11051 float this_free_space;
11052
11054
11056
11057 if (other_item_quantity > this_free_space)
11058 {
11059 return this_free_space;
11060 }
11061 else
11062 {
11063 return other_item_quantity;
11064 }
11065 }
11066
11068 {
11070 }
11071
11073 {
11075 return;
11076
11077 if (!IsMagazine() && other_item)
11078 {
11080 if (quantity_used != 0)
11081 {
11082 float hp1 = GetHealth01("","");
11083 float hp2 = other_item.GetHealth01("","");
11084 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11085 hpResult = hpResult / (
GetQuantity() + quantity_used);
11086
11087 hpResult *= GetMaxHealth();
11088 Math.Round(hpResult);
11089 SetHealth("", "Health", hpResult);
11090
11092 other_item.AddQuantity(-quantity_used);
11093 }
11094 }
11096 }
11097
11099 {
11100 #ifdef SERVER
11101 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11102 GetHierarchyParent().IncreaseLifetimeUp();
11103 #endif
11104 };
11105
11107 {
11108 PlayerBase p = PlayerBase.Cast(player);
11109
11110 array<int> recipesIds = p.m_Recipes;
11111 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11112 if (moduleRecipesManager)
11113 {
11114 EntityAI itemInHands = player.GetEntityInHands();
11115 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11116 }
11117
11118 for (int i = 0;i < recipesIds.Count(); i++)
11119 {
11120 int key = recipesIds.Get(i);
11121 string recipeName = moduleRecipesManager.GetRecipeName(key);
11123 }
11124 }
11125
11126
11127 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11128 {
11129 super.GetDebugActions(outputList);
11130
11131
11137
11138
11143
11148
11149
11153
11154
11156 {
11160 }
11161
11164
11165
11169
11171
11172 InventoryLocation loc = new InventoryLocation();
11173 GetInventory().GetCurrentInventoryLocation(loc);
11175 {
11176 if (Gizmo_IsSupported())
11179 }
11180
11182 }
11183
11184
11185
11186
11188 {
11189 super.OnAction(action_id, player, ctx);
11190
11192 {
11193 switch (action_id)
11194 {
11198 return true;
11202 return true;
11203 }
11204 }
11205
11207 {
11208 switch (action_id)
11209 {
11211 Delete();
11212 return true;
11213 }
11214 }
11215
11216 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11217 {
11218 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11219 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11220 PlayerBase p = PlayerBase.Cast(player);
11221 if (
EActions.RECIPES_RANGE_START < 1000)
11222 {
11223 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11224 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11225 }
11226 }
11227 #ifndef SERVER
11228 else if (action_id ==
EActions.WATCH_PLAYER)
11229 {
11230 PluginDeveloper.SetDeveloperItemClientEx(player);
11231 }
11232 #endif
11234 {
11235 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11236 {
11237 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11238 OnDebugButtonPressServer(id + 1);
11239 }
11240
11241 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11242 {
11243 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11245 }
11246
11247 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11248 {
11249 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11251 }
11252
11253 else if (action_id ==
EActions.ADD_QUANTITY)
11254 {
11255 if (IsMagazine())
11256 {
11257 Magazine mag = Magazine.Cast(this);
11258 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11259 }
11260 else
11261 {
11263 }
11264
11265 if (m_EM)
11266 {
11267 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11268 }
11269
11270 }
11271
11272 else if (action_id ==
EActions.REMOVE_QUANTITY)
11273 {
11274 if (IsMagazine())
11275 {
11276 Magazine mag2 = Magazine.Cast(this);
11277 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11278 }
11279 else
11280 {
11282 }
11283 if (m_EM)
11284 {
11285 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11286 }
11287
11288 }
11289
11290 else if (action_id ==
EActions.SET_QUANTITY_0)
11291 {
11293
11294 if (m_EM)
11295 {
11296 m_EM.SetEnergy(0);
11297 }
11298 }
11299
11300 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11301 {
11303
11304 if (m_EM)
11305 {
11306 m_EM.SetEnergy(m_EM.GetEnergyMax());
11307 }
11308 }
11309
11310 else if (action_id ==
EActions.ADD_HEALTH)
11311 {
11312 AddHealth("","",GetMaxHealth("","Health")/5);
11313 }
11314 else if (action_id ==
EActions.REMOVE_HEALTH)
11315 {
11316 AddHealth("","",-GetMaxHealth("","Health")/5);
11317 }
11318 else if (action_id ==
EActions.DESTROY_HEALTH)
11319 {
11320 SetHealth01("","",0);
11321 }
11322 else if (action_id ==
EActions.WATCH_ITEM)
11323 {
11325 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11326 #ifdef DEVELOPER
11327 SetDebugDeveloper_item(this);
11328 #endif
11329 }
11330
11331 else if (action_id ==
EActions.ADD_TEMPERATURE)
11332 {
11333 AddTemperature(20);
11334
11335 }
11336
11337 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11338 {
11339 AddTemperature(-20);
11340
11341 }
11342
11343 else if (action_id ==
EActions.FLIP_FROZEN)
11344 {
11345 SetFrozen(!GetIsFrozen());
11346
11347 }
11348
11349 else if (action_id ==
EActions.ADD_WETNESS)
11350 {
11352
11353 }
11354
11355 else if (action_id ==
EActions.REMOVE_WETNESS)
11356 {
11358
11359 }
11360
11361 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11362 {
11365
11366
11367 }
11368
11369 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11370 {
11373 }
11374
11375 else if (action_id ==
EActions.MAKE_SPECIAL)
11376 {
11377 auto debugParams = DebugSpawnParams.WithPlayer(player);
11378 OnDebugSpawnEx(debugParams);
11379 }
11380
11381 }
11382
11383
11384 return false;
11385 }
11386
11387
11388
11389
11393
11396
11397
11398
11400 {
11401 return false;
11402 }
11403
11404
11406 {
11407 return true;
11408 }
11409
11410
11412 {
11413 return true;
11414 }
11415
11416
11417
11419 {
11420 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11421 return g_Game.ConfigIsExisting(config_path);
11422 }
11423
11426 {
11427 return null;
11428 }
11429
11431 {
11432 return false;
11433 }
11434
11436 {
11437 return false;
11438 }
11439
11443
11444
11446 {
11447 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11448 return module_repairing.CanRepair(this, item_repair_kit);
11449 }
11450
11451
11452 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11453 {
11454 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11455 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11456 }
11457
11458
11460 {
11461
11462
11463
11464
11465
11466
11467
11468
11469 return 1;
11470 }
11471
11472
11473
11475 {
11477 }
11478
11479
11480
11482 {
11484 }
11485
11486
11495 {
11496 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11497
11498 if (player)
11499 {
11500 player.MessageStatus(text);
11501 }
11502 }
11503
11504
11513 {
11514 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11515
11516 if (player)
11517 {
11518 player.MessageAction(text);
11519 }
11520 }
11521
11522
11531 {
11532 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11533
11534 if (player)
11535 {
11536 player.MessageFriendly(text);
11537 }
11538 }
11539
11540
11549 {
11550 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11551
11552 if (player)
11553 {
11554 player.MessageImportant(text);
11555 }
11556 }
11557
11559 {
11560 return true;
11561 }
11562
11563
11564 override bool KindOf(
string tag)
11565 {
11566 bool found = false;
11567 string item_name = this.
GetType();
11569 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11570
11571 int array_size = item_tag_array.Count();
11572 for (int i = 0; i < array_size; i++)
11573 {
11574 if (item_tag_array.Get(i) == tag)
11575 {
11576 found = true;
11577 break;
11578 }
11579 }
11580 return found;
11581 }
11582
11583
11585 {
11586
11587 super.OnRPC(sender, rpc_type,ctx);
11588
11589
11590 switch (rpc_type)
11591 {
11592 #ifndef SERVER
11593 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11594 Param2<bool, string> p = new Param2<bool, string>(false, "");
11595
11597 return;
11598
11599 bool play = p.param1;
11600 string soundSet = p.param2;
11601
11602 if (play)
11603 {
11605 {
11607 {
11609 }
11610 }
11611 else
11612 {
11614 }
11615 }
11616 else
11617 {
11619 }
11620
11621 break;
11622 #endif
11623
11624 }
11625
11627 {
11629 }
11630 }
11631
11632
11633
11634
11636 {
11637 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11638 return plugin.GetID(
name);
11639 }
11640
11642 {
11643 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11644 return plugin.GetName(id);
11645 }
11646
11649 {
11650
11651
11652 int varFlags;
11653 if (!ctx.
Read(varFlags))
11654 return;
11655
11656 if (varFlags & ItemVariableFlags.FLOAT)
11657 {
11659 }
11660 }
11661
11663 {
11664
11665 super.SerializeNumericalVars(floats_out);
11666
11667
11668
11670 {
11672 }
11673
11675 {
11677 }
11678
11680 {
11682 }
11683
11685 {
11690 }
11691
11693 {
11695 }
11696 }
11697
11699 {
11700
11701 super.DeSerializeNumericalVars(floats);
11702
11703
11704 int index = 0;
11705 int mask = Math.Round(floats.Get(index));
11706
11707 index++;
11708
11710 {
11712 {
11714 }
11715 else
11716 {
11717 float quantity = floats.Get(index);
11718 SetQuantity(quantity,
true,
false,
false,
false);
11719 }
11720 index++;
11721 }
11722
11724 {
11725 float wet = floats.Get(index);
11727 index++;
11728 }
11729
11731 {
11732 int liquidtype = Math.Round(floats.Get(index));
11734 index++;
11735 }
11736
11738 {
11740 index++;
11742 index++;
11744 index++;
11746 index++;
11747 }
11748
11750 {
11751 int cleanness = Math.Round(floats.Get(index));
11753 index++;
11754 }
11755 }
11756
11758 {
11759 super.WriteVarsToCTX(ctx);
11760
11761
11763 {
11765 }
11766
11768 {
11770 }
11771
11773 {
11775 }
11776
11778 {
11779 int r,g,b,a;
11785 }
11786
11788 {
11790 }
11791 }
11792
11794 {
11795 if (!super.ReadVarsFromCTX(ctx,version))
11796 return false;
11797
11798 int intValue;
11799 float value;
11800
11801 if (version < 140)
11802 {
11803 if (!ctx.
Read(intValue))
11804 return false;
11805
11806 m_VariablesMask = intValue;
11807 }
11808
11810 {
11811 if (!ctx.
Read(value))
11812 return false;
11813
11815 {
11817 }
11818 else
11819 {
11821 }
11822 }
11823
11824 if (version < 140)
11825 {
11827 {
11828 if (!ctx.
Read(value))
11829 return false;
11830 SetTemperatureDirect(value);
11831 }
11832 }
11833
11835 {
11836 if (!ctx.
Read(value))
11837 return false;
11839 }
11840
11842 {
11843 if (!ctx.
Read(intValue))
11844 return false;
11846 }
11847
11849 {
11850 int r,g,b,a;
11852 return false;
11854 return false;
11856 return false;
11858 return false;
11859
11861 }
11862
11864 {
11865 if (!ctx.
Read(intValue))
11866 return false;
11868 }
11869
11870 if (version >= 138 && version < 140)
11871 {
11873 {
11874 if (!ctx.
Read(intValue))
11875 return false;
11876 SetFrozen(intValue);
11877 }
11878 }
11879
11880 return true;
11881 }
11882
11883
11885 {
11888 {
11890 }
11891
11892 if (!super.OnStoreLoad(ctx, version))
11893 {
11895 return false;
11896 }
11897
11898 if (version >= 114)
11899 {
11900 bool hasQuickBarIndexSaved;
11901
11902 if (!ctx.
Read(hasQuickBarIndexSaved))
11903 {
11905 return false;
11906 }
11907
11908 if (hasQuickBarIndexSaved)
11909 {
11910 int itmQBIndex;
11911
11912
11913 if (!ctx.
Read(itmQBIndex))
11914 {
11916 return false;
11917 }
11918
11919 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11920 if (itmQBIndex != -1 && parentPlayer)
11921 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11922 }
11923 }
11924 else
11925 {
11926
11927 PlayerBase player;
11928 int itemQBIndex;
11929 if (version ==
int.
MAX)
11930 {
11931 if (!ctx.
Read(itemQBIndex))
11932 {
11934 return false;
11935 }
11936 }
11937 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11938 {
11939
11940 if (!ctx.
Read(itemQBIndex))
11941 {
11943 return false;
11944 }
11945 if (itemQBIndex != -1 && player)
11946 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11947 }
11948 }
11949
11950 if (version < 140)
11951 {
11952
11953 if (!LoadVariables(ctx, version))
11954 {
11956 return false;
11957 }
11958 }
11959
11960
11962 {
11964 return false;
11965 }
11966 if (version >= 132)
11967 {
11969 if (raib)
11970 {
11972 {
11974 return false;
11975 }
11976 }
11977 }
11978
11980 return true;
11981 }
11982
11983
11984
11986 {
11987 super.OnStoreSave(ctx);
11988
11989 PlayerBase player;
11990 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11991 {
11993
11994 int itemQBIndex = -1;
11995 itemQBIndex = player.FindQuickBarEntityIndex(this);
11996 ctx.
Write(itemQBIndex);
11997 }
11998 else
11999 {
12001 }
12002
12004
12006 if (raib)
12007 {
12009 }
12010 }
12011
12012
12014 {
12015 super.AfterStoreLoad();
12016
12018 {
12020 }
12021
12023 {
12026 }
12027 }
12028
12030 {
12031 super.EEOnAfterLoad();
12032
12034 {
12036 }
12037
12040 }
12041
12043 {
12044 return false;
12045 }
12046
12047
12048
12050 {
12052 {
12053 #ifdef PLATFORM_CONSOLE
12054
12056 {
12058 if (menu)
12059 {
12061 }
12062 }
12063 #endif
12064 }
12065
12067 {
12070 }
12071
12073 {
12074 SetWeightDirty();
12076 }
12078 {
12081 }
12082
12084 {
12087
12090 }
12092 {
12096 }
12097
12098 super.OnVariablesSynchronized();
12099 }
12100
12101
12102
12104 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12105 {
12106 if (!IsServerCheck(allow_client))
12107 return false;
12108
12110 return false;
12111
12114
12115 if (value <= (min + 0.001))
12116 value = min;
12117
12118 if (value == min)
12119 {
12120 if (destroy_config)
12121 {
12122 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12123 if (dstr)
12124 {
12126 this.Delete();
12127 return true;
12128 }
12129 }
12130 else if (destroy_forced)
12131 {
12133 this.Delete();
12134 return true;
12135 }
12136
12138 }
12139
12142
12144 {
12145 EntityAI parent = GetHierarchyRoot();
12146 InventoryLocation iLoc = new InventoryLocation();
12147 GetInventory().GetCurrentInventoryLocation(iLoc);
12149 {
12150 int iLocSlot = iLoc.
GetSlot();
12152 {
12154 }
12156 {
12158 }
12159 }
12160 }
12161
12163 {
12165
12166 if (delta)
12168 }
12169
12171
12172 return false;
12173 }
12174
12175
12177 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12178 {
12180 }
12181
12183 {
12186 }
12187
12189 {
12192 }
12193
12195 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12196 {
12197 float value_clamped = Math.Clamp(value, 0, 1);
12199 SetQuantity(result, destroy_config, destroy_forced);
12200 }
12201
12202
12205 {
12207 }
12208
12210 {
12212 }
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12224 {
12225 int slot = -1;
12226 GameInventory inventory = GetInventory();
12227 if (inventory)
12228 {
12229 InventoryLocation il = new InventoryLocation;
12232 }
12233
12235 }
12236
12238 {
12239 float quantity_max = 0;
12240
12242 {
12243 if (attSlotID != -1)
12244 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12245
12246 if (quantity_max <= 0)
12248 }
12249
12250 if (quantity_max <= 0)
12252
12253 return quantity_max;
12254 }
12255
12257 {
12259 }
12260
12262 {
12264 }
12265
12266
12268 {
12270 }
12271
12273 {
12275 }
12276
12278 {
12280 }
12281
12282
12284 {
12285
12286 float weightEx = GetWeightEx();
12287 float special = GetInventoryAndCargoWeight();
12288 return weightEx - special;
12289 }
12290
12291
12293 {
12295 }
12296
12298 {
12300 {
12301 #ifdef DEVELOPER
12302 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12303 {
12304 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12306 }
12307 #endif
12308
12309 return GetQuantity() * GetConfigWeightModified();
12310 }
12311 else if (HasEnergyManager())
12312 {
12313 #ifdef DEVELOPER
12314 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12315 {
12316 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12317 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12318 }
12319 #endif
12320 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12321 }
12322 else
12323 {
12324 #ifdef DEVELOPER
12325 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12326 {
12327 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12328 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12329 }
12330 #endif
12331 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12332 }
12333 }
12334
12337 {
12338 int item_count = 0;
12340
12341 GameInventory inventory = GetInventory();
12342 CargoBase cargo = inventory.
GetCargo();
12343 if (cargo != NULL)
12344 {
12346 }
12347
12349 for (int i = 0; i < nAttachments; ++i)
12350 {
12352 if (item)
12353 item_count += item.GetNumberOfItems();
12354 }
12355 return item_count;
12356 }
12357
12360 {
12361 float weight = 0;
12362 float wetness = 1;
12363 if (include_wetness)
12366 {
12367 weight = wetness * m_ConfigWeight;
12368 }
12370 {
12371 weight = 1;
12372 }
12373 return weight;
12374 }
12375
12376
12377
12379 {
12380 GameInventory inventory = GetInventory();
12381 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12382 {
12383 array<EntityAI> items = new array<EntityAI>;
12385 for (int i = 0; i < items.Count(); ++i)
12386 {
12388 if (item)
12389 {
12390 g_Game.ObjectDelete(item);
12391 }
12392 }
12393 }
12394 }
12395
12396
12397
12398
12400 {
12401 float energy = 0;
12402 if (HasEnergyManager())
12403 {
12404 energy = GetCompEM().GetEnergy();
12405 }
12406 return energy;
12407 }
12408
12409
12411 {
12412 super.OnEnergyConsumed();
12413
12415 }
12416
12418 {
12419 super.OnEnergyAdded();
12420
12422 }
12423
12424
12426 {
12427 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12428 {
12430 {
12431 float energy_0to1 = GetCompEM().GetEnergy0To1();
12433 }
12434 }
12435 }
12436
12437
12439 {
12440 return ConfigGetFloat("heatIsolation");
12441 }
12442
12444 {
12446 }
12447
12449 {
12450 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12451 if (
g_Game.ConfigIsExisting(paramPath))
12452 return g_Game.ConfigGetFloat(paramPath);
12453
12454 return 0.0;
12455 }
12456
12458 {
12459 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12460 if (
g_Game.ConfigIsExisting(paramPath))
12461 return g_Game.ConfigGetFloat(paramPath);
12462
12463 return 0.0;
12464 }
12465
12466 override void SetWet(
float value,
bool allow_client =
false)
12467 {
12468 if (!IsServerCheck(allow_client))
12469 return;
12470
12473
12475
12476 m_VarWet = Math.Clamp(value, min, max);
12477
12479 {
12482 }
12483 }
12484
12485 override void AddWet(
float value)
12486 {
12488 }
12489
12491 {
12493 }
12494
12496 {
12498 }
12499
12501 {
12503 }
12504
12506 {
12508 }
12509
12511 {
12513 }
12514
12515 override void OnWetChanged(
float newVal,
float oldVal)
12516 {
12519 if (newLevel != oldLevel)
12520 {
12522 }
12523 }
12524
12526 {
12527 SetWeightDirty();
12528 }
12529
12531 {
12532 return GetWetLevelInternal(
m_VarWet);
12533 }
12534
12535
12536
12538 {
12540 }
12541
12543 {
12545 }
12546
12548 {
12550 }
12551
12553 {
12555 }
12556
12557
12558
12560 {
12561 if (ConfigIsExisting("itemModelLength"))
12562 {
12563 return ConfigGetFloat("itemModelLength");
12564 }
12565 return 0;
12566 }
12567
12569 {
12570 if (ConfigIsExisting("itemAttachOffset"))
12571 {
12572 return ConfigGetFloat("itemAttachOffset");
12573 }
12574 return 0;
12575 }
12576
12577 override void SetCleanness(
int value,
bool allow_client =
false)
12578 {
12579 if (!IsServerCheck(allow_client))
12580 return;
12581
12583
12585
12588 }
12589
12591 {
12593 }
12594
12596 {
12597 return true;
12598 }
12599
12600
12601
12602
12604 {
12606 }
12607
12609 {
12611 }
12612
12613
12614
12615
12616 override void SetColor(
int r,
int g,
int b,
int a)
12617 {
12623 }
12625 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12626 {
12631 }
12632
12634 {
12636 }
12637
12640 {
12641 int r,g,b,a;
12643 r = r/255;
12644 g = g/255;
12645 b = b/255;
12646 a = a/255;
12647 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12648 }
12649
12650
12651
12652 override void SetLiquidType(
int value,
bool allow_client =
false)
12653 {
12654 if (!IsServerCheck(allow_client))
12655 return;
12656
12661 }
12662
12664 {
12665 return ConfigGetInt("varLiquidTypeInit");
12666 }
12667
12669 {
12671 }
12672
12674 {
12676 SetFrozen(false);
12677 }
12678
12681 {
12682 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12683 }
12684
12685
12688 {
12689 PlayerBase nplayer;
12690 if (PlayerBase.CastTo(nplayer, player))
12691 {
12693 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12694 }
12695 }
12696
12697
12700 {
12701 PlayerBase nplayer;
12702 if (PlayerBase.CastTo(nplayer,player))
12703 {
12704 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12705 }
12706
12707 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12708
12709 if (HasEnergyManager())
12710 {
12711 GetCompEM().UpdatePlugState();
12712 }
12713 }
12714
12715
12717 {
12718 super.OnPlacementStarted(player);
12719
12721 }
12722
12723 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12724 {
12726 {
12727 m_AdminLog.OnPlacementComplete(player,
this);
12728 }
12729
12730 super.OnPlacementComplete(player, position, orientation);
12731 }
12732
12733
12734
12735
12736
12738 {
12740 {
12741 return true;
12742 }
12743 else
12744 {
12745 return false;
12746 }
12747 }
12748
12749
12751 {
12753 {
12755 }
12756 }
12757
12758
12760 {
12762 }
12763
12765 {
12767 }
12768
12769 override void InsertAgent(
int agent,
float count = 1)
12770 {
12771 if (count < 1)
12772 return;
12773
12775 }
12776
12779 {
12781 }
12782
12783
12785 {
12787 }
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
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
12831 {
12833 return false;
12834 return true;
12835 }
12836
12838 {
12839
12841 }
12842
12843
12846 {
12847 super.CheckForRoofLimited(timeTresholdMS);
12848
12849 float time =
g_Game.GetTime();
12850 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12851 {
12852 m_PreviousRoofTestTime = time;
12853 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12854 }
12855 }
12856
12857
12859 {
12861 {
12862 return 0;
12863 }
12864
12865 if (GetInventory().GetAttachmentSlotsCount() != 0)
12866 {
12867 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12868 if (filter)
12869 return filter.GetProtectionLevel(type, false, system);
12870 else
12871 return 0;
12872 }
12873
12874 string subclassPath, entryName;
12875
12876 switch (type)
12877 {
12879 entryName = "biological";
12880 break;
12882 entryName = "chemical";
12883 break;
12884 default:
12885 entryName = "biological";
12886 break;
12887 }
12888
12889 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12890
12891 return g_Game.ConfigGetFloat(subclassPath + entryName);
12892 }
12893
12894
12895
12898 {
12899 if (!IsMagazine())
12901
12903 }
12904
12905
12906
12907
12908
12913 {
12914 return true;
12915 }
12916
12918 {
12920 }
12921
12922
12923
12924
12925
12927 {
12928 if (parent)
12929 {
12930 if (parent.IsInherited(DayZInfected))
12931 return true;
12932
12933 if (!parent.IsRuined())
12934 return true;
12935 }
12936
12937 return true;
12938 }
12939
12941 {
12942 if (!super.CanPutAsAttachment(parent))
12943 {
12944 return false;
12945 }
12946
12947 if (!IsRuined() && !parent.IsRuined())
12948 {
12949 return true;
12950 }
12951
12952 return false;
12953 }
12954
12956 {
12957
12958
12959
12960
12961 return super.CanReceiveItemIntoCargo(item);
12962 }
12963
12965 {
12966
12967
12968
12969
12970 GameInventory attachmentInv = attachment.GetInventory();
12972 {
12973 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12974 return false;
12975 }
12976
12977 InventoryLocation loc = new InventoryLocation();
12978 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12979 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12980 return false;
12981
12982 return super.CanReceiveAttachment(attachment, slotId);
12983 }
12984
12986 {
12987 if (!super.CanReleaseAttachment(attachment))
12988 return false;
12989
12990 return GetInventory().AreChildrenAccessible();
12991 }
12992
12993
12994
12995
12996
12997
12998
12999
13000
13001
13002
13003
13004
13005
13006
13007
13008
13009
13010
13011
13012
13014 {
13015 int id = muzzle_owner.GetMuzzleID();
13016 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13017
13018 if (WPOF_array)
13019 {
13020 for (int i = 0; i < WPOF_array.Count(); i++)
13021 {
13022 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13023
13024 if (WPOF)
13025 {
13026 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13027 }
13028 }
13029 }
13030 }
13031
13032
13034 {
13035 int id = muzzle_owner.GetMuzzleID();
13037
13038 if (WPOBE_array)
13039 {
13040 for (int i = 0; i < WPOBE_array.Count(); i++)
13041 {
13042 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13043
13044 if (WPOBE)
13045 {
13046 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13047 }
13048 }
13049 }
13050 }
13051
13052
13054 {
13055 int id = muzzle_owner.GetMuzzleID();
13056 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13057
13058 if (WPOOH_array)
13059 {
13060 for (int i = 0; i < WPOOH_array.Count(); i++)
13061 {
13062 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13063
13064 if (WPOOH)
13065 {
13066 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13067 }
13068 }
13069 }
13070 }
13071
13072
13074 {
13075 int id = muzzle_owner.GetMuzzleID();
13076 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13077
13078 if (WPOOH_array)
13079 {
13080 for (int i = 0; i < WPOOH_array.Count(); i++)
13081 {
13082 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13083
13084 if (WPOOH)
13085 {
13086 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13087 }
13088 }
13089 }
13090 }
13091
13092
13094 {
13095 int id = muzzle_owner.GetMuzzleID();
13096 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13097
13098 if (WPOOH_array)
13099 {
13100 for (int i = 0; i < WPOOH_array.Count(); i++)
13101 {
13102 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13103
13104 if (WPOOH)
13105 {
13106 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13107 }
13108 }
13109 }
13110 }
13111
13112
13113
13115 {
13117 {
13118 return true;
13119 }
13120
13121 return false;
13122 }
13123
13125 {
13127 {
13128 return true;
13129 }
13130
13131 return false;
13132 }
13133
13135 {
13137 {
13138 return true;
13139 }
13140
13141 return false;
13142 }
13143
13145 {
13146 return false;
13147 }
13148
13151 {
13152 return UATimeSpent.DEFAULT_DEPLOY;
13153 }
13154
13155
13156
13157
13159 {
13161 SetSynchDirty();
13162 }
13163
13165 {
13167 }
13168
13169
13171 {
13172 return false;
13173 }
13174
13177 {
13178 string att_type = "None";
13179
13180 if (ConfigIsExisting("soundAttType"))
13181 {
13182 att_type = ConfigGetString("soundAttType");
13183 }
13184
13186 }
13187
13189 {
13191 }
13192
13193
13194
13195
13196
13202
13204 {
13207
13209 }
13210
13211
13213 {
13215 return;
13216
13218
13221
13224
13225 SoundParameters params = new SoundParameters();
13229 }
13230
13231
13233 {
13235 {
13238
13239 SetSynchDirty();
13240
13243 }
13244 }
13245
13247 {
13249 }
13250
13251
13253 {
13255 return;
13256
13258 SetSynchDirty();
13259
13262 }
13263
13265 {
13268 }
13269
13271 {
13273 }
13274
13275 void OnApply(PlayerBase player);
13276
13278 {
13279 return 1.0;
13280 };
13281
13283 {
13285 }
13286
13288 {
13290 }
13291
13293
13295 {
13296 SetDynamicPhysicsLifeTime(0.01);
13298 }
13299
13301 {
13302 array<string> zone_names = new array<string>;
13303 GetDamageZones(zone_names);
13304 for (int i = 0; i < zone_names.Count(); i++)
13305 {
13306 SetHealthMax(zone_names.Get(i),"Health");
13307 }
13308 SetHealthMax("","Health");
13309 }
13310
13313 {
13314 float global_health = GetHealth01("","Health");
13315 array<string> zones = new array<string>;
13316 GetDamageZones(zones);
13317
13318 for (int i = 0; i < zones.Count(); i++)
13319 {
13320 SetHealth01(zones.Get(i),"Health",global_health);
13321 }
13322 }
13323
13326 {
13327 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13328 }
13329
13331 {
13332 if (!hasRootAsPlayer)
13333 {
13334 if (refParentIB)
13335 {
13336
13337 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13338 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13339
13340 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13341 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13342
13345 }
13346 else
13347 {
13348
13351 }
13352 }
13353 }
13354
13356 {
13358 {
13359 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13360 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13361 {
13362 float heatPermCoef = 1.0;
13364 while (ent)
13365 {
13366 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13367 ent = ent.GetHierarchyParent();
13368 }
13369
13370 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13371 }
13372 }
13373 }
13374
13376 {
13377
13378 EntityAI parent = GetHierarchyParent();
13379 if (!parent)
13380 {
13381 hasParent = false;
13382 hasRootAsPlayer = false;
13383 }
13384 else
13385 {
13386 hasParent = true;
13387 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13388 refParentIB =
ItemBase.Cast(parent);
13389 }
13390 }
13391
13392 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13393 {
13394
13395 }
13396
13398 {
13399
13400 return false;
13401 }
13402
13404 {
13405
13406
13407 return false;
13408 }
13409
13411 {
13412
13413 return false;
13414 }
13415
13418 {
13419 return !GetIsFrozen() &&
IsOpen();
13420 }
13421
13423 {
13424 bool hasParent = false, hasRootAsPlayer = false;
13426
13427 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13428 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13429
13430 if (wwtu || foodDecay)
13431 {
13435
13436 if (processWetness || processTemperature || processDecay)
13437 {
13439
13440 if (processWetness)
13441 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13442
13443 if (processTemperature)
13445
13446 if (processDecay)
13447 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13448 }
13449 }
13450 }
13451
13454 {
13456 }
13457
13459 {
13462
13463 return super.GetTemperatureFreezeThreshold();
13464 }
13465
13467 {
13470
13471 return super.GetTemperatureThawThreshold();
13472 }
13473
13475 {
13478
13479 return super.GetItemOverheatThreshold();
13480 }
13481
13483 {
13485 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13486
13487 return super.GetTemperatureFreezeTime();
13488 }
13489
13491 {
13493 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13494
13495 return super.GetTemperatureThawTime();
13496 }
13497
13502
13504 {
13505 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13506 }
13507
13509 {
13510 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13511 }
13512
13515 {
13517 }
13518
13520 {
13522 }
13523
13525 {
13527 }
13528
13531 {
13532 return null;
13533 }
13534
13537 {
13538 return false;
13539 }
13540
13542 {
13544 {
13547 if (!trg)
13548 {
13550 explosive = this;
13551 }
13552
13553 explosive.PairRemote(trg);
13555
13556 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13557 trg.SetPersistentPairID(persistentID);
13558 explosive.SetPersistentPairID(persistentID);
13559
13560 return true;
13561 }
13562 return false;
13563 }
13564
13567 {
13568 float ret = 1.0;
13571 ret *= GetHealth01();
13572
13573 return ret;
13574 }
13575
13576 #ifdef DEVELOPER
13577 override void SetDebugItem()
13578 {
13579 super.SetDebugItem();
13580 _itemBase = this;
13581 }
13582
13584 {
13585 string text = super.GetDebugText();
13586
13588 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13589
13590 return text;
13591 }
13592 #endif
13593
13595 {
13596 return true;
13597 }
13598
13600
13602
13604 {
13607 }
13608
13609
13617
13633
13634 [
Obsolete(
"Use ItemSoundHandler instead")]
13637 {
13638 if (!
g_Game.IsDedicatedServer())
13639 {
13640 if (ConfigIsExisting("attachSoundSet"))
13641 {
13642 string cfg_path = "";
13643 string soundset = "";
13644 string type_name =
GetType();
13645
13648 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13649 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13650
13651 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13652 {
13653 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13654 {
13655 if (cfg_slot_array[i] == slot_type)
13656 {
13657 soundset = cfg_soundset_array[i];
13658 break;
13659 }
13660 }
13661 }
13662
13663 if (soundset != "")
13664 {
13665 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13667 }
13668 }
13669 }
13670 }
13671
13673}
13674
13676{
13678 if (entity)
13679 {
13680 bool is_item = entity.IsInherited(
ItemBase);
13681 if (is_item && full_quantity)
13682 {
13685 }
13686 }
13687 else
13688 {
13690 return NULL;
13691 }
13692 return entity;
13693}
13694
13696{
13697 if (item)
13698 {
13699 if (health > 0)
13700 item.SetHealth("", "", health);
13701
13702 if (item.CanHaveTemperature())
13703 {
13705 if (item.CanFreeze())
13706 item.SetFrozen(false);
13707 }
13708
13709 if (item.HasEnergyManager())
13710 {
13711 if (quantity >= 0)
13712 {
13713 item.GetCompEM().SetEnergy0To1(quantity);
13714 }
13715 else
13716 {
13718 }
13719 }
13720 else if (item.IsMagazine())
13721 {
13722 Magazine mag = Magazine.Cast(item);
13723 if (quantity >= 0)
13724 {
13725 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13726 }
13727 else
13728 {
13730 }
13731
13732 }
13733 else
13734 {
13735 if (quantity >= 0)
13736 {
13737 item.SetQuantityNormalized(quantity, false);
13738 }
13739 else
13740 {
13742 }
13743
13744 }
13745 }
13746}
13747
13748#ifdef DEVELOPER
13750#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.