8799{
8801 {
8802 return true;
8803 }
8804};
8805
8807{
8808
8809};
8810
8811
8812
8814{
8818
8820
8823
8824
8825
8826
8827
8836
8842
8847
8852
8873 protected bool m_IsResultOfSplit
8874
8876
8881
8882
8883
8885
8889
8890
8891
8893
8896
8897
8898
8904
8905
8913
8916
8917
8919
8920
8922
8923
8928
8929
8934
8936
8937
8939
8940
8942 {
8947
8948 if (!
g_Game.IsDedicatedServer())
8949 {
8951 {
8953
8955 {
8957 }
8958 }
8959
8962 }
8963
8964 m_OldLocation = null;
8965
8967 {
8969 }
8970
8971 if (ConfigIsExisting("headSelectionsToHide"))
8972 {
8975 }
8976
8978 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8979 {
8981 }
8982
8984
8985 m_IsResultOfSplit = false;
8986
8988 }
8989
8991 {
8992 super.InitItemVariables();
8993
8999 m_Count = ConfigGetInt(
"count");
9000
9003
9008
9011
9016
9028
9032
9033
9036 if (ConfigIsExisting("canBeSplit"))
9037 {
9040 }
9041
9043 if (ConfigIsExisting("itemBehaviour"))
9045
9046
9049 RegisterNetSyncVariableInt("m_VarLiquidType");
9050 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9051
9052 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9053 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9054 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9055
9056 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9057 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9058 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9059 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9060
9061 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9062 RegisterNetSyncVariableBool("m_IsTakeable");
9063 RegisterNetSyncVariableBool("m_IsHologram");
9064
9067 {
9070 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9071 }
9072
9074
9076 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9078
9080 }
9081
9083 {
9085 }
9086
9088 {
9091 {
9096 }
9097 }
9098
9099 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9100 {
9102 {
9105 }
9106
9108 }
9109
9111 {
9117 }
9118
9120
9122 {
9124
9125 if (!action)
9126 {
9127 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9128 return;
9129 }
9130
9132 if (!ai)
9133 {
9135 return;
9136 }
9137
9139 if (!action_array)
9140 {
9141 action_array = new array<ActionBase_Basic>;
9143 }
9144 if (LogManager.IsActionLogEnable())
9145 {
9146 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9147 }
9148
9149 if (action_array.Find(action) != -1)
9150 {
9151 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9152 }
9153 else
9154 {
9155 action_array.Insert(action);
9156 }
9157 }
9158
9160 {
9161 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9162 ActionBase action = player.GetActionManager().GetAction(actionName);
9165
9166 if (action_array)
9167 {
9168 action_array.RemoveItem(action);
9169 }
9170 }
9171
9172
9173
9175 {
9176 ActionOverrideData overrideData = new ActionOverrideData();
9180
9182 if (!actionMap)
9183 {
9186 }
9187
9188 actionMap.Insert(this.
Type(), overrideData);
9189
9190 }
9191
9193
9195
9196
9198 {
9201
9204
9205 string config_to_search = "CfgVehicles";
9206 string muzzle_owner_config;
9207
9209 {
9210 if (IsInherited(Weapon))
9211 config_to_search = "CfgWeapons";
9212
9213 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9214
9215 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9216
9217 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9218
9219 if (config_OnFire_subclass_count > 0)
9220 {
9221 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9222
9223 for (int i = 0; i < config_OnFire_subclass_count; i++)
9224 {
9225 string particle_class = "";
9226 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9227 string config_OnFire_entry = config_OnFire_class + particle_class;
9228 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9229 WPOF_array.Insert(WPOF);
9230 }
9231
9232
9234 }
9235 }
9236
9238 {
9239 config_to_search = "CfgWeapons";
9240 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9241
9242 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9243
9244 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9245
9246 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9247 {
9248 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9249
9250 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9251 {
9252 string particle_class2 = "";
9253 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9254 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9255 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9256 WPOBE_array.Insert(WPOBE);
9257 }
9258
9259
9261 }
9262 }
9263 }
9264
9265
9267 {
9270
9272 {
9273 string config_to_search = "CfgVehicles";
9274
9275 if (IsInherited(Weapon))
9276 config_to_search = "CfgWeapons";
9277
9278 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9279 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9280
9281 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9282 {
9283
9285
9287 {
9289 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9291 return;
9292 }
9293
9296
9297
9298
9299 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9300 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9301
9302 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9303 {
9304 string particle_class = "";
9305 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9306 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9307 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9308
9309 if (entry_type == CT_CLASS)
9310 {
9311 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9312 WPOOH_array.Insert(WPOF);
9313 }
9314 }
9315
9316
9318 }
9319 }
9320 }
9321
9323 {
9325 }
9326
9328 {
9330 {
9332
9335
9338
9339 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9340 }
9341 }
9342
9344 {
9346 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9347
9349 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9350
9352 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9353
9355 {
9357 }
9358 }
9359
9361 {
9363 }
9364
9366 {
9369 else
9371
9373 {
9376 }
9377 else
9378 {
9381
9384 }
9385
9387 }
9388
9390 {
9392 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9393 }
9394
9396 {
9398 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9400 }
9401
9403 {
9405 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9406 }
9407
9409 {
9412
9413 OverheatingParticle OP = new OverheatingParticle();
9418
9420 }
9421
9423 {
9426
9427 return -1;
9428 }
9429
9431 {
9433 {
9436
9437 for (int i = count; i > 0; --i)
9438 {
9439 int id = i - 1;
9442
9445
9446 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9447 {
9448 if (p)
9449 {
9452 }
9453 }
9454 }
9455 }
9456 }
9457
9459 {
9461 {
9463 {
9464 int id = i - 1;
9466
9467 if (OP)
9468 {
9470
9471 if (p)
9472 {
9474 }
9475
9476 delete OP;
9477 }
9478 }
9479
9482 }
9483 }
9484
9487 {
9488 return 0.0;
9489 }
9490
9491
9493 {
9494 return 250;
9495 }
9496
9498 {
9499 return 0;
9500 }
9501
9504 {
9506 return true;
9507
9508 return false;
9509 }
9510
9513 {
9516
9518 {
9520 }
9521 else
9522 {
9523
9525 }
9526
9528 }
9529
9536 {
9537 return -1;
9538 }
9539
9540
9541
9542
9544 {
9546 {
9547 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9548 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9549
9550 if (r_index >= 0)
9551 {
9552 InventoryLocation r_il = new InventoryLocation;
9553 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9554
9555 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9558 {
9559 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9560 }
9562 {
9563 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9564 }
9565
9566 }
9567
9568 player.GetHumanInventory().ClearUserReservedLocation(this);
9569 }
9570
9573 }
9574
9575
9576
9577
9579 {
9580 return ItemBase.m_DebugActionsMask;
9581 }
9582
9584 {
9585 return ItemBase.m_DebugActionsMask & mask;
9586 }
9587
9589 {
9590 ItemBase.m_DebugActionsMask = mask;
9591 }
9592
9594 {
9595 ItemBase.m_DebugActionsMask |= mask;
9596 }
9597
9599 {
9600 ItemBase.m_DebugActionsMask &= ~mask;
9601 }
9602
9604 {
9606 {
9608 }
9609 else
9610 {
9612 }
9613 }
9614
9615
9617 {
9618 if (GetEconomyProfile())
9619 {
9620 float q_max = GetEconomyProfile().GetQuantityMax();
9621 if (q_max > 0)
9622 {
9623 float q_min = GetEconomyProfile().GetQuantityMin();
9624 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9625
9627 {
9628 ComponentEnergyManager comp = GetCompEM();
9630 {
9632 }
9633 }
9635 {
9637
9638 }
9639
9640 }
9641 }
9642 }
9643
9646 {
9647 EntityAI parent = GetHierarchyParent();
9648
9649 if (parent)
9650 {
9651 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9652 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9653 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9654 }
9655 }
9656
9659 {
9660 EntityAI parent = GetHierarchyParent();
9661
9662 if (parent)
9663 {
9664 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9665 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9666 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9667 }
9668 }
9669
9671 {
9672
9673
9674
9675
9677
9679 {
9680 if (ScriptInputUserData.CanStoreInputUserData())
9681 {
9682 ScriptInputUserData ctx = new ScriptInputUserData;
9688 ctx.
Write(use_stack_max);
9691
9693 {
9694 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9695 }
9696 }
9697 }
9698 else if (!
g_Game.IsMultiplayer())
9699 {
9701 }
9702 }
9703
9705 {
9707 }
9708
9710 {
9712 }
9713
9715 {
9717 }
9718
9720 {
9721
9722 return false;
9723 }
9724
9726 {
9727 return false;
9728 }
9729
9733 {
9734 return false;
9735 }
9736
9738 {
9739 return "";
9740 }
9741
9743
9745 {
9746 return false;
9747 }
9748
9750 {
9751 return true;
9752 }
9753
9754
9755
9757 {
9758 return true;
9759 }
9760
9762 {
9763 return true;
9764 }
9765
9767 {
9768 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9770 }
9771
9773 {
9775 }
9776
9778 {
9780 if (!is_being_placed)
9782 SetSynchDirty();
9783 }
9784
9785
9787
9789 {
9791 }
9792
9794 {
9796 }
9797
9799 {
9800 return 1;
9801 }
9802
9804 {
9805 return false;
9806 }
9807
9809 {
9811 SetSynchDirty();
9812 }
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9849 {
9850 super.OnMovedInsideCargo(container);
9851
9852 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9853 }
9854
9855 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9856 {
9857 super.EEItemLocationChanged(oldLoc, newLoc);
9858
9859 PlayerBase newPlayer = null;
9860 PlayerBase oldPlayer = null;
9861
9862 if (newLoc.GetParent())
9863 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9864
9865 if (oldLoc.GetParent())
9866 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9867
9869 {
9870 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9871
9872 if (rIndex >= 0)
9873 {
9874 InventoryLocation rIl = new InventoryLocation;
9875 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9876
9877 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9880 {
9881 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9882 }
9884 {
9886 }
9887
9888 }
9889 }
9890
9892 {
9893 if (newPlayer)
9894 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9895
9896 if (newPlayer == oldPlayer)
9897 {
9898 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9899 {
9901 {
9902 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9903 {
9904 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9905 }
9906 }
9907 else
9908 {
9909 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9910 }
9911 }
9912
9913 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9914 {
9915 int type = oldLoc.GetType();
9917 {
9918 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9919 }
9921 {
9922 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9923 }
9924 }
9925 if (!m_OldLocation)
9926 {
9927 m_OldLocation = new InventoryLocation;
9928 }
9929 m_OldLocation.Copy(oldLoc);
9930 }
9931 else
9932 {
9933 if (m_OldLocation)
9934 {
9935 m_OldLocation.Reset();
9936 }
9937 }
9938
9939 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9940 }
9941 else
9942 {
9943 if (newPlayer)
9944 {
9945 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9946 if (resIndex >= 0)
9947 {
9948 InventoryLocation il = new InventoryLocation;
9949 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9951 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9954 {
9955 il.
GetParent().GetOnReleaseLock().Invoke(it);
9956 }
9958 {
9960 }
9961
9962 }
9963 }
9965 {
9966
9968 }
9969
9970 if (m_OldLocation)
9971 {
9972 m_OldLocation.Reset();
9973 }
9974 }
9975
9977 {
9978 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9979 }
9980
9982 {
9983 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9984 }
9985 }
9986
9987 override void EOnContact(IEntity other, Contact extra)
9988 {
9990 {
9991 int liquidType = -1;
9993 if (impactSpeed > 0.0)
9994 {
9996 #ifndef SERVER
9998 #else
10000 SetSynchDirty();
10001 #endif
10003 }
10004 }
10005
10006 #ifdef SERVER
10007 if (GetCompEM() && GetCompEM().IsPlugged())
10008 {
10009 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10010 GetCompEM().UnplugThis();
10011 }
10012 #endif
10013 }
10014
10016
10018 {
10020 }
10021
10023 {
10024
10025 }
10026
10028 {
10029 super.OnItemLocationChanged(old_owner, new_owner);
10030
10031 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10032 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10033
10034 if (!relatedPlayer && playerNew)
10035 relatedPlayer = playerNew;
10036
10037 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10038 {
10040 if (actionMgr)
10041 {
10042 ActionBase currentAction = actionMgr.GetRunningAction();
10043 if (currentAction)
10045 }
10046 }
10047
10048 Man ownerPlayerOld = null;
10049 Man ownerPlayerNew = null;
10050
10051 if (old_owner)
10052 {
10053 if (old_owner.
IsMan())
10054 {
10055 ownerPlayerOld = Man.Cast(old_owner);
10056 }
10057 else
10058 {
10059 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10060 }
10061 }
10062 else
10063 {
10065 {
10067
10068 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10069 {
10070 GetCompEM().UnplugThis();
10071 }
10072 }
10073 }
10074
10075 if (new_owner)
10076 {
10077 if (new_owner.
IsMan())
10078 {
10079 ownerPlayerNew = Man.Cast(new_owner);
10080 }
10081 else
10082 {
10083 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10084 }
10085 }
10086
10087 if (ownerPlayerOld != ownerPlayerNew)
10088 {
10089 if (ownerPlayerOld)
10090 {
10091 array<EntityAI> subItemsExit = new array<EntityAI>;
10093 for (int i = 0; i < subItemsExit.Count(); i++)
10094 {
10097 }
10098 }
10099
10100 if (ownerPlayerNew)
10101 {
10102 array<EntityAI> subItemsEnter = new array<EntityAI>;
10104 for (int j = 0; j < subItemsEnter.Count(); j++)
10105 {
10108 }
10109 }
10110 }
10111 else if (ownerPlayerNew != null)
10112 {
10113 PlayerBase nplayer;
10114 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10115 {
10116 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10118 for (int k = 0; k < subItemsUpdate.Count(); k++)
10119 {
10121 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10122 }
10123 }
10124 }
10125
10126 if (old_owner)
10127 old_owner.OnChildItemRemoved(this);
10128 if (new_owner)
10129 new_owner.OnChildItemReceived(this);
10130 }
10131
10132
10134 {
10135 super.EEDelete(parent);
10136 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10137 if (player)
10138 {
10140
10141 if (player.IsAlive())
10142 {
10143 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10144 if (r_index >= 0)
10145 {
10146 InventoryLocation r_il = new InventoryLocation;
10147 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10148
10149 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10152 {
10153 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10154 }
10156 {
10157 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10158 }
10159
10160 }
10161
10162 player.RemoveQuickBarEntityShortcut(this);
10163 }
10164 }
10165 }
10166
10168 {
10169 super.EEKilled(killer);
10170
10173 {
10174 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10175 {
10176 if (IsMagazine())
10177 {
10178 if (Magazine.Cast(this).GetAmmoCount() > 0)
10179 {
10181 }
10182 }
10183 else
10184 {
10186 }
10187 }
10188 }
10189 }
10190
10192 {
10193 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10194
10195 super.OnWasAttached(parent, slot_id);
10196
10199
10202 }
10203
10205 {
10206 super.OnWasDetached(parent, slot_id);
10207
10210
10213 }
10214
10216 {
10217 int idx;
10220
10221 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10222 if (inventory_slots.Count() < 1)
10223 {
10224 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10225 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10226 }
10227 else
10228 {
10229 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10230 }
10231
10232 idx = inventory_slots.Find(slot);
10233 if (idx < 0)
10234 return "";
10235
10236 return attach_types.Get(idx);
10237 }
10238
10240 {
10241 int idx = -1;
10242 string slot;
10243
10246
10247 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10248 if (inventory_slots.Count() < 1)
10249 {
10250 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10251 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10252 }
10253 else
10254 {
10255 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10256 if (detach_types.Count() < 1)
10257 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10258 }
10259
10260 for (int i = 0; i < inventory_slots.Count(); i++)
10261 {
10262 slot = inventory_slots.Get(i);
10263 }
10264
10265 if (slot != "")
10266 {
10267 if (detach_types.Count() == 1)
10268 idx = 0;
10269 else
10270 idx = inventory_slots.Find(slot);
10271 }
10272 if (idx < 0)
10273 return "";
10274
10275 return detach_types.Get(idx);
10276 }
10277
10279 {
10280
10282
10283
10284 float min_time = 1;
10285 float max_time = 3;
10286 float delay = Math.RandomFloat(min_time, max_time);
10287
10288 explode_timer.Run(delay, this, "DoAmmoExplosion");
10289 }
10290
10292 {
10293 Magazine magazine = Magazine.Cast(this);
10294 int pop_sounds_count = 6;
10295 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10296
10297
10298 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10299 string sound_name = pop_sounds[ sound_idx ];
10300 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10301
10302
10303 magazine.ServerAddAmmoCount(-1);
10304
10305
10306 float min_temp_to_explode = 100;
10307
10308 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10309 {
10311 }
10312 }
10313
10314
10315 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10316 {
10317 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10318
10319 const int CHANCE_DAMAGE_CARGO = 4;
10320 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10321 const int CHANCE_DAMAGE_NOTHING = 2;
10322
10324 {
10325 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10326 int chances;
10327 int rnd;
10328
10329 if (GetInventory().GetCargo())
10330 {
10331 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10332 rnd = Math.RandomInt(0,chances);
10333
10334 if (rnd < CHANCE_DAMAGE_CARGO)
10335 {
10337 }
10338 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10339 {
10341 }
10342 }
10343 else
10344 {
10345 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10346 rnd = Math.RandomInt(0,chances);
10347
10348 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10349 {
10351 }
10352 }
10353 }
10354 }
10355
10357 {
10358 CargoBase cargo = GetInventory().GetCargo();
10359 if (cargo)
10360 {
10362 if (item_count > 0)
10363 {
10364 int random_pick = Math.RandomInt(0, item_count);
10366 if (!item.IsExplosive())
10367 {
10368 item.AddHealth("","",damage);
10369 return true;
10370 }
10371 }
10372 }
10373 return false;
10374 }
10375
10377 {
10378 GameInventory inventory = GetInventory();
10380 if (attachment_count > 0)
10381 {
10382 int random_pick = Math.RandomInt(0, attachment_count);
10384 if (!attachment.IsExplosive())
10385 {
10386 attachment.AddHealth("","",damage);
10387 return true;
10388 }
10389 }
10390 return false;
10391 }
10392
10394 {
10396 }
10397
10399 {
10401 return GetInventory().CanRemoveEntity();
10402
10403 return false;
10404 }
10405
10407 {
10408
10410 return false;
10411
10412
10414 return false;
10415
10416
10417
10419 if (delta == 0)
10420 return false;
10421
10422
10423 return true;
10424 }
10425
10427 {
10429 {
10430 if (ScriptInputUserData.CanStoreInputUserData())
10431 {
10432 ScriptInputUserData ctx = new ScriptInputUserData;
10437 ctx.
Write(destination_entity);
10439 ctx.
Write(slot_id);
10441 }
10442 }
10443 else if (!
g_Game.IsMultiplayer())
10444 {
10446 }
10447 }
10448
10450 {
10451 float split_quantity_new;
10455 InventoryLocation loc = new InventoryLocation;
10456
10457 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10458 {
10460 split_quantity_new = stack_max;
10461 else
10463
10465 {
10466 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10467 if (new_item)
10468 {
10469 new_item.SetResultOfSplit(true);
10470 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10472 new_item.
SetQuantity(split_quantity_new,
false,
true);
10473 }
10474 }
10475 }
10476 else if (destination_entity && slot_id == -1)
10477 {
10478 if (quantity > stack_max)
10479 split_quantity_new = stack_max;
10480 else
10481 split_quantity_new = quantity;
10482
10484 {
10485 GameInventory destinationInventory = destination_entity.GetInventory();
10487 {
10490 }
10491
10492 if (new_item)
10493 {
10494 new_item.SetResultOfSplit(true);
10495 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10497 new_item.
SetQuantity(split_quantity_new,
false,
true);
10498 }
10499 }
10500 }
10501 else
10502 {
10503 if (stack_max != 0)
10504 {
10506 {
10508 }
10509
10510 if (split_quantity_new == 0)
10511 {
10512 if (!
g_Game.IsMultiplayer())
10513 player.PhysicalPredictiveDropItem(this);
10514 else
10515 player.ServerDropEntity(this);
10516 return;
10517 }
10518
10520 {
10522
10523 if (new_item)
10524 {
10525 new_item.SetResultOfSplit(true);
10526 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10529 new_item.PlaceOnSurface();
10530 }
10531 }
10532 }
10533 }
10534 }
10535
10537 {
10538 float split_quantity_new;
10542 InventoryLocation loc = new InventoryLocation;
10543
10544 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10545 {
10547 split_quantity_new = stack_max;
10548 else
10550
10552 {
10553 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10554 if (new_item)
10555 {
10556 new_item.SetResultOfSplit(true);
10557 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10559 new_item.
SetQuantity(split_quantity_new,
false,
true);
10560 }
10561 }
10562 }
10563 else if (destination_entity && slot_id == -1)
10564 {
10565 if (quantity > stack_max)
10566 split_quantity_new = stack_max;
10567 else
10568 split_quantity_new = quantity;
10569
10571 {
10572 GameInventory destinationInventory = destination_entity.GetInventory();
10574 {
10577 }
10578
10579 if (new_item)
10580 {
10581 new_item.SetResultOfSplit(true);
10582 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10584 new_item.
SetQuantity(split_quantity_new,
false,
true);
10585 }
10586 }
10587 }
10588 else
10589 {
10590 if (stack_max != 0)
10591 {
10593 {
10595 }
10596
10598 {
10600
10601 if (new_item)
10602 {
10603 new_item.SetResultOfSplit(true);
10604 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10607 new_item.PlaceOnSurface();
10608 }
10609 }
10610 }
10611 }
10612 }
10613
10615 {
10617 {
10618 if (ScriptInputUserData.CanStoreInputUserData())
10619 {
10620 ScriptInputUserData ctx = new ScriptInputUserData;
10625 dst.WriteToContext(ctx);
10627 }
10628 }
10629 else if (!
g_Game.IsMultiplayer())
10630 {
10632 }
10633 }
10634
10636 {
10638 {
10639 if (ScriptInputUserData.CanStoreInputUserData())
10640 {
10641 ScriptInputUserData ctx = new ScriptInputUserData;
10646 ctx.
Write(destination_entity);
10652 }
10653 }
10654 else if (!
g_Game.IsMultiplayer())
10655 {
10657 }
10658 }
10659
10661 {
10663 }
10664
10666 {
10668 float split_quantity_new;
10670 if (dst.IsValid())
10671 {
10672 int slot_id = dst.GetSlot();
10674
10675 if (quantity > stack_max)
10676 split_quantity_new = stack_max;
10677 else
10678 split_quantity_new = quantity;
10679
10681 {
10683
10684 if (new_item)
10685 {
10686 new_item.SetResultOfSplit(true);
10687 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10689 new_item.
SetQuantity(split_quantity_new,
false,
true);
10690 }
10691
10692 return new_item;
10693 }
10694 }
10695
10696 return null;
10697 }
10698
10700 {
10702 float split_quantity_new;
10704 if (destination_entity)
10705 {
10707 if (quantity > stackable)
10708 split_quantity_new = stackable;
10709 else
10710 split_quantity_new = quantity;
10711
10713 {
10714 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10715 if (new_item)
10716 {
10717 new_item.SetResultOfSplit(true);
10718 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10720 new_item.
SetQuantity(split_quantity_new,
false,
true);
10721 }
10722 }
10723 }
10724 }
10725
10727 {
10729 {
10730 if (ScriptInputUserData.CanStoreInputUserData())
10731 {
10732 ScriptInputUserData ctx = new ScriptInputUserData;
10737 ItemBase destination_entity =
this;
10738 ctx.
Write(destination_entity);
10742 }
10743 }
10744 else if (!
g_Game.IsMultiplayer())
10745 {
10747 }
10748 }
10749
10751 {
10753 float split_quantity_new;
10755 if (player)
10756 {
10758 if (quantity > stackable)
10759 split_quantity_new = stackable;
10760 else
10761 split_quantity_new = quantity;
10762
10764 {
10765 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10766 new_item =
ItemBase.Cast(in_hands);
10767 if (new_item)
10768 {
10769 new_item.SetResultOfSplit(true);
10770 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10772 new_item.SetQuantity(split_quantity_new, false, true);
10773 }
10774 }
10775 }
10776 }
10777
10779 {
10781 float split_quantity_new = Math.Floor(quantity * 0.5);
10782
10784 return;
10785
10787
10788 if (new_item)
10789 {
10790 if (new_item.GetQuantityMax() < split_quantity_new)
10791 {
10792 split_quantity_new = new_item.GetQuantityMax();
10793 }
10794
10795 new_item.SetResultOfSplit(true);
10796 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10797
10799 {
10802 }
10803 else
10804 {
10806 new_item.
SetQuantity(split_quantity_new,
false,
true);
10807 }
10808 }
10809 }
10810
10812 {
10814 float split_quantity_new = Math.Floor(quantity / 2);
10815
10817 return;
10818
10819 InventoryLocation invloc = new InventoryLocation;
10821
10823 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10824
10825 if (new_item)
10826 {
10827 if (new_item.GetQuantityMax() < split_quantity_new)
10828 {
10829 split_quantity_new = new_item.GetQuantityMax();
10830 }
10832 {
10835 }
10836 else if (split_quantity_new > 1)
10837 {
10839 new_item.
SetQuantity(split_quantity_new,
false,
true);
10840 }
10841 }
10842 }
10843
10846 {
10847 SetWeightDirty();
10849
10850 if (parent)
10851 parent.OnAttachmentQuantityChangedEx(this, delta);
10852
10854 {
10856 {
10858 }
10860 {
10861 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10863 }
10864 }
10865 }
10866
10869 {
10870
10871 }
10872
10875 {
10877 }
10878
10880 {
10881 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10882
10884 {
10885 if (newLevel == GameConstants.STATE_RUINED)
10886 {
10888 EntityAI parent = GetHierarchyParent();
10889 if (parent && parent.IsFireplace())
10890 {
10891 CargoBase cargo = GetInventory().GetCargo();
10892 if (cargo)
10893 {
10895 {
10897 }
10898 }
10899 }
10900 }
10901
10903 {
10904
10906 return;
10907 }
10908
10909 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10910 {
10912 }
10913 }
10914 }
10915
10916
10918 {
10919 super.OnRightClick();
10920
10922 {
10924 {
10925 if (ScriptInputUserData.CanStoreInputUserData())
10926 {
10927 EntityAI root = GetHierarchyRoot();
10928 Man playerOwner = GetHierarchyRootPlayer();
10929 InventoryLocation dst = new InventoryLocation;
10930
10931
10932 if (!playerOwner && root && root == this)
10933 {
10935 }
10936 else
10937 {
10938
10939 GetInventory().GetCurrentInventoryLocation(dst);
10941 {
10942 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10944 {
10946 }
10947 else
10948 {
10950
10951
10952 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10953 {
10955 }
10956 else
10957 {
10958 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10959 }
10960 }
10961 }
10962 }
10963
10964 ScriptInputUserData ctx = new ScriptInputUserData;
10972 }
10973 }
10974 else if (!
g_Game.IsMultiplayer())
10975 {
10977 }
10978 }
10979 }
10980
10982 {
10983 if (root)
10984 {
10985 vector m4[4];
10986 root.GetTransform(m4);
10987 dst.SetGround(this, m4);
10988 }
10989 else
10990 {
10991 GetInventory().GetCurrentInventoryLocation(dst);
10992 }
10993 }
10994
10995 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10996 {
10997
10998 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10999 return false;
11000
11001 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11002 return false;
11003
11004
11006 return false;
11007
11008
11009 Magazine mag = Magazine.Cast(this);
11010 if (mag)
11011 {
11012 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11013 return false;
11014
11015 if (stack_max_limit)
11016 {
11017 Magazine other_mag = Magazine.Cast(other_item);
11018 if (other_item)
11019 {
11020 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11021 return false;
11022 }
11023
11024 }
11025 }
11026 else
11027 {
11028
11030 return false;
11031
11033 return false;
11034 }
11035
11036 PlayerBase player = null;
11037 if (CastTo(player, GetHierarchyRootPlayer()))
11038 {
11039 if (player.GetInventory().HasAttachment(this))
11040 return false;
11041
11042 if (player.IsItemsToDelete())
11043 return false;
11044 }
11045
11046 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11047 return false;
11048
11049 int slotID;
11051 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11052 return false;
11053
11054 return true;
11055 }
11056
11058 {
11060 }
11061
11063 {
11064 return m_IsResultOfSplit;
11065 }
11066
11068 {
11069 m_IsResultOfSplit = value;
11070 }
11071
11073 {
11075 }
11076
11078 {
11079 float other_item_quantity = other_item.GetQuantity();
11080 float this_free_space;
11081
11083
11085
11086 if (other_item_quantity > this_free_space)
11087 {
11088 return this_free_space;
11089 }
11090 else
11091 {
11092 return other_item_quantity;
11093 }
11094 }
11095
11097 {
11099 }
11100
11102 {
11104 return;
11105
11106 if (!IsMagazine() && other_item)
11107 {
11109 if (quantity_used != 0)
11110 {
11111 float hp1 = GetHealth01("","");
11112 float hp2 = other_item.GetHealth01("","");
11113 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11114 hpResult = hpResult / (
GetQuantity() + quantity_used);
11115
11116 hpResult *= GetMaxHealth();
11117 Math.Round(hpResult);
11118 SetHealth("", "Health", hpResult);
11119
11121 other_item.AddQuantity(-quantity_used);
11122 }
11123 }
11125 }
11126
11128 {
11129 #ifdef SERVER
11130 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11131 GetHierarchyParent().IncreaseLifetimeUp();
11132 #endif
11133 };
11134
11136 {
11137 PlayerBase p = PlayerBase.Cast(player);
11138
11139 array<int> recipesIds = p.m_Recipes;
11140 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11141 if (moduleRecipesManager)
11142 {
11143 EntityAI itemInHands = player.GetEntityInHands();
11144 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11145 }
11146
11147 for (int i = 0;i < recipesIds.Count(); i++)
11148 {
11149 int key = recipesIds.Get(i);
11150 string recipeName = moduleRecipesManager.GetRecipeName(key);
11152 }
11153 }
11154
11155
11156 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11157 {
11158 super.GetDebugActions(outputList);
11159
11160
11166
11167
11172
11177
11178
11182
11183
11185 {
11189 }
11190
11193
11194
11198
11200
11201 InventoryLocation loc = new InventoryLocation();
11202 GetInventory().GetCurrentInventoryLocation(loc);
11204 {
11205 if (Gizmo_IsSupported())
11208 }
11209
11211 }
11212
11213
11214
11215
11217 {
11218 super.OnAction(action_id, player, ctx);
11219
11221 {
11222 switch (action_id)
11223 {
11227 return true;
11231 return true;
11232 }
11233 }
11234
11236 {
11237 switch (action_id)
11238 {
11240 Delete();
11241 return true;
11242 }
11243 }
11244
11245 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11246 {
11247 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11248 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11249 PlayerBase p = PlayerBase.Cast(player);
11250 if (
EActions.RECIPES_RANGE_START < 1000)
11251 {
11252 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11253 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11254 }
11255 }
11256 #ifndef SERVER
11257 else if (action_id ==
EActions.WATCH_PLAYER)
11258 {
11259 PluginDeveloper.SetDeveloperItemClientEx(player);
11260 }
11261 #endif
11263 {
11264 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11265 {
11266 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11267 OnDebugButtonPressServer(id + 1);
11268 }
11269
11270 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11271 {
11272 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11274 }
11275
11276 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11277 {
11278 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11280 }
11281
11282 else if (action_id ==
EActions.ADD_QUANTITY)
11283 {
11284 if (IsMagazine())
11285 {
11286 Magazine mag = Magazine.Cast(this);
11287 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11288 }
11289 else
11290 {
11292 }
11293
11294 if (m_EM)
11295 {
11296 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11297 }
11298
11299 }
11300
11301 else if (action_id ==
EActions.REMOVE_QUANTITY)
11302 {
11303 if (IsMagazine())
11304 {
11305 Magazine mag2 = Magazine.Cast(this);
11306 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11307 }
11308 else
11309 {
11311 }
11312 if (m_EM)
11313 {
11314 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11315 }
11316
11317 }
11318
11319 else if (action_id ==
EActions.SET_QUANTITY_0)
11320 {
11322
11323 if (m_EM)
11324 {
11325 m_EM.SetEnergy(0);
11326 }
11327 }
11328
11329 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11330 {
11332
11333 if (m_EM)
11334 {
11335 m_EM.SetEnergy(m_EM.GetEnergyMax());
11336 }
11337 }
11338
11339 else if (action_id ==
EActions.ADD_HEALTH)
11340 {
11341 AddHealth("","",GetMaxHealth("","Health")/5);
11342 }
11343 else if (action_id ==
EActions.REMOVE_HEALTH)
11344 {
11345 AddHealth("","",-GetMaxHealth("","Health")/5);
11346 }
11347 else if (action_id ==
EActions.DESTROY_HEALTH)
11348 {
11349 SetHealth01("","",0);
11350 }
11351 else if (action_id ==
EActions.WATCH_ITEM)
11352 {
11354 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11355 #ifdef DEVELOPER
11356 SetDebugDeveloper_item(this);
11357 #endif
11358 }
11359
11360 else if (action_id ==
EActions.ADD_TEMPERATURE)
11361 {
11362 AddTemperature(20);
11363
11364 }
11365
11366 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11367 {
11368 AddTemperature(-20);
11369
11370 }
11371
11372 else if (action_id ==
EActions.FLIP_FROZEN)
11373 {
11374 SetFrozen(!GetIsFrozen());
11375
11376 }
11377
11378 else if (action_id ==
EActions.ADD_WETNESS)
11379 {
11381
11382 }
11383
11384 else if (action_id ==
EActions.REMOVE_WETNESS)
11385 {
11387
11388 }
11389
11390 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11391 {
11394
11395
11396 }
11397
11398 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11399 {
11402 }
11403
11404 else if (action_id ==
EActions.MAKE_SPECIAL)
11405 {
11406 auto debugParams = DebugSpawnParams.WithPlayer(player);
11407 OnDebugSpawnEx(debugParams);
11408 }
11409
11410 }
11411
11412
11413 return false;
11414 }
11415
11416
11417
11418
11422
11425
11426
11427
11429 {
11430 return false;
11431 }
11432
11433
11435 {
11436 return true;
11437 }
11438
11439
11441 {
11442 return true;
11443 }
11444
11445
11446
11448 {
11449 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11450 return g_Game.ConfigIsExisting(config_path);
11451 }
11452
11455 {
11456 return null;
11457 }
11458
11460 {
11461 return false;
11462 }
11463
11465 {
11466 return false;
11467 }
11468
11472
11473
11475 {
11476 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11477 return module_repairing.CanRepair(this, item_repair_kit);
11478 }
11479
11480
11481 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11482 {
11483 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11484 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11485 }
11486
11487
11489 {
11490
11491
11492
11493
11494
11495
11496
11497
11498 return 1;
11499 }
11500
11501
11502
11504 {
11506 }
11507
11508
11509
11511 {
11513 }
11514
11515
11524 {
11525 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11526
11527 if (player)
11528 {
11529 player.MessageStatus(text);
11530 }
11531 }
11532
11533
11542 {
11543 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11544
11545 if (player)
11546 {
11547 player.MessageAction(text);
11548 }
11549 }
11550
11551
11560 {
11561 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11562
11563 if (player)
11564 {
11565 player.MessageFriendly(text);
11566 }
11567 }
11568
11569
11578 {
11579 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11580
11581 if (player)
11582 {
11583 player.MessageImportant(text);
11584 }
11585 }
11586
11588 {
11589 return true;
11590 }
11591
11592
11593 override bool KindOf(
string tag)
11594 {
11595 bool found = false;
11596 string item_name = this.
GetType();
11598 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11599
11600 int array_size = item_tag_array.Count();
11601 for (int i = 0; i < array_size; i++)
11602 {
11603 if (item_tag_array.Get(i) == tag)
11604 {
11605 found = true;
11606 break;
11607 }
11608 }
11609 return found;
11610 }
11611
11612
11614 {
11615
11616 super.OnRPC(sender, rpc_type,ctx);
11617
11618
11619 switch (rpc_type)
11620 {
11621 #ifndef SERVER
11622 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11623 Param2<bool, string> p = new Param2<bool, string>(false, "");
11624
11626 return;
11627
11628 bool play = p.param1;
11629 string soundSet = p.param2;
11630
11631 if (play)
11632 {
11634 {
11636 {
11638 }
11639 }
11640 else
11641 {
11643 }
11644 }
11645 else
11646 {
11648 }
11649
11650 break;
11651 #endif
11652
11653 }
11654
11656 {
11658 }
11659 }
11660
11661
11662
11663
11665 {
11666 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11667 return plugin.GetID(
name);
11668 }
11669
11671 {
11672 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11673 return plugin.GetName(id);
11674 }
11675
11678 {
11679
11680
11681 int varFlags;
11682 if (!ctx.
Read(varFlags))
11683 return;
11684
11685 if (varFlags & ItemVariableFlags.FLOAT)
11686 {
11688 }
11689 }
11690
11692 {
11693
11694 super.SerializeNumericalVars(floats_out);
11695
11696
11697
11699 {
11701 }
11702
11704 {
11706 }
11707
11709 {
11711 }
11712
11714 {
11719 }
11720
11722 {
11724 }
11725 }
11726
11728 {
11729
11730 super.DeSerializeNumericalVars(floats);
11731
11732
11733 int index = 0;
11734 int mask = Math.Round(floats.Get(index));
11735
11736 index++;
11737
11739 {
11741 {
11743 }
11744 else
11745 {
11746 float quantity = floats.Get(index);
11747 SetQuantity(quantity,
true,
false,
false,
false);
11748 }
11749 index++;
11750 }
11751
11753 {
11754 float wet = floats.Get(index);
11756 index++;
11757 }
11758
11760 {
11761 int liquidtype = Math.Round(floats.Get(index));
11763 index++;
11764 }
11765
11767 {
11769 index++;
11771 index++;
11773 index++;
11775 index++;
11776 }
11777
11779 {
11780 int cleanness = Math.Round(floats.Get(index));
11782 index++;
11783 }
11784 }
11785
11787 {
11788 super.WriteVarsToCTX(ctx);
11789
11790
11792 {
11794 }
11795
11797 {
11799 }
11800
11802 {
11804 }
11805
11807 {
11808 int r,g,b,a;
11814 }
11815
11817 {
11819 }
11820 }
11821
11823 {
11824 if (!super.ReadVarsFromCTX(ctx,version))
11825 return false;
11826
11827 int intValue;
11828 float value;
11829
11830 if (version < 140)
11831 {
11832 if (!ctx.
Read(intValue))
11833 return false;
11834
11835 m_VariablesMask = intValue;
11836 }
11837
11839 {
11840 if (!ctx.
Read(value))
11841 return false;
11842
11844 {
11846 }
11847 else
11848 {
11850 }
11851 }
11852
11853 if (version < 140)
11854 {
11856 {
11857 if (!ctx.
Read(value))
11858 return false;
11859 SetTemperatureDirect(value);
11860 }
11861 }
11862
11864 {
11865 if (!ctx.
Read(value))
11866 return false;
11868 }
11869
11871 {
11872 if (!ctx.
Read(intValue))
11873 return false;
11875 }
11876
11878 {
11879 int r,g,b,a;
11881 return false;
11883 return false;
11885 return false;
11887 return false;
11888
11890 }
11891
11893 {
11894 if (!ctx.
Read(intValue))
11895 return false;
11897 }
11898
11899 if (version >= 138 && version < 140)
11900 {
11902 {
11903 if (!ctx.
Read(intValue))
11904 return false;
11905 SetFrozen(intValue);
11906 }
11907 }
11908
11909 return true;
11910 }
11911
11912
11914 {
11917 {
11919 }
11920
11921 if (!super.OnStoreLoad(ctx, version))
11922 {
11924 return false;
11925 }
11926
11927 if (version >= 114)
11928 {
11929 bool hasQuickBarIndexSaved;
11930
11931 if (!ctx.
Read(hasQuickBarIndexSaved))
11932 {
11934 return false;
11935 }
11936
11937 if (hasQuickBarIndexSaved)
11938 {
11939 int itmQBIndex;
11940
11941
11942 if (!ctx.
Read(itmQBIndex))
11943 {
11945 return false;
11946 }
11947
11948 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11949 if (itmQBIndex != -1 && parentPlayer)
11950 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11951 }
11952 }
11953 else
11954 {
11955
11956 PlayerBase player;
11957 int itemQBIndex;
11958 if (version ==
int.
MAX)
11959 {
11960 if (!ctx.
Read(itemQBIndex))
11961 {
11963 return false;
11964 }
11965 }
11966 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11967 {
11968
11969 if (!ctx.
Read(itemQBIndex))
11970 {
11972 return false;
11973 }
11974 if (itemQBIndex != -1 && player)
11975 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11976 }
11977 }
11978
11979 if (version < 140)
11980 {
11981
11982 if (!LoadVariables(ctx, version))
11983 {
11985 return false;
11986 }
11987 }
11988
11989
11991 {
11993 return false;
11994 }
11995 if (version >= 132)
11996 {
11998 if (raib)
11999 {
12001 {
12003 return false;
12004 }
12005 }
12006 }
12007
12009 return true;
12010 }
12011
12012
12013
12015 {
12016 super.OnStoreSave(ctx);
12017
12018 PlayerBase player;
12019 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12020 {
12022
12023 int itemQBIndex = -1;
12024 itemQBIndex = player.FindQuickBarEntityIndex(this);
12025 ctx.
Write(itemQBIndex);
12026 }
12027 else
12028 {
12030 }
12031
12033
12035 if (raib)
12036 {
12038 }
12039 }
12040
12041
12043 {
12044 super.AfterStoreLoad();
12045
12047 {
12049 }
12050
12052 {
12055 }
12056 }
12057
12059 {
12060 super.EEOnAfterLoad();
12061
12063 {
12065 }
12066
12069 }
12070
12072 {
12073 return false;
12074 }
12075
12076
12077
12079 {
12081 {
12082 #ifdef PLATFORM_CONSOLE
12083
12085 {
12087 if (menu)
12088 {
12090 }
12091 }
12092 #endif
12093 }
12094
12096 {
12099 }
12100
12102 {
12103 SetWeightDirty();
12105 }
12107 {
12110 }
12111
12113 {
12116
12119 }
12121 {
12125 }
12126
12127 super.OnVariablesSynchronized();
12128 }
12129
12130
12131
12133 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12134 {
12135 if (!IsServerCheck(allow_client))
12136 return false;
12137
12139 return false;
12140
12143
12144 if (value <= (min + 0.001))
12145 value = min;
12146
12147 if (value == min)
12148 {
12149 if (destroy_config)
12150 {
12151 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12152 if (dstr)
12153 {
12155 this.Delete();
12156 return true;
12157 }
12158 }
12159 else if (destroy_forced)
12160 {
12162 this.Delete();
12163 return true;
12164 }
12165
12167 }
12168
12171
12173 {
12174 EntityAI parent = GetHierarchyRoot();
12175 InventoryLocation iLoc = new InventoryLocation();
12176 GetInventory().GetCurrentInventoryLocation(iLoc);
12178 {
12179 int iLocSlot = iLoc.
GetSlot();
12181 {
12183 }
12185 {
12187 }
12188 }
12189 }
12190
12192 {
12194
12195 if (delta)
12197 }
12198
12200
12201 return false;
12202 }
12203
12204
12206 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12207 {
12209 }
12210
12212 {
12215 }
12216
12218 {
12221 }
12222
12224 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12225 {
12226 float value_clamped = Math.Clamp(value, 0, 1);
12228 SetQuantity(result, destroy_config, destroy_forced);
12229 }
12230
12231
12234 {
12236 }
12237
12239 {
12241 }
12242
12243
12244
12245
12246
12247
12248
12249
12250
12251
12253 {
12254 int slot = -1;
12255 GameInventory inventory = GetInventory();
12256 if (inventory)
12257 {
12258 InventoryLocation il = new InventoryLocation;
12261 }
12262
12264 }
12265
12267 {
12268 float quantity_max = 0;
12269
12271 {
12272 if (attSlotID != -1)
12273 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12274
12275 if (quantity_max <= 0)
12277 }
12278
12279 if (quantity_max <= 0)
12281
12282 return quantity_max;
12283 }
12284
12286 {
12288 }
12289
12291 {
12293 }
12294
12295
12297 {
12299 }
12300
12302 {
12304 }
12305
12307 {
12309 }
12310
12311
12313 {
12314
12315 float weightEx = GetWeightEx();
12316 float special = GetInventoryAndCargoWeight();
12317 return weightEx - special;
12318 }
12319
12320
12322 {
12324 }
12325
12327 {
12329 {
12330 #ifdef DEVELOPER
12331 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12332 {
12333 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12335 }
12336 #endif
12337
12338 return GetQuantity() * GetConfigWeightModified();
12339 }
12340 else if (HasEnergyManager())
12341 {
12342 #ifdef DEVELOPER
12343 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12344 {
12345 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12346 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12347 }
12348 #endif
12349 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12350 }
12351 else
12352 {
12353 #ifdef DEVELOPER
12354 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12355 {
12356 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12357 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12358 }
12359 #endif
12360 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12361 }
12362 }
12363
12366 {
12367 int item_count = 0;
12369
12370 GameInventory inventory = GetInventory();
12371 CargoBase cargo = inventory.
GetCargo();
12372 if (cargo != NULL)
12373 {
12375 }
12376
12378 for (int i = 0; i < nAttachments; ++i)
12379 {
12381 if (item)
12382 item_count += item.GetNumberOfItems();
12383 }
12384 return item_count;
12385 }
12386
12389 {
12390 float weight = 0;
12391 float wetness = 1;
12392 if (include_wetness)
12395 {
12396 weight = wetness * m_ConfigWeight;
12397 }
12399 {
12400 weight = 1;
12401 }
12402 return weight;
12403 }
12404
12405
12406
12408 {
12409 GameInventory inventory = GetInventory();
12410 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12411 {
12412 array<EntityAI> items = new array<EntityAI>;
12414 for (int i = 0; i < items.Count(); ++i)
12415 {
12417 if (item)
12418 {
12419 g_Game.ObjectDelete(item);
12420 }
12421 }
12422 }
12423 }
12424
12425
12426
12427
12429 {
12430 float energy = 0;
12431 if (HasEnergyManager())
12432 {
12433 energy = GetCompEM().GetEnergy();
12434 }
12435 return energy;
12436 }
12437
12438
12440 {
12441 super.OnEnergyConsumed();
12442
12444 }
12445
12447 {
12448 super.OnEnergyAdded();
12449
12451 }
12452
12453
12455 {
12456 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12457 {
12459 {
12460 float energy_0to1 = GetCompEM().GetEnergy0To1();
12462 }
12463 }
12464 }
12465
12466
12468 {
12469 return ConfigGetFloat("heatIsolation");
12470 }
12471
12473 {
12475 }
12476
12478 {
12479 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12480 if (
g_Game.ConfigIsExisting(paramPath))
12481 return g_Game.ConfigGetFloat(paramPath);
12482
12483 return 0.0;
12484 }
12485
12487 {
12488 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12489 if (
g_Game.ConfigIsExisting(paramPath))
12490 return g_Game.ConfigGetFloat(paramPath);
12491
12492 return 0.0;
12493 }
12494
12495 override void SetWet(
float value,
bool allow_client =
false)
12496 {
12497 if (!IsServerCheck(allow_client))
12498 return;
12499
12502
12504
12505 m_VarWet = Math.Clamp(value, min, max);
12506
12508 {
12511 }
12512 }
12513
12514 override void AddWet(
float value)
12515 {
12517 }
12518
12520 {
12522 }
12523
12525 {
12527 }
12528
12530 {
12532 }
12533
12535 {
12537 }
12538
12540 {
12542 }
12543
12544 override void OnWetChanged(
float newVal,
float oldVal)
12545 {
12548 if (newLevel != oldLevel)
12549 {
12551 }
12552 }
12553
12555 {
12556 SetWeightDirty();
12557 }
12558
12560 {
12561 return GetWetLevelInternal(
m_VarWet);
12562 }
12563
12564
12565
12567 {
12569 }
12570
12572 {
12574 }
12575
12577 {
12579 }
12580
12582 {
12584 }
12585
12586
12587
12589 {
12590 if (ConfigIsExisting("itemModelLength"))
12591 {
12592 return ConfigGetFloat("itemModelLength");
12593 }
12594 return 0;
12595 }
12596
12598 {
12599 if (ConfigIsExisting("itemAttachOffset"))
12600 {
12601 return ConfigGetFloat("itemAttachOffset");
12602 }
12603 return 0;
12604 }
12605
12606 override void SetCleanness(
int value,
bool allow_client =
false)
12607 {
12608 if (!IsServerCheck(allow_client))
12609 return;
12610
12612
12614
12617 }
12618
12620 {
12622 }
12623
12625 {
12626 return true;
12627 }
12628
12629
12630
12631
12633 {
12635 }
12636
12638 {
12640 }
12641
12642
12643
12644
12645 override void SetColor(
int r,
int g,
int b,
int a)
12646 {
12652 }
12654 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12655 {
12660 }
12661
12663 {
12665 }
12666
12669 {
12670 int r,g,b,a;
12672 r = r/255;
12673 g = g/255;
12674 b = b/255;
12675 a = a/255;
12676 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12677 }
12678
12679
12680
12681 override void SetLiquidType(
int value,
bool allow_client =
false)
12682 {
12683 if (!IsServerCheck(allow_client))
12684 return;
12685
12690 }
12691
12693 {
12694 return ConfigGetInt("varLiquidTypeInit");
12695 }
12696
12698 {
12700 }
12701
12703 {
12705 SetFrozen(false);
12706 }
12707
12710 {
12711 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12712 }
12713
12714
12717 {
12718 PlayerBase nplayer;
12719 if (PlayerBase.CastTo(nplayer, player))
12720 {
12722 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12723 }
12724 }
12725
12726
12729 {
12730 PlayerBase nplayer;
12731 if (PlayerBase.CastTo(nplayer,player))
12732 {
12733 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12734 }
12735
12736 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12737
12738 if (HasEnergyManager())
12739 {
12740 GetCompEM().UpdatePlugState();
12741 }
12742 }
12743
12744
12746 {
12747 super.OnPlacementStarted(player);
12748
12750 }
12751
12752 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12753 {
12755 {
12756 m_AdminLog.OnPlacementComplete(player,
this);
12757 }
12758
12759 super.OnPlacementComplete(player, position, orientation);
12760 }
12761
12762
12763
12764
12765
12767 {
12769 {
12770 return true;
12771 }
12772 else
12773 {
12774 return false;
12775 }
12776 }
12777
12778
12780 {
12782 {
12784 }
12785 }
12786
12787
12789 {
12791 }
12792
12794 {
12796 }
12797
12798 override void InsertAgent(
int agent,
float count = 1)
12799 {
12800 if (count < 1)
12801 return;
12802
12804 }
12805
12808 {
12810 }
12811
12812
12814 {
12816 }
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12860 {
12862 return false;
12863 return true;
12864 }
12865
12867 {
12868
12870 }
12871
12872
12875 {
12876 super.CheckForRoofLimited(timeTresholdMS);
12877
12878 float time =
g_Game.GetTime();
12879 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12880 {
12881 m_PreviousRoofTestTime = time;
12882 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12883 }
12884 }
12885
12886
12888 {
12890 {
12891 return 0;
12892 }
12893
12894 if (GetInventory().GetAttachmentSlotsCount() != 0)
12895 {
12896 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12897 if (filter)
12898 return filter.GetProtectionLevel(type, false, system);
12899 else
12900 return 0;
12901 }
12902
12903 string subclassPath, entryName;
12904
12905 switch (type)
12906 {
12908 entryName = "biological";
12909 break;
12911 entryName = "chemical";
12912 break;
12913 default:
12914 entryName = "biological";
12915 break;
12916 }
12917
12918 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12919
12920 return g_Game.ConfigGetFloat(subclassPath + entryName);
12921 }
12922
12923
12924
12927 {
12928 if (!IsMagazine())
12930
12932 }
12933
12934
12935
12936
12937
12942 {
12943 return true;
12944 }
12945
12947 {
12949 }
12950
12951
12952
12953
12954
12956 {
12957 if (parent)
12958 {
12959 if (parent.IsInherited(DayZInfected))
12960 return true;
12961
12962 if (!parent.IsRuined())
12963 return true;
12964 }
12965
12966 return true;
12967 }
12968
12970 {
12971 if (!super.CanPutAsAttachment(parent))
12972 {
12973 return false;
12974 }
12975
12976 if (!IsRuined() && !parent.IsRuined())
12977 {
12978 return true;
12979 }
12980
12981 return false;
12982 }
12983
12985 {
12986
12987
12988
12989
12990 return super.CanReceiveItemIntoCargo(item);
12991 }
12992
12994 {
12995
12996
12997
12998
12999 GameInventory attachmentInv = attachment.GetInventory();
13001 {
13002 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13003 return false;
13004 }
13005
13006 InventoryLocation loc = new InventoryLocation();
13007 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13008 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13009 return false;
13010
13011 return super.CanReceiveAttachment(attachment, slotId);
13012 }
13013
13015 {
13016 if (!super.CanReleaseAttachment(attachment))
13017 return false;
13018
13019 return GetInventory().AreChildrenAccessible();
13020 }
13021
13022
13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13043 {
13044 int id = muzzle_owner.GetMuzzleID();
13045 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13046
13047 if (WPOF_array)
13048 {
13049 for (int i = 0; i < WPOF_array.Count(); i++)
13050 {
13051 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13052
13053 if (WPOF)
13054 {
13055 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13056 }
13057 }
13058 }
13059 }
13060
13061
13063 {
13064 int id = muzzle_owner.GetMuzzleID();
13066
13067 if (WPOBE_array)
13068 {
13069 for (int i = 0; i < WPOBE_array.Count(); i++)
13070 {
13071 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13072
13073 if (WPOBE)
13074 {
13075 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13076 }
13077 }
13078 }
13079 }
13080
13081
13083 {
13084 int id = muzzle_owner.GetMuzzleID();
13085 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13086
13087 if (WPOOH_array)
13088 {
13089 for (int i = 0; i < WPOOH_array.Count(); i++)
13090 {
13091 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13092
13093 if (WPOOH)
13094 {
13095 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13096 }
13097 }
13098 }
13099 }
13100
13101
13103 {
13104 int id = muzzle_owner.GetMuzzleID();
13105 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13106
13107 if (WPOOH_array)
13108 {
13109 for (int i = 0; i < WPOOH_array.Count(); i++)
13110 {
13111 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13112
13113 if (WPOOH)
13114 {
13115 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13116 }
13117 }
13118 }
13119 }
13120
13121
13123 {
13124 int id = muzzle_owner.GetMuzzleID();
13125 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13126
13127 if (WPOOH_array)
13128 {
13129 for (int i = 0; i < WPOOH_array.Count(); i++)
13130 {
13131 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13132
13133 if (WPOOH)
13134 {
13135 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13136 }
13137 }
13138 }
13139 }
13140
13141
13142
13144 {
13146 {
13147 return true;
13148 }
13149
13150 return false;
13151 }
13152
13154 {
13156 {
13157 return true;
13158 }
13159
13160 return false;
13161 }
13162
13164 {
13166 {
13167 return true;
13168 }
13169
13170 return false;
13171 }
13172
13174 {
13175 return false;
13176 }
13177
13180 {
13181 return UATimeSpent.DEFAULT_DEPLOY;
13182 }
13183
13184
13185
13186
13188 {
13190 SetSynchDirty();
13191 }
13192
13194 {
13196 }
13197
13198
13200 {
13201 return false;
13202 }
13203
13206 {
13207 string att_type = "None";
13208
13209 if (ConfigIsExisting("soundAttType"))
13210 {
13211 att_type = ConfigGetString("soundAttType");
13212 }
13213
13215 }
13216
13218 {
13220 }
13221
13222
13223
13224
13225
13231
13233 {
13236
13238 }
13239
13240
13242 {
13244 return;
13245
13247
13250
13253
13254 SoundParameters params = new SoundParameters();
13258 }
13259
13260
13262 {
13264 {
13267
13268 SetSynchDirty();
13269
13272 }
13273 }
13274
13276 {
13278 }
13279
13280
13282 {
13284 return;
13285
13287 SetSynchDirty();
13288
13291 }
13292
13294 {
13297 }
13298
13300 {
13302 }
13303
13304 void OnApply(PlayerBase player);
13305
13307 {
13308 return 1.0;
13309 };
13310
13312 {
13314 }
13315
13317 {
13319 }
13320
13322
13324 {
13325 SetDynamicPhysicsLifeTime(0.01);
13327 }
13328
13330 {
13331 array<string> zone_names = new array<string>;
13332 GetDamageZones(zone_names);
13333 for (int i = 0; i < zone_names.Count(); i++)
13334 {
13335 SetHealthMax(zone_names.Get(i),"Health");
13336 }
13337 SetHealthMax("","Health");
13338 }
13339
13342 {
13343 float global_health = GetHealth01("","Health");
13344 array<string> zones = new array<string>;
13345 GetDamageZones(zones);
13346
13347 for (int i = 0; i < zones.Count(); i++)
13348 {
13349 SetHealth01(zones.Get(i),"Health",global_health);
13350 }
13351 }
13352
13355 {
13356 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13357 }
13358
13360 {
13361 if (!hasRootAsPlayer)
13362 {
13363 if (refParentIB)
13364 {
13365
13366 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13367 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13368
13369 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13370 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13371
13374 }
13375 else
13376 {
13377
13380 }
13381 }
13382 }
13383
13385 {
13387 {
13388 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13389 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13390 {
13391 float heatPermCoef = 1.0;
13393 while (ent)
13394 {
13395 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13396 ent = ent.GetHierarchyParent();
13397 }
13398
13399 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13400 }
13401 }
13402 }
13403
13405 {
13406
13407 EntityAI parent = GetHierarchyParent();
13408 if (!parent)
13409 {
13410 hasParent = false;
13411 hasRootAsPlayer = false;
13412 }
13413 else
13414 {
13415 hasParent = true;
13416 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13417 refParentIB =
ItemBase.Cast(parent);
13418 }
13419 }
13420
13421 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13422 {
13423
13424 }
13425
13427 {
13428
13429 return false;
13430 }
13431
13433 {
13434
13435
13436 return false;
13437 }
13438
13440 {
13441
13442 return false;
13443 }
13444
13447 {
13448 return !GetIsFrozen() &&
IsOpen();
13449 }
13450
13452 {
13453 bool hasParent = false, hasRootAsPlayer = false;
13455
13456 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13457 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13458
13459 if (wwtu || foodDecay)
13460 {
13464
13465 if (processWetness || processTemperature || processDecay)
13466 {
13468
13469 if (processWetness)
13470 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13471
13472 if (processTemperature)
13474
13475 if (processDecay)
13476 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13477 }
13478 }
13479 }
13480
13483 {
13485 }
13486
13488 {
13491
13492 return super.GetTemperatureFreezeThreshold();
13493 }
13494
13496 {
13499
13500 return super.GetTemperatureThawThreshold();
13501 }
13502
13504 {
13507
13508 return super.GetItemOverheatThreshold();
13509 }
13510
13512 {
13514 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13515
13516 return super.GetTemperatureFreezeTime();
13517 }
13518
13520 {
13522 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13523
13524 return super.GetTemperatureThawTime();
13525 }
13526
13531
13533 {
13534 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13535 }
13536
13538 {
13539 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13540 }
13541
13544 {
13546 }
13547
13549 {
13551 }
13552
13554 {
13556 }
13557
13560 {
13561 return null;
13562 }
13563
13566 {
13567 return false;
13568 }
13569
13571 {
13573 {
13576 if (!trg)
13577 {
13579 explosive = this;
13580 }
13581
13582 explosive.PairRemote(trg);
13584
13585 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13586 trg.SetPersistentPairID(persistentID);
13587 explosive.SetPersistentPairID(persistentID);
13588
13589 return true;
13590 }
13591 return false;
13592 }
13593
13596 {
13597 float ret = 1.0;
13600 ret *= GetHealth01();
13601
13602 return ret;
13603 }
13604
13605 #ifdef DEVELOPER
13606 override void SetDebugItem()
13607 {
13608 super.SetDebugItem();
13609 _itemBase = this;
13610 }
13611
13613 {
13614 string text = super.GetDebugText();
13615
13617 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13618
13619 return text;
13620 }
13621 #endif
13622
13624 {
13625 return true;
13626 }
13627
13629
13631
13633 {
13636 }
13637
13638
13646
13662
13663 [
Obsolete(
"Use ItemSoundHandler instead")]
13666 {
13667 if (!
g_Game.IsDedicatedServer())
13668 {
13669 if (ConfigIsExisting("attachSoundSet"))
13670 {
13671 string cfg_path = "";
13672 string soundset = "";
13673 string type_name =
GetType();
13674
13677 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13678 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13679
13680 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13681 {
13682 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13683 {
13684 if (cfg_slot_array[i] == slot_type)
13685 {
13686 soundset = cfg_soundset_array[i];
13687 break;
13688 }
13689 }
13690 }
13691
13692 if (soundset != "")
13693 {
13694 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13696 }
13697 }
13698 }
13699 }
13700
13702}
13703
13705{
13707 if (entity)
13708 {
13709 bool is_item = entity.IsInherited(
ItemBase);
13710 if (is_item && full_quantity)
13711 {
13714 }
13715 }
13716 else
13717 {
13719 return NULL;
13720 }
13721 return entity;
13722}
13723
13725{
13726 if (item)
13727 {
13728 if (health > 0)
13729 item.SetHealth("", "", health);
13730
13731 if (item.CanHaveTemperature())
13732 {
13734 if (item.CanFreeze())
13735 item.SetFrozen(false);
13736 }
13737
13738 if (item.HasEnergyManager())
13739 {
13740 if (quantity >= 0)
13741 {
13742 item.GetCompEM().SetEnergy0To1(quantity);
13743 }
13744 else
13745 {
13747 }
13748 }
13749 else if (item.IsMagazine())
13750 {
13751 Magazine mag = Magazine.Cast(item);
13752 if (quantity >= 0)
13753 {
13754 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13755 }
13756 else
13757 {
13759 }
13760
13761 }
13762 else
13763 {
13764 if (quantity >= 0)
13765 {
13766 item.SetQuantityNormalized(quantity, false);
13767 }
13768 else
13769 {
13771 }
13772
13773 }
13774 }
13775}
13776
13777#ifdef DEVELOPER
13779#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.