8804{
8806 {
8807 return true;
8808 }
8809};
8810
8812{
8813
8814};
8815
8816
8817
8819{
8823
8825
8828
8829
8830
8831
8832
8841
8847
8852
8857
8878 protected bool m_IsResultOfSplit
8879
8881
8886
8887
8888
8890
8894
8895
8896
8898
8901
8902
8903
8909
8910
8918
8921
8922
8924
8925
8927
8928
8933
8934
8939
8941
8942
8944
8945
8947 {
8952
8953 if (!
g_Game.IsDedicatedServer())
8954 {
8956 {
8958
8960 {
8962 }
8963 }
8964
8967 }
8968
8969 m_OldLocation = null;
8970
8972 {
8974 }
8975
8976 if (ConfigIsExisting("headSelectionsToHide"))
8977 {
8980 }
8981
8983 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8984 {
8986 }
8987
8989
8990 m_IsResultOfSplit = false;
8991
8993 }
8994
8996 {
8997 super.InitItemVariables();
8998
9004 m_Count = ConfigGetInt(
"count");
9005
9008
9013
9016
9021
9033
9037
9038
9041 if (ConfigIsExisting("canBeSplit"))
9042 {
9045 }
9046
9048 if (ConfigIsExisting("itemBehaviour"))
9050
9051
9054 RegisterNetSyncVariableInt("m_VarLiquidType");
9055 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9056
9057 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9058 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9059 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9060
9061 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9062 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9063 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9064 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9065
9066 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9067 RegisterNetSyncVariableBool("m_IsTakeable");
9068 RegisterNetSyncVariableBool("m_IsHologram");
9069
9072 {
9075 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9076 }
9077
9079
9081 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9083
9085 }
9086
9088 {
9090 }
9091
9093 {
9096 {
9101 }
9102 }
9103
9104 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9105 {
9107 {
9110 }
9111
9113 }
9114
9116 {
9122 }
9123
9125
9127 {
9129
9130 if (!action)
9131 {
9132 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9133 return;
9134 }
9135
9137 if (!ai)
9138 {
9140 return;
9141 }
9142
9144 if (!action_array)
9145 {
9146 action_array = new array<ActionBase_Basic>;
9148 }
9149 if (LogManager.IsActionLogEnable())
9150 {
9151 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9152 }
9153
9154 if (action_array.Find(action) != -1)
9155 {
9156 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9157 }
9158 else
9159 {
9160 action_array.Insert(action);
9161 }
9162 }
9163
9165 {
9166 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9167 ActionBase action = player.GetActionManager().GetAction(actionName);
9170
9171 if (action_array)
9172 {
9173 action_array.RemoveItem(action);
9174 }
9175 }
9176
9177
9178
9180 {
9181 ActionOverrideData overrideData = new ActionOverrideData();
9185
9187 if (!actionMap)
9188 {
9191 }
9192
9193 actionMap.Insert(this.
Type(), overrideData);
9194
9195 }
9196
9198
9200
9201
9203 {
9206
9209
9210 string config_to_search = "CfgVehicles";
9211 string muzzle_owner_config;
9212
9214 {
9215 if (IsInherited(Weapon))
9216 config_to_search = "CfgWeapons";
9217
9218 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9219
9220 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9221
9222 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9223
9224 if (config_OnFire_subclass_count > 0)
9225 {
9226 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9227
9228 for (int i = 0; i < config_OnFire_subclass_count; i++)
9229 {
9230 string particle_class = "";
9231 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9232 string config_OnFire_entry = config_OnFire_class + particle_class;
9233 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9234 WPOF_array.Insert(WPOF);
9235 }
9236
9237
9239 }
9240 }
9241
9243 {
9244 config_to_search = "CfgWeapons";
9245 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9246
9247 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9248
9249 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9250
9251 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9252 {
9253 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9254
9255 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9256 {
9257 string particle_class2 = "";
9258 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9259 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9260 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9261 WPOBE_array.Insert(WPOBE);
9262 }
9263
9264
9266 }
9267 }
9268 }
9269
9270
9272 {
9275
9277 {
9278 string config_to_search = "CfgVehicles";
9279
9280 if (IsInherited(Weapon))
9281 config_to_search = "CfgWeapons";
9282
9283 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9284 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9285
9286 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9287 {
9288
9290
9292 {
9294 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9296 return;
9297 }
9298
9301
9302
9303
9304 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9305 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9306
9307 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9308 {
9309 string particle_class = "";
9310 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9311 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9312 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9313
9314 if (entry_type == CT_CLASS)
9315 {
9316 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9317 WPOOH_array.Insert(WPOF);
9318 }
9319 }
9320
9321
9323 }
9324 }
9325 }
9326
9328 {
9330 }
9331
9333 {
9335 {
9337
9340
9343
9344 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9345 }
9346 }
9347
9349 {
9351 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9352
9354 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9355
9357 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9358
9360 {
9362 }
9363 }
9364
9366 {
9368 }
9369
9371 {
9374 else
9376
9378 {
9381 }
9382 else
9383 {
9386
9389 }
9390
9392 }
9393
9395 {
9397 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9398 }
9399
9401 {
9403 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9405 }
9406
9408 {
9410 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9411 }
9412
9414 {
9417
9418 OverheatingParticle OP = new OverheatingParticle();
9423
9425 }
9426
9428 {
9431
9432 return -1;
9433 }
9434
9436 {
9438 {
9441
9442 for (int i = count; i > 0; --i)
9443 {
9444 int id = i - 1;
9447
9450
9451 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9452 {
9453 if (p)
9454 {
9457 }
9458 }
9459 }
9460 }
9461 }
9462
9464 {
9466 {
9468 {
9469 int id = i - 1;
9471
9472 if (OP)
9473 {
9475
9476 if (p)
9477 {
9479 }
9480
9481 delete OP;
9482 }
9483 }
9484
9487 }
9488 }
9489
9492 {
9493 return 0.0;
9494 }
9495
9496
9498 {
9499 return 250;
9500 }
9501
9503 {
9504 return 0;
9505 }
9506
9509 {
9511 return true;
9512
9513 return false;
9514 }
9515
9518 {
9521
9523 {
9525 }
9526 else
9527 {
9528
9530 }
9531
9533 }
9534
9541 {
9542 return -1;
9543 }
9544
9545
9546
9547
9549 {
9551 {
9552 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9553 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9554
9555 if (r_index >= 0)
9556 {
9557 InventoryLocation r_il = new InventoryLocation;
9558 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9559
9560 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9563 {
9564 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9565 }
9567 {
9568 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9569 }
9570
9571 }
9572
9573 player.GetHumanInventory().ClearUserReservedLocation(this);
9574 }
9575
9578 }
9579
9580
9581
9582
9584 {
9585 return ItemBase.m_DebugActionsMask;
9586 }
9587
9589 {
9590 return ItemBase.m_DebugActionsMask & mask;
9591 }
9592
9594 {
9595 ItemBase.m_DebugActionsMask = mask;
9596 }
9597
9599 {
9600 ItemBase.m_DebugActionsMask |= mask;
9601 }
9602
9604 {
9605 ItemBase.m_DebugActionsMask &= ~mask;
9606 }
9607
9609 {
9611 {
9613 }
9614 else
9615 {
9617 }
9618 }
9619
9620
9622 {
9623 if (GetEconomyProfile())
9624 {
9625 float q_max = GetEconomyProfile().GetQuantityMax();
9626 if (q_max > 0)
9627 {
9628 float q_min = GetEconomyProfile().GetQuantityMin();
9629 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9630
9632 {
9633 ComponentEnergyManager comp = GetCompEM();
9635 {
9637 }
9638 }
9640 {
9642
9643 }
9644
9645 }
9646 }
9647 }
9648
9651 {
9652 EntityAI parent = GetHierarchyParent();
9653
9654 if (parent)
9655 {
9656 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9657 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9658 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9659 }
9660 }
9661
9664 {
9665 EntityAI parent = GetHierarchyParent();
9666
9667 if (parent)
9668 {
9669 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9670 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9671 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9672 }
9673 }
9674
9676 {
9677
9678
9679
9680
9682
9684 {
9685 if (ScriptInputUserData.CanStoreInputUserData())
9686 {
9687 ScriptInputUserData ctx = new ScriptInputUserData;
9693 ctx.
Write(use_stack_max);
9696
9698 {
9699 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9700 }
9701 }
9702 }
9703 else if (!
g_Game.IsMultiplayer())
9704 {
9706 }
9707 }
9708
9710 {
9712 }
9713
9715 {
9717 }
9718
9720 {
9722 }
9723
9725 {
9726
9727 return false;
9728 }
9729
9731 {
9732 return false;
9733 }
9734
9738 {
9739 return false;
9740 }
9741
9743 {
9744 return "";
9745 }
9746
9748
9750 {
9751 return false;
9752 }
9753
9755 {
9756 return true;
9757 }
9758
9759
9760
9762 {
9763 return true;
9764 }
9765
9767 {
9768 return true;
9769 }
9770
9772 {
9773 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9775 }
9776
9778 {
9780 }
9781
9783 {
9785 if (!is_being_placed)
9787 SetSynchDirty();
9788 }
9789
9790
9792
9794 {
9796 }
9797
9799 {
9801 }
9802
9804 {
9805 return 1;
9806 }
9807
9809 {
9810 return false;
9811 }
9812
9814 {
9816 SetSynchDirty();
9817 }
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9854 {
9855 super.OnMovedInsideCargo(container);
9856
9857 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9858 }
9859
9860 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9861 {
9862 super.EEItemLocationChanged(oldLoc, newLoc);
9863
9864 PlayerBase newPlayer = null;
9865 PlayerBase oldPlayer = null;
9866
9867 if (newLoc.GetParent())
9868 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9869
9870 if (oldLoc.GetParent())
9871 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9872
9874 {
9875 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9876
9877 if (rIndex >= 0)
9878 {
9879 InventoryLocation rIl = new InventoryLocation;
9880 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9881
9882 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9885 {
9886 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9887 }
9889 {
9891 }
9892
9893 }
9894 }
9895
9897 {
9898 if (newPlayer)
9899 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9900
9901 if (newPlayer == oldPlayer)
9902 {
9903 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9904 {
9906 {
9907 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9908 {
9909 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9910 }
9911 }
9912 else
9913 {
9914 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9915 }
9916 }
9917
9918 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9919 {
9920 int type = oldLoc.GetType();
9922 {
9923 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9924 }
9926 {
9927 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9928 }
9929 }
9930 if (!m_OldLocation)
9931 {
9932 m_OldLocation = new InventoryLocation;
9933 }
9934 m_OldLocation.Copy(oldLoc);
9935 }
9936 else
9937 {
9938 if (m_OldLocation)
9939 {
9940 m_OldLocation.Reset();
9941 }
9942 }
9943
9944 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9945 }
9946 else
9947 {
9948 if (newPlayer)
9949 {
9950 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9951 if (resIndex >= 0)
9952 {
9953 InventoryLocation il = new InventoryLocation;
9954 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9956 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9959 {
9960 il.
GetParent().GetOnReleaseLock().Invoke(it);
9961 }
9963 {
9965 }
9966
9967 }
9968 }
9970 {
9971
9973 }
9974
9975 if (m_OldLocation)
9976 {
9977 m_OldLocation.Reset();
9978 }
9979 }
9980
9982 {
9983 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9984 }
9985
9987 {
9988 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9989 }
9990 }
9991
9992 override void EOnContact(IEntity other, Contact extra)
9993 {
9995 {
9996 int liquidType = -1;
9998 if (impactSpeed > 0.0)
9999 {
10001 #ifndef SERVER
10003 #else
10005 SetSynchDirty();
10006 #endif
10008 }
10009 }
10010
10011 #ifdef SERVER
10012 if (GetCompEM() && GetCompEM().IsPlugged())
10013 {
10014 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10015 GetCompEM().UnplugThis();
10016 }
10017 #endif
10018 }
10019
10021
10023 {
10025 }
10026
10028 {
10029
10030 }
10031
10033 {
10034 super.OnItemLocationChanged(old_owner, new_owner);
10035
10036 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10037 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10038
10039 if (!relatedPlayer && playerNew)
10040 relatedPlayer = playerNew;
10041
10042 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10043 {
10045 if (actionMgr)
10046 {
10047 ActionBase currentAction = actionMgr.GetRunningAction();
10048 if (currentAction)
10050 }
10051 }
10052
10053 Man ownerPlayerOld = null;
10054 Man ownerPlayerNew = null;
10055
10056 if (old_owner)
10057 {
10058 if (old_owner.
IsMan())
10059 {
10060 ownerPlayerOld = Man.Cast(old_owner);
10061 }
10062 else
10063 {
10064 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10065 }
10066 }
10067 else
10068 {
10070 {
10072
10073 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10074 {
10075 GetCompEM().UnplugThis();
10076 }
10077 }
10078 }
10079
10080 if (new_owner)
10081 {
10082 if (new_owner.
IsMan())
10083 {
10084 ownerPlayerNew = Man.Cast(new_owner);
10085 }
10086 else
10087 {
10088 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10089 }
10090 }
10091
10092 if (ownerPlayerOld != ownerPlayerNew)
10093 {
10094 if (ownerPlayerOld)
10095 {
10096 array<EntityAI> subItemsExit = new array<EntityAI>;
10098 for (int i = 0; i < subItemsExit.Count(); i++)
10099 {
10102 }
10103 }
10104
10105 if (ownerPlayerNew)
10106 {
10107 array<EntityAI> subItemsEnter = new array<EntityAI>;
10109 for (int j = 0; j < subItemsEnter.Count(); j++)
10110 {
10113 }
10114 }
10115 }
10116 else if (ownerPlayerNew != null)
10117 {
10118 PlayerBase nplayer;
10119 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10120 {
10121 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10123 for (int k = 0; k < subItemsUpdate.Count(); k++)
10124 {
10126 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10127 }
10128 }
10129 }
10130
10131 if (old_owner)
10132 old_owner.OnChildItemRemoved(this);
10133 if (new_owner)
10134 new_owner.OnChildItemReceived(this);
10135 }
10136
10137
10139 {
10140 super.EEDelete(parent);
10141 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10142 if (player)
10143 {
10145
10146 if (player.IsAlive())
10147 {
10148 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10149 if (r_index >= 0)
10150 {
10151 InventoryLocation r_il = new InventoryLocation;
10152 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10153
10154 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10157 {
10158 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10159 }
10161 {
10162 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10163 }
10164
10165 }
10166
10167 player.RemoveQuickBarEntityShortcut(this);
10168 }
10169 }
10170 }
10171
10173 {
10174 super.EEKilled(killer);
10175
10178 {
10179 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10180 {
10181 if (IsMagazine())
10182 {
10183 if (Magazine.Cast(this).GetAmmoCount() > 0)
10184 {
10186 }
10187 }
10188 else
10189 {
10191 }
10192 }
10193 }
10194 }
10195
10197 {
10198 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10199
10200 super.OnWasAttached(parent, slot_id);
10201
10204
10207 }
10208
10210 {
10211 super.OnWasDetached(parent, slot_id);
10212
10215
10218 }
10219
10221 {
10222 int idx;
10225
10226 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10227 if (inventory_slots.Count() < 1)
10228 {
10229 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10230 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10231 }
10232 else
10233 {
10234 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10235 }
10236
10237 idx = inventory_slots.Find(slot);
10238 if (idx < 0)
10239 return "";
10240
10241 return attach_types.Get(idx);
10242 }
10243
10245 {
10246 int idx = -1;
10247 string slot;
10248
10251
10252 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10253 if (inventory_slots.Count() < 1)
10254 {
10255 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10256 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10257 }
10258 else
10259 {
10260 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10261 if (detach_types.Count() < 1)
10262 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10263 }
10264
10265 for (int i = 0; i < inventory_slots.Count(); i++)
10266 {
10267 slot = inventory_slots.Get(i);
10268 }
10269
10270 if (slot != "")
10271 {
10272 if (detach_types.Count() == 1)
10273 idx = 0;
10274 else
10275 idx = inventory_slots.Find(slot);
10276 }
10277 if (idx < 0)
10278 return "";
10279
10280 return detach_types.Get(idx);
10281 }
10282
10284 {
10285
10287
10288
10289 float min_time = 1;
10290 float max_time = 3;
10291 float delay = Math.RandomFloat(min_time, max_time);
10292
10293 explode_timer.Run(delay, this, "DoAmmoExplosion");
10294 }
10295
10297 {
10298 Magazine magazine = Magazine.Cast(this);
10299 int pop_sounds_count = 6;
10300 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10301
10302
10303 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10304 string sound_name = pop_sounds[ sound_idx ];
10305 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10306
10307
10308 magazine.ServerAddAmmoCount(-1);
10309
10310
10311 float min_temp_to_explode = 100;
10312
10313 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10314 {
10316 }
10317 }
10318
10319
10320 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10321 {
10322 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10323
10324 const int CHANCE_DAMAGE_CARGO = 4;
10325 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10326 const int CHANCE_DAMAGE_NOTHING = 2;
10327
10329 {
10330 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10331 int chances;
10332 int rnd;
10333
10334 if (GetInventory().GetCargo())
10335 {
10336 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10337 rnd = Math.RandomInt(0,chances);
10338
10339 if (rnd < CHANCE_DAMAGE_CARGO)
10340 {
10342 }
10343 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10344 {
10346 }
10347 }
10348 else
10349 {
10350 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10351 rnd = Math.RandomInt(0,chances);
10352
10353 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10354 {
10356 }
10357 }
10358 }
10359 }
10360
10362 {
10363 CargoBase cargo = GetInventory().GetCargo();
10364 if (cargo)
10365 {
10367 if (item_count > 0)
10368 {
10369 int random_pick = Math.RandomInt(0, item_count);
10371 if (!item.IsExplosive())
10372 {
10373 item.AddHealth("","",damage);
10374 return true;
10375 }
10376 }
10377 }
10378 return false;
10379 }
10380
10382 {
10383 GameInventory inventory = GetInventory();
10385 if (attachment_count > 0)
10386 {
10387 int random_pick = Math.RandomInt(0, attachment_count);
10389 if (!attachment.IsExplosive())
10390 {
10391 attachment.AddHealth("","",damage);
10392 return true;
10393 }
10394 }
10395 return false;
10396 }
10397
10399 {
10401 }
10402
10404 {
10406 return GetInventory().CanRemoveEntity();
10407
10408 return false;
10409 }
10410
10412 {
10413
10415 return false;
10416
10417
10419 return false;
10420
10421
10422
10424 if (delta == 0)
10425 return false;
10426
10427
10428 return true;
10429 }
10430
10432 {
10434 {
10435 if (ScriptInputUserData.CanStoreInputUserData())
10436 {
10437 ScriptInputUserData ctx = new ScriptInputUserData;
10442 ctx.
Write(destination_entity);
10444 ctx.
Write(slot_id);
10446 }
10447 }
10448 else if (!
g_Game.IsMultiplayer())
10449 {
10451 }
10452 }
10453
10455 {
10456 float split_quantity_new;
10460 InventoryLocation loc = new InventoryLocation;
10461
10462 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10463 {
10465 split_quantity_new = stack_max;
10466 else
10468
10470 {
10471 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10472 if (new_item)
10473 {
10474 new_item.SetResultOfSplit(true);
10475 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10477 new_item.
SetQuantity(split_quantity_new,
false,
true);
10478 }
10479 }
10480 }
10481 else if (destination_entity && slot_id == -1)
10482 {
10483 if (quantity > stack_max)
10484 split_quantity_new = stack_max;
10485 else
10486 split_quantity_new = quantity;
10487
10489 {
10490 GameInventory destinationInventory = destination_entity.GetInventory();
10492 {
10495 }
10496
10497 if (new_item)
10498 {
10499 new_item.SetResultOfSplit(true);
10500 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10502 new_item.
SetQuantity(split_quantity_new,
false,
true);
10503 }
10504 }
10505 }
10506 else
10507 {
10508 if (stack_max != 0)
10509 {
10511 {
10513 }
10514
10515 if (split_quantity_new == 0)
10516 {
10517 if (!
g_Game.IsMultiplayer())
10518 player.PhysicalPredictiveDropItem(this);
10519 else
10520 player.ServerDropEntity(this);
10521 return;
10522 }
10523
10525 {
10527
10528 if (new_item)
10529 {
10530 new_item.SetResultOfSplit(true);
10531 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10534 new_item.PlaceOnSurface();
10535 }
10536 }
10537 }
10538 }
10539 }
10540
10542 {
10543 float split_quantity_new;
10547 InventoryLocation loc = new InventoryLocation;
10548
10549 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10550 {
10552 split_quantity_new = stack_max;
10553 else
10555
10557 {
10558 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10559 if (new_item)
10560 {
10561 new_item.SetResultOfSplit(true);
10562 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10564 new_item.
SetQuantity(split_quantity_new,
false,
true);
10565 }
10566 }
10567 }
10568 else if (destination_entity && slot_id == -1)
10569 {
10570 if (quantity > stack_max)
10571 split_quantity_new = stack_max;
10572 else
10573 split_quantity_new = quantity;
10574
10576 {
10577 GameInventory destinationInventory = destination_entity.GetInventory();
10579 {
10582 }
10583
10584 if (new_item)
10585 {
10586 new_item.SetResultOfSplit(true);
10587 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10589 new_item.
SetQuantity(split_quantity_new,
false,
true);
10590 }
10591 }
10592 }
10593 else
10594 {
10595 if (stack_max != 0)
10596 {
10598 {
10600 }
10601
10603 {
10605
10606 if (new_item)
10607 {
10608 new_item.SetResultOfSplit(true);
10609 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10612 new_item.PlaceOnSurface();
10613 }
10614 }
10615 }
10616 }
10617 }
10618
10620 {
10622 {
10623 if (ScriptInputUserData.CanStoreInputUserData())
10624 {
10625 ScriptInputUserData ctx = new ScriptInputUserData;
10630 dst.WriteToContext(ctx);
10632 }
10633 }
10634 else if (!
g_Game.IsMultiplayer())
10635 {
10637 }
10638 }
10639
10641 {
10643 {
10644 if (ScriptInputUserData.CanStoreInputUserData())
10645 {
10646 ScriptInputUserData ctx = new ScriptInputUserData;
10651 ctx.
Write(destination_entity);
10657 }
10658 }
10659 else if (!
g_Game.IsMultiplayer())
10660 {
10662 }
10663 }
10664
10666 {
10668 }
10669
10671 {
10673 float split_quantity_new;
10675 if (dst.IsValid())
10676 {
10677 int slot_id = dst.GetSlot();
10679
10680 if (quantity > stack_max)
10681 split_quantity_new = stack_max;
10682 else
10683 split_quantity_new = quantity;
10684
10686 {
10688
10689 if (new_item)
10690 {
10691 new_item.SetResultOfSplit(true);
10692 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10694 new_item.
SetQuantity(split_quantity_new,
false,
true);
10695 }
10696
10697 return new_item;
10698 }
10699 }
10700
10701 return null;
10702 }
10703
10705 {
10707 float split_quantity_new;
10709 if (destination_entity)
10710 {
10712 if (quantity > stackable)
10713 split_quantity_new = stackable;
10714 else
10715 split_quantity_new = quantity;
10716
10718 {
10719 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10720 if (new_item)
10721 {
10722 new_item.SetResultOfSplit(true);
10723 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10725 new_item.
SetQuantity(split_quantity_new,
false,
true);
10726 }
10727 }
10728 }
10729 }
10730
10732 {
10734 {
10735 if (ScriptInputUserData.CanStoreInputUserData())
10736 {
10737 ScriptInputUserData ctx = new ScriptInputUserData;
10742 ItemBase destination_entity =
this;
10743 ctx.
Write(destination_entity);
10747 }
10748 }
10749 else if (!
g_Game.IsMultiplayer())
10750 {
10752 }
10753 }
10754
10756 {
10758 float split_quantity_new;
10760 if (player)
10761 {
10763 if (quantity > stackable)
10764 split_quantity_new = stackable;
10765 else
10766 split_quantity_new = quantity;
10767
10769 {
10770 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10771 new_item =
ItemBase.Cast(in_hands);
10772 if (new_item)
10773 {
10774 new_item.SetResultOfSplit(true);
10775 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10777 new_item.SetQuantity(split_quantity_new, false, true);
10778 }
10779 }
10780 }
10781 }
10782
10784 {
10786 float split_quantity_new = Math.Floor(quantity * 0.5);
10787
10789 return;
10790
10792
10793 if (new_item)
10794 {
10795 if (new_item.GetQuantityMax() < split_quantity_new)
10796 {
10797 split_quantity_new = new_item.GetQuantityMax();
10798 }
10799
10800 new_item.SetResultOfSplit(true);
10801 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10802
10804 {
10807 }
10808 else
10809 {
10811 new_item.
SetQuantity(split_quantity_new,
false,
true);
10812 }
10813 }
10814 }
10815
10817 {
10819 float split_quantity_new = Math.Floor(quantity / 2);
10820
10822 return;
10823
10824 InventoryLocation invloc = new InventoryLocation;
10826
10828 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10829
10830 if (new_item)
10831 {
10832 if (new_item.GetQuantityMax() < split_quantity_new)
10833 {
10834 split_quantity_new = new_item.GetQuantityMax();
10835 }
10837 {
10840 }
10841 else if (split_quantity_new > 1)
10842 {
10844 new_item.
SetQuantity(split_quantity_new,
false,
true);
10845 }
10846 }
10847 }
10848
10851 {
10852 SetWeightDirty();
10854
10855 if (parent)
10856 parent.OnAttachmentQuantityChangedEx(this, delta);
10857
10859 {
10861 {
10863 }
10865 {
10866 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10868 }
10869 }
10870 }
10871
10874 {
10875
10876 }
10877
10880 {
10882 }
10883
10885 {
10886 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10887
10889 {
10890 if (newLevel == GameConstants.STATE_RUINED)
10891 {
10893 EntityAI parent = GetHierarchyParent();
10894 if (parent && parent.IsFireplace())
10895 {
10896 CargoBase cargo = GetInventory().GetCargo();
10897 if (cargo)
10898 {
10900 {
10902 }
10903 }
10904 }
10905 }
10906
10908 {
10909
10911 return;
10912 }
10913
10914 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10915 {
10917 }
10918 }
10919 }
10920
10921
10923 {
10924 super.OnRightClick();
10925
10927 {
10929 {
10930 if (ScriptInputUserData.CanStoreInputUserData())
10931 {
10932 EntityAI root = GetHierarchyRoot();
10933 Man playerOwner = GetHierarchyRootPlayer();
10934 InventoryLocation dst = new InventoryLocation;
10935
10936
10937 if (!playerOwner && root && root == this)
10938 {
10940 }
10941 else
10942 {
10943
10944 GetInventory().GetCurrentInventoryLocation(dst);
10946 {
10947 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10949 {
10951 }
10952 else
10953 {
10955
10956
10957 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10958 {
10960 }
10961 else
10962 {
10963 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10964 }
10965 }
10966 }
10967 }
10968
10969 ScriptInputUserData ctx = new ScriptInputUserData;
10977 }
10978 }
10979 else if (!
g_Game.IsMultiplayer())
10980 {
10982 }
10983 }
10984 }
10985
10987 {
10988 if (root)
10989 {
10990 vector m4[4];
10991 root.GetTransform(m4);
10992 dst.SetGround(this, m4);
10993 }
10994 else
10995 {
10996 GetInventory().GetCurrentInventoryLocation(dst);
10997 }
10998 }
10999
11000 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11001 {
11002
11003 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11004 return false;
11005
11006 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11007 return false;
11008
11009
11011 return false;
11012
11013
11014 Magazine mag = Magazine.Cast(this);
11015 if (mag)
11016 {
11017 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11018 return false;
11019
11020 if (stack_max_limit)
11021 {
11022 Magazine other_mag = Magazine.Cast(other_item);
11023 if (other_item)
11024 {
11025 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11026 return false;
11027 }
11028
11029 }
11030 }
11031 else
11032 {
11033
11035 return false;
11036
11038 return false;
11039 }
11040
11041 PlayerBase player = null;
11042 if (CastTo(player, GetHierarchyRootPlayer()))
11043 {
11044 if (player.GetInventory().HasAttachment(this))
11045 return false;
11046
11047 if (player.IsItemsToDelete())
11048 return false;
11049 }
11050
11051 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11052 return false;
11053
11054 int slotID;
11056 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11057 return false;
11058
11059 return true;
11060 }
11061
11063 {
11065 }
11066
11068 {
11069 return m_IsResultOfSplit;
11070 }
11071
11073 {
11074 m_IsResultOfSplit = value;
11075 }
11076
11078 {
11080 }
11081
11083 {
11084 float other_item_quantity = other_item.GetQuantity();
11085 float this_free_space;
11086
11088
11090
11091 if (other_item_quantity > this_free_space)
11092 {
11093 return this_free_space;
11094 }
11095 else
11096 {
11097 return other_item_quantity;
11098 }
11099 }
11100
11102 {
11104 }
11105
11107 {
11109 return;
11110
11111 if (!IsMagazine() && other_item)
11112 {
11114 if (quantity_used != 0)
11115 {
11116 float hp1 = GetHealth01("","");
11117 float hp2 = other_item.GetHealth01("","");
11118 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11119 hpResult = hpResult / (
GetQuantity() + quantity_used);
11120
11121 hpResult *= GetMaxHealth();
11122 Math.Round(hpResult);
11123 SetHealth("", "Health", hpResult);
11124
11126 other_item.AddQuantity(-quantity_used);
11127 }
11128 }
11130 }
11131
11133 {
11134 #ifdef SERVER
11135 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11136 GetHierarchyParent().IncreaseLifetimeUp();
11137 #endif
11138 };
11139
11141 {
11142 PlayerBase p = PlayerBase.Cast(player);
11143
11144 array<int> recipesIds = p.m_Recipes;
11145 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11146 if (moduleRecipesManager)
11147 {
11148 EntityAI itemInHands = player.GetEntityInHands();
11149 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11150 }
11151
11152 for (int i = 0;i < recipesIds.Count(); i++)
11153 {
11154 int key = recipesIds.Get(i);
11155 string recipeName = moduleRecipesManager.GetRecipeName(key);
11157 }
11158 }
11159
11160
11161 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11162 {
11163 super.GetDebugActions(outputList);
11164
11165
11171
11172
11177
11182
11183
11187
11188
11190 {
11194 }
11195
11198
11199
11203
11205
11206 InventoryLocation loc = new InventoryLocation();
11207 GetInventory().GetCurrentInventoryLocation(loc);
11209 {
11210 if (Gizmo_IsSupported())
11213 }
11214
11216 }
11217
11218
11219
11220
11222 {
11223 super.OnAction(action_id, player, ctx);
11224
11226 {
11227 switch (action_id)
11228 {
11232 return true;
11236 return true;
11237 }
11238 }
11239
11241 {
11242 switch (action_id)
11243 {
11245 Delete();
11246 return true;
11247 }
11248 }
11249
11250 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11251 {
11252 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11253 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11254 PlayerBase p = PlayerBase.Cast(player);
11255 if (
EActions.RECIPES_RANGE_START < 1000)
11256 {
11257 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11258 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11259 }
11260 }
11261 #ifndef SERVER
11262 else if (action_id ==
EActions.WATCH_PLAYER)
11263 {
11264 PluginDeveloper.SetDeveloperItemClientEx(player);
11265 }
11266 #endif
11268 {
11269 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11270 {
11271 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11272 OnDebugButtonPressServer(id + 1);
11273 }
11274
11275 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11276 {
11277 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11279 }
11280
11281 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11282 {
11283 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11285 }
11286
11287 else if (action_id ==
EActions.ADD_QUANTITY)
11288 {
11289 if (IsMagazine())
11290 {
11291 Magazine mag = Magazine.Cast(this);
11292 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11293 }
11294 else
11295 {
11297 }
11298
11299 if (m_EM)
11300 {
11301 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11302 }
11303
11304 }
11305
11306 else if (action_id ==
EActions.REMOVE_QUANTITY)
11307 {
11308 if (IsMagazine())
11309 {
11310 Magazine mag2 = Magazine.Cast(this);
11311 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11312 }
11313 else
11314 {
11316 }
11317 if (m_EM)
11318 {
11319 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11320 }
11321
11322 }
11323
11324 else if (action_id ==
EActions.SET_QUANTITY_0)
11325 {
11327
11328 if (m_EM)
11329 {
11330 m_EM.SetEnergy(0);
11331 }
11332 }
11333
11334 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11335 {
11337
11338 if (m_EM)
11339 {
11340 m_EM.SetEnergy(m_EM.GetEnergyMax());
11341 }
11342 }
11343
11344 else if (action_id ==
EActions.ADD_HEALTH)
11345 {
11346 AddHealth("","",GetMaxHealth("","Health")/5);
11347 }
11348 else if (action_id ==
EActions.REMOVE_HEALTH)
11349 {
11350 AddHealth("","",-GetMaxHealth("","Health")/5);
11351 }
11352 else if (action_id ==
EActions.DESTROY_HEALTH)
11353 {
11354 SetHealth01("","",0);
11355 }
11356 else if (action_id ==
EActions.WATCH_ITEM)
11357 {
11359 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11360 #ifdef DEVELOPER
11361 SetDebugDeveloper_item(this);
11362 #endif
11363 }
11364
11365 else if (action_id ==
EActions.ADD_TEMPERATURE)
11366 {
11367 AddTemperature(20);
11368
11369 }
11370
11371 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11372 {
11373 AddTemperature(-20);
11374
11375 }
11376
11377 else if (action_id ==
EActions.FLIP_FROZEN)
11378 {
11379 SetFrozen(!GetIsFrozen());
11380
11381 }
11382
11383 else if (action_id ==
EActions.ADD_WETNESS)
11384 {
11386
11387 }
11388
11389 else if (action_id ==
EActions.REMOVE_WETNESS)
11390 {
11392
11393 }
11394
11395 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11396 {
11399
11400
11401 }
11402
11403 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11404 {
11407 }
11408
11409 else if (action_id ==
EActions.MAKE_SPECIAL)
11410 {
11411 auto debugParams = DebugSpawnParams.WithPlayer(player);
11412 OnDebugSpawnEx(debugParams);
11413 }
11414
11415 }
11416
11417
11418 return false;
11419 }
11420
11421
11422
11423
11427
11430
11431
11432
11434 {
11435 return false;
11436 }
11437
11438
11440 {
11441 return true;
11442 }
11443
11444
11446 {
11447 return true;
11448 }
11449
11450
11451
11453 {
11454 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11455 return g_Game.ConfigIsExisting(config_path);
11456 }
11457
11460 {
11461 return null;
11462 }
11463
11465 {
11466 return false;
11467 }
11468
11470 {
11471 return false;
11472 }
11473
11477
11478
11480 {
11481 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11482 return module_repairing.CanRepair(this, item_repair_kit);
11483 }
11484
11485
11486 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11487 {
11488 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11489 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11490 }
11491
11492
11494 {
11495
11496
11497
11498
11499
11500
11501
11502
11503 return 1;
11504 }
11505
11506
11507
11509 {
11511 }
11512
11513
11514
11516 {
11518 }
11519
11520
11529 {
11530 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11531
11532 if (player)
11533 {
11534 player.MessageStatus(text);
11535 }
11536 }
11537
11538
11547 {
11548 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11549
11550 if (player)
11551 {
11552 player.MessageAction(text);
11553 }
11554 }
11555
11556
11565 {
11566 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11567
11568 if (player)
11569 {
11570 player.MessageFriendly(text);
11571 }
11572 }
11573
11574
11583 {
11584 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11585
11586 if (player)
11587 {
11588 player.MessageImportant(text);
11589 }
11590 }
11591
11593 {
11594 return true;
11595 }
11596
11597
11598 override bool KindOf(
string tag)
11599 {
11600 bool found = false;
11601 string item_name = this.
GetType();
11603 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11604
11605 int array_size = item_tag_array.Count();
11606 for (int i = 0; i < array_size; i++)
11607 {
11608 if (item_tag_array.Get(i) == tag)
11609 {
11610 found = true;
11611 break;
11612 }
11613 }
11614 return found;
11615 }
11616
11617
11619 {
11620
11621 super.OnRPC(sender, rpc_type,ctx);
11622
11623
11624 switch (rpc_type)
11625 {
11626 #ifndef SERVER
11627 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11628 Param2<bool, string> p = new Param2<bool, string>(false, "");
11629
11631 return;
11632
11633 bool play = p.param1;
11634 string soundSet = p.param2;
11635
11636 if (play)
11637 {
11639 {
11641 {
11643 }
11644 }
11645 else
11646 {
11648 }
11649 }
11650 else
11651 {
11653 }
11654
11655 break;
11656 #endif
11657
11658 }
11659
11661 {
11663 }
11664 }
11665
11666
11667
11668
11670 {
11671 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11672 return plugin.GetID(
name);
11673 }
11674
11676 {
11677 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11678 return plugin.GetName(id);
11679 }
11680
11683 {
11684
11685
11686 int varFlags;
11687 if (!ctx.
Read(varFlags))
11688 return;
11689
11690 if (varFlags & ItemVariableFlags.FLOAT)
11691 {
11693 }
11694 }
11695
11697 {
11698
11699 super.SerializeNumericalVars(floats_out);
11700
11701
11702
11704 {
11706 }
11707
11709 {
11711 }
11712
11714 {
11716 }
11717
11719 {
11724 }
11725
11727 {
11729 }
11730 }
11731
11733 {
11734
11735 super.DeSerializeNumericalVars(floats);
11736
11737
11738 int index = 0;
11739 int mask = Math.Round(floats.Get(index));
11740
11741 index++;
11742
11744 {
11746 {
11748 }
11749 else
11750 {
11751 float quantity = floats.Get(index);
11752 SetQuantity(quantity,
true,
false,
false,
false);
11753 }
11754 index++;
11755 }
11756
11758 {
11759 float wet = floats.Get(index);
11761 index++;
11762 }
11763
11765 {
11766 int liquidtype = Math.Round(floats.Get(index));
11768 index++;
11769 }
11770
11772 {
11774 index++;
11776 index++;
11778 index++;
11780 index++;
11781 }
11782
11784 {
11785 int cleanness = Math.Round(floats.Get(index));
11787 index++;
11788 }
11789 }
11790
11792 {
11793 super.WriteVarsToCTX(ctx);
11794
11795
11797 {
11799 }
11800
11802 {
11804 }
11805
11807 {
11809 }
11810
11812 {
11813 int r,g,b,a;
11819 }
11820
11822 {
11824 }
11825 }
11826
11828 {
11829 if (!super.ReadVarsFromCTX(ctx,version))
11830 return false;
11831
11832 int intValue;
11833 float value;
11834
11835 if (version < 140)
11836 {
11837 if (!ctx.
Read(intValue))
11838 return false;
11839
11840 m_VariablesMask = intValue;
11841 }
11842
11844 {
11845 if (!ctx.
Read(value))
11846 return false;
11847
11849 {
11851 }
11852 else
11853 {
11855 }
11856 }
11857
11858 if (version < 140)
11859 {
11861 {
11862 if (!ctx.
Read(value))
11863 return false;
11864 SetTemperatureDirect(value);
11865 }
11866 }
11867
11869 {
11870 if (!ctx.
Read(value))
11871 return false;
11873 }
11874
11876 {
11877 if (!ctx.
Read(intValue))
11878 return false;
11880 }
11881
11883 {
11884 int r,g,b,a;
11886 return false;
11888 return false;
11890 return false;
11892 return false;
11893
11895 }
11896
11898 {
11899 if (!ctx.
Read(intValue))
11900 return false;
11902 }
11903
11904 if (version >= 138 && version < 140)
11905 {
11907 {
11908 if (!ctx.
Read(intValue))
11909 return false;
11910 SetFrozen(intValue);
11911 }
11912 }
11913
11914 return true;
11915 }
11916
11917
11919 {
11922 {
11924 }
11925
11926 if (!super.OnStoreLoad(ctx, version))
11927 {
11929 return false;
11930 }
11931
11932 if (version >= 114)
11933 {
11934 bool hasQuickBarIndexSaved;
11935
11936 if (!ctx.
Read(hasQuickBarIndexSaved))
11937 {
11939 return false;
11940 }
11941
11942 if (hasQuickBarIndexSaved)
11943 {
11944 int itmQBIndex;
11945
11946
11947 if (!ctx.
Read(itmQBIndex))
11948 {
11950 return false;
11951 }
11952
11953 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11954 if (itmQBIndex != -1 && parentPlayer)
11955 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11956 }
11957 }
11958 else
11959 {
11960
11961 PlayerBase player;
11962 int itemQBIndex;
11963 if (version ==
int.
MAX)
11964 {
11965 if (!ctx.
Read(itemQBIndex))
11966 {
11968 return false;
11969 }
11970 }
11971 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11972 {
11973
11974 if (!ctx.
Read(itemQBIndex))
11975 {
11977 return false;
11978 }
11979 if (itemQBIndex != -1 && player)
11980 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11981 }
11982 }
11983
11984 if (version < 140)
11985 {
11986
11987 if (!LoadVariables(ctx, version))
11988 {
11990 return false;
11991 }
11992 }
11993
11994
11996 {
11998 return false;
11999 }
12000 if (version >= 132)
12001 {
12003 if (raib)
12004 {
12006 {
12008 return false;
12009 }
12010 }
12011 }
12012
12014 return true;
12015 }
12016
12017
12018
12020 {
12021 super.OnStoreSave(ctx);
12022
12023 PlayerBase player;
12024 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12025 {
12027
12028 int itemQBIndex = -1;
12029 itemQBIndex = player.FindQuickBarEntityIndex(this);
12030 ctx.
Write(itemQBIndex);
12031 }
12032 else
12033 {
12035 }
12036
12038
12040 if (raib)
12041 {
12043 }
12044 }
12045
12046
12048 {
12049 super.AfterStoreLoad();
12050
12052 {
12054 }
12055
12057 {
12060 }
12061 }
12062
12064 {
12065 super.EEOnAfterLoad();
12066
12068 {
12070 }
12071
12074 }
12075
12077 {
12078 return false;
12079 }
12080
12081
12082
12084 {
12086 {
12087 #ifdef PLATFORM_CONSOLE
12088
12090 {
12092 if (menu)
12093 {
12095 }
12096 }
12097 #endif
12098 }
12099
12101 {
12104 }
12105
12107 {
12108 SetWeightDirty();
12110 }
12112 {
12115 }
12116
12118 {
12121
12124 }
12126 {
12130 }
12131
12132 super.OnVariablesSynchronized();
12133 }
12134
12135
12136
12138 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12139 {
12140 if (!IsServerCheck(allow_client))
12141 return false;
12142
12144 return false;
12145
12148
12149 if (value <= (min + 0.001))
12150 value = min;
12151
12152 if (value == min)
12153 {
12154 if (destroy_config)
12155 {
12156 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12157 if (dstr)
12158 {
12160 this.Delete();
12161 return true;
12162 }
12163 }
12164 else if (destroy_forced)
12165 {
12167 this.Delete();
12168 return true;
12169 }
12170
12172 }
12173
12176
12178 {
12179 EntityAI parent = GetHierarchyRoot();
12180 InventoryLocation iLoc = new InventoryLocation();
12181 GetInventory().GetCurrentInventoryLocation(iLoc);
12183 {
12184 int iLocSlot = iLoc.
GetSlot();
12186 {
12188 }
12190 {
12192 }
12193 }
12194 }
12195
12197 {
12199
12200 if (delta)
12202 }
12203
12205
12206 return false;
12207 }
12208
12209
12211 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12212 {
12214 }
12215
12217 {
12220 }
12221
12223 {
12226 }
12227
12229 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12230 {
12231 float value_clamped = Math.Clamp(value, 0, 1);
12233 SetQuantity(result, destroy_config, destroy_forced);
12234 }
12235
12236
12239 {
12241 }
12242
12244 {
12246 }
12247
12248
12249
12250
12251
12252
12253
12254
12255
12256
12258 {
12259 int slot = -1;
12260 GameInventory inventory = GetInventory();
12261 if (inventory)
12262 {
12263 InventoryLocation il = new InventoryLocation;
12266 }
12267
12269 }
12270
12272 {
12273 float quantity_max = 0;
12274
12276 {
12277 if (attSlotID != -1)
12278 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12279
12280 if (quantity_max <= 0)
12282 }
12283
12284 if (quantity_max <= 0)
12286
12287 return quantity_max;
12288 }
12289
12291 {
12293 }
12294
12296 {
12298 }
12299
12300
12302 {
12304 }
12305
12307 {
12309 }
12310
12312 {
12314 }
12315
12316
12318 {
12319
12320 float weightEx = GetWeightEx();
12321 float special = GetInventoryAndCargoWeight();
12322 return weightEx - special;
12323 }
12324
12325
12327 {
12329 }
12330
12332 {
12334 {
12335 #ifdef DEVELOPER
12336 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12337 {
12338 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12340 }
12341 #endif
12342
12343 return GetQuantity() * GetConfigWeightModified();
12344 }
12345 else if (HasEnergyManager())
12346 {
12347 #ifdef DEVELOPER
12348 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12349 {
12350 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12351 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12352 }
12353 #endif
12354 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12355 }
12356 else
12357 {
12358 #ifdef DEVELOPER
12359 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12360 {
12361 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12362 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12363 }
12364 #endif
12365 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12366 }
12367 }
12368
12371 {
12372 int item_count = 0;
12374
12375 GameInventory inventory = GetInventory();
12376 CargoBase cargo = inventory.
GetCargo();
12377 if (cargo != NULL)
12378 {
12380 }
12381
12383 for (int i = 0; i < nAttachments; ++i)
12384 {
12386 if (item)
12387 item_count += item.GetNumberOfItems();
12388 }
12389 return item_count;
12390 }
12391
12394 {
12395 float weight = 0;
12396 float wetness = 1;
12397 if (include_wetness)
12400 {
12401 weight = wetness * m_ConfigWeight;
12402 }
12404 {
12405 weight = 1;
12406 }
12407 return weight;
12408 }
12409
12410
12411
12413 {
12414 GameInventory inventory = GetInventory();
12415 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12416 {
12417 array<EntityAI> items = new array<EntityAI>;
12419 for (int i = 0; i < items.Count(); ++i)
12420 {
12422 if (item)
12423 {
12424 g_Game.ObjectDelete(item);
12425 }
12426 }
12427 }
12428 }
12429
12430
12431
12432
12434 {
12435 float energy = 0;
12436 if (HasEnergyManager())
12437 {
12438 energy = GetCompEM().GetEnergy();
12439 }
12440 return energy;
12441 }
12442
12443
12445 {
12446 super.OnEnergyConsumed();
12447
12449 }
12450
12452 {
12453 super.OnEnergyAdded();
12454
12456 }
12457
12458
12460 {
12461 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12462 {
12464 {
12465 float energy_0to1 = GetCompEM().GetEnergy0To1();
12467 }
12468 }
12469 }
12470
12471
12473 {
12474 return ConfigGetFloat("heatIsolation");
12475 }
12476
12478 {
12480 }
12481
12483 {
12484 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12485 if (
g_Game.ConfigIsExisting(paramPath))
12486 return g_Game.ConfigGetFloat(paramPath);
12487
12488 return 0.0;
12489 }
12490
12492 {
12493 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12494 if (
g_Game.ConfigIsExisting(paramPath))
12495 return g_Game.ConfigGetFloat(paramPath);
12496
12497 return 0.0;
12498 }
12499
12500 override void SetWet(
float value,
bool allow_client =
false)
12501 {
12502 if (!IsServerCheck(allow_client))
12503 return;
12504
12507
12509
12510 m_VarWet = Math.Clamp(value, min, max);
12511
12513 {
12516 }
12517 }
12518
12519 override void AddWet(
float value)
12520 {
12522 }
12523
12525 {
12527 }
12528
12530 {
12532 }
12533
12535 {
12537 }
12538
12540 {
12542 }
12543
12545 {
12547 }
12548
12549 override void OnWetChanged(
float newVal,
float oldVal)
12550 {
12553 if (newLevel != oldLevel)
12554 {
12556 }
12557 }
12558
12560 {
12561 SetWeightDirty();
12562 }
12563
12565 {
12566 return GetWetLevelInternal(
m_VarWet);
12567 }
12568
12569
12570
12572 {
12574 }
12575
12577 {
12579 }
12580
12582 {
12584 }
12585
12587 {
12589 }
12590
12591
12592
12594 {
12595 if (ConfigIsExisting("itemModelLength"))
12596 {
12597 return ConfigGetFloat("itemModelLength");
12598 }
12599 return 0;
12600 }
12601
12603 {
12604 if (ConfigIsExisting("itemAttachOffset"))
12605 {
12606 return ConfigGetFloat("itemAttachOffset");
12607 }
12608 return 0;
12609 }
12610
12611 override void SetCleanness(
int value,
bool allow_client =
false)
12612 {
12613 if (!IsServerCheck(allow_client))
12614 return;
12615
12617
12619
12622 }
12623
12625 {
12627 }
12628
12630 {
12631 return true;
12632 }
12633
12634
12635
12636
12638 {
12640 }
12641
12643 {
12645 }
12646
12647
12648
12649
12650 override void SetColor(
int r,
int g,
int b,
int a)
12651 {
12657 }
12659 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12660 {
12665 }
12666
12668 {
12670 }
12671
12674 {
12675 int r,g,b,a;
12677 r = r/255;
12678 g = g/255;
12679 b = b/255;
12680 a = a/255;
12681 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12682 }
12683
12684
12685
12686 override void SetLiquidType(
int value,
bool allow_client =
false)
12687 {
12688 if (!IsServerCheck(allow_client))
12689 return;
12690
12695 }
12696
12698 {
12699 return ConfigGetInt("varLiquidTypeInit");
12700 }
12701
12703 {
12705 }
12706
12708 {
12710 SetFrozen(false);
12711 }
12712
12715 {
12716 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12717 }
12718
12719
12722 {
12723 PlayerBase nplayer;
12724 if (PlayerBase.CastTo(nplayer, player))
12725 {
12727 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12728 }
12729 }
12730
12731
12734 {
12735 PlayerBase nplayer;
12736 if (PlayerBase.CastTo(nplayer,player))
12737 {
12738 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12739 }
12740
12741 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12742
12743 if (HasEnergyManager())
12744 {
12745 GetCompEM().UpdatePlugState();
12746 }
12747 }
12748
12749
12751 {
12752 super.OnPlacementStarted(player);
12753
12755 }
12756
12757 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12758 {
12760 {
12761 m_AdminLog.OnPlacementComplete(player,
this);
12762 }
12763
12764 super.OnPlacementComplete(player, position, orientation);
12765 }
12766
12767
12768
12769
12770
12772 {
12774 {
12775 return true;
12776 }
12777 else
12778 {
12779 return false;
12780 }
12781 }
12782
12783
12785 {
12787 {
12789 }
12790 }
12791
12792
12794 {
12796 }
12797
12799 {
12801 }
12802
12803 override void InsertAgent(
int agent,
float count = 1)
12804 {
12805 if (count < 1)
12806 return;
12807
12809 }
12810
12813 {
12815 }
12816
12817
12819 {
12821 }
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12865 {
12867 return false;
12868 return true;
12869 }
12870
12872 {
12873
12875 }
12876
12877
12880 {
12881 super.CheckForRoofLimited(timeTresholdMS);
12882
12883 float time =
g_Game.GetTime();
12884 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12885 {
12886 m_PreviousRoofTestTime = time;
12887 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12888 }
12889 }
12890
12891
12893 {
12895 {
12896 return 0;
12897 }
12898
12899 if (GetInventory().GetAttachmentSlotsCount() != 0)
12900 {
12901 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12902 if (filter)
12903 return filter.GetProtectionLevel(type, false, system);
12904 else
12905 return 0;
12906 }
12907
12908 string subclassPath, entryName;
12909
12910 switch (type)
12911 {
12913 entryName = "biological";
12914 break;
12916 entryName = "chemical";
12917 break;
12918 default:
12919 entryName = "biological";
12920 break;
12921 }
12922
12923 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12924
12925 return g_Game.ConfigGetFloat(subclassPath + entryName);
12926 }
12927
12928
12929
12932 {
12933 if (!IsMagazine())
12935
12937 }
12938
12939
12940
12941
12942
12947 {
12948 return true;
12949 }
12950
12952 {
12954 }
12955
12956
12957
12958
12959
12961 {
12962 if (parent)
12963 {
12964 if (parent.IsInherited(DayZInfected))
12965 return true;
12966
12967 if (!parent.IsRuined())
12968 return true;
12969 }
12970
12971 return true;
12972 }
12973
12975 {
12976 if (!super.CanPutAsAttachment(parent))
12977 {
12978 return false;
12979 }
12980
12981 if (!IsRuined() && !parent.IsRuined())
12982 {
12983 return true;
12984 }
12985
12986 return false;
12987 }
12988
12990 {
12991
12992
12993
12994
12995 return super.CanReceiveItemIntoCargo(item);
12996 }
12997
12999 {
13000
13001
13002
13003
13004 GameInventory attachmentInv = attachment.GetInventory();
13006 {
13007 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13008 return false;
13009 }
13010
13011 InventoryLocation loc = new InventoryLocation();
13012 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13013 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13014 return false;
13015
13016 return super.CanReceiveAttachment(attachment, slotId);
13017 }
13018
13020 {
13021 if (!super.CanReleaseAttachment(attachment))
13022 return false;
13023
13024 return GetInventory().AreChildrenAccessible();
13025 }
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13048 {
13049 int id = muzzle_owner.GetMuzzleID();
13050 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13051
13052 if (WPOF_array)
13053 {
13054 for (int i = 0; i < WPOF_array.Count(); i++)
13055 {
13056 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13057
13058 if (WPOF)
13059 {
13060 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13061 }
13062 }
13063 }
13064 }
13065
13066
13068 {
13069 int id = muzzle_owner.GetMuzzleID();
13071
13072 if (WPOBE_array)
13073 {
13074 for (int i = 0; i < WPOBE_array.Count(); i++)
13075 {
13076 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13077
13078 if (WPOBE)
13079 {
13080 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13081 }
13082 }
13083 }
13084 }
13085
13086
13088 {
13089 int id = muzzle_owner.GetMuzzleID();
13090 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13091
13092 if (WPOOH_array)
13093 {
13094 for (int i = 0; i < WPOOH_array.Count(); i++)
13095 {
13096 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13097
13098 if (WPOOH)
13099 {
13100 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13101 }
13102 }
13103 }
13104 }
13105
13106
13108 {
13109 int id = muzzle_owner.GetMuzzleID();
13110 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13111
13112 if (WPOOH_array)
13113 {
13114 for (int i = 0; i < WPOOH_array.Count(); i++)
13115 {
13116 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13117
13118 if (WPOOH)
13119 {
13120 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13121 }
13122 }
13123 }
13124 }
13125
13126
13128 {
13129 int id = muzzle_owner.GetMuzzleID();
13130 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13131
13132 if (WPOOH_array)
13133 {
13134 for (int i = 0; i < WPOOH_array.Count(); i++)
13135 {
13136 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13137
13138 if (WPOOH)
13139 {
13140 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13141 }
13142 }
13143 }
13144 }
13145
13146
13147
13149 {
13151 {
13152 return true;
13153 }
13154
13155 return false;
13156 }
13157
13159 {
13161 {
13162 return true;
13163 }
13164
13165 return false;
13166 }
13167
13169 {
13171 {
13172 return true;
13173 }
13174
13175 return false;
13176 }
13177
13179 {
13180 return false;
13181 }
13182
13185 {
13186 return UATimeSpent.DEFAULT_DEPLOY;
13187 }
13188
13189
13190
13191
13193 {
13195 SetSynchDirty();
13196 }
13197
13199 {
13201 }
13202
13203
13205 {
13206 return false;
13207 }
13208
13211 {
13212 string att_type = "None";
13213
13214 if (ConfigIsExisting("soundAttType"))
13215 {
13216 att_type = ConfigGetString("soundAttType");
13217 }
13218
13220 }
13221
13223 {
13225 }
13226
13227
13228
13229
13230
13236
13238 {
13241
13243 }
13244
13245
13247 {
13249 return;
13250
13252
13255
13258
13259 SoundParameters params = new SoundParameters();
13263 }
13264
13265
13267 {
13269 {
13272
13273 SetSynchDirty();
13274
13277 }
13278 }
13279
13281 {
13283 }
13284
13285
13287 {
13289 return;
13290
13292 SetSynchDirty();
13293
13296 }
13297
13299 {
13302 }
13303
13305 {
13307 }
13308
13309 void OnApply(PlayerBase player);
13310
13312 {
13313 return 1.0;
13314 };
13315
13317 {
13319 }
13320
13322 {
13324 }
13325
13327
13329 {
13330 SetDynamicPhysicsLifeTime(0.01);
13332 }
13333
13335 {
13336 array<string> zone_names = new array<string>;
13337 GetDamageZones(zone_names);
13338 for (int i = 0; i < zone_names.Count(); i++)
13339 {
13340 SetHealthMax(zone_names.Get(i),"Health");
13341 }
13342 SetHealthMax("","Health");
13343 }
13344
13347 {
13348 float global_health = GetHealth01("","Health");
13349 array<string> zones = new array<string>;
13350 GetDamageZones(zones);
13351
13352 for (int i = 0; i < zones.Count(); i++)
13353 {
13354 SetHealth01(zones.Get(i),"Health",global_health);
13355 }
13356 }
13357
13360 {
13361 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13362 }
13363
13365 {
13366 if (!hasRootAsPlayer)
13367 {
13368 if (refParentIB)
13369 {
13370
13371 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13372 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13373
13374 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13375 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13376
13379 }
13380 else
13381 {
13382
13385 }
13386 }
13387 }
13388
13390 {
13392 {
13393 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13394 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13395 {
13396 float heatPermCoef = 1.0;
13398 while (ent)
13399 {
13400 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13401 ent = ent.GetHierarchyParent();
13402 }
13403
13404 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13405 }
13406 }
13407 }
13408
13410 {
13411
13412 EntityAI parent = GetHierarchyParent();
13413 if (!parent)
13414 {
13415 hasParent = false;
13416 hasRootAsPlayer = false;
13417 }
13418 else
13419 {
13420 hasParent = true;
13421 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13422 refParentIB =
ItemBase.Cast(parent);
13423 }
13424 }
13425
13426 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13427 {
13428
13429 }
13430
13432 {
13433
13434 return false;
13435 }
13436
13438 {
13439
13440
13441 return false;
13442 }
13443
13445 {
13446
13447 return false;
13448 }
13449
13452 {
13453 return !GetIsFrozen() &&
IsOpen();
13454 }
13455
13457 {
13458 bool hasParent = false, hasRootAsPlayer = false;
13460
13461 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13462 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13463
13464 if (wwtu || foodDecay)
13465 {
13469
13470 if (processWetness || processTemperature || processDecay)
13471 {
13473
13474 if (processWetness)
13475 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13476
13477 if (processTemperature)
13479
13480 if (processDecay)
13481 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13482 }
13483 }
13484 }
13485
13488 {
13490 }
13491
13493 {
13496
13497 return super.GetTemperatureFreezeThreshold();
13498 }
13499
13501 {
13504
13505 return super.GetTemperatureThawThreshold();
13506 }
13507
13509 {
13512
13513 return super.GetItemOverheatThreshold();
13514 }
13515
13517 {
13519 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13520
13521 return super.GetTemperatureFreezeTime();
13522 }
13523
13525 {
13527 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13528
13529 return super.GetTemperatureThawTime();
13530 }
13531
13536
13538 {
13539 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13540 }
13541
13543 {
13544 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13545 }
13546
13549 {
13551 }
13552
13554 {
13556 }
13557
13559 {
13561 }
13562
13565 {
13566 return null;
13567 }
13568
13571 {
13572 return false;
13573 }
13574
13576 {
13578 {
13581 if (!trg)
13582 {
13584 explosive = this;
13585 }
13586
13587 explosive.PairRemote(trg);
13589
13590 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13591 trg.SetPersistentPairID(persistentID);
13592 explosive.SetPersistentPairID(persistentID);
13593
13594 return true;
13595 }
13596 return false;
13597 }
13598
13601 {
13602 float ret = 1.0;
13605 ret *= GetHealth01();
13606
13607 return ret;
13608 }
13609
13610 #ifdef DEVELOPER
13611 override void SetDebugItem()
13612 {
13613 super.SetDebugItem();
13614 _itemBase = this;
13615 }
13616
13618 {
13619 string text = super.GetDebugText();
13620
13622 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13623
13624 return text;
13625 }
13626 #endif
13627
13629 {
13630 return true;
13631 }
13632
13634
13636
13638 {
13641 }
13642
13643
13651
13667
13668 [
Obsolete(
"Use ItemSoundHandler instead")]
13671 {
13672 if (!
g_Game.IsDedicatedServer())
13673 {
13674 if (ConfigIsExisting("attachSoundSet"))
13675 {
13676 string cfg_path = "";
13677 string soundset = "";
13678 string type_name =
GetType();
13679
13682 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13683 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13684
13685 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13686 {
13687 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13688 {
13689 if (cfg_slot_array[i] == slot_type)
13690 {
13691 soundset = cfg_soundset_array[i];
13692 break;
13693 }
13694 }
13695 }
13696
13697 if (soundset != "")
13698 {
13699 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13701 }
13702 }
13703 }
13704 }
13705
13707}
13708
13710{
13712 if (entity)
13713 {
13714 bool is_item = entity.IsInherited(
ItemBase);
13715 if (is_item && full_quantity)
13716 {
13719 }
13720 }
13721 else
13722 {
13724 return NULL;
13725 }
13726 return entity;
13727}
13728
13730{
13731 if (item)
13732 {
13733 if (health > 0)
13734 item.SetHealth("", "", health);
13735
13736 if (item.CanHaveTemperature())
13737 {
13739 if (item.CanFreeze())
13740 item.SetFrozen(false);
13741 }
13742
13743 if (item.HasEnergyManager())
13744 {
13745 if (quantity >= 0)
13746 {
13747 item.GetCompEM().SetEnergy0To1(quantity);
13748 }
13749 else
13750 {
13752 }
13753 }
13754 else if (item.IsMagazine())
13755 {
13756 Magazine mag = Magazine.Cast(item);
13757 if (quantity >= 0)
13758 {
13759 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13760 }
13761 else
13762 {
13764 }
13765
13766 }
13767 else
13768 {
13769 if (quantity >= 0)
13770 {
13771 item.SetQuantityNormalized(quantity, false);
13772 }
13773 else
13774 {
13776 }
13777
13778 }
13779 }
13780}
13781
13782#ifdef DEVELOPER
13784#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.