8854{
8856 {
8857 return true;
8858 }
8859};
8860
8862{
8863
8864};
8865
8866
8867
8869{
8873
8875
8878
8879
8880
8881
8882
8891
8897
8902
8907
8928 protected bool m_IsResultOfSplit
8929
8931
8936
8937
8938
8940
8944
8945
8946
8948
8951
8952
8953
8959
8960
8968
8971
8972
8974
8975
8977
8978
8983
8984
8989
8991
8992
8994
8995
8997 {
9002
9003 if (!
g_Game.IsDedicatedServer())
9004 {
9006 {
9008
9010 {
9012 }
9013 }
9014
9017 }
9018
9019 m_OldLocation = null;
9020
9022 {
9024 }
9025
9026 if (ConfigIsExisting("headSelectionsToHide"))
9027 {
9030 }
9031
9033 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9034 {
9036 }
9037
9039
9040 m_IsResultOfSplit = false;
9041
9043 }
9044
9046 {
9047 super.InitItemVariables();
9048
9054 m_Count = ConfigGetInt(
"count");
9055
9058
9063
9066
9071
9083
9087
9088
9091 if (ConfigIsExisting("canBeSplit"))
9092 {
9095 }
9096
9098 if (ConfigIsExisting("itemBehaviour"))
9100
9101
9104 RegisterNetSyncVariableInt("m_VarLiquidType");
9105 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9106
9107 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9108 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9109 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9110
9111 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9112 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9113 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9114 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9115
9116 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9117 RegisterNetSyncVariableBool("m_IsTakeable");
9118 RegisterNetSyncVariableBool("m_IsHologram");
9119
9122 {
9125 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9126 }
9127
9129
9131 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9133
9135 }
9136
9138 {
9140 }
9141
9143 {
9146 {
9151 }
9152 }
9153
9154 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9155 {
9157 {
9160 }
9161
9163 }
9164
9166 {
9172 }
9173
9175
9177 {
9179
9180 if (!action)
9181 {
9182 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9183 return;
9184 }
9185
9187 if (!ai)
9188 {
9190 return;
9191 }
9192
9194 if (!action_array)
9195 {
9196 action_array = new array<ActionBase_Basic>;
9198 }
9199 if (LogManager.IsActionLogEnable())
9200 {
9201 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9202 }
9203
9204 if (action_array.Find(action) != -1)
9205 {
9206 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9207 }
9208 else
9209 {
9210 action_array.Insert(action);
9211 }
9212 }
9213
9215 {
9216 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9217 ActionBase action = player.GetActionManager().GetAction(actionName);
9220
9221 if (action_array)
9222 {
9223 action_array.RemoveItem(action);
9224 }
9225 }
9226
9227
9228
9230 {
9231 ActionOverrideData overrideData = new ActionOverrideData();
9235
9237 if (!actionMap)
9238 {
9241 }
9242
9243 actionMap.Insert(this.
Type(), overrideData);
9244
9245 }
9246
9248
9250
9251
9253 {
9256
9259
9260 string config_to_search = "CfgVehicles";
9261 string muzzle_owner_config;
9262
9264 {
9265 if (IsInherited(Weapon))
9266 config_to_search = "CfgWeapons";
9267
9268 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9269
9270 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9271
9272 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9273
9274 if (config_OnFire_subclass_count > 0)
9275 {
9276 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9277
9278 for (int i = 0; i < config_OnFire_subclass_count; i++)
9279 {
9280 string particle_class = "";
9281 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9282 string config_OnFire_entry = config_OnFire_class + particle_class;
9283 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9284 WPOF_array.Insert(WPOF);
9285 }
9286
9287
9289 }
9290 }
9291
9293 {
9294 config_to_search = "CfgWeapons";
9295 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9296
9297 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9298
9299 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9300
9301 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9302 {
9303 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9304
9305 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9306 {
9307 string particle_class2 = "";
9308 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9309 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9310 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9311 WPOBE_array.Insert(WPOBE);
9312 }
9313
9314
9316 }
9317 }
9318 }
9319
9320
9322 {
9325
9327 {
9328 string config_to_search = "CfgVehicles";
9329
9330 if (IsInherited(Weapon))
9331 config_to_search = "CfgWeapons";
9332
9333 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9334 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9335
9336 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9337 {
9338
9340
9342 {
9344 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9346 return;
9347 }
9348
9351
9352
9353
9354 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9355 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9356
9357 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9358 {
9359 string particle_class = "";
9360 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9361 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9362 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9363
9364 if (entry_type == CT_CLASS)
9365 {
9366 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9367 WPOOH_array.Insert(WPOF);
9368 }
9369 }
9370
9371
9373 }
9374 }
9375 }
9376
9378 {
9380 }
9381
9383 {
9385 {
9387
9390
9393
9394 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9395 }
9396 }
9397
9399 {
9401 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9402
9404 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9405
9407 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9408
9410 {
9412 }
9413 }
9414
9416 {
9418 }
9419
9421 {
9424 else
9426
9428 {
9431 }
9432 else
9433 {
9436
9439 }
9440
9442 }
9443
9445 {
9447 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9448 }
9449
9451 {
9453 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9455 }
9456
9458 {
9460 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9461 }
9462
9464 {
9467
9468 OverheatingParticle OP = new OverheatingParticle();
9473
9475 }
9476
9478 {
9481
9482 return -1;
9483 }
9484
9486 {
9488 {
9491
9492 for (int i = count; i > 0; --i)
9493 {
9494 int id = i - 1;
9497
9500
9501 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9502 {
9503 if (p)
9504 {
9507 }
9508 }
9509 }
9510 }
9511 }
9512
9514 {
9516 {
9518 {
9519 int id = i - 1;
9521
9522 if (OP)
9523 {
9525
9526 if (p)
9527 {
9529 }
9530
9531 delete OP;
9532 }
9533 }
9534
9537 }
9538 }
9539
9542 {
9543 return 0.0;
9544 }
9545
9546
9548 {
9549 return 250;
9550 }
9551
9553 {
9554 return 0;
9555 }
9556
9559 {
9561 return true;
9562
9563 return false;
9564 }
9565
9568 {
9571
9573 {
9575 }
9576 else
9577 {
9578
9580 }
9581
9583 }
9584
9591 {
9592 return -1;
9593 }
9594
9595
9596
9597
9599 {
9601 {
9602 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9603 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9604
9605 if (r_index >= 0)
9606 {
9607 InventoryLocation r_il = new InventoryLocation;
9608 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9609
9610 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9613 {
9614 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9615 }
9617 {
9618 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9619 }
9620
9621 }
9622
9623 player.GetHumanInventory().ClearUserReservedLocation(this);
9624 }
9625
9628 }
9629
9630
9631
9632
9634 {
9635 return ItemBase.m_DebugActionsMask;
9636 }
9637
9639 {
9640 return ItemBase.m_DebugActionsMask & mask;
9641 }
9642
9644 {
9645 ItemBase.m_DebugActionsMask = mask;
9646 }
9647
9649 {
9650 ItemBase.m_DebugActionsMask |= mask;
9651 }
9652
9654 {
9655 ItemBase.m_DebugActionsMask &= ~mask;
9656 }
9657
9659 {
9661 {
9663 }
9664 else
9665 {
9667 }
9668 }
9669
9670
9672 {
9673 if (GetEconomyProfile())
9674 {
9675 float q_max = GetEconomyProfile().GetQuantityMax();
9676 if (q_max > 0)
9677 {
9678 float q_min = GetEconomyProfile().GetQuantityMin();
9679 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9680
9682 {
9683 ComponentEnergyManager comp = GetCompEM();
9685 {
9687 }
9688 }
9690 {
9692
9693 }
9694
9695 }
9696 }
9697 }
9698
9701 {
9702 EntityAI parent = GetHierarchyParent();
9703
9704 if (parent)
9705 {
9706 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9707 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9708 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9709 }
9710 }
9711
9714 {
9715 EntityAI parent = GetHierarchyParent();
9716
9717 if (parent)
9718 {
9719 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9720 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9721 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9722 }
9723 }
9724
9726 {
9727
9728
9729
9730
9732
9734 {
9735 if (ScriptInputUserData.CanStoreInputUserData())
9736 {
9737 ScriptInputUserData ctx = new ScriptInputUserData;
9743 ctx.
Write(use_stack_max);
9746
9748 {
9749 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9750 }
9751 }
9752 }
9753 else if (!
g_Game.IsMultiplayer())
9754 {
9756 }
9757 }
9758
9760 {
9762 }
9763
9765 {
9767 }
9768
9770 {
9772 }
9773
9775 {
9776
9777 return false;
9778 }
9779
9781 {
9782 return false;
9783 }
9784
9788 {
9789 return false;
9790 }
9791
9793 {
9794 return "";
9795 }
9796
9798
9800 {
9801 return false;
9802 }
9803
9805 {
9806 return true;
9807 }
9808
9809
9810
9812 {
9813 return true;
9814 }
9815
9817 {
9818 return true;
9819 }
9820
9822 {
9823 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9825 }
9826
9828 {
9830 }
9831
9833 {
9835 if (!is_being_placed)
9837 SetSynchDirty();
9838 }
9839
9840
9842
9844 {
9846 }
9847
9849 {
9851 }
9852
9854 {
9855 return 1;
9856 }
9857
9859 {
9860 return false;
9861 }
9862
9864 {
9866 SetSynchDirty();
9867 }
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9904 {
9905 super.OnMovedInsideCargo(container);
9906
9907 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9908 }
9909
9910 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9911 {
9912 super.EEItemLocationChanged(oldLoc, newLoc);
9913
9914 PlayerBase newPlayer = null;
9915 PlayerBase oldPlayer = null;
9916
9917 if (newLoc.GetParent())
9918 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9919
9920 if (oldLoc.GetParent())
9921 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9922
9924 {
9925 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9926
9927 if (rIndex >= 0)
9928 {
9929 InventoryLocation rIl = new InventoryLocation;
9930 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9931
9932 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9935 {
9936 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9937 }
9939 {
9941 }
9942
9943 }
9944 }
9945
9947 {
9948 if (newPlayer)
9949 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9950
9951 if (newPlayer == oldPlayer)
9952 {
9953 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9954 {
9956 {
9957 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9958 {
9959 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9960 }
9961 }
9962 else
9963 {
9964 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9965 }
9966 }
9967
9968 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9969 {
9970 int type = oldLoc.GetType();
9972 {
9973 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9974 }
9976 {
9977 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9978 }
9979 }
9980 if (!m_OldLocation)
9981 {
9982 m_OldLocation = new InventoryLocation;
9983 }
9984 m_OldLocation.Copy(oldLoc);
9985 }
9986 else
9987 {
9988 if (m_OldLocation)
9989 {
9990 m_OldLocation.Reset();
9991 }
9992 }
9993
9994 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9995 }
9996 else
9997 {
9998 if (newPlayer)
9999 {
10000 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10001 if (resIndex >= 0)
10002 {
10003 InventoryLocation il = new InventoryLocation;
10004 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10006 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10009 {
10010 il.
GetParent().GetOnReleaseLock().Invoke(it);
10011 }
10013 {
10015 }
10016
10017 }
10018 }
10020 {
10021
10023 }
10024
10025 if (m_OldLocation)
10026 {
10027 m_OldLocation.Reset();
10028 }
10029 }
10030
10032 {
10033 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10034 }
10035
10037 {
10038 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10039 }
10040 }
10041
10042 override void EOnContact(IEntity other, Contact extra)
10043 {
10045 {
10046 int liquidType = -1;
10048 if (impactSpeed > 0.0)
10049 {
10051 #ifndef SERVER
10053 #else
10055 SetSynchDirty();
10056 #endif
10058 }
10059 }
10060
10061 #ifdef SERVER
10062 if (GetCompEM() && GetCompEM().IsPlugged())
10063 {
10064 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10065 GetCompEM().UnplugThis();
10066 }
10067 #endif
10068 }
10069
10071
10073 {
10075 }
10076
10078 {
10079
10080 }
10081
10083 {
10084 super.OnItemLocationChanged(old_owner, new_owner);
10085
10086 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10087 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10088
10089 if (!relatedPlayer && playerNew)
10090 relatedPlayer = playerNew;
10091
10092 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10093 {
10095 if (actionMgr)
10096 {
10097 ActionBase currentAction = actionMgr.GetRunningAction();
10098 if (currentAction)
10100 }
10101 }
10102
10103 Man ownerPlayerOld = null;
10104 Man ownerPlayerNew = null;
10105
10106 if (old_owner)
10107 {
10108 if (old_owner.
IsMan())
10109 {
10110 ownerPlayerOld = Man.Cast(old_owner);
10111 }
10112 else
10113 {
10114 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10115 }
10116 }
10117 else
10118 {
10120 {
10122
10123 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10124 {
10125 GetCompEM().UnplugThis();
10126 }
10127 }
10128 }
10129
10130 if (new_owner)
10131 {
10132 if (new_owner.
IsMan())
10133 {
10134 ownerPlayerNew = Man.Cast(new_owner);
10135 }
10136 else
10137 {
10138 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10139 }
10140 }
10141
10142 if (ownerPlayerOld != ownerPlayerNew)
10143 {
10144 if (ownerPlayerOld)
10145 {
10146 array<EntityAI> subItemsExit = new array<EntityAI>;
10148 for (int i = 0; i < subItemsExit.Count(); i++)
10149 {
10152 }
10153 }
10154
10155 if (ownerPlayerNew)
10156 {
10157 array<EntityAI> subItemsEnter = new array<EntityAI>;
10159 for (int j = 0; j < subItemsEnter.Count(); j++)
10160 {
10163 }
10164 }
10165 }
10166 else if (ownerPlayerNew != null)
10167 {
10168 PlayerBase nplayer;
10169 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10170 {
10171 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10173 for (int k = 0; k < subItemsUpdate.Count(); k++)
10174 {
10176 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10177 }
10178 }
10179 }
10180
10181 if (old_owner)
10182 old_owner.OnChildItemRemoved(this);
10183 if (new_owner)
10184 new_owner.OnChildItemReceived(this);
10185 }
10186
10187
10189 {
10190 super.EEDelete(parent);
10191 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10192 if (player)
10193 {
10195
10196 if (player.IsAlive())
10197 {
10198 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10199 if (r_index >= 0)
10200 {
10201 InventoryLocation r_il = new InventoryLocation;
10202 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10203
10204 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10207 {
10208 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10209 }
10211 {
10212 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10213 }
10214
10215 }
10216
10217 player.RemoveQuickBarEntityShortcut(this);
10218 }
10219 }
10220 }
10221
10223 {
10224 super.EEKilled(killer);
10225
10228 {
10229 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10230 {
10231 if (IsMagazine())
10232 {
10233 if (Magazine.Cast(this).GetAmmoCount() > 0)
10234 {
10236 }
10237 }
10238 else
10239 {
10241 }
10242 }
10243 }
10244 }
10245
10247 {
10248 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10249
10250 super.OnWasAttached(parent, slot_id);
10251
10254
10257 }
10258
10260 {
10261 super.OnWasDetached(parent, slot_id);
10262
10265
10268 }
10269
10271 {
10272 int idx;
10275
10276 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10277 if (inventory_slots.Count() < 1)
10278 {
10279 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10280 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10281 }
10282 else
10283 {
10284 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10285 }
10286
10287 idx = inventory_slots.Find(slot);
10288 if (idx < 0)
10289 return "";
10290
10291 return attach_types.Get(idx);
10292 }
10293
10295 {
10296 int idx = -1;
10297 string slot;
10298
10301
10302 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10303 if (inventory_slots.Count() < 1)
10304 {
10305 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10306 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10307 }
10308 else
10309 {
10310 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10311 if (detach_types.Count() < 1)
10312 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10313 }
10314
10315 for (int i = 0; i < inventory_slots.Count(); i++)
10316 {
10317 slot = inventory_slots.Get(i);
10318 }
10319
10320 if (slot != "")
10321 {
10322 if (detach_types.Count() == 1)
10323 idx = 0;
10324 else
10325 idx = inventory_slots.Find(slot);
10326 }
10327 if (idx < 0)
10328 return "";
10329
10330 return detach_types.Get(idx);
10331 }
10332
10334 {
10335
10337
10338
10339 float min_time = 1;
10340 float max_time = 3;
10341 float delay = Math.RandomFloat(min_time, max_time);
10342
10343 explode_timer.Run(delay, this, "DoAmmoExplosion");
10344 }
10345
10347 {
10348 Magazine magazine = Magazine.Cast(this);
10349 int pop_sounds_count = 6;
10350 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10351
10352
10353 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10354 string sound_name = pop_sounds[ sound_idx ];
10355 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10356
10357
10358 magazine.ServerAddAmmoCount(-1);
10359
10360
10361 float min_temp_to_explode = 100;
10362
10363 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10364 {
10366 }
10367 }
10368
10369
10370 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10371 {
10372 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10373
10374 const int CHANCE_DAMAGE_CARGO = 4;
10375 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10376 const int CHANCE_DAMAGE_NOTHING = 2;
10377
10379 {
10380 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10381 int chances;
10382 int rnd;
10383
10384 if (GetInventory().GetCargo())
10385 {
10386 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10387 rnd = Math.RandomInt(0,chances);
10388
10389 if (rnd < CHANCE_DAMAGE_CARGO)
10390 {
10392 }
10393 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10394 {
10396 }
10397 }
10398 else
10399 {
10400 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10401 rnd = Math.RandomInt(0,chances);
10402
10403 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10404 {
10406 }
10407 }
10408 }
10409 }
10410
10412 {
10413 CargoBase cargo = GetInventory().GetCargo();
10414 if (cargo)
10415 {
10417 if (item_count > 0)
10418 {
10419 int random_pick = Math.RandomInt(0, item_count);
10421 if (!item.IsExplosive())
10422 {
10423 item.AddHealth("","",damage);
10424 return true;
10425 }
10426 }
10427 }
10428 return false;
10429 }
10430
10432 {
10433 GameInventory inventory = GetInventory();
10435 if (attachment_count > 0)
10436 {
10437 int random_pick = Math.RandomInt(0, attachment_count);
10439 if (!attachment.IsExplosive())
10440 {
10441 attachment.AddHealth("","",damage);
10442 return true;
10443 }
10444 }
10445 return false;
10446 }
10447
10449 {
10451 }
10452
10454 {
10456 return GetInventory().CanRemoveEntity();
10457
10458 return false;
10459 }
10460
10462 {
10463
10465 return false;
10466
10467
10469 return false;
10470
10471
10472
10474 if (delta == 0)
10475 return false;
10476
10477
10478 return true;
10479 }
10480
10482 {
10484 {
10485 if (ScriptInputUserData.CanStoreInputUserData())
10486 {
10487 ScriptInputUserData ctx = new ScriptInputUserData;
10492 ctx.
Write(destination_entity);
10494 ctx.
Write(slot_id);
10496 }
10497 }
10498 else if (!
g_Game.IsMultiplayer())
10499 {
10501 }
10502 }
10503
10505 {
10506 float split_quantity_new;
10510 InventoryLocation loc = new InventoryLocation;
10511
10512 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10513 {
10515 split_quantity_new = stack_max;
10516 else
10518
10520 {
10521 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10522 if (new_item)
10523 {
10524 new_item.SetResultOfSplit(true);
10525 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10527 new_item.
SetQuantity(split_quantity_new,
false,
true);
10528 }
10529 }
10530 }
10531 else if (destination_entity && slot_id == -1)
10532 {
10533 if (quantity > stack_max)
10534 split_quantity_new = stack_max;
10535 else
10536 split_quantity_new = quantity;
10537
10539 {
10540 GameInventory destinationInventory = destination_entity.GetInventory();
10542 {
10545 }
10546
10547 if (new_item)
10548 {
10549 new_item.SetResultOfSplit(true);
10550 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10552 new_item.
SetQuantity(split_quantity_new,
false,
true);
10553 }
10554 }
10555 }
10556 else
10557 {
10558 if (stack_max != 0)
10559 {
10561 {
10563 }
10564
10565 if (split_quantity_new == 0)
10566 {
10567 if (!
g_Game.IsMultiplayer())
10568 player.PhysicalPredictiveDropItem(this);
10569 else
10570 player.ServerDropEntity(this);
10571 return;
10572 }
10573
10575 {
10577
10578 if (new_item)
10579 {
10580 new_item.SetResultOfSplit(true);
10581 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10584 new_item.PlaceOnSurface();
10585 }
10586 }
10587 }
10588 }
10589 }
10590
10592 {
10593 float split_quantity_new;
10597 InventoryLocation loc = new InventoryLocation;
10598
10599 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10600 {
10602 split_quantity_new = stack_max;
10603 else
10605
10607 {
10608 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10609 if (new_item)
10610 {
10611 new_item.SetResultOfSplit(true);
10612 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10614 new_item.
SetQuantity(split_quantity_new,
false,
true);
10615 }
10616 }
10617 }
10618 else if (destination_entity && slot_id == -1)
10619 {
10620 if (quantity > stack_max)
10621 split_quantity_new = stack_max;
10622 else
10623 split_quantity_new = quantity;
10624
10626 {
10627 GameInventory destinationInventory = destination_entity.GetInventory();
10629 {
10632 }
10633
10634 if (new_item)
10635 {
10636 new_item.SetResultOfSplit(true);
10637 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10639 new_item.
SetQuantity(split_quantity_new,
false,
true);
10640 }
10641 }
10642 }
10643 else
10644 {
10645 if (stack_max != 0)
10646 {
10648 {
10650 }
10651
10653 {
10655
10656 if (new_item)
10657 {
10658 new_item.SetResultOfSplit(true);
10659 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10662 new_item.PlaceOnSurface();
10663 }
10664 }
10665 }
10666 }
10667 }
10668
10670 {
10672 {
10673 if (ScriptInputUserData.CanStoreInputUserData())
10674 {
10675 ScriptInputUserData ctx = new ScriptInputUserData;
10680 dst.WriteToContext(ctx);
10682 }
10683 }
10684 else if (!
g_Game.IsMultiplayer())
10685 {
10687 }
10688 }
10689
10691 {
10693 {
10694 if (ScriptInputUserData.CanStoreInputUserData())
10695 {
10696 ScriptInputUserData ctx = new ScriptInputUserData;
10701 ctx.
Write(destination_entity);
10707 }
10708 }
10709 else if (!
g_Game.IsMultiplayer())
10710 {
10712 }
10713 }
10714
10716 {
10718 }
10719
10721 {
10723 float split_quantity_new;
10725 if (dst.IsValid())
10726 {
10727 int slot_id = dst.GetSlot();
10729
10730 if (quantity > stack_max)
10731 split_quantity_new = stack_max;
10732 else
10733 split_quantity_new = quantity;
10734
10736 {
10738
10739 if (new_item)
10740 {
10741 new_item.SetResultOfSplit(true);
10742 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10744 new_item.
SetQuantity(split_quantity_new,
false,
true);
10745 }
10746
10747 return new_item;
10748 }
10749 }
10750
10751 return null;
10752 }
10753
10755 {
10757 float split_quantity_new;
10759 if (destination_entity)
10760 {
10762 if (quantity > stackable)
10763 split_quantity_new = stackable;
10764 else
10765 split_quantity_new = quantity;
10766
10768 {
10769 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10770 if (new_item)
10771 {
10772 new_item.SetResultOfSplit(true);
10773 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10775 new_item.
SetQuantity(split_quantity_new,
false,
true);
10776 }
10777 }
10778 }
10779 }
10780
10782 {
10784 {
10785 if (ScriptInputUserData.CanStoreInputUserData())
10786 {
10787 ScriptInputUserData ctx = new ScriptInputUserData;
10792 ItemBase destination_entity =
this;
10793 ctx.
Write(destination_entity);
10797 }
10798 }
10799 else if (!
g_Game.IsMultiplayer())
10800 {
10802 }
10803 }
10804
10806 {
10808 float split_quantity_new;
10810 if (player)
10811 {
10813 if (quantity > stackable)
10814 split_quantity_new = stackable;
10815 else
10816 split_quantity_new = quantity;
10817
10819 {
10820 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10821 new_item =
ItemBase.Cast(in_hands);
10822 if (new_item)
10823 {
10824 new_item.SetResultOfSplit(true);
10825 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10827 new_item.SetQuantity(split_quantity_new, false, true);
10828 }
10829 }
10830 }
10831 }
10832
10834 {
10836 float split_quantity_new = Math.Floor(quantity * 0.5);
10837
10839 return;
10840
10842
10843 if (new_item)
10844 {
10845 if (new_item.GetQuantityMax() < split_quantity_new)
10846 {
10847 split_quantity_new = new_item.GetQuantityMax();
10848 }
10849
10850 new_item.SetResultOfSplit(true);
10851 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10852
10854 {
10857 }
10858 else
10859 {
10861 new_item.
SetQuantity(split_quantity_new,
false,
true);
10862 }
10863 }
10864 }
10865
10867 {
10869 float split_quantity_new = Math.Floor(quantity / 2);
10870
10872 return;
10873
10874 InventoryLocation invloc = new InventoryLocation;
10876
10878 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10879
10880 if (new_item)
10881 {
10882 if (new_item.GetQuantityMax() < split_quantity_new)
10883 {
10884 split_quantity_new = new_item.GetQuantityMax();
10885 }
10887 {
10890 }
10891 else if (split_quantity_new > 1)
10892 {
10894 new_item.
SetQuantity(split_quantity_new,
false,
true);
10895 }
10896 }
10897 }
10898
10901 {
10902 SetWeightDirty();
10904
10905 if (parent)
10906 parent.OnAttachmentQuantityChangedEx(this, delta);
10907
10909 {
10911 {
10913 }
10915 {
10916 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10918 }
10919 }
10920 }
10921
10924 {
10925
10926 }
10927
10930 {
10932 }
10933
10935 {
10936 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10937
10939 {
10940 if (newLevel == GameConstants.STATE_RUINED)
10941 {
10943 EntityAI parent = GetHierarchyParent();
10944 if (parent && parent.IsFireplace())
10945 {
10946 CargoBase cargo = GetInventory().GetCargo();
10947 if (cargo)
10948 {
10950 {
10952 }
10953 }
10954 }
10955 }
10956
10958 {
10959
10961 return;
10962 }
10963
10964 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10965 {
10967 }
10968 }
10969 }
10970
10971
10973 {
10974 super.OnRightClick();
10975
10977 {
10979 {
10980 if (ScriptInputUserData.CanStoreInputUserData())
10981 {
10982 EntityAI root = GetHierarchyRoot();
10983 Man playerOwner = GetHierarchyRootPlayer();
10984 InventoryLocation dst = new InventoryLocation;
10985
10986
10987 if (!playerOwner && root && root == this)
10988 {
10990 }
10991 else
10992 {
10993
10994 GetInventory().GetCurrentInventoryLocation(dst);
10996 {
10997 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10999 {
11001 }
11002 else
11003 {
11005
11006
11007 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11008 {
11010 }
11011 else
11012 {
11013 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11014 }
11015 }
11016 }
11017 }
11018
11019 ScriptInputUserData ctx = new ScriptInputUserData;
11027 }
11028 }
11029 else if (!
g_Game.IsMultiplayer())
11030 {
11032 }
11033 }
11034 }
11035
11037 {
11038 if (root)
11039 {
11040 vector m4[4];
11041 root.GetTransform(m4);
11042 dst.SetGround(this, m4);
11043 }
11044 else
11045 {
11046 GetInventory().GetCurrentInventoryLocation(dst);
11047 }
11048 }
11049
11050 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11051 {
11052
11053 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11054 return false;
11055
11056 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11057 return false;
11058
11059
11061 return false;
11062
11063
11064 Magazine mag = Magazine.Cast(this);
11065 if (mag)
11066 {
11067 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11068 return false;
11069
11070 if (stack_max_limit)
11071 {
11072 Magazine other_mag = Magazine.Cast(other_item);
11073 if (other_item)
11074 {
11075 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11076 return false;
11077 }
11078
11079 }
11080 }
11081 else
11082 {
11083
11085 return false;
11086
11088 return false;
11089 }
11090
11091 PlayerBase player = null;
11092 if (CastTo(player, GetHierarchyRootPlayer()))
11093 {
11094 if (player.GetInventory().HasAttachment(this))
11095 return false;
11096
11097 if (player.IsItemsToDelete())
11098 return false;
11099 }
11100
11101 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11102 return false;
11103
11104 int slotID;
11106 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11107 return false;
11108
11109 return true;
11110 }
11111
11113 {
11115 }
11116
11118 {
11119 return m_IsResultOfSplit;
11120 }
11121
11123 {
11124 m_IsResultOfSplit = value;
11125 }
11126
11128 {
11130 }
11131
11133 {
11134 float other_item_quantity = other_item.GetQuantity();
11135 float this_free_space;
11136
11138
11140
11141 if (other_item_quantity > this_free_space)
11142 {
11143 return this_free_space;
11144 }
11145 else
11146 {
11147 return other_item_quantity;
11148 }
11149 }
11150
11152 {
11154 }
11155
11157 {
11159 return;
11160
11161 if (!IsMagazine() && other_item)
11162 {
11164 if (quantity_used != 0)
11165 {
11166 float hp1 = GetHealth01("","");
11167 float hp2 = other_item.GetHealth01("","");
11168 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11169 hpResult = hpResult / (
GetQuantity() + quantity_used);
11170
11171 hpResult *= GetMaxHealth();
11172 Math.Round(hpResult);
11173 SetHealth("", "Health", hpResult);
11174
11176 other_item.AddQuantity(-quantity_used);
11177 }
11178 }
11180 }
11181
11183 {
11184 #ifdef SERVER
11185 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11186 GetHierarchyParent().IncreaseLifetimeUp();
11187 #endif
11188 };
11189
11191 {
11192 PlayerBase p = PlayerBase.Cast(player);
11193
11194 array<int> recipesIds = p.m_Recipes;
11195 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11196 if (moduleRecipesManager)
11197 {
11198 EntityAI itemInHands = player.GetEntityInHands();
11199 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11200 }
11201
11202 for (int i = 0;i < recipesIds.Count(); i++)
11203 {
11204 int key = recipesIds.Get(i);
11205 string recipeName = moduleRecipesManager.GetRecipeName(key);
11207 }
11208 }
11209
11210
11211 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11212 {
11213 super.GetDebugActions(outputList);
11214
11215
11221
11222
11227
11232
11233
11237
11238
11240 {
11244 }
11245
11248
11249
11253
11255
11256 InventoryLocation loc = new InventoryLocation();
11257 GetInventory().GetCurrentInventoryLocation(loc);
11259 {
11260 if (Gizmo_IsSupported())
11263 }
11264
11266 }
11267
11268
11269
11270
11272 {
11273 super.OnAction(action_id, player, ctx);
11274
11276 {
11277 switch (action_id)
11278 {
11282 return true;
11286 return true;
11287 }
11288 }
11289
11291 {
11292 switch (action_id)
11293 {
11295 Delete();
11296 return true;
11297 }
11298 }
11299
11300 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11301 {
11302 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11303 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11304 PlayerBase p = PlayerBase.Cast(player);
11305 if (
EActions.RECIPES_RANGE_START < 1000)
11306 {
11307 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11308 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11309 }
11310 }
11311 #ifndef SERVER
11312 else if (action_id ==
EActions.WATCH_PLAYER)
11313 {
11314 PluginDeveloper.SetDeveloperItemClientEx(player);
11315 }
11316 #endif
11318 {
11319 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11320 {
11321 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11322 OnDebugButtonPressServer(id + 1);
11323 }
11324
11325 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11326 {
11327 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11329 }
11330
11331 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11332 {
11333 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11335 }
11336
11337 else if (action_id ==
EActions.ADD_QUANTITY)
11338 {
11339 if (IsMagazine())
11340 {
11341 Magazine mag = Magazine.Cast(this);
11342 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11343 }
11344 else
11345 {
11347 }
11348
11349 if (m_EM)
11350 {
11351 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11352 }
11353
11354 }
11355
11356 else if (action_id ==
EActions.REMOVE_QUANTITY)
11357 {
11358 if (IsMagazine())
11359 {
11360 Magazine mag2 = Magazine.Cast(this);
11361 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11362 }
11363 else
11364 {
11366 }
11367 if (m_EM)
11368 {
11369 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11370 }
11371
11372 }
11373
11374 else if (action_id ==
EActions.SET_QUANTITY_0)
11375 {
11377
11378 if (m_EM)
11379 {
11380 m_EM.SetEnergy(0);
11381 }
11382 }
11383
11384 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11385 {
11387
11388 if (m_EM)
11389 {
11390 m_EM.SetEnergy(m_EM.GetEnergyMax());
11391 }
11392 }
11393
11394 else if (action_id ==
EActions.ADD_HEALTH)
11395 {
11396 AddHealth("","",GetMaxHealth("","Health")/5);
11397 }
11398 else if (action_id ==
EActions.REMOVE_HEALTH)
11399 {
11400 AddHealth("","",-GetMaxHealth("","Health")/5);
11401 }
11402 else if (action_id ==
EActions.DESTROY_HEALTH)
11403 {
11404 SetHealth01("","",0);
11405 }
11406 else if (action_id ==
EActions.WATCH_ITEM)
11407 {
11409 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11410 #ifdef DEVELOPER
11411 SetDebugDeveloper_item(this);
11412 #endif
11413 }
11414
11415 else if (action_id ==
EActions.ADD_TEMPERATURE)
11416 {
11417 AddTemperature(20);
11418
11419 }
11420
11421 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11422 {
11423 AddTemperature(-20);
11424
11425 }
11426
11427 else if (action_id ==
EActions.FLIP_FROZEN)
11428 {
11429 SetFrozen(!GetIsFrozen());
11430
11431 }
11432
11433 else if (action_id ==
EActions.ADD_WETNESS)
11434 {
11436
11437 }
11438
11439 else if (action_id ==
EActions.REMOVE_WETNESS)
11440 {
11442
11443 }
11444
11445 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11446 {
11449
11450
11451 }
11452
11453 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11454 {
11457 }
11458
11459 else if (action_id ==
EActions.MAKE_SPECIAL)
11460 {
11461 auto debugParams = DebugSpawnParams.WithPlayer(player);
11462 OnDebugSpawnEx(debugParams);
11463 }
11464
11465 }
11466
11467
11468 return false;
11469 }
11470
11471
11472
11473
11477
11480
11481
11482
11484 {
11485 return false;
11486 }
11487
11488
11490 {
11491 return true;
11492 }
11493
11494
11496 {
11497 return true;
11498 }
11499
11500
11501
11503 {
11504 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11505 return g_Game.ConfigIsExisting(config_path);
11506 }
11507
11510 {
11511 return null;
11512 }
11513
11515 {
11516 return false;
11517 }
11518
11520 {
11521 return false;
11522 }
11523
11527
11528
11530 {
11531 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11532 return module_repairing.CanRepair(this, item_repair_kit);
11533 }
11534
11535
11536 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11537 {
11538 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11539 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11540 }
11541
11542
11544 {
11545
11546
11547
11548
11549
11550
11551
11552
11553 return 1;
11554 }
11555
11556
11557
11559 {
11561 }
11562
11563
11564
11566 {
11568 }
11569
11570
11579 {
11580 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11581
11582 if (player)
11583 {
11584 player.MessageStatus(text);
11585 }
11586 }
11587
11588
11597 {
11598 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11599
11600 if (player)
11601 {
11602 player.MessageAction(text);
11603 }
11604 }
11605
11606
11615 {
11616 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11617
11618 if (player)
11619 {
11620 player.MessageFriendly(text);
11621 }
11622 }
11623
11624
11633 {
11634 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11635
11636 if (player)
11637 {
11638 player.MessageImportant(text);
11639 }
11640 }
11641
11643 {
11644 return true;
11645 }
11646
11647
11648 override bool KindOf(
string tag)
11649 {
11650 bool found = false;
11651 string item_name = this.
GetType();
11653 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11654
11655 int array_size = item_tag_array.Count();
11656 for (int i = 0; i < array_size; i++)
11657 {
11658 if (item_tag_array.Get(i) == tag)
11659 {
11660 found = true;
11661 break;
11662 }
11663 }
11664 return found;
11665 }
11666
11667
11669 {
11670
11671 super.OnRPC(sender, rpc_type,ctx);
11672
11673
11674 switch (rpc_type)
11675 {
11676 #ifndef SERVER
11677 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11678 Param2<bool, string> p = new Param2<bool, string>(false, "");
11679
11681 return;
11682
11683 bool play = p.param1;
11684 string soundSet = p.param2;
11685
11686 if (play)
11687 {
11689 {
11691 {
11693 }
11694 }
11695 else
11696 {
11698 }
11699 }
11700 else
11701 {
11703 }
11704
11705 break;
11706 #endif
11707
11708 }
11709
11711 {
11713 }
11714 }
11715
11716
11717
11718
11720 {
11721 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11722 return plugin.GetID(
name);
11723 }
11724
11726 {
11727 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11728 return plugin.GetName(id);
11729 }
11730
11733 {
11734
11735
11736 int varFlags;
11737 if (!ctx.
Read(varFlags))
11738 return;
11739
11740 if (varFlags & ItemVariableFlags.FLOAT)
11741 {
11743 }
11744 }
11745
11747 {
11748
11749 super.SerializeNumericalVars(floats_out);
11750
11751
11752
11754 {
11756 }
11757
11759 {
11761 }
11762
11764 {
11766 }
11767
11769 {
11774 }
11775
11777 {
11779 }
11780 }
11781
11783 {
11784
11785 super.DeSerializeNumericalVars(floats);
11786
11787
11788 int index = 0;
11789 int mask = Math.Round(floats.Get(index));
11790
11791 index++;
11792
11794 {
11796 {
11798 }
11799 else
11800 {
11801 float quantity = floats.Get(index);
11802 SetQuantity(quantity,
true,
false,
false,
false);
11803 }
11804 index++;
11805 }
11806
11808 {
11809 float wet = floats.Get(index);
11811 index++;
11812 }
11813
11815 {
11816 int liquidtype = Math.Round(floats.Get(index));
11818 index++;
11819 }
11820
11822 {
11824 index++;
11826 index++;
11828 index++;
11830 index++;
11831 }
11832
11834 {
11835 int cleanness = Math.Round(floats.Get(index));
11837 index++;
11838 }
11839 }
11840
11842 {
11843 super.WriteVarsToCTX(ctx);
11844
11845
11847 {
11849 }
11850
11852 {
11854 }
11855
11857 {
11859 }
11860
11862 {
11863 int r,g,b,a;
11869 }
11870
11872 {
11874 }
11875 }
11876
11878 {
11879 if (!super.ReadVarsFromCTX(ctx,version))
11880 return false;
11881
11882 int intValue;
11883 float value;
11884
11885 if (version < 140)
11886 {
11887 if (!ctx.
Read(intValue))
11888 return false;
11889
11890 m_VariablesMask = intValue;
11891 }
11892
11894 {
11895 if (!ctx.
Read(value))
11896 return false;
11897
11899 {
11901 }
11902 else
11903 {
11905 }
11906 }
11907
11908 if (version < 140)
11909 {
11911 {
11912 if (!ctx.
Read(value))
11913 return false;
11914 SetTemperatureDirect(value);
11915 }
11916 }
11917
11919 {
11920 if (!ctx.
Read(value))
11921 return false;
11923 }
11924
11926 {
11927 if (!ctx.
Read(intValue))
11928 return false;
11930 }
11931
11933 {
11934 int r,g,b,a;
11936 return false;
11938 return false;
11940 return false;
11942 return false;
11943
11945 }
11946
11948 {
11949 if (!ctx.
Read(intValue))
11950 return false;
11952 }
11953
11954 if (version >= 138 && version < 140)
11955 {
11957 {
11958 if (!ctx.
Read(intValue))
11959 return false;
11960 SetFrozen(intValue);
11961 }
11962 }
11963
11964 return true;
11965 }
11966
11967
11969 {
11972 {
11974 }
11975
11976 if (!super.OnStoreLoad(ctx, version))
11977 {
11979 return false;
11980 }
11981
11982 if (version >= 114)
11983 {
11984 bool hasQuickBarIndexSaved;
11985
11986 if (!ctx.
Read(hasQuickBarIndexSaved))
11987 {
11989 return false;
11990 }
11991
11992 if (hasQuickBarIndexSaved)
11993 {
11994 int itmQBIndex;
11995
11996
11997 if (!ctx.
Read(itmQBIndex))
11998 {
12000 return false;
12001 }
12002
12003 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12004 if (itmQBIndex != -1 && parentPlayer)
12005 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12006 }
12007 }
12008 else
12009 {
12010
12011 PlayerBase player;
12012 int itemQBIndex;
12013 if (version ==
int.
MAX)
12014 {
12015 if (!ctx.
Read(itemQBIndex))
12016 {
12018 return false;
12019 }
12020 }
12021 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12022 {
12023
12024 if (!ctx.
Read(itemQBIndex))
12025 {
12027 return false;
12028 }
12029 if (itemQBIndex != -1 && player)
12030 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12031 }
12032 }
12033
12034 if (version < 140)
12035 {
12036
12037 if (!LoadVariables(ctx, version))
12038 {
12040 return false;
12041 }
12042 }
12043
12044
12046 {
12048 return false;
12049 }
12050 if (version >= 132)
12051 {
12053 if (raib)
12054 {
12056 {
12058 return false;
12059 }
12060 }
12061 }
12062
12064 return true;
12065 }
12066
12067
12068
12070 {
12071 super.OnStoreSave(ctx);
12072
12073 PlayerBase player;
12074 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12075 {
12077
12078 int itemQBIndex = -1;
12079 itemQBIndex = player.FindQuickBarEntityIndex(this);
12080 ctx.
Write(itemQBIndex);
12081 }
12082 else
12083 {
12085 }
12086
12088
12090 if (raib)
12091 {
12093 }
12094 }
12095
12096
12098 {
12099 super.AfterStoreLoad();
12100
12102 {
12104 }
12105
12107 {
12110 }
12111 }
12112
12114 {
12115 super.EEOnAfterLoad();
12116
12118 {
12120 }
12121
12124 }
12125
12127 {
12128 return false;
12129 }
12130
12131
12132
12134 {
12136 {
12137 #ifdef PLATFORM_CONSOLE
12138
12140 {
12142 if (menu)
12143 {
12145 }
12146 }
12147 #endif
12148 }
12149
12151 {
12154 }
12155
12157 {
12158 SetWeightDirty();
12160 }
12162 {
12165 }
12166
12168 {
12171
12174 }
12176 {
12180 }
12181
12182 super.OnVariablesSynchronized();
12183 }
12184
12185
12186
12188 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12189 {
12190 if (!IsServerCheck(allow_client))
12191 return false;
12192
12194 return false;
12195
12198
12199 if (value <= (min + 0.001))
12200 value = min;
12201
12202 if (value == min)
12203 {
12204 if (destroy_config)
12205 {
12206 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12207 if (dstr)
12208 {
12210 this.Delete();
12211 return true;
12212 }
12213 }
12214 else if (destroy_forced)
12215 {
12217 this.Delete();
12218 return true;
12219 }
12220
12222 }
12223
12226
12228 {
12229 EntityAI parent = GetHierarchyRoot();
12230 InventoryLocation iLoc = new InventoryLocation();
12231 GetInventory().GetCurrentInventoryLocation(iLoc);
12233 {
12234 int iLocSlot = iLoc.
GetSlot();
12236 {
12238 }
12240 {
12242 }
12243 }
12244 }
12245
12247 {
12249
12250 if (delta)
12252 }
12253
12255
12256 return false;
12257 }
12258
12259
12261 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12262 {
12264 }
12265
12267 {
12270 }
12271
12273 {
12276 }
12277
12279 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12280 {
12281 float value_clamped = Math.Clamp(value, 0, 1);
12283 SetQuantity(result, destroy_config, destroy_forced);
12284 }
12285
12286
12289 {
12291 }
12292
12294 {
12296 }
12297
12298
12299
12300
12301
12302
12303
12304
12305
12306
12308 {
12309 int slot = -1;
12310 GameInventory inventory = GetInventory();
12311 if (inventory)
12312 {
12313 InventoryLocation il = new InventoryLocation;
12316 }
12317
12319 }
12320
12322 {
12323 float quantity_max = 0;
12324
12326 {
12327 if (attSlotID != -1)
12328 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12329
12330 if (quantity_max <= 0)
12332 }
12333
12334 if (quantity_max <= 0)
12336
12337 return quantity_max;
12338 }
12339
12341 {
12343 }
12344
12346 {
12348 }
12349
12350
12352 {
12354 }
12355
12357 {
12359 }
12360
12362 {
12364 }
12365
12366
12368 {
12369
12370 float weightEx = GetWeightEx();
12371 float special = GetInventoryAndCargoWeight();
12372 return weightEx - special;
12373 }
12374
12375
12377 {
12379 }
12380
12382 {
12384 {
12385 #ifdef DEVELOPER
12386 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12387 {
12388 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12390 }
12391 #endif
12392
12393 return GetQuantity() * GetConfigWeightModified();
12394 }
12395 else if (HasEnergyManager())
12396 {
12397 #ifdef DEVELOPER
12398 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12399 {
12400 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12401 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12402 }
12403 #endif
12404 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12405 }
12406 else
12407 {
12408 #ifdef DEVELOPER
12409 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12410 {
12411 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12412 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12413 }
12414 #endif
12415 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12416 }
12417 }
12418
12421 {
12422 int item_count = 0;
12424
12425 GameInventory inventory = GetInventory();
12426 CargoBase cargo = inventory.
GetCargo();
12427 if (cargo != NULL)
12428 {
12430 }
12431
12433 for (int i = 0; i < nAttachments; ++i)
12434 {
12436 if (item)
12437 item_count += item.GetNumberOfItems();
12438 }
12439 return item_count;
12440 }
12441
12444 {
12445 float weight = 0;
12446 float wetness = 1;
12447 if (include_wetness)
12450 {
12451 weight = wetness * m_ConfigWeight;
12452 }
12454 {
12455 weight = 1;
12456 }
12457 return weight;
12458 }
12459
12460
12461
12463 {
12464 GameInventory inventory = GetInventory();
12465 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12466 {
12467 array<EntityAI> items = new array<EntityAI>;
12469 for (int i = 0; i < items.Count(); ++i)
12470 {
12472 if (item)
12473 {
12474 g_Game.ObjectDelete(item);
12475 }
12476 }
12477 }
12478 }
12479
12480
12481
12482
12484 {
12485 float energy = 0;
12486 if (HasEnergyManager())
12487 {
12488 energy = GetCompEM().GetEnergy();
12489 }
12490 return energy;
12491 }
12492
12493
12495 {
12496 super.OnEnergyConsumed();
12497
12499 }
12500
12502 {
12503 super.OnEnergyAdded();
12504
12506 }
12507
12508
12510 {
12511 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12512 {
12514 {
12515 float energy_0to1 = GetCompEM().GetEnergy0To1();
12517 }
12518 }
12519 }
12520
12521
12523 {
12524 return ConfigGetFloat("heatIsolation");
12525 }
12526
12528 {
12530 }
12531
12533 {
12534 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12535 if (
g_Game.ConfigIsExisting(paramPath))
12536 return g_Game.ConfigGetFloat(paramPath);
12537
12538 return 0.0;
12539 }
12540
12542 {
12543 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12544 if (
g_Game.ConfigIsExisting(paramPath))
12545 return g_Game.ConfigGetFloat(paramPath);
12546
12547 return 0.0;
12548 }
12549
12550 override void SetWet(
float value,
bool allow_client =
false)
12551 {
12552 if (!IsServerCheck(allow_client))
12553 return;
12554
12557
12559
12560 m_VarWet = Math.Clamp(value, min, max);
12561
12563 {
12566 }
12567 }
12568
12569 override void AddWet(
float value)
12570 {
12572 }
12573
12575 {
12577 }
12578
12580 {
12582 }
12583
12585 {
12587 }
12588
12590 {
12592 }
12593
12595 {
12597 }
12598
12599 override void OnWetChanged(
float newVal,
float oldVal)
12600 {
12603 if (newLevel != oldLevel)
12604 {
12606 }
12607 }
12608
12610 {
12611 SetWeightDirty();
12612 }
12613
12615 {
12616 return GetWetLevelInternal(
m_VarWet);
12617 }
12618
12619
12620
12622 {
12624 }
12625
12627 {
12629 }
12630
12632 {
12634 }
12635
12637 {
12639 }
12640
12641
12642
12644 {
12645 if (ConfigIsExisting("itemModelLength"))
12646 {
12647 return ConfigGetFloat("itemModelLength");
12648 }
12649 return 0;
12650 }
12651
12653 {
12654 if (ConfigIsExisting("itemAttachOffset"))
12655 {
12656 return ConfigGetFloat("itemAttachOffset");
12657 }
12658 return 0;
12659 }
12660
12661 override void SetCleanness(
int value,
bool allow_client =
false)
12662 {
12663 if (!IsServerCheck(allow_client))
12664 return;
12665
12667
12669
12672 }
12673
12675 {
12677 }
12678
12680 {
12681 return true;
12682 }
12683
12684
12685
12686
12688 {
12690 }
12691
12693 {
12695 }
12696
12697
12698
12699
12700 override void SetColor(
int r,
int g,
int b,
int a)
12701 {
12707 }
12709 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12710 {
12715 }
12716
12718 {
12720 }
12721
12724 {
12725 int r,g,b,a;
12727 r = r/255;
12728 g = g/255;
12729 b = b/255;
12730 a = a/255;
12731 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12732 }
12733
12734
12735
12736 override void SetLiquidType(
int value,
bool allow_client =
false)
12737 {
12738 if (!IsServerCheck(allow_client))
12739 return;
12740
12745 }
12746
12748 {
12749 return ConfigGetInt("varLiquidTypeInit");
12750 }
12751
12753 {
12755 }
12756
12758 {
12760 SetFrozen(false);
12761 }
12762
12765 {
12766 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12767 }
12768
12769
12772 {
12773 PlayerBase nplayer;
12774 if (PlayerBase.CastTo(nplayer, player))
12775 {
12777 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12778 }
12779 }
12780
12781
12784 {
12785 PlayerBase nplayer;
12786 if (PlayerBase.CastTo(nplayer,player))
12787 {
12788 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12789 }
12790
12791 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12792
12793 if (HasEnergyManager())
12794 {
12795 GetCompEM().UpdatePlugState();
12796 }
12797 }
12798
12799
12801 {
12802 super.OnPlacementStarted(player);
12803
12805 }
12806
12807 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12808 {
12810 {
12811 m_AdminLog.OnPlacementComplete(player,
this);
12812 }
12813
12814 super.OnPlacementComplete(player, position, orientation);
12815 }
12816
12817
12818
12819
12820
12822 {
12824 {
12825 return true;
12826 }
12827 else
12828 {
12829 return false;
12830 }
12831 }
12832
12833
12835 {
12837 {
12839 }
12840 }
12841
12842
12844 {
12846 }
12847
12849 {
12851 }
12852
12853 override void InsertAgent(
int agent,
float count = 1)
12854 {
12855 if (count < 1)
12856 return;
12857
12859 }
12860
12863 {
12865 }
12866
12867
12869 {
12871 }
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12915 {
12917 return false;
12918 return true;
12919 }
12920
12922 {
12923
12925 }
12926
12927
12930 {
12931 super.CheckForRoofLimited(timeTresholdMS);
12932
12933 float time =
g_Game.GetTime();
12934 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12935 {
12936 m_PreviousRoofTestTime = time;
12937 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12938 }
12939 }
12940
12941
12943 {
12945 {
12946 return 0;
12947 }
12948
12949 if (GetInventory().GetAttachmentSlotsCount() != 0)
12950 {
12951 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12952 if (filter)
12953 return filter.GetProtectionLevel(type, false, system);
12954 else
12955 return 0;
12956 }
12957
12958 string subclassPath, entryName;
12959
12960 switch (type)
12961 {
12963 entryName = "biological";
12964 break;
12966 entryName = "chemical";
12967 break;
12968 default:
12969 entryName = "biological";
12970 break;
12971 }
12972
12973 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12974
12975 return g_Game.ConfigGetFloat(subclassPath + entryName);
12976 }
12977
12978
12979
12982 {
12983 if (!IsMagazine())
12985
12987 }
12988
12989
12990
12991
12992
12997 {
12998 return true;
12999 }
13000
13002 {
13004 }
13005
13006
13007
13008
13009
13011 {
13012 if (parent)
13013 {
13014 if (parent.IsInherited(DayZInfected))
13015 return true;
13016
13017 if (!parent.IsRuined())
13018 return true;
13019 }
13020
13021 return true;
13022 }
13023
13025 {
13026 if (!super.CanPutAsAttachment(parent))
13027 {
13028 return false;
13029 }
13030
13031 if (!IsRuined() && !parent.IsRuined())
13032 {
13033 return true;
13034 }
13035
13036 return false;
13037 }
13038
13040 {
13041
13042
13043
13044
13045 return super.CanReceiveItemIntoCargo(item);
13046 }
13047
13049 {
13050
13051
13052
13053
13054 GameInventory attachmentInv = attachment.GetInventory();
13056 {
13057 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13058 return false;
13059 }
13060
13061 InventoryLocation loc = new InventoryLocation();
13062 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13063 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13064 return false;
13065
13066 return super.CanReceiveAttachment(attachment, slotId);
13067 }
13068
13070 {
13071 if (!super.CanReleaseAttachment(attachment))
13072 return false;
13073
13074 return GetInventory().AreChildrenAccessible();
13075 }
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13088
13089
13090
13091
13092
13093
13094
13095
13096
13098 {
13099 int id = muzzle_owner.GetMuzzleID();
13100 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13101
13102 if (WPOF_array)
13103 {
13104 for (int i = 0; i < WPOF_array.Count(); i++)
13105 {
13106 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13107
13108 if (WPOF)
13109 {
13110 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13111 }
13112 }
13113 }
13114 }
13115
13116
13118 {
13119 int id = muzzle_owner.GetMuzzleID();
13121
13122 if (WPOBE_array)
13123 {
13124 for (int i = 0; i < WPOBE_array.Count(); i++)
13125 {
13126 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13127
13128 if (WPOBE)
13129 {
13130 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13131 }
13132 }
13133 }
13134 }
13135
13136
13138 {
13139 int id = muzzle_owner.GetMuzzleID();
13140 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13141
13142 if (WPOOH_array)
13143 {
13144 for (int i = 0; i < WPOOH_array.Count(); i++)
13145 {
13146 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13147
13148 if (WPOOH)
13149 {
13150 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13151 }
13152 }
13153 }
13154 }
13155
13156
13158 {
13159 int id = muzzle_owner.GetMuzzleID();
13160 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13161
13162 if (WPOOH_array)
13163 {
13164 for (int i = 0; i < WPOOH_array.Count(); i++)
13165 {
13166 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13167
13168 if (WPOOH)
13169 {
13170 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13171 }
13172 }
13173 }
13174 }
13175
13176
13178 {
13179 int id = muzzle_owner.GetMuzzleID();
13180 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13181
13182 if (WPOOH_array)
13183 {
13184 for (int i = 0; i < WPOOH_array.Count(); i++)
13185 {
13186 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13187
13188 if (WPOOH)
13189 {
13190 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13191 }
13192 }
13193 }
13194 }
13195
13196
13197
13199 {
13201 {
13202 return true;
13203 }
13204
13205 return false;
13206 }
13207
13209 {
13211 {
13212 return true;
13213 }
13214
13215 return false;
13216 }
13217
13219 {
13221 {
13222 return true;
13223 }
13224
13225 return false;
13226 }
13227
13229 {
13230 return false;
13231 }
13232
13235 {
13236 return UATimeSpent.DEFAULT_DEPLOY;
13237 }
13238
13239
13240
13241
13243 {
13245 SetSynchDirty();
13246 }
13247
13249 {
13251 }
13252
13253
13255 {
13256 return false;
13257 }
13258
13261 {
13262 string att_type = "None";
13263
13264 if (ConfigIsExisting("soundAttType"))
13265 {
13266 att_type = ConfigGetString("soundAttType");
13267 }
13268
13270 }
13271
13273 {
13275 }
13276
13277
13278
13279
13280
13286
13288 {
13291
13293 }
13294
13295
13297 {
13299 return;
13300
13302
13305
13308
13309 SoundParameters params = new SoundParameters();
13313 }
13314
13315
13317 {
13319 {
13322
13323 SetSynchDirty();
13324
13327 }
13328 }
13329
13331 {
13333 }
13334
13335
13337 {
13339 return;
13340
13342 SetSynchDirty();
13343
13346 }
13347
13349 {
13352 }
13353
13355 {
13357 }
13358
13359 void OnApply(PlayerBase player);
13360
13362 {
13363 return 1.0;
13364 };
13365
13367 {
13369 }
13370
13372 {
13374 }
13375
13377
13379 {
13380 SetDynamicPhysicsLifeTime(0.01);
13382 }
13383
13385 {
13386 array<string> zone_names = new array<string>;
13387 GetDamageZones(zone_names);
13388 for (int i = 0; i < zone_names.Count(); i++)
13389 {
13390 SetHealthMax(zone_names.Get(i),"Health");
13391 }
13392 SetHealthMax("","Health");
13393 }
13394
13397 {
13398 float global_health = GetHealth01("","Health");
13399 array<string> zones = new array<string>;
13400 GetDamageZones(zones);
13401
13402 for (int i = 0; i < zones.Count(); i++)
13403 {
13404 SetHealth01(zones.Get(i),"Health",global_health);
13405 }
13406 }
13407
13410 {
13411 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13412 }
13413
13415 {
13416 if (!hasRootAsPlayer)
13417 {
13418 if (refParentIB)
13419 {
13420
13421 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13422 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13423
13424 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13425 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13426
13429 }
13430 else
13431 {
13432
13435 }
13436 }
13437 }
13438
13440 {
13442 {
13443 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13444 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13445 {
13446 float heatPermCoef = 1.0;
13448 while (ent)
13449 {
13450 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13451 ent = ent.GetHierarchyParent();
13452 }
13453
13454 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13455 }
13456 }
13457 }
13458
13460 {
13461
13462 EntityAI parent = GetHierarchyParent();
13463 if (!parent)
13464 {
13465 hasParent = false;
13466 hasRootAsPlayer = false;
13467 }
13468 else
13469 {
13470 hasParent = true;
13471 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13472 refParentIB =
ItemBase.Cast(parent);
13473 }
13474 }
13475
13476 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13477 {
13478
13479 }
13480
13482 {
13483
13484 return false;
13485 }
13486
13488 {
13489
13490
13491 return false;
13492 }
13493
13495 {
13496
13497 return false;
13498 }
13499
13502 {
13503 return !GetIsFrozen() &&
IsOpen();
13504 }
13505
13507 {
13508 bool hasParent = false, hasRootAsPlayer = false;
13510
13511 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13512 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13513
13514 if (wwtu || foodDecay)
13515 {
13519
13520 if (processWetness || processTemperature || processDecay)
13521 {
13523
13524 if (processWetness)
13525 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13526
13527 if (processTemperature)
13529
13530 if (processDecay)
13531 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13532 }
13533 }
13534 }
13535
13538 {
13540 }
13541
13543 {
13546
13547 return super.GetTemperatureFreezeThreshold();
13548 }
13549
13551 {
13554
13555 return super.GetTemperatureThawThreshold();
13556 }
13557
13559 {
13562
13563 return super.GetItemOverheatThreshold();
13564 }
13565
13567 {
13569 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13570
13571 return super.GetTemperatureFreezeTime();
13572 }
13573
13575 {
13577 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13578
13579 return super.GetTemperatureThawTime();
13580 }
13581
13586
13588 {
13589 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13590 }
13591
13593 {
13594 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13595 }
13596
13599 {
13601 }
13602
13604 {
13606 }
13607
13609 {
13611 }
13612
13615 {
13616 return null;
13617 }
13618
13621 {
13622 return false;
13623 }
13624
13626 {
13628 {
13631 if (!trg)
13632 {
13634 explosive = this;
13635 }
13636
13637 explosive.PairRemote(trg);
13639
13640 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13641 trg.SetPersistentPairID(persistentID);
13642 explosive.SetPersistentPairID(persistentID);
13643
13644 return true;
13645 }
13646 return false;
13647 }
13648
13651 {
13652 float ret = 1.0;
13655 ret *= GetHealth01();
13656
13657 return ret;
13658 }
13659
13660 #ifdef DEVELOPER
13661 override void SetDebugItem()
13662 {
13663 super.SetDebugItem();
13664 _itemBase = this;
13665 }
13666
13668 {
13669 string text = super.GetDebugText();
13670
13672 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13673
13674 return text;
13675 }
13676 #endif
13677
13679 {
13680 return true;
13681 }
13682
13684
13686
13688 {
13691 }
13692
13693
13701
13717
13718 [
Obsolete(
"Use ItemSoundHandler instead")]
13721 {
13722 if (!
g_Game.IsDedicatedServer())
13723 {
13724 if (ConfigIsExisting("attachSoundSet"))
13725 {
13726 string cfg_path = "";
13727 string soundset = "";
13728 string type_name =
GetType();
13729
13732 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13733 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13734
13735 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13736 {
13737 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13738 {
13739 if (cfg_slot_array[i] == slot_type)
13740 {
13741 soundset = cfg_soundset_array[i];
13742 break;
13743 }
13744 }
13745 }
13746
13747 if (soundset != "")
13748 {
13749 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13751 }
13752 }
13753 }
13754 }
13755
13757}
13758
13760{
13762 if (entity)
13763 {
13764 bool is_item = entity.IsInherited(
ItemBase);
13765 if (is_item && full_quantity)
13766 {
13769 }
13770 }
13771 else
13772 {
13774 return NULL;
13775 }
13776 return entity;
13777}
13778
13780{
13781 if (item)
13782 {
13783 if (health > 0)
13784 item.SetHealth("", "", health);
13785
13786 if (item.CanHaveTemperature())
13787 {
13789 if (item.CanFreeze())
13790 item.SetFrozen(false);
13791 }
13792
13793 if (item.HasEnergyManager())
13794 {
13795 if (quantity >= 0)
13796 {
13797 item.GetCompEM().SetEnergy0To1(quantity);
13798 }
13799 else
13800 {
13802 }
13803 }
13804 else if (item.IsMagazine())
13805 {
13806 Magazine mag = Magazine.Cast(item);
13807 if (quantity >= 0)
13808 {
13809 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13810 }
13811 else
13812 {
13814 }
13815
13816 }
13817 else
13818 {
13819 if (quantity >= 0)
13820 {
13821 item.SetQuantityNormalized(quantity, false);
13822 }
13823 else
13824 {
13826 }
13827
13828 }
13829 }
13830}
13831
13832#ifdef DEVELOPER
13834#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.