8683{
8685 {
8686 return true;
8687 }
8688};
8689
8691{
8692
8693};
8694
8695
8696
8698{
8702
8704
8707
8708
8709
8710
8711
8720
8726
8731
8736
8757 protected bool m_IsResultOfSplit
8758
8760
8765
8766
8767
8769
8773
8774
8775
8777
8780
8781
8782
8788
8789
8797
8800
8801
8803
8804
8806
8807
8812
8813
8818
8820
8821
8823
8824
8826 {
8831
8832 if (!
g_Game.IsDedicatedServer())
8833 {
8835 {
8837
8839 {
8841 }
8842 }
8843
8846 }
8847
8848 m_OldLocation = null;
8849
8851 {
8853 }
8854
8855 if (ConfigIsExisting("headSelectionsToHide"))
8856 {
8859 }
8860
8862 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8863 {
8865 }
8866
8868
8869 m_IsResultOfSplit = false;
8870
8872 }
8873
8875 {
8876 super.InitItemVariables();
8877
8883 m_Count = ConfigGetInt(
"count");
8884
8887
8892
8895
8900
8912
8916
8917
8920 if (ConfigIsExisting("canBeSplit"))
8921 {
8924 }
8925
8927 if (ConfigIsExisting("itemBehaviour"))
8929
8930
8933 RegisterNetSyncVariableInt("m_VarLiquidType");
8934 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8935
8936 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8937 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8938 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8939
8940 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8941 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8942 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8943 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8944
8945 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8946 RegisterNetSyncVariableBool("m_IsTakeable");
8947 RegisterNetSyncVariableBool("m_IsHologram");
8948
8951 {
8954 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8955 }
8956
8958
8960 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8962
8964 }
8965
8967 {
8969 }
8970
8972 {
8975 {
8980 }
8981 }
8982
8983 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8984 {
8986 {
8989 }
8990
8992 }
8993
8995 {
9001 }
9002
9004
9006 {
9008
9009 if (!action)
9010 {
9011 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9012 return;
9013 }
9014
9016 if (!ai)
9017 {
9019 return;
9020 }
9021
9023 if (!action_array)
9024 {
9025 action_array = new array<ActionBase_Basic>;
9027 }
9028 if (LogManager.IsActionLogEnable())
9029 {
9030 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9031 }
9032
9033 if (action_array.Find(action) != -1)
9034 {
9035 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9036 }
9037 else
9038 {
9039 action_array.Insert(action);
9040 }
9041 }
9042
9044 {
9045 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9046 ActionBase action = player.GetActionManager().GetAction(actionName);
9049
9050 if (action_array)
9051 {
9052 action_array.RemoveItem(action);
9053 }
9054 }
9055
9056
9057
9059 {
9060 ActionOverrideData overrideData = new ActionOverrideData();
9064
9066 if (!actionMap)
9067 {
9070 }
9071
9072 actionMap.Insert(this.
Type(), overrideData);
9073
9074 }
9075
9077
9079
9080
9082 {
9085
9088
9089 string config_to_search = "CfgVehicles";
9090 string muzzle_owner_config;
9091
9093 {
9094 if (IsInherited(Weapon))
9095 config_to_search = "CfgWeapons";
9096
9097 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9098
9099 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9100
9101 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9102
9103 if (config_OnFire_subclass_count > 0)
9104 {
9105 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9106
9107 for (int i = 0; i < config_OnFire_subclass_count; i++)
9108 {
9109 string particle_class = "";
9110 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9111 string config_OnFire_entry = config_OnFire_class + particle_class;
9112 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9113 WPOF_array.Insert(WPOF);
9114 }
9115
9116
9118 }
9119 }
9120
9122 {
9123 config_to_search = "CfgWeapons";
9124 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9125
9126 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9127
9128 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9129
9130 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9131 {
9132 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9133
9134 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9135 {
9136 string particle_class2 = "";
9137 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9138 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9139 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9140 WPOBE_array.Insert(WPOBE);
9141 }
9142
9143
9145 }
9146 }
9147 }
9148
9149
9151 {
9154
9156 {
9157 string config_to_search = "CfgVehicles";
9158
9159 if (IsInherited(Weapon))
9160 config_to_search = "CfgWeapons";
9161
9162 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9163 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9164
9165 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9166 {
9167
9169
9171 {
9173 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9175 return;
9176 }
9177
9180
9181
9182
9183 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9184 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9185
9186 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9187 {
9188 string particle_class = "";
9189 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9190 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9191 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9192
9193 if (entry_type == CT_CLASS)
9194 {
9195 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9196 WPOOH_array.Insert(WPOF);
9197 }
9198 }
9199
9200
9202 }
9203 }
9204 }
9205
9207 {
9209 }
9210
9212 {
9214 {
9216
9219
9222
9223 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9224 }
9225 }
9226
9228 {
9230 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9231
9233 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9234
9236 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9237
9239 {
9241 }
9242 }
9243
9245 {
9247 }
9248
9250 {
9253 else
9255
9257 {
9260 }
9261 else
9262 {
9265
9268 }
9269
9271 }
9272
9274 {
9276 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9277 }
9278
9280 {
9282 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9284 }
9285
9287 {
9289 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9290 }
9291
9293 {
9296
9297 OverheatingParticle OP = new OverheatingParticle();
9302
9304 }
9305
9307 {
9310
9311 return -1;
9312 }
9313
9315 {
9317 {
9320
9321 for (int i = count; i > 0; --i)
9322 {
9323 int id = i - 1;
9326
9329
9330 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9331 {
9332 if (p)
9333 {
9336 }
9337 }
9338 }
9339 }
9340 }
9341
9343 {
9345 {
9347 {
9348 int id = i - 1;
9350
9351 if (OP)
9352 {
9354
9355 if (p)
9356 {
9358 }
9359
9360 delete OP;
9361 }
9362 }
9363
9366 }
9367 }
9368
9371 {
9372 return 0.0;
9373 }
9374
9375
9377 {
9378 return 250;
9379 }
9380
9382 {
9383 return 0;
9384 }
9385
9388 {
9390 return true;
9391
9392 return false;
9393 }
9394
9397 {
9400
9402 {
9404 }
9405 else
9406 {
9407
9409 }
9410
9412 }
9413
9420 {
9421 return -1;
9422 }
9423
9424
9425
9426
9428 {
9430 {
9431 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9432 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9433
9434 if (r_index >= 0)
9435 {
9436 InventoryLocation r_il = new InventoryLocation;
9437 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9438
9439 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9442 {
9443 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9444 }
9446 {
9447 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9448 }
9449
9450 }
9451
9452 player.GetHumanInventory().ClearUserReservedLocation(this);
9453 }
9454
9457 }
9458
9459
9460
9461
9463 {
9464 return ItemBase.m_DebugActionsMask;
9465 }
9466
9468 {
9469 return ItemBase.m_DebugActionsMask & mask;
9470 }
9471
9473 {
9474 ItemBase.m_DebugActionsMask = mask;
9475 }
9476
9478 {
9479 ItemBase.m_DebugActionsMask |= mask;
9480 }
9481
9483 {
9484 ItemBase.m_DebugActionsMask &= ~mask;
9485 }
9486
9488 {
9490 {
9492 }
9493 else
9494 {
9496 }
9497 }
9498
9499
9501 {
9502 if (GetEconomyProfile())
9503 {
9504 float q_max = GetEconomyProfile().GetQuantityMax();
9505 if (q_max > 0)
9506 {
9507 float q_min = GetEconomyProfile().GetQuantityMin();
9508 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9509
9511 {
9512 ComponentEnergyManager comp = GetCompEM();
9514 {
9516 }
9517 }
9519 {
9521
9522 }
9523
9524 }
9525 }
9526 }
9527
9530 {
9531 EntityAI parent = GetHierarchyParent();
9532
9533 if (parent)
9534 {
9535 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9536 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9537 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9538 }
9539 }
9540
9543 {
9544 EntityAI parent = GetHierarchyParent();
9545
9546 if (parent)
9547 {
9548 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9549 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9550 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9551 }
9552 }
9553
9555 {
9556
9557
9558
9559
9561
9563 {
9564 if (ScriptInputUserData.CanStoreInputUserData())
9565 {
9566 ScriptInputUserData ctx = new ScriptInputUserData;
9572 ctx.
Write(use_stack_max);
9575
9577 {
9578 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9579 }
9580 }
9581 }
9582 else if (!
g_Game.IsMultiplayer())
9583 {
9585 }
9586 }
9587
9589 {
9591 }
9592
9594 {
9596 }
9597
9599 {
9601 }
9602
9604 {
9605
9606 return false;
9607 }
9608
9610 {
9611 return false;
9612 }
9613
9617 {
9618 return false;
9619 }
9620
9622 {
9623 return "";
9624 }
9625
9627
9629 {
9630 return false;
9631 }
9632
9634 {
9635 return true;
9636 }
9637
9638
9639
9641 {
9642 return true;
9643 }
9644
9646 {
9647 return true;
9648 }
9649
9651 {
9652 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9654 }
9655
9657 {
9659 }
9660
9662 {
9664 if (!is_being_placed)
9666 SetSynchDirty();
9667 }
9668
9669
9671
9673 {
9675 }
9676
9678 {
9680 }
9681
9683 {
9684 return 1;
9685 }
9686
9688 {
9689 return false;
9690 }
9691
9693 {
9695 SetSynchDirty();
9696 }
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9733 {
9734 super.OnMovedInsideCargo(container);
9735
9736 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9737 }
9738
9739 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9740 {
9741 super.EEItemLocationChanged(oldLoc, newLoc);
9742
9743 PlayerBase newPlayer = null;
9744 PlayerBase oldPlayer = null;
9745
9746 if (newLoc.GetParent())
9747 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9748
9749 if (oldLoc.GetParent())
9750 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9751
9753 {
9754 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9755
9756 if (rIndex >= 0)
9757 {
9758 InventoryLocation rIl = new InventoryLocation;
9759 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9760
9761 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9764 {
9765 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9766 }
9768 {
9770 }
9771
9772 }
9773 }
9774
9776 {
9777 if (newPlayer)
9778 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9779
9780 if (newPlayer == oldPlayer)
9781 {
9782 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9783 {
9785 {
9786 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9787 {
9788 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9789 }
9790 }
9791 else
9792 {
9793 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9794 }
9795 }
9796
9797 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9798 {
9799 int type = oldLoc.GetType();
9801 {
9802 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9803 }
9805 {
9806 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9807 }
9808 }
9809 if (!m_OldLocation)
9810 {
9811 m_OldLocation = new InventoryLocation;
9812 }
9813 m_OldLocation.Copy(oldLoc);
9814 }
9815 else
9816 {
9817 if (m_OldLocation)
9818 {
9819 m_OldLocation.Reset();
9820 }
9821 }
9822
9823 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9824 }
9825 else
9826 {
9827 if (newPlayer)
9828 {
9829 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9830 if (resIndex >= 0)
9831 {
9832 InventoryLocation il = new InventoryLocation;
9833 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9835 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9838 {
9839 il.
GetParent().GetOnReleaseLock().Invoke(it);
9840 }
9842 {
9844 }
9845
9846 }
9847 }
9849 {
9850
9852 }
9853
9854 if (m_OldLocation)
9855 {
9856 m_OldLocation.Reset();
9857 }
9858 }
9859
9861 {
9862 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9863 }
9864
9866 {
9867 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9868 }
9869 }
9870
9871 override void EOnContact(IEntity other, Contact extra)
9872 {
9874 {
9875 int liquidType = -1;
9877 if (impactSpeed > 0.0)
9878 {
9880 #ifndef SERVER
9882 #else
9884 SetSynchDirty();
9885 #endif
9887 }
9888 }
9889
9890 #ifdef SERVER
9891 if (GetCompEM() && GetCompEM().IsPlugged())
9892 {
9893 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9894 GetCompEM().UnplugThis();
9895 }
9896 #endif
9897 }
9898
9900
9902 {
9904 }
9905
9907 {
9908
9909 }
9910
9912 {
9913 super.OnItemLocationChanged(old_owner, new_owner);
9914
9915 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9916 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9917
9918 if (!relatedPlayer && playerNew)
9919 relatedPlayer = playerNew;
9920
9921 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9922 {
9924 if (actionMgr)
9925 {
9926 ActionBase currentAction = actionMgr.GetRunningAction();
9927 if (currentAction)
9929 }
9930 }
9931
9932 Man ownerPlayerOld = null;
9933 Man ownerPlayerNew = null;
9934
9935 if (old_owner)
9936 {
9937 if (old_owner.
IsMan())
9938 {
9939 ownerPlayerOld = Man.Cast(old_owner);
9940 }
9941 else
9942 {
9943 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9944 }
9945 }
9946 else
9947 {
9949 {
9951
9952 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9953 {
9954 GetCompEM().UnplugThis();
9955 }
9956 }
9957 }
9958
9959 if (new_owner)
9960 {
9961 if (new_owner.
IsMan())
9962 {
9963 ownerPlayerNew = Man.Cast(new_owner);
9964 }
9965 else
9966 {
9967 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9968 }
9969 }
9970
9971 if (ownerPlayerOld != ownerPlayerNew)
9972 {
9973 if (ownerPlayerOld)
9974 {
9975 array<EntityAI> subItemsExit = new array<EntityAI>;
9977 for (int i = 0; i < subItemsExit.Count(); i++)
9978 {
9981 }
9982 }
9983
9984 if (ownerPlayerNew)
9985 {
9986 array<EntityAI> subItemsEnter = new array<EntityAI>;
9988 for (int j = 0; j < subItemsEnter.Count(); j++)
9989 {
9992 }
9993 }
9994 }
9995 else if (ownerPlayerNew != null)
9996 {
9997 PlayerBase nplayer;
9998 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9999 {
10000 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10002 for (int k = 0; k < subItemsUpdate.Count(); k++)
10003 {
10005 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10006 }
10007 }
10008 }
10009
10010 if (old_owner)
10011 old_owner.OnChildItemRemoved(this);
10012 if (new_owner)
10013 new_owner.OnChildItemReceived(this);
10014 }
10015
10016
10018 {
10019 super.EEDelete(parent);
10020 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10021 if (player)
10022 {
10024
10025 if (player.IsAlive())
10026 {
10027 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10028 if (r_index >= 0)
10029 {
10030 InventoryLocation r_il = new InventoryLocation;
10031 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10032
10033 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10036 {
10037 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10038 }
10040 {
10041 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10042 }
10043
10044 }
10045
10046 player.RemoveQuickBarEntityShortcut(this);
10047 }
10048 }
10049 }
10050
10052 {
10053 super.EEKilled(killer);
10054
10057 {
10058 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10059 {
10060 if (IsMagazine())
10061 {
10062 if (Magazine.Cast(this).GetAmmoCount() > 0)
10063 {
10065 }
10066 }
10067 else
10068 {
10070 }
10071 }
10072 }
10073 }
10074
10076 {
10077 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10078
10079 super.OnWasAttached(parent, slot_id);
10080
10083
10086 }
10087
10089 {
10090 super.OnWasDetached(parent, slot_id);
10091
10094
10097 }
10098
10100 {
10101 int idx;
10104
10105 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10106 if (inventory_slots.Count() < 1)
10107 {
10108 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10109 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10110 }
10111 else
10112 {
10113 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10114 }
10115
10116 idx = inventory_slots.Find(slot);
10117 if (idx < 0)
10118 return "";
10119
10120 return attach_types.Get(idx);
10121 }
10122
10124 {
10125 int idx = -1;
10126 string slot;
10127
10130
10131 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10132 if (inventory_slots.Count() < 1)
10133 {
10134 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10135 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10136 }
10137 else
10138 {
10139 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10140 if (detach_types.Count() < 1)
10141 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10142 }
10143
10144 for (int i = 0; i < inventory_slots.Count(); i++)
10145 {
10146 slot = inventory_slots.Get(i);
10147 }
10148
10149 if (slot != "")
10150 {
10151 if (detach_types.Count() == 1)
10152 idx = 0;
10153 else
10154 idx = inventory_slots.Find(slot);
10155 }
10156 if (idx < 0)
10157 return "";
10158
10159 return detach_types.Get(idx);
10160 }
10161
10163 {
10164
10166
10167
10168 float min_time = 1;
10169 float max_time = 3;
10170 float delay = Math.RandomFloat(min_time, max_time);
10171
10172 explode_timer.Run(delay, this, "DoAmmoExplosion");
10173 }
10174
10176 {
10177 Magazine magazine = Magazine.Cast(this);
10178 int pop_sounds_count = 6;
10179 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10180
10181
10182 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10183 string sound_name = pop_sounds[ sound_idx ];
10184 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10185
10186
10187 magazine.ServerAddAmmoCount(-1);
10188
10189
10190 float min_temp_to_explode = 100;
10191
10192 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10193 {
10195 }
10196 }
10197
10198
10199 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10200 {
10201 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10202
10203 const int CHANCE_DAMAGE_CARGO = 4;
10204 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10205 const int CHANCE_DAMAGE_NOTHING = 2;
10206
10208 {
10209 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10210 int chances;
10211 int rnd;
10212
10213 if (GetInventory().GetCargo())
10214 {
10215 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10216 rnd = Math.RandomInt(0,chances);
10217
10218 if (rnd < CHANCE_DAMAGE_CARGO)
10219 {
10221 }
10222 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10223 {
10225 }
10226 }
10227 else
10228 {
10229 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10230 rnd = Math.RandomInt(0,chances);
10231
10232 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10233 {
10235 }
10236 }
10237 }
10238 }
10239
10241 {
10242 CargoBase cargo = GetInventory().GetCargo();
10243 if (cargo)
10244 {
10246 if (item_count > 0)
10247 {
10248 int random_pick = Math.RandomInt(0, item_count);
10250 if (!item.IsExplosive())
10251 {
10252 item.AddHealth("","",damage);
10253 return true;
10254 }
10255 }
10256 }
10257 return false;
10258 }
10259
10261 {
10262 GameInventory inventory = GetInventory();
10264 if (attachment_count > 0)
10265 {
10266 int random_pick = Math.RandomInt(0, attachment_count);
10268 if (!attachment.IsExplosive())
10269 {
10270 attachment.AddHealth("","",damage);
10271 return true;
10272 }
10273 }
10274 return false;
10275 }
10276
10278 {
10280 }
10281
10283 {
10285 return GetInventory().CanRemoveEntity();
10286
10287 return false;
10288 }
10289
10291 {
10292
10294 return false;
10295
10296
10298 return false;
10299
10300
10301
10303 if (delta == 0)
10304 return false;
10305
10306
10307 return true;
10308 }
10309
10311 {
10313 {
10314 if (ScriptInputUserData.CanStoreInputUserData())
10315 {
10316 ScriptInputUserData ctx = new ScriptInputUserData;
10321 ctx.
Write(destination_entity);
10323 ctx.
Write(slot_id);
10325 }
10326 }
10327 else if (!
g_Game.IsMultiplayer())
10328 {
10330 }
10331 }
10332
10334 {
10335 float split_quantity_new;
10339 InventoryLocation loc = new InventoryLocation;
10340
10341 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10342 {
10344 split_quantity_new = stack_max;
10345 else
10347
10349 {
10350 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10351 if (new_item)
10352 {
10353 new_item.SetResultOfSplit(true);
10354 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10356 new_item.
SetQuantity(split_quantity_new,
false,
true);
10357 }
10358 }
10359 }
10360 else if (destination_entity && slot_id == -1)
10361 {
10362 if (quantity > stack_max)
10363 split_quantity_new = stack_max;
10364 else
10365 split_quantity_new = quantity;
10366
10368 {
10369 GameInventory destinationInventory = destination_entity.GetInventory();
10371 {
10374 }
10375
10376 if (new_item)
10377 {
10378 new_item.SetResultOfSplit(true);
10379 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10381 new_item.
SetQuantity(split_quantity_new,
false,
true);
10382 }
10383 }
10384 }
10385 else
10386 {
10387 if (stack_max != 0)
10388 {
10390 {
10392 }
10393
10394 if (split_quantity_new == 0)
10395 {
10396 if (!
g_Game.IsMultiplayer())
10397 player.PhysicalPredictiveDropItem(this);
10398 else
10399 player.ServerDropEntity(this);
10400 return;
10401 }
10402
10404 {
10406
10407 if (new_item)
10408 {
10409 new_item.SetResultOfSplit(true);
10410 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10413 new_item.PlaceOnSurface();
10414 }
10415 }
10416 }
10417 }
10418 }
10419
10421 {
10422 float split_quantity_new;
10426 InventoryLocation loc = new InventoryLocation;
10427
10428 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10429 {
10431 split_quantity_new = stack_max;
10432 else
10434
10436 {
10437 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10438 if (new_item)
10439 {
10440 new_item.SetResultOfSplit(true);
10441 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10443 new_item.
SetQuantity(split_quantity_new,
false,
true);
10444 }
10445 }
10446 }
10447 else if (destination_entity && slot_id == -1)
10448 {
10449 if (quantity > stack_max)
10450 split_quantity_new = stack_max;
10451 else
10452 split_quantity_new = quantity;
10453
10455 {
10456 GameInventory destinationInventory = destination_entity.GetInventory();
10458 {
10461 }
10462
10463 if (new_item)
10464 {
10465 new_item.SetResultOfSplit(true);
10466 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10468 new_item.
SetQuantity(split_quantity_new,
false,
true);
10469 }
10470 }
10471 }
10472 else
10473 {
10474 if (stack_max != 0)
10475 {
10477 {
10479 }
10480
10482 {
10484
10485 if (new_item)
10486 {
10487 new_item.SetResultOfSplit(true);
10488 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10491 new_item.PlaceOnSurface();
10492 }
10493 }
10494 }
10495 }
10496 }
10497
10499 {
10501 {
10502 if (ScriptInputUserData.CanStoreInputUserData())
10503 {
10504 ScriptInputUserData ctx = new ScriptInputUserData;
10509 dst.WriteToContext(ctx);
10511 }
10512 }
10513 else if (!
g_Game.IsMultiplayer())
10514 {
10516 }
10517 }
10518
10520 {
10522 {
10523 if (ScriptInputUserData.CanStoreInputUserData())
10524 {
10525 ScriptInputUserData ctx = new ScriptInputUserData;
10530 ctx.
Write(destination_entity);
10536 }
10537 }
10538 else if (!
g_Game.IsMultiplayer())
10539 {
10541 }
10542 }
10543
10545 {
10547 }
10548
10550 {
10552 float split_quantity_new;
10554 if (dst.IsValid())
10555 {
10556 int slot_id = dst.GetSlot();
10558
10559 if (quantity > stack_max)
10560 split_quantity_new = stack_max;
10561 else
10562 split_quantity_new = quantity;
10563
10565 {
10567
10568 if (new_item)
10569 {
10570 new_item.SetResultOfSplit(true);
10571 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10573 new_item.
SetQuantity(split_quantity_new,
false,
true);
10574 }
10575
10576 return new_item;
10577 }
10578 }
10579
10580 return null;
10581 }
10582
10584 {
10586 float split_quantity_new;
10588 if (destination_entity)
10589 {
10591 if (quantity > stackable)
10592 split_quantity_new = stackable;
10593 else
10594 split_quantity_new = quantity;
10595
10597 {
10598 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10599 if (new_item)
10600 {
10601 new_item.SetResultOfSplit(true);
10602 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10604 new_item.
SetQuantity(split_quantity_new,
false,
true);
10605 }
10606 }
10607 }
10608 }
10609
10611 {
10613 {
10614 if (ScriptInputUserData.CanStoreInputUserData())
10615 {
10616 ScriptInputUserData ctx = new ScriptInputUserData;
10621 ItemBase destination_entity =
this;
10622 ctx.
Write(destination_entity);
10626 }
10627 }
10628 else if (!
g_Game.IsMultiplayer())
10629 {
10631 }
10632 }
10633
10635 {
10637 float split_quantity_new;
10639 if (player)
10640 {
10642 if (quantity > stackable)
10643 split_quantity_new = stackable;
10644 else
10645 split_quantity_new = quantity;
10646
10648 {
10649 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10650 new_item =
ItemBase.Cast(in_hands);
10651 if (new_item)
10652 {
10653 new_item.SetResultOfSplit(true);
10654 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10656 new_item.SetQuantity(split_quantity_new, false, true);
10657 }
10658 }
10659 }
10660 }
10661
10663 {
10665 float split_quantity_new = Math.Floor(quantity * 0.5);
10666
10668 return;
10669
10671
10672 if (new_item)
10673 {
10674 if (new_item.GetQuantityMax() < split_quantity_new)
10675 {
10676 split_quantity_new = new_item.GetQuantityMax();
10677 }
10678
10679 new_item.SetResultOfSplit(true);
10680 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10681
10683 {
10686 }
10687 else
10688 {
10690 new_item.
SetQuantity(split_quantity_new,
false,
true);
10691 }
10692 }
10693 }
10694
10696 {
10698 float split_quantity_new = Math.Floor(quantity / 2);
10699
10701 return;
10702
10703 InventoryLocation invloc = new InventoryLocation;
10705
10707 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10708
10709 if (new_item)
10710 {
10711 if (new_item.GetQuantityMax() < split_quantity_new)
10712 {
10713 split_quantity_new = new_item.GetQuantityMax();
10714 }
10716 {
10719 }
10720 else if (split_quantity_new > 1)
10721 {
10723 new_item.
SetQuantity(split_quantity_new,
false,
true);
10724 }
10725 }
10726 }
10727
10730 {
10731 SetWeightDirty();
10733
10734 if (parent)
10735 parent.OnAttachmentQuantityChangedEx(this, delta);
10736
10738 {
10740 {
10742 }
10744 {
10745 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10747 }
10748 }
10749 }
10750
10753 {
10754
10755 }
10756
10759 {
10761 }
10762
10764 {
10765 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10766
10768 {
10769 if (newLevel == GameConstants.STATE_RUINED)
10770 {
10772 EntityAI parent = GetHierarchyParent();
10773 if (parent && parent.IsFireplace())
10774 {
10775 CargoBase cargo = GetInventory().GetCargo();
10776 if (cargo)
10777 {
10779 {
10781 }
10782 }
10783 }
10784 }
10785
10787 {
10788
10790 return;
10791 }
10792
10793 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10794 {
10796 }
10797 }
10798 }
10799
10800
10802 {
10803 super.OnRightClick();
10804
10806 {
10808 {
10809 if (ScriptInputUserData.CanStoreInputUserData())
10810 {
10811 EntityAI root = GetHierarchyRoot();
10812 Man playerOwner = GetHierarchyRootPlayer();
10813 InventoryLocation dst = new InventoryLocation;
10814
10815
10816 if (!playerOwner && root && root == this)
10817 {
10819 }
10820 else
10821 {
10822
10823 GetInventory().GetCurrentInventoryLocation(dst);
10825 {
10826 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10828 {
10830 }
10831 else
10832 {
10834
10835
10836 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10837 {
10839 }
10840 else
10841 {
10842 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10843 }
10844 }
10845 }
10846 }
10847
10848 ScriptInputUserData ctx = new ScriptInputUserData;
10856 }
10857 }
10858 else if (!
g_Game.IsMultiplayer())
10859 {
10861 }
10862 }
10863 }
10864
10866 {
10867 if (root)
10868 {
10869 vector m4[4];
10870 root.GetTransform(m4);
10871 dst.SetGround(this, m4);
10872 }
10873 else
10874 {
10875 GetInventory().GetCurrentInventoryLocation(dst);
10876 }
10877 }
10878
10879 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10880 {
10881
10882 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10883 return false;
10884
10885 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10886 return false;
10887
10888
10890 return false;
10891
10892
10893 Magazine mag = Magazine.Cast(this);
10894 if (mag)
10895 {
10896 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10897 return false;
10898
10899 if (stack_max_limit)
10900 {
10901 Magazine other_mag = Magazine.Cast(other_item);
10902 if (other_item)
10903 {
10904 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10905 return false;
10906 }
10907
10908 }
10909 }
10910 else
10911 {
10912
10914 return false;
10915
10917 return false;
10918 }
10919
10920 PlayerBase player = null;
10921 if (CastTo(player, GetHierarchyRootPlayer()))
10922 {
10923 if (player.GetInventory().HasAttachment(this))
10924 return false;
10925
10926 if (player.IsItemsToDelete())
10927 return false;
10928 }
10929
10930 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10931 return false;
10932
10933 int slotID;
10935 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10936 return false;
10937
10938 return true;
10939 }
10940
10942 {
10944 }
10945
10947 {
10948 return m_IsResultOfSplit;
10949 }
10950
10952 {
10953 m_IsResultOfSplit = value;
10954 }
10955
10957 {
10959 }
10960
10962 {
10963 float other_item_quantity = other_item.GetQuantity();
10964 float this_free_space;
10965
10967
10969
10970 if (other_item_quantity > this_free_space)
10971 {
10972 return this_free_space;
10973 }
10974 else
10975 {
10976 return other_item_quantity;
10977 }
10978 }
10979
10981 {
10983 }
10984
10986 {
10988 return;
10989
10990 if (!IsMagazine() && other_item)
10991 {
10993 if (quantity_used != 0)
10994 {
10995 float hp1 = GetHealth01("","");
10996 float hp2 = other_item.GetHealth01("","");
10997 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10998 hpResult = hpResult / (
GetQuantity() + quantity_used);
10999
11000 hpResult *= GetMaxHealth();
11001 Math.Round(hpResult);
11002 SetHealth("", "Health", hpResult);
11003
11005 other_item.AddQuantity(-quantity_used);
11006 }
11007 }
11009 }
11010
11012 {
11013 #ifdef SERVER
11014 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11015 GetHierarchyParent().IncreaseLifetimeUp();
11016 #endif
11017 };
11018
11020 {
11021 PlayerBase p = PlayerBase.Cast(player);
11022
11023 array<int> recipesIds = p.m_Recipes;
11024 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11025 if (moduleRecipesManager)
11026 {
11027 EntityAI itemInHands = player.GetEntityInHands();
11028 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11029 }
11030
11031 for (int i = 0;i < recipesIds.Count(); i++)
11032 {
11033 int key = recipesIds.Get(i);
11034 string recipeName = moduleRecipesManager.GetRecipeName(key);
11036 }
11037 }
11038
11039
11040 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11041 {
11042 super.GetDebugActions(outputList);
11043
11044
11050
11051
11056
11061
11062
11066
11067
11069 {
11073 }
11074
11077
11078
11082
11084
11085 InventoryLocation loc = new InventoryLocation();
11086 GetInventory().GetCurrentInventoryLocation(loc);
11088 {
11089 if (Gizmo_IsSupported())
11092 }
11093
11095 }
11096
11097
11098
11099
11101 {
11102 super.OnAction(action_id, player, ctx);
11103
11105 {
11106 switch (action_id)
11107 {
11111 return true;
11115 return true;
11116 }
11117 }
11118
11120 {
11121 switch (action_id)
11122 {
11124 Delete();
11125 return true;
11126 }
11127 }
11128
11129 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11130 {
11131 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11132 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11133 PlayerBase p = PlayerBase.Cast(player);
11134 if (
EActions.RECIPES_RANGE_START < 1000)
11135 {
11136 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11137 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11138 }
11139 }
11140 #ifndef SERVER
11141 else if (action_id ==
EActions.WATCH_PLAYER)
11142 {
11143 PluginDeveloper.SetDeveloperItemClientEx(player);
11144 }
11145 #endif
11147 {
11148 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11149 {
11150 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11151 OnDebugButtonPressServer(id + 1);
11152 }
11153
11154 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11155 {
11156 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11158 }
11159
11160 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11161 {
11162 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11164 }
11165
11166 else if (action_id ==
EActions.ADD_QUANTITY)
11167 {
11168 if (IsMagazine())
11169 {
11170 Magazine mag = Magazine.Cast(this);
11171 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11172 }
11173 else
11174 {
11176 }
11177
11178 if (m_EM)
11179 {
11180 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11181 }
11182
11183 }
11184
11185 else if (action_id ==
EActions.REMOVE_QUANTITY)
11186 {
11187 if (IsMagazine())
11188 {
11189 Magazine mag2 = Magazine.Cast(this);
11190 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11191 }
11192 else
11193 {
11195 }
11196 if (m_EM)
11197 {
11198 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11199 }
11200
11201 }
11202
11203 else if (action_id ==
EActions.SET_QUANTITY_0)
11204 {
11206
11207 if (m_EM)
11208 {
11209 m_EM.SetEnergy(0);
11210 }
11211 }
11212
11213 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11214 {
11216
11217 if (m_EM)
11218 {
11219 m_EM.SetEnergy(m_EM.GetEnergyMax());
11220 }
11221 }
11222
11223 else if (action_id ==
EActions.ADD_HEALTH)
11224 {
11225 AddHealth("","",GetMaxHealth("","Health")/5);
11226 }
11227 else if (action_id ==
EActions.REMOVE_HEALTH)
11228 {
11229 AddHealth("","",-GetMaxHealth("","Health")/5);
11230 }
11231 else if (action_id ==
EActions.DESTROY_HEALTH)
11232 {
11233 SetHealth01("","",0);
11234 }
11235 else if (action_id ==
EActions.WATCH_ITEM)
11236 {
11238 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11239 #ifdef DEVELOPER
11240 SetDebugDeveloper_item(this);
11241 #endif
11242 }
11243
11244 else if (action_id ==
EActions.ADD_TEMPERATURE)
11245 {
11246 AddTemperature(20);
11247
11248 }
11249
11250 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11251 {
11252 AddTemperature(-20);
11253
11254 }
11255
11256 else if (action_id ==
EActions.FLIP_FROZEN)
11257 {
11258 SetFrozen(!GetIsFrozen());
11259
11260 }
11261
11262 else if (action_id ==
EActions.ADD_WETNESS)
11263 {
11265
11266 }
11267
11268 else if (action_id ==
EActions.REMOVE_WETNESS)
11269 {
11271
11272 }
11273
11274 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11275 {
11278
11279
11280 }
11281
11282 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11283 {
11286 }
11287
11288 else if (action_id ==
EActions.MAKE_SPECIAL)
11289 {
11290 auto debugParams = DebugSpawnParams.WithPlayer(player);
11291 OnDebugSpawnEx(debugParams);
11292 }
11293
11294 }
11295
11296
11297 return false;
11298 }
11299
11300
11301
11302
11306
11309
11310
11311
11313 {
11314 return false;
11315 }
11316
11317
11319 {
11320 return true;
11321 }
11322
11323
11325 {
11326 return true;
11327 }
11328
11329
11330
11332 {
11333 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11334 return g_Game.ConfigIsExisting(config_path);
11335 }
11336
11339 {
11340 return null;
11341 }
11342
11344 {
11345 return false;
11346 }
11347
11349 {
11350 return false;
11351 }
11352
11356
11357
11359 {
11360 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11361 return module_repairing.CanRepair(this, item_repair_kit);
11362 }
11363
11364
11365 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11366 {
11367 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11368 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11369 }
11370
11371
11373 {
11374
11375
11376
11377
11378
11379
11380
11381
11382 return 1;
11383 }
11384
11385
11386
11388 {
11390 }
11391
11392
11393
11395 {
11397 }
11398
11399
11408 {
11409 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11410
11411 if (player)
11412 {
11413 player.MessageStatus(text);
11414 }
11415 }
11416
11417
11426 {
11427 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11428
11429 if (player)
11430 {
11431 player.MessageAction(text);
11432 }
11433 }
11434
11435
11444 {
11445 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11446
11447 if (player)
11448 {
11449 player.MessageFriendly(text);
11450 }
11451 }
11452
11453
11462 {
11463 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11464
11465 if (player)
11466 {
11467 player.MessageImportant(text);
11468 }
11469 }
11470
11472 {
11473 return true;
11474 }
11475
11476
11477 override bool KindOf(
string tag)
11478 {
11479 bool found = false;
11480 string item_name = this.
GetType();
11482 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11483
11484 int array_size = item_tag_array.Count();
11485 for (int i = 0; i < array_size; i++)
11486 {
11487 if (item_tag_array.Get(i) == tag)
11488 {
11489 found = true;
11490 break;
11491 }
11492 }
11493 return found;
11494 }
11495
11496
11498 {
11499
11500 super.OnRPC(sender, rpc_type,ctx);
11501
11502
11503 switch (rpc_type)
11504 {
11505 #ifndef SERVER
11506 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11507 Param2<bool, string> p = new Param2<bool, string>(false, "");
11508
11510 return;
11511
11512 bool play = p.param1;
11513 string soundSet = p.param2;
11514
11515 if (play)
11516 {
11518 {
11520 {
11522 }
11523 }
11524 else
11525 {
11527 }
11528 }
11529 else
11530 {
11532 }
11533
11534 break;
11535 #endif
11536
11537 }
11538
11540 {
11542 }
11543 }
11544
11545
11546
11547
11549 {
11550 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11551 return plugin.GetID(
name);
11552 }
11553
11555 {
11556 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11557 return plugin.GetName(id);
11558 }
11559
11562 {
11563
11564
11565 int varFlags;
11566 if (!ctx.
Read(varFlags))
11567 return;
11568
11569 if (varFlags & ItemVariableFlags.FLOAT)
11570 {
11572 }
11573 }
11574
11576 {
11577
11578 super.SerializeNumericalVars(floats_out);
11579
11580
11581
11583 {
11585 }
11586
11588 {
11590 }
11591
11593 {
11595 }
11596
11598 {
11603 }
11604
11606 {
11608 }
11609 }
11610
11612 {
11613
11614 super.DeSerializeNumericalVars(floats);
11615
11616
11617 int index = 0;
11618 int mask = Math.Round(floats.Get(index));
11619
11620 index++;
11621
11623 {
11625 {
11627 }
11628 else
11629 {
11630 float quantity = floats.Get(index);
11631 SetQuantity(quantity,
true,
false,
false,
false);
11632 }
11633 index++;
11634 }
11635
11637 {
11638 float wet = floats.Get(index);
11640 index++;
11641 }
11642
11644 {
11645 int liquidtype = Math.Round(floats.Get(index));
11647 index++;
11648 }
11649
11651 {
11653 index++;
11655 index++;
11657 index++;
11659 index++;
11660 }
11661
11663 {
11664 int cleanness = Math.Round(floats.Get(index));
11666 index++;
11667 }
11668 }
11669
11671 {
11672 super.WriteVarsToCTX(ctx);
11673
11674
11676 {
11678 }
11679
11681 {
11683 }
11684
11686 {
11688 }
11689
11691 {
11692 int r,g,b,a;
11698 }
11699
11701 {
11703 }
11704 }
11705
11707 {
11708 if (!super.ReadVarsFromCTX(ctx,version))
11709 return false;
11710
11711 int intValue;
11712 float value;
11713
11714 if (version < 140)
11715 {
11716 if (!ctx.
Read(intValue))
11717 return false;
11718
11719 m_VariablesMask = intValue;
11720 }
11721
11723 {
11724 if (!ctx.
Read(value))
11725 return false;
11726
11728 {
11730 }
11731 else
11732 {
11734 }
11735 }
11736
11737 if (version < 140)
11738 {
11740 {
11741 if (!ctx.
Read(value))
11742 return false;
11743 SetTemperatureDirect(value);
11744 }
11745 }
11746
11748 {
11749 if (!ctx.
Read(value))
11750 return false;
11752 }
11753
11755 {
11756 if (!ctx.
Read(intValue))
11757 return false;
11759 }
11760
11762 {
11763 int r,g,b,a;
11765 return false;
11767 return false;
11769 return false;
11771 return false;
11772
11774 }
11775
11777 {
11778 if (!ctx.
Read(intValue))
11779 return false;
11781 }
11782
11783 if (version >= 138 && version < 140)
11784 {
11786 {
11787 if (!ctx.
Read(intValue))
11788 return false;
11789 SetFrozen(intValue);
11790 }
11791 }
11792
11793 return true;
11794 }
11795
11796
11798 {
11801 {
11803 }
11804
11805 if (!super.OnStoreLoad(ctx, version))
11806 {
11808 return false;
11809 }
11810
11811 if (version >= 114)
11812 {
11813 bool hasQuickBarIndexSaved;
11814
11815 if (!ctx.
Read(hasQuickBarIndexSaved))
11816 {
11818 return false;
11819 }
11820
11821 if (hasQuickBarIndexSaved)
11822 {
11823 int itmQBIndex;
11824
11825
11826 if (!ctx.
Read(itmQBIndex))
11827 {
11829 return false;
11830 }
11831
11832 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11833 if (itmQBIndex != -1 && parentPlayer)
11834 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11835 }
11836 }
11837 else
11838 {
11839
11840 PlayerBase player;
11841 int itemQBIndex;
11842 if (version ==
int.
MAX)
11843 {
11844 if (!ctx.
Read(itemQBIndex))
11845 {
11847 return false;
11848 }
11849 }
11850 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11851 {
11852
11853 if (!ctx.
Read(itemQBIndex))
11854 {
11856 return false;
11857 }
11858 if (itemQBIndex != -1 && player)
11859 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11860 }
11861 }
11862
11863 if (version < 140)
11864 {
11865
11866 if (!LoadVariables(ctx, version))
11867 {
11869 return false;
11870 }
11871 }
11872
11873
11875 {
11877 return false;
11878 }
11879 if (version >= 132)
11880 {
11882 if (raib)
11883 {
11885 {
11887 return false;
11888 }
11889 }
11890 }
11891
11893 return true;
11894 }
11895
11896
11897
11899 {
11900 super.OnStoreSave(ctx);
11901
11902 PlayerBase player;
11903 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11904 {
11906
11907 int itemQBIndex = -1;
11908 itemQBIndex = player.FindQuickBarEntityIndex(this);
11909 ctx.
Write(itemQBIndex);
11910 }
11911 else
11912 {
11914 }
11915
11917
11919 if (raib)
11920 {
11922 }
11923 }
11924
11925
11927 {
11928 super.AfterStoreLoad();
11929
11931 {
11933 }
11934
11936 {
11939 }
11940 }
11941
11943 {
11944 super.EEOnAfterLoad();
11945
11947 {
11949 }
11950
11953 }
11954
11956 {
11957 return false;
11958 }
11959
11960
11961
11963 {
11965 {
11966 #ifdef PLATFORM_CONSOLE
11967
11969 {
11971 if (menu)
11972 {
11974 }
11975 }
11976 #endif
11977 }
11978
11980 {
11983 }
11984
11986 {
11987 SetWeightDirty();
11989 }
11991 {
11994 }
11995
11997 {
12000
12003 }
12005 {
12009 }
12010
12011 super.OnVariablesSynchronized();
12012 }
12013
12014
12015
12017 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12018 {
12019 if (!IsServerCheck(allow_client))
12020 return false;
12021
12023 return false;
12024
12027
12028 if (value <= (min + 0.001))
12029 value = min;
12030
12031 if (value == min)
12032 {
12033 if (destroy_config)
12034 {
12035 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12036 if (dstr)
12037 {
12039 this.Delete();
12040 return true;
12041 }
12042 }
12043 else if (destroy_forced)
12044 {
12046 this.Delete();
12047 return true;
12048 }
12049
12051 }
12052
12055
12057 {
12058 EntityAI parent = GetHierarchyRoot();
12059 InventoryLocation iLoc = new InventoryLocation();
12060 GetInventory().GetCurrentInventoryLocation(iLoc);
12062 {
12063 int iLocSlot = iLoc.
GetSlot();
12065 {
12067 }
12069 {
12071 }
12072 }
12073 }
12074
12076 {
12078
12079 if (delta)
12081 }
12082
12084
12085 return false;
12086 }
12087
12088
12090 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12091 {
12093 }
12094
12096 {
12099 }
12100
12102 {
12105 }
12106
12108 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12109 {
12110 float value_clamped = Math.Clamp(value, 0, 1);
12112 SetQuantity(result, destroy_config, destroy_forced);
12113 }
12114
12115
12118 {
12120 }
12121
12123 {
12125 }
12126
12127
12128
12129
12130
12131
12132
12133
12134
12135
12137 {
12138 int slot = -1;
12139 GameInventory inventory = GetInventory();
12140 if (inventory)
12141 {
12142 InventoryLocation il = new InventoryLocation;
12145 }
12146
12148 }
12149
12151 {
12152 float quantity_max = 0;
12153
12155 {
12156 if (attSlotID != -1)
12157 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12158
12159 if (quantity_max <= 0)
12161 }
12162
12163 if (quantity_max <= 0)
12165
12166 return quantity_max;
12167 }
12168
12170 {
12172 }
12173
12175 {
12177 }
12178
12179
12181 {
12183 }
12184
12186 {
12188 }
12189
12191 {
12193 }
12194
12195
12197 {
12198
12199 float weightEx = GetWeightEx();
12200 float special = GetInventoryAndCargoWeight();
12201 return weightEx - special;
12202 }
12203
12204
12206 {
12208 }
12209
12211 {
12213 {
12214 #ifdef DEVELOPER
12215 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12216 {
12217 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12219 }
12220 #endif
12221
12222 return GetQuantity() * GetConfigWeightModified();
12223 }
12224 else if (HasEnergyManager())
12225 {
12226 #ifdef DEVELOPER
12227 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12228 {
12229 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12230 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12231 }
12232 #endif
12233 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12234 }
12235 else
12236 {
12237 #ifdef DEVELOPER
12238 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12239 {
12240 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12241 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12242 }
12243 #endif
12244 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12245 }
12246 }
12247
12250 {
12251 int item_count = 0;
12253
12254 GameInventory inventory = GetInventory();
12255 CargoBase cargo = inventory.
GetCargo();
12256 if (cargo != NULL)
12257 {
12259 }
12260
12262 for (int i = 0; i < nAttachments; ++i)
12263 {
12265 if (item)
12266 item_count += item.GetNumberOfItems();
12267 }
12268 return item_count;
12269 }
12270
12273 {
12274 float weight = 0;
12275 float wetness = 1;
12276 if (include_wetness)
12279 {
12280 weight = wetness * m_ConfigWeight;
12281 }
12283 {
12284 weight = 1;
12285 }
12286 return weight;
12287 }
12288
12289
12290
12292 {
12293 GameInventory inventory = GetInventory();
12294 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12295 {
12296 array<EntityAI> items = new array<EntityAI>;
12298 for (int i = 0; i < items.Count(); ++i)
12299 {
12301 if (item)
12302 {
12303 g_Game.ObjectDelete(item);
12304 }
12305 }
12306 }
12307 }
12308
12309
12310
12311
12313 {
12314 float energy = 0;
12315 if (HasEnergyManager())
12316 {
12317 energy = GetCompEM().GetEnergy();
12318 }
12319 return energy;
12320 }
12321
12322
12324 {
12325 super.OnEnergyConsumed();
12326
12328 }
12329
12331 {
12332 super.OnEnergyAdded();
12333
12335 }
12336
12337
12339 {
12340 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12341 {
12343 {
12344 float energy_0to1 = GetCompEM().GetEnergy0To1();
12346 }
12347 }
12348 }
12349
12350
12352 {
12353 return ConfigGetFloat("heatIsolation");
12354 }
12355
12357 {
12359 }
12360
12362 {
12363 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12364 if (
g_Game.ConfigIsExisting(paramPath))
12365 return g_Game.ConfigGetFloat(paramPath);
12366
12367 return 0.0;
12368 }
12369
12371 {
12372 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12373 if (
g_Game.ConfigIsExisting(paramPath))
12374 return g_Game.ConfigGetFloat(paramPath);
12375
12376 return 0.0;
12377 }
12378
12379 override void SetWet(
float value,
bool allow_client =
false)
12380 {
12381 if (!IsServerCheck(allow_client))
12382 return;
12383
12386
12388
12389 m_VarWet = Math.Clamp(value, min, max);
12390
12392 {
12395 }
12396 }
12397
12398 override void AddWet(
float value)
12399 {
12401 }
12402
12404 {
12406 }
12407
12409 {
12411 }
12412
12414 {
12416 }
12417
12419 {
12421 }
12422
12424 {
12426 }
12427
12428 override void OnWetChanged(
float newVal,
float oldVal)
12429 {
12432 if (newLevel != oldLevel)
12433 {
12435 }
12436 }
12437
12439 {
12440 SetWeightDirty();
12441 }
12442
12444 {
12445 return GetWetLevelInternal(
m_VarWet);
12446 }
12447
12448
12449
12451 {
12453 }
12454
12456 {
12458 }
12459
12461 {
12463 }
12464
12466 {
12468 }
12469
12470
12471
12473 {
12474 if (ConfigIsExisting("itemModelLength"))
12475 {
12476 return ConfigGetFloat("itemModelLength");
12477 }
12478 return 0;
12479 }
12480
12482 {
12483 if (ConfigIsExisting("itemAttachOffset"))
12484 {
12485 return ConfigGetFloat("itemAttachOffset");
12486 }
12487 return 0;
12488 }
12489
12490 override void SetCleanness(
int value,
bool allow_client =
false)
12491 {
12492 if (!IsServerCheck(allow_client))
12493 return;
12494
12496
12498
12501 }
12502
12504 {
12506 }
12507
12509 {
12510 return true;
12511 }
12512
12513
12514
12515
12517 {
12519 }
12520
12522 {
12524 }
12525
12526
12527
12528
12529 override void SetColor(
int r,
int g,
int b,
int a)
12530 {
12536 }
12538 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12539 {
12544 }
12545
12547 {
12549 }
12550
12553 {
12554 int r,g,b,a;
12556 r = r/255;
12557 g = g/255;
12558 b = b/255;
12559 a = a/255;
12560 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12561 }
12562
12563
12564
12565 override void SetLiquidType(
int value,
bool allow_client =
false)
12566 {
12567 if (!IsServerCheck(allow_client))
12568 return;
12569
12574 }
12575
12577 {
12578 return ConfigGetInt("varLiquidTypeInit");
12579 }
12580
12582 {
12584 }
12585
12587 {
12589 SetFrozen(false);
12590 }
12591
12594 {
12595 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12596 }
12597
12598
12601 {
12602 PlayerBase nplayer;
12603 if (PlayerBase.CastTo(nplayer, player))
12604 {
12606 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12607 }
12608 }
12609
12610
12613 {
12614 PlayerBase nplayer;
12615 if (PlayerBase.CastTo(nplayer,player))
12616 {
12617 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12618 }
12619
12620 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12621
12622 if (HasEnergyManager())
12623 {
12624 GetCompEM().UpdatePlugState();
12625 }
12626 }
12627
12628
12630 {
12631 super.OnPlacementStarted(player);
12632
12634 }
12635
12636 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12637 {
12639 {
12640 m_AdminLog.OnPlacementComplete(player,
this);
12641 }
12642
12643 super.OnPlacementComplete(player, position, orientation);
12644 }
12645
12646
12647
12648
12649
12651 {
12653 {
12654 return true;
12655 }
12656 else
12657 {
12658 return false;
12659 }
12660 }
12661
12662
12664 {
12666 {
12668 }
12669 }
12670
12671
12673 {
12675 }
12676
12678 {
12680 }
12681
12682 override void InsertAgent(
int agent,
float count = 1)
12683 {
12684 if (count < 1)
12685 return;
12686
12688 }
12689
12692 {
12694 }
12695
12696
12698 {
12700 }
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12742
12744 {
12746 return false;
12747 return true;
12748 }
12749
12751 {
12752
12754 }
12755
12756
12759 {
12760 super.CheckForRoofLimited(timeTresholdMS);
12761
12762 float time =
g_Game.GetTime();
12763 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12764 {
12765 m_PreviousRoofTestTime = time;
12766 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12767 }
12768 }
12769
12770
12772 {
12774 {
12775 return 0;
12776 }
12777
12778 if (GetInventory().GetAttachmentSlotsCount() != 0)
12779 {
12780 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12781 if (filter)
12782 return filter.GetProtectionLevel(type, false, system);
12783 else
12784 return 0;
12785 }
12786
12787 string subclassPath, entryName;
12788
12789 switch (type)
12790 {
12792 entryName = "biological";
12793 break;
12795 entryName = "chemical";
12796 break;
12797 default:
12798 entryName = "biological";
12799 break;
12800 }
12801
12802 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12803
12804 return g_Game.ConfigGetFloat(subclassPath + entryName);
12805 }
12806
12807
12808
12811 {
12812 if (!IsMagazine())
12814
12816 }
12817
12818
12819
12820
12821
12826 {
12827 return true;
12828 }
12829
12831 {
12833 }
12834
12835
12836
12837
12838
12840 {
12841 if (parent)
12842 {
12843 if (parent.IsInherited(DayZInfected))
12844 return true;
12845
12846 if (!parent.IsRuined())
12847 return true;
12848 }
12849
12850 return true;
12851 }
12852
12854 {
12855 if (!super.CanPutAsAttachment(parent))
12856 {
12857 return false;
12858 }
12859
12860 if (!IsRuined() && !parent.IsRuined())
12861 {
12862 return true;
12863 }
12864
12865 return false;
12866 }
12867
12869 {
12870
12871
12872
12873
12874 return super.CanReceiveItemIntoCargo(item);
12875 }
12876
12878 {
12879
12880
12881
12882
12883 GameInventory attachmentInv = attachment.GetInventory();
12885 {
12886 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12887 return false;
12888 }
12889
12890 InventoryLocation loc = new InventoryLocation();
12891 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12892 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12893 return false;
12894
12895 return super.CanReceiveAttachment(attachment, slotId);
12896 }
12897
12899 {
12900 if (!super.CanReleaseAttachment(attachment))
12901 return false;
12902
12903 return GetInventory().AreChildrenAccessible();
12904 }
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12927 {
12928 int id = muzzle_owner.GetMuzzleID();
12929 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12930
12931 if (WPOF_array)
12932 {
12933 for (int i = 0; i < WPOF_array.Count(); i++)
12934 {
12935 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12936
12937 if (WPOF)
12938 {
12939 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12940 }
12941 }
12942 }
12943 }
12944
12945
12947 {
12948 int id = muzzle_owner.GetMuzzleID();
12950
12951 if (WPOBE_array)
12952 {
12953 for (int i = 0; i < WPOBE_array.Count(); i++)
12954 {
12955 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12956
12957 if (WPOBE)
12958 {
12959 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12960 }
12961 }
12962 }
12963 }
12964
12965
12967 {
12968 int id = muzzle_owner.GetMuzzleID();
12969 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12970
12971 if (WPOOH_array)
12972 {
12973 for (int i = 0; i < WPOOH_array.Count(); i++)
12974 {
12975 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12976
12977 if (WPOOH)
12978 {
12979 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12980 }
12981 }
12982 }
12983 }
12984
12985
12987 {
12988 int id = muzzle_owner.GetMuzzleID();
12989 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12990
12991 if (WPOOH_array)
12992 {
12993 for (int i = 0; i < WPOOH_array.Count(); i++)
12994 {
12995 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12996
12997 if (WPOOH)
12998 {
12999 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13000 }
13001 }
13002 }
13003 }
13004
13005
13007 {
13008 int id = muzzle_owner.GetMuzzleID();
13009 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13010
13011 if (WPOOH_array)
13012 {
13013 for (int i = 0; i < WPOOH_array.Count(); i++)
13014 {
13015 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13016
13017 if (WPOOH)
13018 {
13019 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13020 }
13021 }
13022 }
13023 }
13024
13025
13026
13028 {
13030 {
13031 return true;
13032 }
13033
13034 return false;
13035 }
13036
13038 {
13040 {
13041 return true;
13042 }
13043
13044 return false;
13045 }
13046
13048 {
13050 {
13051 return true;
13052 }
13053
13054 return false;
13055 }
13056
13058 {
13059 return false;
13060 }
13061
13064 {
13065 return UATimeSpent.DEFAULT_DEPLOY;
13066 }
13067
13068
13069
13070
13072 {
13074 SetSynchDirty();
13075 }
13076
13078 {
13080 }
13081
13082
13084 {
13085 return false;
13086 }
13087
13090 {
13091 string att_type = "None";
13092
13093 if (ConfigIsExisting("soundAttType"))
13094 {
13095 att_type = ConfigGetString("soundAttType");
13096 }
13097
13099 }
13100
13102 {
13104 }
13105
13106
13107
13108
13109
13115
13117 {
13120
13122 }
13123
13124
13126 {
13128 return;
13129
13131
13134
13137
13138 SoundParameters params = new SoundParameters();
13142 }
13143
13144
13146 {
13148 {
13151
13152 SetSynchDirty();
13153
13156 }
13157 }
13158
13160 {
13162 }
13163
13164
13166 {
13168 return;
13169
13171 SetSynchDirty();
13172
13175 }
13176
13178 {
13181 }
13182
13184 {
13186 }
13187
13188 void OnApply(PlayerBase player);
13189
13191 {
13192 return 1.0;
13193 };
13194
13196 {
13198 }
13199
13201 {
13203 }
13204
13206
13208 {
13209 SetDynamicPhysicsLifeTime(0.01);
13211 }
13212
13214 {
13215 array<string> zone_names = new array<string>;
13216 GetDamageZones(zone_names);
13217 for (int i = 0; i < zone_names.Count(); i++)
13218 {
13219 SetHealthMax(zone_names.Get(i),"Health");
13220 }
13221 SetHealthMax("","Health");
13222 }
13223
13226 {
13227 float global_health = GetHealth01("","Health");
13228 array<string> zones = new array<string>;
13229 GetDamageZones(zones);
13230
13231 for (int i = 0; i < zones.Count(); i++)
13232 {
13233 SetHealth01(zones.Get(i),"Health",global_health);
13234 }
13235 }
13236
13239 {
13240 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13241 }
13242
13244 {
13245 if (!hasRootAsPlayer)
13246 {
13247 if (refParentIB)
13248 {
13249
13250 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13251 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13252
13253 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13254 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13255
13258 }
13259 else
13260 {
13261
13264 }
13265 }
13266 }
13267
13269 {
13271 {
13272 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13273 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13274 {
13275 float heatPermCoef = 1.0;
13277 while (ent)
13278 {
13279 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13280 ent = ent.GetHierarchyParent();
13281 }
13282
13283 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13284 }
13285 }
13286 }
13287
13289 {
13290
13291 EntityAI parent = GetHierarchyParent();
13292 if (!parent)
13293 {
13294 hasParent = false;
13295 hasRootAsPlayer = false;
13296 }
13297 else
13298 {
13299 hasParent = true;
13300 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13301 refParentIB =
ItemBase.Cast(parent);
13302 }
13303 }
13304
13305 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13306 {
13307
13308 }
13309
13311 {
13312
13313 return false;
13314 }
13315
13317 {
13318
13319
13320 return false;
13321 }
13322
13324 {
13325
13326 return false;
13327 }
13328
13331 {
13332 return !GetIsFrozen() &&
IsOpen();
13333 }
13334
13336 {
13337 bool hasParent = false, hasRootAsPlayer = false;
13339
13340 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13341 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13342
13343 if (wwtu || foodDecay)
13344 {
13348
13349 if (processWetness || processTemperature || processDecay)
13350 {
13352
13353 if (processWetness)
13354 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13355
13356 if (processTemperature)
13358
13359 if (processDecay)
13360 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13361 }
13362 }
13363 }
13364
13367 {
13369 }
13370
13372 {
13375
13376 return super.GetTemperatureFreezeThreshold();
13377 }
13378
13380 {
13383
13384 return super.GetTemperatureThawThreshold();
13385 }
13386
13388 {
13391
13392 return super.GetItemOverheatThreshold();
13393 }
13394
13396 {
13398 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13399
13400 return super.GetTemperatureFreezeTime();
13401 }
13402
13404 {
13406 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13407
13408 return super.GetTemperatureThawTime();
13409 }
13410
13415
13417 {
13418 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13419 }
13420
13422 {
13423 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13424 }
13425
13428 {
13430 }
13431
13433 {
13435 }
13436
13438 {
13440 }
13441
13444 {
13445 return null;
13446 }
13447
13450 {
13451 return false;
13452 }
13453
13455 {
13457 {
13460 if (!trg)
13461 {
13463 explosive = this;
13464 }
13465
13466 explosive.PairRemote(trg);
13468
13469 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13470 trg.SetPersistentPairID(persistentID);
13471 explosive.SetPersistentPairID(persistentID);
13472
13473 return true;
13474 }
13475 return false;
13476 }
13477
13480 {
13481 float ret = 1.0;
13484 ret *= GetHealth01();
13485
13486 return ret;
13487 }
13488
13489 #ifdef DEVELOPER
13490 override void SetDebugItem()
13491 {
13492 super.SetDebugItem();
13493 _itemBase = this;
13494 }
13495
13497 {
13498 string text = super.GetDebugText();
13499
13501 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13502
13503 return text;
13504 }
13505 #endif
13506
13508 {
13509 return true;
13510 }
13511
13513
13515
13517 {
13520 }
13521
13522
13530
13546
13547 [
Obsolete(
"Use ItemSoundHandler instead")]
13550 {
13551 if (!
g_Game.IsDedicatedServer())
13552 {
13553 if (ConfigIsExisting("attachSoundSet"))
13554 {
13555 string cfg_path = "";
13556 string soundset = "";
13557 string type_name =
GetType();
13558
13561 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13562 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13563
13564 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13565 {
13566 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13567 {
13568 if (cfg_slot_array[i] == slot_type)
13569 {
13570 soundset = cfg_soundset_array[i];
13571 break;
13572 }
13573 }
13574 }
13575
13576 if (soundset != "")
13577 {
13578 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13580 }
13581 }
13582 }
13583 }
13584
13586}
13587
13589{
13591 if (entity)
13592 {
13593 bool is_item = entity.IsInherited(
ItemBase);
13594 if (is_item && full_quantity)
13595 {
13598 }
13599 }
13600 else
13601 {
13603 return NULL;
13604 }
13605 return entity;
13606}
13607
13609{
13610 if (item)
13611 {
13612 if (health > 0)
13613 item.SetHealth("", "", health);
13614
13615 if (item.CanHaveTemperature())
13616 {
13618 if (item.CanFreeze())
13619 item.SetFrozen(false);
13620 }
13621
13622 if (item.HasEnergyManager())
13623 {
13624 if (quantity >= 0)
13625 {
13626 item.GetCompEM().SetEnergy0To1(quantity);
13627 }
13628 else
13629 {
13631 }
13632 }
13633 else if (item.IsMagazine())
13634 {
13635 Magazine mag = Magazine.Cast(item);
13636 if (quantity >= 0)
13637 {
13638 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13639 }
13640 else
13641 {
13643 }
13644
13645 }
13646 else
13647 {
13648 if (quantity >= 0)
13649 {
13650 item.SetQuantityNormalized(quantity, false);
13651 }
13652 else
13653 {
13655 }
13656
13657 }
13658 }
13659}
13660
13661#ifdef DEVELOPER
13663#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.