8699{
8701 {
8702 return true;
8703 }
8704};
8705
8707{
8708
8709};
8710
8711
8712
8714{
8718
8720
8723
8724
8725
8726
8727
8736
8742
8747
8752
8773 protected bool m_IsResultOfSplit
8774
8776
8781
8782
8783
8785
8789
8790
8791
8793
8796
8797
8798
8804
8805
8813
8816
8817
8819
8820
8822
8823
8828
8829
8834
8836
8837
8839
8840
8842 {
8847
8848 if (!
g_Game.IsDedicatedServer())
8849 {
8851 {
8853
8855 {
8857 }
8858 }
8859
8862 }
8863
8864 m_OldLocation = null;
8865
8867 {
8869 }
8870
8871 if (ConfigIsExisting("headSelectionsToHide"))
8872 {
8875 }
8876
8878 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8879 {
8881 }
8882
8884
8885 m_IsResultOfSplit = false;
8886
8888 }
8889
8891 {
8892 super.InitItemVariables();
8893
8899 m_Count = ConfigGetInt(
"count");
8900
8903
8908
8911
8916
8928
8932
8933
8936 if (ConfigIsExisting("canBeSplit"))
8937 {
8940 }
8941
8943 if (ConfigIsExisting("itemBehaviour"))
8945
8946
8949 RegisterNetSyncVariableInt("m_VarLiquidType");
8950 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8951
8952 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8953 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8954 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8955
8956 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8957 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8958 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8959 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8960
8961 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8962 RegisterNetSyncVariableBool("m_IsTakeable");
8963 RegisterNetSyncVariableBool("m_IsHologram");
8964
8967 {
8970 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8971 }
8972
8974
8976 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8978
8980 }
8981
8983 {
8985 }
8986
8988 {
8991 {
8996 }
8997 }
8998
8999 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9000 {
9002 {
9005 }
9006
9008 }
9009
9011 {
9017 }
9018
9020
9022 {
9024
9025 if (!action)
9026 {
9027 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9028 return;
9029 }
9030
9032 if (!ai)
9033 {
9035 return;
9036 }
9037
9039 if (!action_array)
9040 {
9041 action_array = new array<ActionBase_Basic>;
9043 }
9044 if (LogManager.IsActionLogEnable())
9045 {
9046 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9047 }
9048
9049 if (action_array.Find(action) != -1)
9050 {
9051 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9052 }
9053 else
9054 {
9055 action_array.Insert(action);
9056 }
9057 }
9058
9060 {
9061 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9062 ActionBase action = player.GetActionManager().GetAction(actionName);
9065
9066 if (action_array)
9067 {
9068 action_array.RemoveItem(action);
9069 }
9070 }
9071
9072
9073
9075 {
9076 ActionOverrideData overrideData = new ActionOverrideData();
9080
9082 if (!actionMap)
9083 {
9086 }
9087
9088 actionMap.Insert(this.
Type(), overrideData);
9089
9090 }
9091
9093
9095
9096
9098 {
9101
9104
9105 string config_to_search = "CfgVehicles";
9106 string muzzle_owner_config;
9107
9109 {
9110 if (IsInherited(Weapon))
9111 config_to_search = "CfgWeapons";
9112
9113 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9114
9115 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9116
9117 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9118
9119 if (config_OnFire_subclass_count > 0)
9120 {
9121 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9122
9123 for (int i = 0; i < config_OnFire_subclass_count; i++)
9124 {
9125 string particle_class = "";
9126 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9127 string config_OnFire_entry = config_OnFire_class + particle_class;
9128 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9129 WPOF_array.Insert(WPOF);
9130 }
9131
9132
9134 }
9135 }
9136
9138 {
9139 config_to_search = "CfgWeapons";
9140 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9141
9142 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9143
9144 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9145
9146 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9147 {
9148 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9149
9150 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9151 {
9152 string particle_class2 = "";
9153 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9154 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9155 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9156 WPOBE_array.Insert(WPOBE);
9157 }
9158
9159
9161 }
9162 }
9163 }
9164
9165
9167 {
9170
9172 {
9173 string config_to_search = "CfgVehicles";
9174
9175 if (IsInherited(Weapon))
9176 config_to_search = "CfgWeapons";
9177
9178 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9179 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9180
9181 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9182 {
9183
9185
9187 {
9189 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9191 return;
9192 }
9193
9196
9197
9198
9199 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9200 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9201
9202 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9203 {
9204 string particle_class = "";
9205 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9206 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9207 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9208
9209 if (entry_type == CT_CLASS)
9210 {
9211 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9212 WPOOH_array.Insert(WPOF);
9213 }
9214 }
9215
9216
9218 }
9219 }
9220 }
9221
9223 {
9225 }
9226
9228 {
9230 {
9232
9235
9238
9239 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9240 }
9241 }
9242
9244 {
9246 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9247
9249 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9250
9252 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9253
9255 {
9257 }
9258 }
9259
9261 {
9263 }
9264
9266 {
9269 else
9271
9273 {
9276 }
9277 else
9278 {
9281
9284 }
9285
9287 }
9288
9290 {
9292 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9293 }
9294
9296 {
9298 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9300 }
9301
9303 {
9305 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9306 }
9307
9309 {
9312
9313 OverheatingParticle OP = new OverheatingParticle();
9318
9320 }
9321
9323 {
9326
9327 return -1;
9328 }
9329
9331 {
9333 {
9336
9337 for (int i = count; i > 0; --i)
9338 {
9339 int id = i - 1;
9342
9345
9346 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9347 {
9348 if (p)
9349 {
9352 }
9353 }
9354 }
9355 }
9356 }
9357
9359 {
9361 {
9363 {
9364 int id = i - 1;
9366
9367 if (OP)
9368 {
9370
9371 if (p)
9372 {
9374 }
9375
9376 delete OP;
9377 }
9378 }
9379
9382 }
9383 }
9384
9387 {
9388 return 0.0;
9389 }
9390
9391
9393 {
9394 return 250;
9395 }
9396
9398 {
9399 return 0;
9400 }
9401
9404 {
9406 return true;
9407
9408 return false;
9409 }
9410
9413 {
9416
9418 {
9420 }
9421 else
9422 {
9423
9425 }
9426
9428 }
9429
9436 {
9437 return -1;
9438 }
9439
9440
9441
9442
9444 {
9446 {
9447 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9448 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9449
9450 if (r_index >= 0)
9451 {
9452 InventoryLocation r_il = new InventoryLocation;
9453 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9454
9455 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9458 {
9459 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9460 }
9462 {
9463 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9464 }
9465
9466 }
9467
9468 player.GetHumanInventory().ClearUserReservedLocation(this);
9469 }
9470
9473 }
9474
9475
9476
9477
9479 {
9480 return ItemBase.m_DebugActionsMask;
9481 }
9482
9484 {
9485 return ItemBase.m_DebugActionsMask & mask;
9486 }
9487
9489 {
9490 ItemBase.m_DebugActionsMask = mask;
9491 }
9492
9494 {
9495 ItemBase.m_DebugActionsMask |= mask;
9496 }
9497
9499 {
9500 ItemBase.m_DebugActionsMask &= ~mask;
9501 }
9502
9504 {
9506 {
9508 }
9509 else
9510 {
9512 }
9513 }
9514
9515
9517 {
9518 if (GetEconomyProfile())
9519 {
9520 float q_max = GetEconomyProfile().GetQuantityMax();
9521 if (q_max > 0)
9522 {
9523 float q_min = GetEconomyProfile().GetQuantityMin();
9524 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9525
9527 {
9528 ComponentEnergyManager comp = GetCompEM();
9530 {
9532 }
9533 }
9535 {
9537
9538 }
9539
9540 }
9541 }
9542 }
9543
9546 {
9547 EntityAI parent = GetHierarchyParent();
9548
9549 if (parent)
9550 {
9551 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9552 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9553 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9554 }
9555 }
9556
9559 {
9560 EntityAI parent = GetHierarchyParent();
9561
9562 if (parent)
9563 {
9564 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9565 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9566 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9567 }
9568 }
9569
9571 {
9572
9573
9574
9575
9577
9579 {
9580 if (ScriptInputUserData.CanStoreInputUserData())
9581 {
9582 ScriptInputUserData ctx = new ScriptInputUserData;
9588 ctx.
Write(use_stack_max);
9591
9593 {
9594 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9595 }
9596 }
9597 }
9598 else if (!
g_Game.IsMultiplayer())
9599 {
9601 }
9602 }
9603
9605 {
9607 }
9608
9610 {
9612 }
9613
9615 {
9617 }
9618
9620 {
9621
9622 return false;
9623 }
9624
9626 {
9627 return false;
9628 }
9629
9633 {
9634 return false;
9635 }
9636
9638 {
9639 return "";
9640 }
9641
9643
9645 {
9646 return false;
9647 }
9648
9650 {
9651 return true;
9652 }
9653
9654
9655
9657 {
9658 return true;
9659 }
9660
9662 {
9663 return true;
9664 }
9665
9667 {
9668 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9670 }
9671
9673 {
9675 }
9676
9678 {
9680 if (!is_being_placed)
9682 SetSynchDirty();
9683 }
9684
9685
9687
9689 {
9691 }
9692
9694 {
9696 }
9697
9699 {
9700 return 1;
9701 }
9702
9704 {
9705 return false;
9706 }
9707
9709 {
9711 SetSynchDirty();
9712 }
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9749 {
9750 super.OnMovedInsideCargo(container);
9751
9752 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9753 }
9754
9755 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9756 {
9757 super.EEItemLocationChanged(oldLoc, newLoc);
9758
9759 PlayerBase newPlayer = null;
9760 PlayerBase oldPlayer = null;
9761
9762 if (newLoc.GetParent())
9763 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9764
9765 if (oldLoc.GetParent())
9766 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9767
9769 {
9770 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9771
9772 if (rIndex >= 0)
9773 {
9774 InventoryLocation rIl = new InventoryLocation;
9775 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9776
9777 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9780 {
9781 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9782 }
9784 {
9786 }
9787
9788 }
9789 }
9790
9792 {
9793 if (newPlayer)
9794 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9795
9796 if (newPlayer == oldPlayer)
9797 {
9798 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9799 {
9801 {
9802 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9803 {
9804 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9805 }
9806 }
9807 else
9808 {
9809 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9810 }
9811 }
9812
9813 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9814 {
9815 int type = oldLoc.GetType();
9817 {
9818 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9819 }
9821 {
9822 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9823 }
9824 }
9825 if (!m_OldLocation)
9826 {
9827 m_OldLocation = new InventoryLocation;
9828 }
9829 m_OldLocation.Copy(oldLoc);
9830 }
9831 else
9832 {
9833 if (m_OldLocation)
9834 {
9835 m_OldLocation.Reset();
9836 }
9837 }
9838
9839 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9840 }
9841 else
9842 {
9843 if (newPlayer)
9844 {
9845 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9846 if (resIndex >= 0)
9847 {
9848 InventoryLocation il = new InventoryLocation;
9849 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9851 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9854 {
9855 il.
GetParent().GetOnReleaseLock().Invoke(it);
9856 }
9858 {
9860 }
9861
9862 }
9863 }
9865 {
9866
9868 }
9869
9870 if (m_OldLocation)
9871 {
9872 m_OldLocation.Reset();
9873 }
9874 }
9875
9877 {
9878 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9879 }
9880
9882 {
9883 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9884 }
9885 }
9886
9887 override void EOnContact(IEntity other, Contact extra)
9888 {
9890 {
9891 int liquidType = -1;
9893 if (impactSpeed > 0.0)
9894 {
9896 #ifndef SERVER
9898 #else
9900 SetSynchDirty();
9901 #endif
9903 }
9904 }
9905
9906 #ifdef SERVER
9907 if (GetCompEM() && GetCompEM().IsPlugged())
9908 {
9909 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9910 GetCompEM().UnplugThis();
9911 }
9912 #endif
9913 }
9914
9916
9918 {
9920 }
9921
9923 {
9924
9925 }
9926
9928 {
9929 super.OnItemLocationChanged(old_owner, new_owner);
9930
9931 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9932 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9933
9934 if (!relatedPlayer && playerNew)
9935 relatedPlayer = playerNew;
9936
9937 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9938 {
9940 if (actionMgr)
9941 {
9942 ActionBase currentAction = actionMgr.GetRunningAction();
9943 if (currentAction)
9945 }
9946 }
9947
9948 Man ownerPlayerOld = null;
9949 Man ownerPlayerNew = null;
9950
9951 if (old_owner)
9952 {
9953 if (old_owner.
IsMan())
9954 {
9955 ownerPlayerOld = Man.Cast(old_owner);
9956 }
9957 else
9958 {
9959 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9960 }
9961 }
9962 else
9963 {
9965 {
9967
9968 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9969 {
9970 GetCompEM().UnplugThis();
9971 }
9972 }
9973 }
9974
9975 if (new_owner)
9976 {
9977 if (new_owner.
IsMan())
9978 {
9979 ownerPlayerNew = Man.Cast(new_owner);
9980 }
9981 else
9982 {
9983 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9984 }
9985 }
9986
9987 if (ownerPlayerOld != ownerPlayerNew)
9988 {
9989 if (ownerPlayerOld)
9990 {
9991 array<EntityAI> subItemsExit = new array<EntityAI>;
9993 for (int i = 0; i < subItemsExit.Count(); i++)
9994 {
9997 }
9998 }
9999
10000 if (ownerPlayerNew)
10001 {
10002 array<EntityAI> subItemsEnter = new array<EntityAI>;
10004 for (int j = 0; j < subItemsEnter.Count(); j++)
10005 {
10008 }
10009 }
10010 }
10011 else if (ownerPlayerNew != null)
10012 {
10013 PlayerBase nplayer;
10014 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10015 {
10016 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10018 for (int k = 0; k < subItemsUpdate.Count(); k++)
10019 {
10021 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10022 }
10023 }
10024 }
10025
10026 if (old_owner)
10027 old_owner.OnChildItemRemoved(this);
10028 if (new_owner)
10029 new_owner.OnChildItemReceived(this);
10030 }
10031
10032
10034 {
10035 super.EEDelete(parent);
10036 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10037 if (player)
10038 {
10040
10041 if (player.IsAlive())
10042 {
10043 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10044 if (r_index >= 0)
10045 {
10046 InventoryLocation r_il = new InventoryLocation;
10047 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10048
10049 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10052 {
10053 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10054 }
10056 {
10057 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10058 }
10059
10060 }
10061
10062 player.RemoveQuickBarEntityShortcut(this);
10063 }
10064 }
10065 }
10066
10068 {
10069 super.EEKilled(killer);
10070
10073 {
10074 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10075 {
10076 if (IsMagazine())
10077 {
10078 if (Magazine.Cast(this).GetAmmoCount() > 0)
10079 {
10081 }
10082 }
10083 else
10084 {
10086 }
10087 }
10088 }
10089 }
10090
10092 {
10093 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10094
10095 super.OnWasAttached(parent, slot_id);
10096
10099
10102 }
10103
10105 {
10106 super.OnWasDetached(parent, slot_id);
10107
10110
10113 }
10114
10116 {
10117 int idx;
10120
10121 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10122 if (inventory_slots.Count() < 1)
10123 {
10124 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10125 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10126 }
10127 else
10128 {
10129 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10130 }
10131
10132 idx = inventory_slots.Find(slot);
10133 if (idx < 0)
10134 return "";
10135
10136 return attach_types.Get(idx);
10137 }
10138
10140 {
10141 int idx = -1;
10142 string slot;
10143
10146
10147 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10148 if (inventory_slots.Count() < 1)
10149 {
10150 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10151 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10152 }
10153 else
10154 {
10155 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10156 if (detach_types.Count() < 1)
10157 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10158 }
10159
10160 for (int i = 0; i < inventory_slots.Count(); i++)
10161 {
10162 slot = inventory_slots.Get(i);
10163 }
10164
10165 if (slot != "")
10166 {
10167 if (detach_types.Count() == 1)
10168 idx = 0;
10169 else
10170 idx = inventory_slots.Find(slot);
10171 }
10172 if (idx < 0)
10173 return "";
10174
10175 return detach_types.Get(idx);
10176 }
10177
10179 {
10180
10182
10183
10184 float min_time = 1;
10185 float max_time = 3;
10186 float delay = Math.RandomFloat(min_time, max_time);
10187
10188 explode_timer.Run(delay, this, "DoAmmoExplosion");
10189 }
10190
10192 {
10193 Magazine magazine = Magazine.Cast(this);
10194 int pop_sounds_count = 6;
10195 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10196
10197
10198 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10199 string sound_name = pop_sounds[ sound_idx ];
10200 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10201
10202
10203 magazine.ServerAddAmmoCount(-1);
10204
10205
10206 float min_temp_to_explode = 100;
10207
10208 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10209 {
10211 }
10212 }
10213
10214
10215 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10216 {
10217 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10218
10219 const int CHANCE_DAMAGE_CARGO = 4;
10220 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10221 const int CHANCE_DAMAGE_NOTHING = 2;
10222
10224 {
10225 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10226 int chances;
10227 int rnd;
10228
10229 if (GetInventory().GetCargo())
10230 {
10231 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10232 rnd = Math.RandomInt(0,chances);
10233
10234 if (rnd < CHANCE_DAMAGE_CARGO)
10235 {
10237 }
10238 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10239 {
10241 }
10242 }
10243 else
10244 {
10245 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10246 rnd = Math.RandomInt(0,chances);
10247
10248 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10249 {
10251 }
10252 }
10253 }
10254 }
10255
10257 {
10258 CargoBase cargo = GetInventory().GetCargo();
10259 if (cargo)
10260 {
10262 if (item_count > 0)
10263 {
10264 int random_pick = Math.RandomInt(0, item_count);
10266 if (!item.IsExplosive())
10267 {
10268 item.AddHealth("","",damage);
10269 return true;
10270 }
10271 }
10272 }
10273 return false;
10274 }
10275
10277 {
10278 GameInventory inventory = GetInventory();
10280 if (attachment_count > 0)
10281 {
10282 int random_pick = Math.RandomInt(0, attachment_count);
10284 if (!attachment.IsExplosive())
10285 {
10286 attachment.AddHealth("","",damage);
10287 return true;
10288 }
10289 }
10290 return false;
10291 }
10292
10294 {
10296 }
10297
10299 {
10301 return GetInventory().CanRemoveEntity();
10302
10303 return false;
10304 }
10305
10307 {
10308
10310 return false;
10311
10312
10314 return false;
10315
10316
10317
10319 if (delta == 0)
10320 return false;
10321
10322
10323 return true;
10324 }
10325
10327 {
10329 {
10330 if (ScriptInputUserData.CanStoreInputUserData())
10331 {
10332 ScriptInputUserData ctx = new ScriptInputUserData;
10337 ctx.
Write(destination_entity);
10339 ctx.
Write(slot_id);
10341 }
10342 }
10343 else if (!
g_Game.IsMultiplayer())
10344 {
10346 }
10347 }
10348
10350 {
10351 float split_quantity_new;
10355 InventoryLocation loc = new InventoryLocation;
10356
10357 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10358 {
10360 split_quantity_new = stack_max;
10361 else
10363
10365 {
10366 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10367 if (new_item)
10368 {
10369 new_item.SetResultOfSplit(true);
10370 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10372 new_item.
SetQuantity(split_quantity_new,
false,
true);
10373 }
10374 }
10375 }
10376 else if (destination_entity && slot_id == -1)
10377 {
10378 if (quantity > stack_max)
10379 split_quantity_new = stack_max;
10380 else
10381 split_quantity_new = quantity;
10382
10384 {
10385 GameInventory destinationInventory = destination_entity.GetInventory();
10387 {
10390 }
10391
10392 if (new_item)
10393 {
10394 new_item.SetResultOfSplit(true);
10395 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10397 new_item.
SetQuantity(split_quantity_new,
false,
true);
10398 }
10399 }
10400 }
10401 else
10402 {
10403 if (stack_max != 0)
10404 {
10406 {
10408 }
10409
10410 if (split_quantity_new == 0)
10411 {
10412 if (!
g_Game.IsMultiplayer())
10413 player.PhysicalPredictiveDropItem(this);
10414 else
10415 player.ServerDropEntity(this);
10416 return;
10417 }
10418
10420 {
10422
10423 if (new_item)
10424 {
10425 new_item.SetResultOfSplit(true);
10426 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10429 new_item.PlaceOnSurface();
10430 }
10431 }
10432 }
10433 }
10434 }
10435
10437 {
10438 float split_quantity_new;
10442 InventoryLocation loc = new InventoryLocation;
10443
10444 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10445 {
10447 split_quantity_new = stack_max;
10448 else
10450
10452 {
10453 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10454 if (new_item)
10455 {
10456 new_item.SetResultOfSplit(true);
10457 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10459 new_item.
SetQuantity(split_quantity_new,
false,
true);
10460 }
10461 }
10462 }
10463 else if (destination_entity && slot_id == -1)
10464 {
10465 if (quantity > stack_max)
10466 split_quantity_new = stack_max;
10467 else
10468 split_quantity_new = quantity;
10469
10471 {
10472 GameInventory destinationInventory = destination_entity.GetInventory();
10474 {
10477 }
10478
10479 if (new_item)
10480 {
10481 new_item.SetResultOfSplit(true);
10482 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10484 new_item.
SetQuantity(split_quantity_new,
false,
true);
10485 }
10486 }
10487 }
10488 else
10489 {
10490 if (stack_max != 0)
10491 {
10493 {
10495 }
10496
10498 {
10500
10501 if (new_item)
10502 {
10503 new_item.SetResultOfSplit(true);
10504 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10507 new_item.PlaceOnSurface();
10508 }
10509 }
10510 }
10511 }
10512 }
10513
10515 {
10517 {
10518 if (ScriptInputUserData.CanStoreInputUserData())
10519 {
10520 ScriptInputUserData ctx = new ScriptInputUserData;
10525 dst.WriteToContext(ctx);
10527 }
10528 }
10529 else if (!
g_Game.IsMultiplayer())
10530 {
10532 }
10533 }
10534
10536 {
10538 {
10539 if (ScriptInputUserData.CanStoreInputUserData())
10540 {
10541 ScriptInputUserData ctx = new ScriptInputUserData;
10546 ctx.
Write(destination_entity);
10552 }
10553 }
10554 else if (!
g_Game.IsMultiplayer())
10555 {
10557 }
10558 }
10559
10561 {
10563 }
10564
10566 {
10568 float split_quantity_new;
10570 if (dst.IsValid())
10571 {
10572 int slot_id = dst.GetSlot();
10574
10575 if (quantity > stack_max)
10576 split_quantity_new = stack_max;
10577 else
10578 split_quantity_new = quantity;
10579
10581 {
10583
10584 if (new_item)
10585 {
10586 new_item.SetResultOfSplit(true);
10587 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10589 new_item.
SetQuantity(split_quantity_new,
false,
true);
10590 }
10591
10592 return new_item;
10593 }
10594 }
10595
10596 return null;
10597 }
10598
10600 {
10602 float split_quantity_new;
10604 if (destination_entity)
10605 {
10607 if (quantity > stackable)
10608 split_quantity_new = stackable;
10609 else
10610 split_quantity_new = quantity;
10611
10613 {
10614 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10615 if (new_item)
10616 {
10617 new_item.SetResultOfSplit(true);
10618 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10620 new_item.
SetQuantity(split_quantity_new,
false,
true);
10621 }
10622 }
10623 }
10624 }
10625
10627 {
10629 {
10630 if (ScriptInputUserData.CanStoreInputUserData())
10631 {
10632 ScriptInputUserData ctx = new ScriptInputUserData;
10637 ItemBase destination_entity =
this;
10638 ctx.
Write(destination_entity);
10642 }
10643 }
10644 else if (!
g_Game.IsMultiplayer())
10645 {
10647 }
10648 }
10649
10651 {
10653 float split_quantity_new;
10655 if (player)
10656 {
10658 if (quantity > stackable)
10659 split_quantity_new = stackable;
10660 else
10661 split_quantity_new = quantity;
10662
10664 {
10665 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10666 new_item =
ItemBase.Cast(in_hands);
10667 if (new_item)
10668 {
10669 new_item.SetResultOfSplit(true);
10670 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10672 new_item.SetQuantity(split_quantity_new, false, true);
10673 }
10674 }
10675 }
10676 }
10677
10679 {
10681 float split_quantity_new = Math.Floor(quantity * 0.5);
10682
10684 return;
10685
10687
10688 if (new_item)
10689 {
10690 if (new_item.GetQuantityMax() < split_quantity_new)
10691 {
10692 split_quantity_new = new_item.GetQuantityMax();
10693 }
10694
10695 new_item.SetResultOfSplit(true);
10696 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10697
10699 {
10702 }
10703 else
10704 {
10706 new_item.
SetQuantity(split_quantity_new,
false,
true);
10707 }
10708 }
10709 }
10710
10712 {
10714 float split_quantity_new = Math.Floor(quantity / 2);
10715
10717 return;
10718
10719 InventoryLocation invloc = new InventoryLocation;
10721
10723 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10724
10725 if (new_item)
10726 {
10727 if (new_item.GetQuantityMax() < split_quantity_new)
10728 {
10729 split_quantity_new = new_item.GetQuantityMax();
10730 }
10732 {
10735 }
10736 else if (split_quantity_new > 1)
10737 {
10739 new_item.
SetQuantity(split_quantity_new,
false,
true);
10740 }
10741 }
10742 }
10743
10746 {
10747 SetWeightDirty();
10749
10750 if (parent)
10751 parent.OnAttachmentQuantityChangedEx(this, delta);
10752
10754 {
10756 {
10758 }
10760 {
10761 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10763 }
10764 }
10765 }
10766
10769 {
10770
10771 }
10772
10775 {
10777 }
10778
10780 {
10781 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10782
10784 {
10785 if (newLevel == GameConstants.STATE_RUINED)
10786 {
10788 EntityAI parent = GetHierarchyParent();
10789 if (parent && parent.IsFireplace())
10790 {
10791 CargoBase cargo = GetInventory().GetCargo();
10792 if (cargo)
10793 {
10795 {
10797 }
10798 }
10799 }
10800 }
10801
10803 {
10804
10806 return;
10807 }
10808
10809 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10810 {
10812 }
10813 }
10814 }
10815
10816
10818 {
10819 super.OnRightClick();
10820
10822 {
10824 {
10825 if (ScriptInputUserData.CanStoreInputUserData())
10826 {
10827 EntityAI root = GetHierarchyRoot();
10828 Man playerOwner = GetHierarchyRootPlayer();
10829 InventoryLocation dst = new InventoryLocation;
10830
10831
10832 if (!playerOwner && root && root == this)
10833 {
10835 }
10836 else
10837 {
10838
10839 GetInventory().GetCurrentInventoryLocation(dst);
10841 {
10842 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10844 {
10846 }
10847 else
10848 {
10850
10851
10852 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10853 {
10855 }
10856 else
10857 {
10858 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10859 }
10860 }
10861 }
10862 }
10863
10864 ScriptInputUserData ctx = new ScriptInputUserData;
10872 }
10873 }
10874 else if (!
g_Game.IsMultiplayer())
10875 {
10877 }
10878 }
10879 }
10880
10882 {
10883 if (root)
10884 {
10885 vector m4[4];
10886 root.GetTransform(m4);
10887 dst.SetGround(this, m4);
10888 }
10889 else
10890 {
10891 GetInventory().GetCurrentInventoryLocation(dst);
10892 }
10893 }
10894
10895 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10896 {
10897
10898 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10899 return false;
10900
10901 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10902 return false;
10903
10904
10906 return false;
10907
10908
10909 Magazine mag = Magazine.Cast(this);
10910 if (mag)
10911 {
10912 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10913 return false;
10914
10915 if (stack_max_limit)
10916 {
10917 Magazine other_mag = Magazine.Cast(other_item);
10918 if (other_item)
10919 {
10920 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10921 return false;
10922 }
10923
10924 }
10925 }
10926 else
10927 {
10928
10930 return false;
10931
10933 return false;
10934 }
10935
10936 PlayerBase player = null;
10937 if (CastTo(player, GetHierarchyRootPlayer()))
10938 {
10939 if (player.GetInventory().HasAttachment(this))
10940 return false;
10941
10942 if (player.IsItemsToDelete())
10943 return false;
10944 }
10945
10946 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10947 return false;
10948
10949 int slotID;
10951 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10952 return false;
10953
10954 return true;
10955 }
10956
10958 {
10960 }
10961
10963 {
10964 return m_IsResultOfSplit;
10965 }
10966
10968 {
10969 m_IsResultOfSplit = value;
10970 }
10971
10973 {
10975 }
10976
10978 {
10979 float other_item_quantity = other_item.GetQuantity();
10980 float this_free_space;
10981
10983
10985
10986 if (other_item_quantity > this_free_space)
10987 {
10988 return this_free_space;
10989 }
10990 else
10991 {
10992 return other_item_quantity;
10993 }
10994 }
10995
10997 {
10999 }
11000
11002 {
11004 return;
11005
11006 if (!IsMagazine() && other_item)
11007 {
11009 if (quantity_used != 0)
11010 {
11011 float hp1 = GetHealth01("","");
11012 float hp2 = other_item.GetHealth01("","");
11013 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11014 hpResult = hpResult / (
GetQuantity() + quantity_used);
11015
11016 hpResult *= GetMaxHealth();
11017 Math.Round(hpResult);
11018 SetHealth("", "Health", hpResult);
11019
11021 other_item.AddQuantity(-quantity_used);
11022 }
11023 }
11025 }
11026
11028 {
11029 #ifdef SERVER
11030 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11031 GetHierarchyParent().IncreaseLifetimeUp();
11032 #endif
11033 };
11034
11036 {
11037 PlayerBase p = PlayerBase.Cast(player);
11038
11039 array<int> recipesIds = p.m_Recipes;
11040 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11041 if (moduleRecipesManager)
11042 {
11043 EntityAI itemInHands = player.GetEntityInHands();
11044 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11045 }
11046
11047 for (int i = 0;i < recipesIds.Count(); i++)
11048 {
11049 int key = recipesIds.Get(i);
11050 string recipeName = moduleRecipesManager.GetRecipeName(key);
11052 }
11053 }
11054
11055
11056 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11057 {
11058 super.GetDebugActions(outputList);
11059
11060
11066
11067
11072
11077
11078
11082
11083
11085 {
11089 }
11090
11093
11094
11098
11100
11101 InventoryLocation loc = new InventoryLocation();
11102 GetInventory().GetCurrentInventoryLocation(loc);
11104 {
11105 if (Gizmo_IsSupported())
11108 }
11109
11111 }
11112
11113
11114
11115
11117 {
11118 super.OnAction(action_id, player, ctx);
11119
11121 {
11122 switch (action_id)
11123 {
11127 return true;
11131 return true;
11132 }
11133 }
11134
11136 {
11137 switch (action_id)
11138 {
11140 Delete();
11141 return true;
11142 }
11143 }
11144
11145 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11146 {
11147 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11148 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11149 PlayerBase p = PlayerBase.Cast(player);
11150 if (
EActions.RECIPES_RANGE_START < 1000)
11151 {
11152 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11153 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11154 }
11155 }
11156 #ifndef SERVER
11157 else if (action_id ==
EActions.WATCH_PLAYER)
11158 {
11159 PluginDeveloper.SetDeveloperItemClientEx(player);
11160 }
11161 #endif
11163 {
11164 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11165 {
11166 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11167 OnDebugButtonPressServer(id + 1);
11168 }
11169
11170 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11171 {
11172 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11174 }
11175
11176 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11177 {
11178 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11180 }
11181
11182 else if (action_id ==
EActions.ADD_QUANTITY)
11183 {
11184 if (IsMagazine())
11185 {
11186 Magazine mag = Magazine.Cast(this);
11187 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11188 }
11189 else
11190 {
11192 }
11193
11194 if (m_EM)
11195 {
11196 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11197 }
11198
11199 }
11200
11201 else if (action_id ==
EActions.REMOVE_QUANTITY)
11202 {
11203 if (IsMagazine())
11204 {
11205 Magazine mag2 = Magazine.Cast(this);
11206 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11207 }
11208 else
11209 {
11211 }
11212 if (m_EM)
11213 {
11214 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11215 }
11216
11217 }
11218
11219 else if (action_id ==
EActions.SET_QUANTITY_0)
11220 {
11222
11223 if (m_EM)
11224 {
11225 m_EM.SetEnergy(0);
11226 }
11227 }
11228
11229 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11230 {
11232
11233 if (m_EM)
11234 {
11235 m_EM.SetEnergy(m_EM.GetEnergyMax());
11236 }
11237 }
11238
11239 else if (action_id ==
EActions.ADD_HEALTH)
11240 {
11241 AddHealth("","",GetMaxHealth("","Health")/5);
11242 }
11243 else if (action_id ==
EActions.REMOVE_HEALTH)
11244 {
11245 AddHealth("","",-GetMaxHealth("","Health")/5);
11246 }
11247 else if (action_id ==
EActions.DESTROY_HEALTH)
11248 {
11249 SetHealth01("","",0);
11250 }
11251 else if (action_id ==
EActions.WATCH_ITEM)
11252 {
11254 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11255 #ifdef DEVELOPER
11256 SetDebugDeveloper_item(this);
11257 #endif
11258 }
11259
11260 else if (action_id ==
EActions.ADD_TEMPERATURE)
11261 {
11262 AddTemperature(20);
11263
11264 }
11265
11266 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11267 {
11268 AddTemperature(-20);
11269
11270 }
11271
11272 else if (action_id ==
EActions.FLIP_FROZEN)
11273 {
11274 SetFrozen(!GetIsFrozen());
11275
11276 }
11277
11278 else if (action_id ==
EActions.ADD_WETNESS)
11279 {
11281
11282 }
11283
11284 else if (action_id ==
EActions.REMOVE_WETNESS)
11285 {
11287
11288 }
11289
11290 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11291 {
11294
11295
11296 }
11297
11298 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11299 {
11302 }
11303
11304 else if (action_id ==
EActions.MAKE_SPECIAL)
11305 {
11306 auto debugParams = DebugSpawnParams.WithPlayer(player);
11307 OnDebugSpawnEx(debugParams);
11308 }
11309
11310 }
11311
11312
11313 return false;
11314 }
11315
11316
11317
11318
11322
11325
11326
11327
11329 {
11330 return false;
11331 }
11332
11333
11335 {
11336 return true;
11337 }
11338
11339
11341 {
11342 return true;
11343 }
11344
11345
11346
11348 {
11349 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11350 return g_Game.ConfigIsExisting(config_path);
11351 }
11352
11355 {
11356 return null;
11357 }
11358
11360 {
11361 return false;
11362 }
11363
11365 {
11366 return false;
11367 }
11368
11372
11373
11375 {
11376 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11377 return module_repairing.CanRepair(this, item_repair_kit);
11378 }
11379
11380
11381 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11382 {
11383 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11384 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11385 }
11386
11387
11389 {
11390
11391
11392
11393
11394
11395
11396
11397
11398 return 1;
11399 }
11400
11401
11402
11404 {
11406 }
11407
11408
11409
11411 {
11413 }
11414
11415
11424 {
11425 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11426
11427 if (player)
11428 {
11429 player.MessageStatus(text);
11430 }
11431 }
11432
11433
11442 {
11443 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11444
11445 if (player)
11446 {
11447 player.MessageAction(text);
11448 }
11449 }
11450
11451
11460 {
11461 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11462
11463 if (player)
11464 {
11465 player.MessageFriendly(text);
11466 }
11467 }
11468
11469
11478 {
11479 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11480
11481 if (player)
11482 {
11483 player.MessageImportant(text);
11484 }
11485 }
11486
11488 {
11489 return true;
11490 }
11491
11492
11493 override bool KindOf(
string tag)
11494 {
11495 bool found = false;
11496 string item_name = this.
GetType();
11498 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11499
11500 int array_size = item_tag_array.Count();
11501 for (int i = 0; i < array_size; i++)
11502 {
11503 if (item_tag_array.Get(i) == tag)
11504 {
11505 found = true;
11506 break;
11507 }
11508 }
11509 return found;
11510 }
11511
11512
11514 {
11515
11516 super.OnRPC(sender, rpc_type,ctx);
11517
11518
11519 switch (rpc_type)
11520 {
11521 #ifndef SERVER
11522 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11523 Param2<bool, string> p = new Param2<bool, string>(false, "");
11524
11526 return;
11527
11528 bool play = p.param1;
11529 string soundSet = p.param2;
11530
11531 if (play)
11532 {
11534 {
11536 {
11538 }
11539 }
11540 else
11541 {
11543 }
11544 }
11545 else
11546 {
11548 }
11549
11550 break;
11551 #endif
11552
11553 }
11554
11556 {
11558 }
11559 }
11560
11561
11562
11563
11565 {
11566 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11567 return plugin.GetID(
name);
11568 }
11569
11571 {
11572 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11573 return plugin.GetName(id);
11574 }
11575
11578 {
11579
11580
11581 int varFlags;
11582 if (!ctx.
Read(varFlags))
11583 return;
11584
11585 if (varFlags & ItemVariableFlags.FLOAT)
11586 {
11588 }
11589 }
11590
11592 {
11593
11594 super.SerializeNumericalVars(floats_out);
11595
11596
11597
11599 {
11601 }
11602
11604 {
11606 }
11607
11609 {
11611 }
11612
11614 {
11619 }
11620
11622 {
11624 }
11625 }
11626
11628 {
11629
11630 super.DeSerializeNumericalVars(floats);
11631
11632
11633 int index = 0;
11634 int mask = Math.Round(floats.Get(index));
11635
11636 index++;
11637
11639 {
11641 {
11643 }
11644 else
11645 {
11646 float quantity = floats.Get(index);
11647 SetQuantity(quantity,
true,
false,
false,
false);
11648 }
11649 index++;
11650 }
11651
11653 {
11654 float wet = floats.Get(index);
11656 index++;
11657 }
11658
11660 {
11661 int liquidtype = Math.Round(floats.Get(index));
11663 index++;
11664 }
11665
11667 {
11669 index++;
11671 index++;
11673 index++;
11675 index++;
11676 }
11677
11679 {
11680 int cleanness = Math.Round(floats.Get(index));
11682 index++;
11683 }
11684 }
11685
11687 {
11688 super.WriteVarsToCTX(ctx);
11689
11690
11692 {
11694 }
11695
11697 {
11699 }
11700
11702 {
11704 }
11705
11707 {
11708 int r,g,b,a;
11714 }
11715
11717 {
11719 }
11720 }
11721
11723 {
11724 if (!super.ReadVarsFromCTX(ctx,version))
11725 return false;
11726
11727 int intValue;
11728 float value;
11729
11730 if (version < 140)
11731 {
11732 if (!ctx.
Read(intValue))
11733 return false;
11734
11735 m_VariablesMask = intValue;
11736 }
11737
11739 {
11740 if (!ctx.
Read(value))
11741 return false;
11742
11744 {
11746 }
11747 else
11748 {
11750 }
11751 }
11752
11753 if (version < 140)
11754 {
11756 {
11757 if (!ctx.
Read(value))
11758 return false;
11759 SetTemperatureDirect(value);
11760 }
11761 }
11762
11764 {
11765 if (!ctx.
Read(value))
11766 return false;
11768 }
11769
11771 {
11772 if (!ctx.
Read(intValue))
11773 return false;
11775 }
11776
11778 {
11779 int r,g,b,a;
11781 return false;
11783 return false;
11785 return false;
11787 return false;
11788
11790 }
11791
11793 {
11794 if (!ctx.
Read(intValue))
11795 return false;
11797 }
11798
11799 if (version >= 138 && version < 140)
11800 {
11802 {
11803 if (!ctx.
Read(intValue))
11804 return false;
11805 SetFrozen(intValue);
11806 }
11807 }
11808
11809 return true;
11810 }
11811
11812
11814 {
11817 {
11819 }
11820
11821 if (!super.OnStoreLoad(ctx, version))
11822 {
11824 return false;
11825 }
11826
11827 if (version >= 114)
11828 {
11829 bool hasQuickBarIndexSaved;
11830
11831 if (!ctx.
Read(hasQuickBarIndexSaved))
11832 {
11834 return false;
11835 }
11836
11837 if (hasQuickBarIndexSaved)
11838 {
11839 int itmQBIndex;
11840
11841
11842 if (!ctx.
Read(itmQBIndex))
11843 {
11845 return false;
11846 }
11847
11848 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11849 if (itmQBIndex != -1 && parentPlayer)
11850 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11851 }
11852 }
11853 else
11854 {
11855
11856 PlayerBase player;
11857 int itemQBIndex;
11858 if (version ==
int.
MAX)
11859 {
11860 if (!ctx.
Read(itemQBIndex))
11861 {
11863 return false;
11864 }
11865 }
11866 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11867 {
11868
11869 if (!ctx.
Read(itemQBIndex))
11870 {
11872 return false;
11873 }
11874 if (itemQBIndex != -1 && player)
11875 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11876 }
11877 }
11878
11879 if (version < 140)
11880 {
11881
11882 if (!LoadVariables(ctx, version))
11883 {
11885 return false;
11886 }
11887 }
11888
11889
11891 {
11893 return false;
11894 }
11895 if (version >= 132)
11896 {
11898 if (raib)
11899 {
11901 {
11903 return false;
11904 }
11905 }
11906 }
11907
11909 return true;
11910 }
11911
11912
11913
11915 {
11916 super.OnStoreSave(ctx);
11917
11918 PlayerBase player;
11919 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11920 {
11922
11923 int itemQBIndex = -1;
11924 itemQBIndex = player.FindQuickBarEntityIndex(this);
11925 ctx.
Write(itemQBIndex);
11926 }
11927 else
11928 {
11930 }
11931
11933
11935 if (raib)
11936 {
11938 }
11939 }
11940
11941
11943 {
11944 super.AfterStoreLoad();
11945
11947 {
11949 }
11950
11952 {
11955 }
11956 }
11957
11959 {
11960 super.EEOnAfterLoad();
11961
11963 {
11965 }
11966
11969 }
11970
11972 {
11973 return false;
11974 }
11975
11976
11977
11979 {
11981 {
11982 #ifdef PLATFORM_CONSOLE
11983
11985 {
11987 if (menu)
11988 {
11990 }
11991 }
11992 #endif
11993 }
11994
11996 {
11999 }
12000
12002 {
12003 SetWeightDirty();
12005 }
12007 {
12010 }
12011
12013 {
12016
12019 }
12021 {
12025 }
12026
12027 super.OnVariablesSynchronized();
12028 }
12029
12030
12031
12033 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12034 {
12035 if (!IsServerCheck(allow_client))
12036 return false;
12037
12039 return false;
12040
12043
12044 if (value <= (min + 0.001))
12045 value = min;
12046
12047 if (value == min)
12048 {
12049 if (destroy_config)
12050 {
12051 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12052 if (dstr)
12053 {
12055 this.Delete();
12056 return true;
12057 }
12058 }
12059 else if (destroy_forced)
12060 {
12062 this.Delete();
12063 return true;
12064 }
12065
12067 }
12068
12071
12073 {
12074 EntityAI parent = GetHierarchyRoot();
12075 InventoryLocation iLoc = new InventoryLocation();
12076 GetInventory().GetCurrentInventoryLocation(iLoc);
12078 {
12079 int iLocSlot = iLoc.
GetSlot();
12081 {
12083 }
12085 {
12087 }
12088 }
12089 }
12090
12092 {
12094
12095 if (delta)
12097 }
12098
12100
12101 return false;
12102 }
12103
12104
12106 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12107 {
12109 }
12110
12112 {
12115 }
12116
12118 {
12121 }
12122
12124 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12125 {
12126 float value_clamped = Math.Clamp(value, 0, 1);
12128 SetQuantity(result, destroy_config, destroy_forced);
12129 }
12130
12131
12134 {
12136 }
12137
12139 {
12141 }
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12153 {
12154 int slot = -1;
12155 GameInventory inventory = GetInventory();
12156 if (inventory)
12157 {
12158 InventoryLocation il = new InventoryLocation;
12161 }
12162
12164 }
12165
12167 {
12168 float quantity_max = 0;
12169
12171 {
12172 if (attSlotID != -1)
12173 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12174
12175 if (quantity_max <= 0)
12177 }
12178
12179 if (quantity_max <= 0)
12181
12182 return quantity_max;
12183 }
12184
12186 {
12188 }
12189
12191 {
12193 }
12194
12195
12197 {
12199 }
12200
12202 {
12204 }
12205
12207 {
12209 }
12210
12211
12213 {
12214
12215 float weightEx = GetWeightEx();
12216 float special = GetInventoryAndCargoWeight();
12217 return weightEx - special;
12218 }
12219
12220
12222 {
12224 }
12225
12227 {
12229 {
12230 #ifdef DEVELOPER
12231 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12232 {
12233 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12235 }
12236 #endif
12237
12238 return GetQuantity() * GetConfigWeightModified();
12239 }
12240 else if (HasEnergyManager())
12241 {
12242 #ifdef DEVELOPER
12243 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12244 {
12245 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12246 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12247 }
12248 #endif
12249 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12250 }
12251 else
12252 {
12253 #ifdef DEVELOPER
12254 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12255 {
12256 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12257 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12258 }
12259 #endif
12260 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12261 }
12262 }
12263
12266 {
12267 int item_count = 0;
12269
12270 GameInventory inventory = GetInventory();
12271 CargoBase cargo = inventory.
GetCargo();
12272 if (cargo != NULL)
12273 {
12275 }
12276
12278 for (int i = 0; i < nAttachments; ++i)
12279 {
12281 if (item)
12282 item_count += item.GetNumberOfItems();
12283 }
12284 return item_count;
12285 }
12286
12289 {
12290 float weight = 0;
12291 float wetness = 1;
12292 if (include_wetness)
12295 {
12296 weight = wetness * m_ConfigWeight;
12297 }
12299 {
12300 weight = 1;
12301 }
12302 return weight;
12303 }
12304
12305
12306
12308 {
12309 GameInventory inventory = GetInventory();
12310 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12311 {
12312 array<EntityAI> items = new array<EntityAI>;
12314 for (int i = 0; i < items.Count(); ++i)
12315 {
12317 if (item)
12318 {
12319 g_Game.ObjectDelete(item);
12320 }
12321 }
12322 }
12323 }
12324
12325
12326
12327
12329 {
12330 float energy = 0;
12331 if (HasEnergyManager())
12332 {
12333 energy = GetCompEM().GetEnergy();
12334 }
12335 return energy;
12336 }
12337
12338
12340 {
12341 super.OnEnergyConsumed();
12342
12344 }
12345
12347 {
12348 super.OnEnergyAdded();
12349
12351 }
12352
12353
12355 {
12356 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12357 {
12359 {
12360 float energy_0to1 = GetCompEM().GetEnergy0To1();
12362 }
12363 }
12364 }
12365
12366
12368 {
12369 return ConfigGetFloat("heatIsolation");
12370 }
12371
12373 {
12375 }
12376
12378 {
12379 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12380 if (
g_Game.ConfigIsExisting(paramPath))
12381 return g_Game.ConfigGetFloat(paramPath);
12382
12383 return 0.0;
12384 }
12385
12387 {
12388 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12389 if (
g_Game.ConfigIsExisting(paramPath))
12390 return g_Game.ConfigGetFloat(paramPath);
12391
12392 return 0.0;
12393 }
12394
12395 override void SetWet(
float value,
bool allow_client =
false)
12396 {
12397 if (!IsServerCheck(allow_client))
12398 return;
12399
12402
12404
12405 m_VarWet = Math.Clamp(value, min, max);
12406
12408 {
12411 }
12412 }
12413
12414 override void AddWet(
float value)
12415 {
12417 }
12418
12420 {
12422 }
12423
12425 {
12427 }
12428
12430 {
12432 }
12433
12435 {
12437 }
12438
12440 {
12442 }
12443
12444 override void OnWetChanged(
float newVal,
float oldVal)
12445 {
12448 if (newLevel != oldLevel)
12449 {
12451 }
12452 }
12453
12455 {
12456 SetWeightDirty();
12457 }
12458
12460 {
12461 return GetWetLevelInternal(
m_VarWet);
12462 }
12463
12464
12465
12467 {
12469 }
12470
12472 {
12474 }
12475
12477 {
12479 }
12480
12482 {
12484 }
12485
12486
12487
12489 {
12490 if (ConfigIsExisting("itemModelLength"))
12491 {
12492 return ConfigGetFloat("itemModelLength");
12493 }
12494 return 0;
12495 }
12496
12498 {
12499 if (ConfigIsExisting("itemAttachOffset"))
12500 {
12501 return ConfigGetFloat("itemAttachOffset");
12502 }
12503 return 0;
12504 }
12505
12506 override void SetCleanness(
int value,
bool allow_client =
false)
12507 {
12508 if (!IsServerCheck(allow_client))
12509 return;
12510
12512
12514
12517 }
12518
12520 {
12522 }
12523
12525 {
12526 return true;
12527 }
12528
12529
12530
12531
12533 {
12535 }
12536
12538 {
12540 }
12541
12542
12543
12544
12545 override void SetColor(
int r,
int g,
int b,
int a)
12546 {
12552 }
12554 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12555 {
12560 }
12561
12563 {
12565 }
12566
12569 {
12570 int r,g,b,a;
12572 r = r/255;
12573 g = g/255;
12574 b = b/255;
12575 a = a/255;
12576 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12577 }
12578
12579
12580
12581 override void SetLiquidType(
int value,
bool allow_client =
false)
12582 {
12583 if (!IsServerCheck(allow_client))
12584 return;
12585
12590 }
12591
12593 {
12594 return ConfigGetInt("varLiquidTypeInit");
12595 }
12596
12598 {
12600 }
12601
12603 {
12605 SetFrozen(false);
12606 }
12607
12610 {
12611 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12612 }
12613
12614
12617 {
12618 PlayerBase nplayer;
12619 if (PlayerBase.CastTo(nplayer, player))
12620 {
12622 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12623 }
12624 }
12625
12626
12629 {
12630 PlayerBase nplayer;
12631 if (PlayerBase.CastTo(nplayer,player))
12632 {
12633 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12634 }
12635
12636 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12637
12638 if (HasEnergyManager())
12639 {
12640 GetCompEM().UpdatePlugState();
12641 }
12642 }
12643
12644
12646 {
12647 super.OnPlacementStarted(player);
12648
12650 }
12651
12652 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12653 {
12655 {
12656 m_AdminLog.OnPlacementComplete(player,
this);
12657 }
12658
12659 super.OnPlacementComplete(player, position, orientation);
12660 }
12661
12662
12663
12664
12665
12667 {
12669 {
12670 return true;
12671 }
12672 else
12673 {
12674 return false;
12675 }
12676 }
12677
12678
12680 {
12682 {
12684 }
12685 }
12686
12687
12689 {
12691 }
12692
12694 {
12696 }
12697
12698 override void InsertAgent(
int agent,
float count = 1)
12699 {
12700 if (count < 1)
12701 return;
12702
12704 }
12705
12708 {
12710 }
12711
12712
12714 {
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
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12760 {
12762 return false;
12763 return true;
12764 }
12765
12767 {
12768
12770 }
12771
12772
12775 {
12776 super.CheckForRoofLimited(timeTresholdMS);
12777
12778 float time =
g_Game.GetTime();
12779 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12780 {
12781 m_PreviousRoofTestTime = time;
12782 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12783 }
12784 }
12785
12786
12788 {
12790 {
12791 return 0;
12792 }
12793
12794 if (GetInventory().GetAttachmentSlotsCount() != 0)
12795 {
12796 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12797 if (filter)
12798 return filter.GetProtectionLevel(type, false, system);
12799 else
12800 return 0;
12801 }
12802
12803 string subclassPath, entryName;
12804
12805 switch (type)
12806 {
12808 entryName = "biological";
12809 break;
12811 entryName = "chemical";
12812 break;
12813 default:
12814 entryName = "biological";
12815 break;
12816 }
12817
12818 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12819
12820 return g_Game.ConfigGetFloat(subclassPath + entryName);
12821 }
12822
12823
12824
12827 {
12828 if (!IsMagazine())
12830
12832 }
12833
12834
12835
12836
12837
12842 {
12843 return true;
12844 }
12845
12847 {
12849 }
12850
12851
12852
12853
12854
12856 {
12857 if (parent)
12858 {
12859 if (parent.IsInherited(DayZInfected))
12860 return true;
12861
12862 if (!parent.IsRuined())
12863 return true;
12864 }
12865
12866 return true;
12867 }
12868
12870 {
12871 if (!super.CanPutAsAttachment(parent))
12872 {
12873 return false;
12874 }
12875
12876 if (!IsRuined() && !parent.IsRuined())
12877 {
12878 return true;
12879 }
12880
12881 return false;
12882 }
12883
12885 {
12886
12887
12888
12889
12890 return super.CanReceiveItemIntoCargo(item);
12891 }
12892
12894 {
12895
12896
12897
12898
12899 GameInventory attachmentInv = attachment.GetInventory();
12901 {
12902 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12903 return false;
12904 }
12905
12906 InventoryLocation loc = new InventoryLocation();
12907 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12908 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12909 return false;
12910
12911 return super.CanReceiveAttachment(attachment, slotId);
12912 }
12913
12915 {
12916 if (!super.CanReleaseAttachment(attachment))
12917 return false;
12918
12919 return GetInventory().AreChildrenAccessible();
12920 }
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12943 {
12944 int id = muzzle_owner.GetMuzzleID();
12945 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12946
12947 if (WPOF_array)
12948 {
12949 for (int i = 0; i < WPOF_array.Count(); i++)
12950 {
12951 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12952
12953 if (WPOF)
12954 {
12955 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12956 }
12957 }
12958 }
12959 }
12960
12961
12963 {
12964 int id = muzzle_owner.GetMuzzleID();
12966
12967 if (WPOBE_array)
12968 {
12969 for (int i = 0; i < WPOBE_array.Count(); i++)
12970 {
12971 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12972
12973 if (WPOBE)
12974 {
12975 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12976 }
12977 }
12978 }
12979 }
12980
12981
12983 {
12984 int id = muzzle_owner.GetMuzzleID();
12985 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12986
12987 if (WPOOH_array)
12988 {
12989 for (int i = 0; i < WPOOH_array.Count(); i++)
12990 {
12991 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12992
12993 if (WPOOH)
12994 {
12995 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12996 }
12997 }
12998 }
12999 }
13000
13001
13003 {
13004 int id = muzzle_owner.GetMuzzleID();
13005 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13006
13007 if (WPOOH_array)
13008 {
13009 for (int i = 0; i < WPOOH_array.Count(); i++)
13010 {
13011 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13012
13013 if (WPOOH)
13014 {
13015 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13016 }
13017 }
13018 }
13019 }
13020
13021
13023 {
13024 int id = muzzle_owner.GetMuzzleID();
13025 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13026
13027 if (WPOOH_array)
13028 {
13029 for (int i = 0; i < WPOOH_array.Count(); i++)
13030 {
13031 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13032
13033 if (WPOOH)
13034 {
13035 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13036 }
13037 }
13038 }
13039 }
13040
13041
13042
13044 {
13046 {
13047 return true;
13048 }
13049
13050 return false;
13051 }
13052
13054 {
13056 {
13057 return true;
13058 }
13059
13060 return false;
13061 }
13062
13064 {
13066 {
13067 return true;
13068 }
13069
13070 return false;
13071 }
13072
13074 {
13075 return false;
13076 }
13077
13080 {
13081 return UATimeSpent.DEFAULT_DEPLOY;
13082 }
13083
13084
13085
13086
13088 {
13090 SetSynchDirty();
13091 }
13092
13094 {
13096 }
13097
13098
13100 {
13101 return false;
13102 }
13103
13106 {
13107 string att_type = "None";
13108
13109 if (ConfigIsExisting("soundAttType"))
13110 {
13111 att_type = ConfigGetString("soundAttType");
13112 }
13113
13115 }
13116
13118 {
13120 }
13121
13122
13123
13124
13125
13131
13133 {
13136
13138 }
13139
13140
13142 {
13144 return;
13145
13147
13150
13153
13154 SoundParameters params = new SoundParameters();
13158 }
13159
13160
13162 {
13164 {
13167
13168 SetSynchDirty();
13169
13172 }
13173 }
13174
13176 {
13178 }
13179
13180
13182 {
13184 return;
13185
13187 SetSynchDirty();
13188
13191 }
13192
13194 {
13197 }
13198
13200 {
13202 }
13203
13204 void OnApply(PlayerBase player);
13205
13207 {
13208 return 1.0;
13209 };
13210
13212 {
13214 }
13215
13217 {
13219 }
13220
13222
13224 {
13225 SetDynamicPhysicsLifeTime(0.01);
13227 }
13228
13230 {
13231 array<string> zone_names = new array<string>;
13232 GetDamageZones(zone_names);
13233 for (int i = 0; i < zone_names.Count(); i++)
13234 {
13235 SetHealthMax(zone_names.Get(i),"Health");
13236 }
13237 SetHealthMax("","Health");
13238 }
13239
13242 {
13243 float global_health = GetHealth01("","Health");
13244 array<string> zones = new array<string>;
13245 GetDamageZones(zones);
13246
13247 for (int i = 0; i < zones.Count(); i++)
13248 {
13249 SetHealth01(zones.Get(i),"Health",global_health);
13250 }
13251 }
13252
13255 {
13256 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13257 }
13258
13260 {
13261 if (!hasRootAsPlayer)
13262 {
13263 if (refParentIB)
13264 {
13265
13266 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13267 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13268
13269 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13270 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13271
13274 }
13275 else
13276 {
13277
13280 }
13281 }
13282 }
13283
13285 {
13287 {
13288 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13289 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13290 {
13291 float heatPermCoef = 1.0;
13293 while (ent)
13294 {
13295 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13296 ent = ent.GetHierarchyParent();
13297 }
13298
13299 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13300 }
13301 }
13302 }
13303
13305 {
13306
13307 EntityAI parent = GetHierarchyParent();
13308 if (!parent)
13309 {
13310 hasParent = false;
13311 hasRootAsPlayer = false;
13312 }
13313 else
13314 {
13315 hasParent = true;
13316 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13317 refParentIB =
ItemBase.Cast(parent);
13318 }
13319 }
13320
13321 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13322 {
13323
13324 }
13325
13327 {
13328
13329 return false;
13330 }
13331
13333 {
13334
13335
13336 return false;
13337 }
13338
13340 {
13341
13342 return false;
13343 }
13344
13347 {
13348 return !GetIsFrozen() &&
IsOpen();
13349 }
13350
13352 {
13353 bool hasParent = false, hasRootAsPlayer = false;
13355
13356 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13357 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13358
13359 if (wwtu || foodDecay)
13360 {
13364
13365 if (processWetness || processTemperature || processDecay)
13366 {
13368
13369 if (processWetness)
13370 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13371
13372 if (processTemperature)
13374
13375 if (processDecay)
13376 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13377 }
13378 }
13379 }
13380
13383 {
13385 }
13386
13388 {
13391
13392 return super.GetTemperatureFreezeThreshold();
13393 }
13394
13396 {
13399
13400 return super.GetTemperatureThawThreshold();
13401 }
13402
13404 {
13407
13408 return super.GetItemOverheatThreshold();
13409 }
13410
13412 {
13414 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13415
13416 return super.GetTemperatureFreezeTime();
13417 }
13418
13420 {
13422 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13423
13424 return super.GetTemperatureThawTime();
13425 }
13426
13431
13433 {
13434 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13435 }
13436
13438 {
13439 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13440 }
13441
13444 {
13446 }
13447
13449 {
13451 }
13452
13454 {
13456 }
13457
13460 {
13461 return null;
13462 }
13463
13466 {
13467 return false;
13468 }
13469
13471 {
13473 {
13476 if (!trg)
13477 {
13479 explosive = this;
13480 }
13481
13482 explosive.PairRemote(trg);
13484
13485 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13486 trg.SetPersistentPairID(persistentID);
13487 explosive.SetPersistentPairID(persistentID);
13488
13489 return true;
13490 }
13491 return false;
13492 }
13493
13496 {
13497 float ret = 1.0;
13500 ret *= GetHealth01();
13501
13502 return ret;
13503 }
13504
13505 #ifdef DEVELOPER
13506 override void SetDebugItem()
13507 {
13508 super.SetDebugItem();
13509 _itemBase = this;
13510 }
13511
13513 {
13514 string text = super.GetDebugText();
13515
13517 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13518
13519 return text;
13520 }
13521 #endif
13522
13524 {
13525 return true;
13526 }
13527
13529
13531
13533 {
13536 }
13537
13538
13546
13562
13563 [
Obsolete(
"Use ItemSoundHandler instead")]
13566 {
13567 if (!
g_Game.IsDedicatedServer())
13568 {
13569 if (ConfigIsExisting("attachSoundSet"))
13570 {
13571 string cfg_path = "";
13572 string soundset = "";
13573 string type_name =
GetType();
13574
13577 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13578 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13579
13580 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13581 {
13582 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13583 {
13584 if (cfg_slot_array[i] == slot_type)
13585 {
13586 soundset = cfg_soundset_array[i];
13587 break;
13588 }
13589 }
13590 }
13591
13592 if (soundset != "")
13593 {
13594 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13596 }
13597 }
13598 }
13599 }
13600
13602}
13603
13605{
13607 if (entity)
13608 {
13609 bool is_item = entity.IsInherited(
ItemBase);
13610 if (is_item && full_quantity)
13611 {
13614 }
13615 }
13616 else
13617 {
13619 return NULL;
13620 }
13621 return entity;
13622}
13623
13625{
13626 if (item)
13627 {
13628 if (health > 0)
13629 item.SetHealth("", "", health);
13630
13631 if (item.CanHaveTemperature())
13632 {
13634 if (item.CanFreeze())
13635 item.SetFrozen(false);
13636 }
13637
13638 if (item.HasEnergyManager())
13639 {
13640 if (quantity >= 0)
13641 {
13642 item.GetCompEM().SetEnergy0To1(quantity);
13643 }
13644 else
13645 {
13647 }
13648 }
13649 else if (item.IsMagazine())
13650 {
13651 Magazine mag = Magazine.Cast(item);
13652 if (quantity >= 0)
13653 {
13654 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13655 }
13656 else
13657 {
13659 }
13660
13661 }
13662 else
13663 {
13664 if (quantity >= 0)
13665 {
13666 item.SetQuantityNormalized(quantity, false);
13667 }
13668 else
13669 {
13671 }
13672
13673 }
13674 }
13675}
13676
13677#ifdef DEVELOPER
13679#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.