8789{
8791 {
8792 return true;
8793 }
8794};
8795
8796
8797
8799{
8803
8805
8808
8809
8810
8811
8812
8821
8827
8832
8837
8858 protected bool m_IsResultOfSplit
8859
8861
8866
8867
8868
8870
8874
8875
8876
8878
8881
8882
8883
8889
8890
8898
8901
8902
8904
8905
8907
8908
8913
8914
8919
8920
8922
8923
8925 {
8930
8931 if (!
GetGame().IsDedicatedServer())
8932 {
8934 {
8936
8938 {
8940 }
8941 }
8942
8945 }
8946
8947 m_OldLocation = null;
8948
8950 {
8952 }
8953
8954 if (ConfigIsExisting("headSelectionsToHide"))
8955 {
8958 }
8959
8961 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8962 {
8964 }
8965
8967
8968 m_IsResultOfSplit = false;
8969
8971 }
8972
8974 {
8975 super.InitItemVariables();
8976
8982 m_Count = ConfigGetInt(
"count");
8983
8986
8991
8994
8999
9011
9015
9016
9019 if (ConfigIsExisting("canBeSplit"))
9020 {
9023 }
9024
9026 if (ConfigIsExisting("itemBehaviour"))
9028
9029
9032 RegisterNetSyncVariableInt("m_VarLiquidType");
9033 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9034
9035 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9036 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9037 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9038
9039 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9040 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9041 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9042 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9043
9044 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9045 RegisterNetSyncVariableBool("m_IsTakeable");
9046 RegisterNetSyncVariableBool("m_IsHologram");
9047
9050 {
9053 }
9054
9056
9058 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9060
9061 }
9062
9064 {
9066 }
9067
9069 {
9072 {
9077 }
9078 }
9079
9080 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9081 {
9083 {
9086 }
9087
9089 }
9090
9092 {
9098 }
9099
9101
9103 {
9105
9106 if (!action)
9107 {
9108 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9109 return;
9110 }
9111
9113 if (!ai)
9114 {
9116 return;
9117 }
9118
9120 if (!action_array)
9121 {
9122 action_array = new array<ActionBase_Basic>;
9124 }
9125 if (LogManager.IsActionLogEnable())
9126 {
9127 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9128 }
9129
9130 if (action_array.Find(action) != -1)
9131 {
9132 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9133 }
9134 else
9135 {
9136 action_array.Insert(action);
9137 }
9138 }
9139
9141 {
9143 ActionBase action = player.GetActionManager().GetAction(actionName);
9146
9147 if (action_array)
9148 {
9149 action_array.RemoveItem(action);
9150 }
9151 }
9152
9153
9154
9156 {
9157 ActionOverrideData overrideData = new ActionOverrideData();
9161
9163 if (!actionMap)
9164 {
9167 }
9168
9169 actionMap.Insert(this.
Type(), overrideData);
9170
9171 }
9172
9174
9176
9177
9179 {
9182
9185
9186 string config_to_search = "CfgVehicles";
9187 string muzzle_owner_config;
9188
9190 {
9191 if (IsInherited(Weapon))
9192 config_to_search = "CfgWeapons";
9193
9194 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9195
9196 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9197
9199
9200 if (config_OnFire_subclass_count > 0)
9201 {
9202 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9203
9204 for (int i = 0; i < config_OnFire_subclass_count; i++)
9205 {
9206 string particle_class = "";
9208 string config_OnFire_entry = config_OnFire_class + particle_class;
9209 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9210 WPOF_array.Insert(WPOF);
9211 }
9212
9213
9215 }
9216 }
9217
9219 {
9220 config_to_search = "CfgWeapons";
9221 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9222
9223 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9224
9226
9227 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9228 {
9229 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9230
9231 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9232 {
9233 string particle_class2 = "";
9235 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9236 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9237 WPOBE_array.Insert(WPOBE);
9238 }
9239
9240
9242 }
9243 }
9244 }
9245
9246
9248 {
9251
9253 {
9254 string config_to_search = "CfgVehicles";
9255
9256 if (IsInherited(Weapon))
9257 config_to_search = "CfgWeapons";
9258
9259 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9260 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9261
9262 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
9263 {
9264
9266
9268 {
9270 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9272 return;
9273 }
9274
9277
9278
9279
9281 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9282
9283 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9284 {
9285 string particle_class = "";
9287 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9289
9290 if (entry_type == CT_CLASS)
9291 {
9292 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9293 WPOOH_array.Insert(WPOF);
9294 }
9295 }
9296
9297
9299 }
9300 }
9301 }
9302
9304 {
9306 }
9307
9309 {
9311 {
9313
9316
9319
9320 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9321 }
9322 }
9323
9325 {
9327 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9328
9330 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9331
9333 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9334
9336 {
9338 }
9339 }
9340
9342 {
9344 }
9345
9347 {
9350 else
9352
9354 {
9357 }
9358 else
9359 {
9362
9365 }
9366
9368 }
9369
9371 {
9373 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9374 }
9375
9377 {
9379 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9381 }
9382
9384 {
9386 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9387 }
9388
9390 {
9393
9394 OverheatingParticle OP = new OverheatingParticle();
9399
9401 }
9402
9404 {
9407
9408 return -1;
9409 }
9410
9412 {
9414 {
9417
9418 for (int i = count; i > 0; --i)
9419 {
9420 int id = i - 1;
9423
9426
9427 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9428 {
9429 if (p)
9430 {
9433 }
9434 }
9435 }
9436 }
9437 }
9438
9440 {
9442 {
9444 {
9445 int id = i - 1;
9447
9448 if (OP)
9449 {
9451
9452 if (p)
9453 {
9455 }
9456
9457 delete OP;
9458 }
9459 }
9460
9463 }
9464 }
9465
9468 {
9469 return 0.0;
9470 }
9471
9472
9474 {
9475 return 250;
9476 }
9477
9479 {
9480 return 0;
9481 }
9482
9485 {
9487 return true;
9488
9489 return false;
9490 }
9491
9494 {
9497
9499 {
9501 }
9502 else
9503 {
9504
9506 }
9507
9509 }
9510
9517 {
9518 return -1;
9519 }
9520
9521
9522
9523
9525 {
9527 {
9529 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9530
9531 if (r_index >= 0)
9532 {
9533 InventoryLocation r_il = new InventoryLocation;
9534 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9535
9536 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9539 {
9540 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9541 }
9543 {
9544 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9545 }
9546
9547 }
9548
9549 player.GetHumanInventory().ClearUserReservedLocation(this);
9550 }
9551
9554 }
9555
9556
9557
9558
9560 {
9561 return ItemBase.m_DebugActionsMask;
9562 }
9563
9565 {
9566 return ItemBase.m_DebugActionsMask & mask;
9567 }
9568
9570 {
9571 ItemBase.m_DebugActionsMask = mask;
9572 }
9573
9575 {
9576 ItemBase.m_DebugActionsMask |= mask;
9577 }
9578
9580 {
9581 ItemBase.m_DebugActionsMask &= ~mask;
9582 }
9583
9585 {
9587 {
9589 }
9590 else
9591 {
9593 }
9594 }
9595
9596
9598 {
9599 if (GetEconomyProfile())
9600 {
9601 float q_max = GetEconomyProfile().GetQuantityMax();
9602 if (q_max > 0)
9603 {
9604 float q_min = GetEconomyProfile().GetQuantityMin();
9605 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9606
9608 {
9609 ComponentEnergyManager comp = GetCompEM();
9611 {
9613 }
9614 }
9616 {
9618
9619 }
9620
9621 }
9622 }
9623 }
9624
9627 {
9628 EntityAI parent = GetHierarchyParent();
9629
9630 if (parent)
9631 {
9632 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9633 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9634 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9635 }
9636 }
9637
9640 {
9641 EntityAI parent = GetHierarchyParent();
9642
9643 if (parent)
9644 {
9645 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9646 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9647 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9648 }
9649 }
9650
9652 {
9653
9654
9655
9656
9658
9660 {
9661 if (ScriptInputUserData.CanStoreInputUserData())
9662 {
9663 ScriptInputUserData ctx = new ScriptInputUserData;
9669 ctx.
Write(use_stack_max);
9672
9674 {
9675 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9676 }
9677 }
9678 }
9679 else if (!
GetGame().IsMultiplayer())
9680 {
9682 }
9683 }
9684
9686 {
9688 }
9689
9691 {
9693 }
9694
9696 {
9698 }
9699
9701 {
9702
9703 return false;
9704 }
9705
9707 {
9708 return false;
9709 }
9710
9714 {
9715 return false;
9716 }
9717
9719 {
9720 return "";
9721 }
9722
9724
9726 {
9727 return false;
9728 }
9729
9731 {
9732 return true;
9733 }
9734
9735
9736
9738 {
9739 return true;
9740 }
9741
9743 {
9744 return true;
9745 }
9746
9748 {
9749 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9751 }
9752
9754 {
9756 }
9757
9759 {
9761 if (!is_being_placed)
9763 SetSynchDirty();
9764 }
9765
9766
9768
9770 {
9772 }
9773
9775 {
9777 }
9778
9780 {
9781 return 1;
9782 }
9783
9785 {
9786 return false;
9787 }
9788
9790 {
9792 SetSynchDirty();
9793 }
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9830 {
9831 super.OnMovedInsideCargo(container);
9832
9833 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9834 }
9835
9836 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9837 {
9838 super.EEItemLocationChanged(oldLoc,newLoc);
9839
9840 PlayerBase new_player = null;
9841 PlayerBase old_player = null;
9842
9843 if (newLoc.GetParent())
9844 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9845
9846 if (oldLoc.GetParent())
9847 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9848
9850 {
9851 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9852
9853 if (r_index >= 0)
9854 {
9855 InventoryLocation r_il = new InventoryLocation;
9856 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9857
9858 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9861 {
9862 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9863 }
9865 {
9866 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9867 }
9868
9869 }
9870 }
9871
9873 {
9874 if (new_player)
9875 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9876
9877 if (new_player == old_player)
9878 {
9879
9880 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9881 {
9883 {
9884 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9885 {
9886 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9887 }
9888 }
9889 else
9890 {
9891 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9892 }
9893 }
9894
9895 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9896 {
9897 int type = oldLoc.GetType();
9899 {
9900 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9901 }
9903 {
9904 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9905 }
9906 }
9907 if (!m_OldLocation)
9908 {
9909 m_OldLocation = new InventoryLocation;
9910 }
9911 m_OldLocation.Copy(oldLoc);
9912 }
9913 else
9914 {
9915 if (m_OldLocation)
9916 {
9917 m_OldLocation.Reset();
9918 }
9919 }
9920
9922 }
9923 else
9924 {
9925 if (new_player)
9926 {
9927 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9928 if (res_index >= 0)
9929 {
9930 InventoryLocation il = new InventoryLocation;
9931 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9933 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9936 {
9937 il.
GetParent().GetOnReleaseLock().Invoke(it);
9938 }
9940 {
9942 }
9943
9944 }
9945 }
9947 {
9948
9950 }
9951
9952 if (m_OldLocation)
9953 {
9954 m_OldLocation.Reset();
9955 }
9956 }
9957 }
9958
9959 override void EOnContact(IEntity other, Contact extra)
9960 {
9962 {
9963 int liquidType = -1;
9965 if (impactSpeed > 0.0)
9966 {
9968 #ifndef SERVER
9970 #else
9972 SetSynchDirty();
9973 #endif
9975 }
9976 }
9977
9978 #ifdef SERVER
9979 if (GetCompEM() && GetCompEM().IsPlugged())
9980 {
9981 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9982 GetCompEM().UnplugThis();
9983 }
9984 #endif
9985 }
9986
9988
9990 {
9992 }
9993
9995 {
9996
9997 }
9998
10000 {
10001 super.OnItemLocationChanged(old_owner, new_owner);
10002
10003 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10004 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10005
10006 if (!relatedPlayer && playerNew)
10007 relatedPlayer = playerNew;
10008
10009 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10010 {
10012 if (actionMgr)
10013 {
10014 ActionBase currentAction = actionMgr.GetRunningAction();
10015 if (currentAction)
10017 }
10018 }
10019
10020 Man ownerPlayerOld = null;
10021 Man ownerPlayerNew = null;
10022
10023 if (old_owner)
10024 {
10025 if (old_owner.
IsMan())
10026 {
10027 ownerPlayerOld = Man.Cast(old_owner);
10028 }
10029 else
10030 {
10031 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10032 }
10033 }
10034 else
10035 {
10037 {
10039
10040 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10041 {
10042 GetCompEM().UnplugThis();
10043 }
10044 }
10045 }
10046
10047 if (new_owner)
10048 {
10049 if (new_owner.
IsMan())
10050 {
10051 ownerPlayerNew = Man.Cast(new_owner);
10052 }
10053 else
10054 {
10055 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10056 }
10057 }
10058
10059 if (ownerPlayerOld != ownerPlayerNew)
10060 {
10061 if (ownerPlayerOld)
10062 {
10063 array<EntityAI> subItemsExit = new array<EntityAI>;
10065 for (int i = 0; i < subItemsExit.Count(); i++)
10066 {
10069 }
10070 }
10071
10072 if (ownerPlayerNew)
10073 {
10074 array<EntityAI> subItemsEnter = new array<EntityAI>;
10076 for (int j = 0; j < subItemsEnter.Count(); j++)
10077 {
10080 }
10081 }
10082 }
10083 else if (ownerPlayerNew != null)
10084 {
10085 PlayerBase nplayer;
10086 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10087 {
10088 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10090 for (int k = 0; k < subItemsUpdate.Count(); k++)
10091 {
10093 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10094 }
10095 }
10096 }
10097
10098 if (old_owner)
10099 old_owner.OnChildItemRemoved(this);
10100 if (new_owner)
10101 new_owner.OnChildItemReceived(this);
10102 }
10103
10104
10106 {
10107 super.EEDelete(parent);
10108 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10109 if (player)
10110 {
10112
10113 if (player.IsAlive())
10114 {
10115 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10116 if (r_index >= 0)
10117 {
10118 InventoryLocation r_il = new InventoryLocation;
10119 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10120
10121 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10124 {
10125 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10126 }
10128 {
10129 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10130 }
10131
10132 }
10133
10134 player.RemoveQuickBarEntityShortcut(this);
10135 }
10136 }
10137 }
10138
10140 {
10141 super.EEKilled(killer);
10142
10145 {
10146 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10147 {
10148 if (IsMagazine())
10149 {
10150 if (Magazine.Cast(this).GetAmmoCount() > 0)
10151 {
10153 }
10154 }
10155 else
10156 {
10158 }
10159 }
10160 }
10161 }
10162
10164 {
10165 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10166
10167 super.OnWasAttached(parent, slot_id);
10168
10171
10173 }
10174
10176 {
10177 super.OnWasDetached(parent, slot_id);
10178
10181 }
10182
10184 {
10185 int idx;
10188
10189 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10190 if (inventory_slots.Count() < 1)
10191 {
10192 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10193 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10194 }
10195 else
10196 {
10197 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10198 }
10199
10200 idx = inventory_slots.Find(slot);
10201 if (idx < 0)
10202 return "";
10203
10204 return attach_types.Get(idx);
10205 }
10206
10208 {
10209 int idx = -1;
10210 string slot;
10211
10214
10215 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10216 if (inventory_slots.Count() < 1)
10217 {
10218 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10219 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10220 }
10221 else
10222 {
10223 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10224 if (detach_types.Count() < 1)
10225 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10226 }
10227
10228 for (int i = 0; i < inventory_slots.Count(); i++)
10229 {
10230 slot = inventory_slots.Get(i);
10231 }
10232
10233 if (slot != "")
10234 {
10235 if (detach_types.Count() == 1)
10236 idx = 0;
10237 else
10238 idx = inventory_slots.Find(slot);
10239 }
10240 if (idx < 0)
10241 return "";
10242
10243 return detach_types.Get(idx);
10244 }
10245
10247 {
10248
10250
10251
10252 float min_time = 1;
10253 float max_time = 3;
10254 float delay = Math.RandomFloat(min_time, max_time);
10255
10256 explode_timer.Run(delay, this, "DoAmmoExplosion");
10257 }
10258
10260 {
10261 Magazine magazine = Magazine.Cast(this);
10262 int pop_sounds_count = 6;
10263 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10264
10265
10266 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10267 string sound_name = pop_sounds[ sound_idx ];
10269
10270
10271 magazine.ServerAddAmmoCount(-1);
10272
10273
10274 float min_temp_to_explode = 100;
10275
10276 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10277 {
10279 }
10280 }
10281
10282
10283 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10284 {
10285 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10286
10287 const int CHANCE_DAMAGE_CARGO = 4;
10288 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10289 const int CHANCE_DAMAGE_NOTHING = 2;
10290
10292 {
10293 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10294 int chances;
10295 int rnd;
10296
10297 if (GetInventory().GetCargo())
10298 {
10299 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10300 rnd = Math.RandomInt(0,chances);
10301
10302 if (rnd < CHANCE_DAMAGE_CARGO)
10303 {
10305 }
10306 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10307 {
10309 }
10310 }
10311 else
10312 {
10313 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10314 rnd = Math.RandomInt(0,chances);
10315
10316 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10317 {
10319 }
10320 }
10321 }
10322 }
10323
10325 {
10326 if (GetInventory().GetCargo())
10327 {
10328 int item_count = GetInventory().GetCargo().GetItemCount();
10329 if (item_count > 0)
10330 {
10331 int random_pick = Math.RandomInt(0, item_count);
10333 if (!item.IsExplosive())
10334 {
10335 item.AddHealth("","",damage);
10336 return true;
10337 }
10338 }
10339 }
10340 return false;
10341 }
10342
10344 {
10345 int attachment_count = GetInventory().AttachmentCount();
10346 if (attachment_count > 0)
10347 {
10348 int random_pick = Math.RandomInt(0, attachment_count);
10349 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
10350 if (!attachment.IsExplosive())
10351 {
10352 attachment.AddHealth("","",damage);
10353 return true;
10354 }
10355 }
10356 return false;
10357 }
10358
10360 {
10362 }
10363
10365 {
10367 return GetInventory().CanRemoveEntity();
10368
10369 return false;
10370 }
10371
10373 {
10374
10376 return false;
10377
10378
10380 return false;
10381
10382
10383
10385 if (delta == 0)
10386 return false;
10387
10388
10389 return true;
10390 }
10391
10393 {
10395 {
10396 if (ScriptInputUserData.CanStoreInputUserData())
10397 {
10398 ScriptInputUserData ctx = new ScriptInputUserData;
10403 ctx.
Write(destination_entity);
10405 ctx.
Write(slot_id);
10407 }
10408 }
10409 else if (!
GetGame().IsMultiplayer())
10410 {
10412 }
10413 }
10414
10416 {
10417 float split_quantity_new;
10421 InventoryLocation loc = new InventoryLocation;
10422
10423 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10424 {
10426 split_quantity_new = stack_max;
10427 else
10429
10431 {
10432 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10433 if (new_item)
10434 {
10435 new_item.SetResultOfSplit(true);
10436 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10438 new_item.
SetQuantity(split_quantity_new,
false,
true);
10439 }
10440 }
10441 }
10442 else if (destination_entity && slot_id == -1)
10443 {
10444 if (quantity > stack_max)
10445 split_quantity_new = stack_max;
10446 else
10447 split_quantity_new = quantity;
10448
10450 {
10452 {
10455 }
10456
10457 if (new_item)
10458 {
10459 new_item.SetResultOfSplit(true);
10460 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10462 new_item.
SetQuantity(split_quantity_new,
false,
true);
10463 }
10464 }
10465 }
10466 else
10467 {
10468 if (stack_max != 0)
10469 {
10471 {
10473 }
10474
10475 if (split_quantity_new == 0)
10476 {
10477 if (!
GetGame().IsMultiplayer())
10478 player.PhysicalPredictiveDropItem(this);
10479 else
10480 player.ServerDropEntity(this);
10481 return;
10482 }
10483
10485 {
10487
10488 if (new_item)
10489 {
10490 new_item.SetResultOfSplit(true);
10491 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10494 new_item.PlaceOnSurface();
10495 }
10496 }
10497 }
10498 }
10499 }
10500
10502 {
10503 float split_quantity_new;
10507 InventoryLocation loc = new InventoryLocation;
10508
10509 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10510 {
10512 split_quantity_new = stack_max;
10513 else
10515
10517 {
10518 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10519 if (new_item)
10520 {
10521 new_item.SetResultOfSplit(true);
10522 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10524 new_item.
SetQuantity(split_quantity_new,
false,
true);
10525 }
10526 }
10527 }
10528 else if (destination_entity && slot_id == -1)
10529 {
10530 if (quantity > stack_max)
10531 split_quantity_new = stack_max;
10532 else
10533 split_quantity_new = quantity;
10534
10536 {
10538 {
10541 }
10542
10543 if (new_item)
10544 {
10545 new_item.SetResultOfSplit(true);
10546 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10548 new_item.
SetQuantity(split_quantity_new,
false,
true);
10549 }
10550 }
10551 }
10552 else
10553 {
10554 if (stack_max != 0)
10555 {
10557 {
10559 }
10560
10562 {
10564
10565 if (new_item)
10566 {
10567 new_item.SetResultOfSplit(true);
10568 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10571 new_item.PlaceOnSurface();
10572 }
10573 }
10574 }
10575 }
10576 }
10577
10579 {
10581 {
10582 if (ScriptInputUserData.CanStoreInputUserData())
10583 {
10584 ScriptInputUserData ctx = new ScriptInputUserData;
10589 dst.WriteToContext(ctx);
10591 }
10592 }
10593 else if (!
GetGame().IsMultiplayer())
10594 {
10596 }
10597 }
10598
10600 {
10602 {
10603 if (ScriptInputUserData.CanStoreInputUserData())
10604 {
10605 ScriptInputUserData ctx = new ScriptInputUserData;
10610 ctx.
Write(destination_entity);
10616 }
10617 }
10618 else if (!
GetGame().IsMultiplayer())
10619 {
10621 }
10622 }
10623
10625 {
10627 }
10628
10630 {
10632 float split_quantity_new;
10634 if (dst.IsValid())
10635 {
10636 int slot_id = dst.GetSlot();
10638
10639 if (quantity > stack_max)
10640 split_quantity_new = stack_max;
10641 else
10642 split_quantity_new = quantity;
10643
10645 {
10647
10648 if (new_item)
10649 {
10650 new_item.SetResultOfSplit(true);
10651 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10653 new_item.
SetQuantity(split_quantity_new,
false,
true);
10654 }
10655
10656 return new_item;
10657 }
10658 }
10659
10660 return null;
10661 }
10662
10664 {
10666 float split_quantity_new;
10668 if (destination_entity)
10669 {
10671 if (quantity > stackable)
10672 split_quantity_new = stackable;
10673 else
10674 split_quantity_new = quantity;
10675
10677 {
10678 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10679 if (new_item)
10680 {
10681 new_item.SetResultOfSplit(true);
10682 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10684 new_item.
SetQuantity(split_quantity_new,
false,
true);
10685 }
10686 }
10687 }
10688 }
10689
10691 {
10693 {
10694 if (ScriptInputUserData.CanStoreInputUserData())
10695 {
10696 ScriptInputUserData ctx = new ScriptInputUserData;
10701 ItemBase destination_entity =
this;
10702 ctx.
Write(destination_entity);
10706 }
10707 }
10708 else if (!
GetGame().IsMultiplayer())
10709 {
10711 }
10712 }
10713
10715 {
10717 float split_quantity_new;
10719 if (player)
10720 {
10722 if (quantity > stackable)
10723 split_quantity_new = stackable;
10724 else
10725 split_quantity_new = quantity;
10726
10728 {
10729 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10730 new_item =
ItemBase.Cast(in_hands);
10731 if (new_item)
10732 {
10733 new_item.SetResultOfSplit(true);
10734 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10736 new_item.SetQuantity(split_quantity_new, false, true);
10737 }
10738 }
10739 }
10740 }
10741
10743 {
10745 float split_quantity_new = Math.Floor(quantity * 0.5);
10746
10748 return;
10749
10751
10752 if (new_item)
10753 {
10754 if (new_item.GetQuantityMax() < split_quantity_new)
10755 {
10756 split_quantity_new = new_item.GetQuantityMax();
10757 }
10758
10759 new_item.SetResultOfSplit(true);
10760 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10761
10763 {
10766 }
10767 else
10768 {
10770 new_item.
SetQuantity(split_quantity_new,
false,
true);
10771 }
10772 }
10773 }
10774
10776 {
10778 float split_quantity_new = Math.Floor(quantity / 2);
10779
10781 return;
10782
10783 InventoryLocation invloc = new InventoryLocation;
10785
10787 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10788
10789 if (new_item)
10790 {
10791 if (new_item.GetQuantityMax() < split_quantity_new)
10792 {
10793 split_quantity_new = new_item.GetQuantityMax();
10794 }
10796 {
10799 }
10800 else if (split_quantity_new > 1)
10801 {
10803 new_item.
SetQuantity(split_quantity_new,
false,
true);
10804 }
10805 }
10806 }
10807
10810 {
10811 SetWeightDirty();
10813
10814 if (parent)
10815 parent.OnAttachmentQuantityChangedEx(this, delta);
10816
10818 {
10820 {
10822 }
10824 {
10825 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10827 }
10828 }
10829
10830 }
10831
10834 {
10835
10836 }
10837
10840 {
10842 }
10843
10845 {
10846 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10847
10849 {
10850 if (newLevel == GameConstants.STATE_RUINED)
10851 {
10853 EntityAI parent = GetHierarchyParent();
10854 if (parent && parent.IsFireplace())
10855 {
10856 CargoBase cargo = GetInventory().GetCargo();
10857 if (cargo)
10858 {
10860 {
10862 }
10863 }
10864 }
10865 }
10866
10868 {
10869
10871 return;
10872 }
10873
10874 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10875 {
10877 }
10878 }
10879 }
10880
10881
10883 {
10884 super.OnRightClick();
10885
10887 {
10889 {
10890 if (ScriptInputUserData.CanStoreInputUserData())
10891 {
10892 EntityAI root = GetHierarchyRoot();
10893 Man playerOwner = GetHierarchyRootPlayer();
10894 InventoryLocation dst = new InventoryLocation;
10895
10896
10897 if (!playerOwner && root && root == this)
10898 {
10900 }
10901 else
10902 {
10903
10904 GetInventory().GetCurrentInventoryLocation(dst);
10906 {
10909 {
10911 }
10912 else
10913 {
10915
10916
10917 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10918 {
10920 }
10921 else
10922 {
10923 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10924 }
10925 }
10926 }
10927 }
10928
10929 ScriptInputUserData ctx = new ScriptInputUserData;
10937 }
10938 }
10939 else if (!
GetGame().IsMultiplayer())
10940 {
10942 }
10943 }
10944 }
10945
10947 {
10948 if (root)
10949 {
10950 vector m4[4];
10951 root.GetTransform(m4);
10952 dst.SetGround(this, m4);
10953 }
10954 else
10955 {
10956 GetInventory().GetCurrentInventoryLocation(dst);
10957 }
10958 }
10959
10960 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10961 {
10962
10963 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10964 return false;
10965
10966 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10967 return false;
10968
10969
10971 return false;
10972
10973
10974 Magazine mag = Magazine.Cast(this);
10975 if (mag)
10976 {
10977 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10978 return false;
10979
10980 if (stack_max_limit)
10981 {
10982 Magazine other_mag = Magazine.Cast(other_item);
10983 if (other_item)
10984 {
10985 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10986 return false;
10987 }
10988
10989 }
10990 }
10991 else
10992 {
10993
10995 return false;
10996
10998 return false;
10999 }
11000
11001 PlayerBase player = null;
11002 if (CastTo(player, GetHierarchyRootPlayer()))
11003 {
11004 if (player.GetInventory().HasAttachment(this))
11005 return false;
11006
11007 if (player.IsItemsToDelete())
11008 return false;
11009 }
11010
11011 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11012 return false;
11013
11014 int slotID;
11016 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11017 return false;
11018
11019 return true;
11020 }
11021
11023 {
11025 }
11026
11028 {
11029 return m_IsResultOfSplit;
11030 }
11031
11033 {
11034 m_IsResultOfSplit = value;
11035 }
11036
11038 {
11040 }
11041
11043 {
11044 float other_item_quantity = other_item.GetQuantity();
11045 float this_free_space;
11046
11048
11050
11051 if (other_item_quantity > this_free_space)
11052 {
11053 return this_free_space;
11054 }
11055 else
11056 {
11057 return other_item_quantity;
11058 }
11059 }
11060
11062 {
11064 }
11065
11067 {
11069 return;
11070
11071 if (!IsMagazine() && other_item)
11072 {
11074 if (quantity_used != 0)
11075 {
11076 float hp1 = GetHealth01("","");
11077 float hp2 = other_item.GetHealth01("","");
11078 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11079 hpResult = hpResult / (
GetQuantity() + quantity_used);
11080
11081 hpResult *= GetMaxHealth();
11082 Math.Round(hpResult);
11083 SetHealth("", "Health", hpResult);
11084
11086 other_item.AddQuantity(-quantity_used);
11087 }
11088 }
11090 }
11091
11093 {
11094 #ifdef SERVER
11095 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11096 GetHierarchyParent().IncreaseLifetimeUp();
11097 #endif
11098 };
11099
11101 {
11102 PlayerBase p = PlayerBase.Cast(player);
11103
11104 array<int> recipesIds = p.m_Recipes;
11105 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11106 if (moduleRecipesManager)
11107 {
11108 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
11109 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11110 }
11111
11112 for (int i = 0;i < recipesIds.Count(); i++)
11113 {
11114 int key = recipesIds.Get(i);
11115 string recipeName = moduleRecipesManager.GetRecipeName(key);
11117 }
11118 }
11119
11120
11121 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11122 {
11123 super.GetDebugActions(outputList);
11124
11125
11131
11132
11137
11142
11143
11147
11148
11150 {
11154 }
11155
11158
11159
11163
11165
11166 InventoryLocation loc = new InventoryLocation();
11167 GetInventory().GetCurrentInventoryLocation(loc);
11169 {
11170 if (Gizmo_IsSupported())
11173 }
11174
11176 }
11177
11178
11179
11180
11182 {
11183 super.OnAction(action_id, player, ctx);
11184
11186 {
11187 switch (action_id)
11188 {
11191 return true;
11194 return true;
11195 }
11196 }
11197
11199 {
11200 switch (action_id)
11201 {
11203 Delete();
11204 return true;
11205 }
11206 }
11207
11208 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11209 {
11210 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11211 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11212 PlayerBase p = PlayerBase.Cast(player);
11213 if (
EActions.RECIPES_RANGE_START < 1000)
11214 {
11215 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11216 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11217 }
11218 }
11219 #ifndef SERVER
11220 else if (action_id ==
EActions.WATCH_PLAYER)
11221 {
11222 PluginDeveloper.SetDeveloperItemClientEx(player);
11223 }
11224 #endif
11226 {
11227 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11228 {
11229 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11230 OnDebugButtonPressServer(id + 1);
11231 }
11232
11233 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11234 {
11235 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11237 }
11238
11239 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11240 {
11241 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11243 }
11244
11245 else if (action_id ==
EActions.ADD_QUANTITY)
11246 {
11247 if (IsMagazine())
11248 {
11249 Magazine mag = Magazine.Cast(this);
11250 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11251 }
11252 else
11253 {
11255 }
11256
11257 if (m_EM)
11258 {
11259 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11260 }
11261
11262 }
11263
11264 else if (action_id ==
EActions.REMOVE_QUANTITY)
11265 {
11266 if (IsMagazine())
11267 {
11268 Magazine mag2 = Magazine.Cast(this);
11269 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11270 }
11271 else
11272 {
11274 }
11275 if (m_EM)
11276 {
11277 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11278 }
11279
11280 }
11281
11282 else if (action_id ==
EActions.SET_QUANTITY_0)
11283 {
11285
11286 if (m_EM)
11287 {
11288 m_EM.SetEnergy(0);
11289 }
11290 }
11291
11292 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11293 {
11295
11296 if (m_EM)
11297 {
11298 m_EM.SetEnergy(m_EM.GetEnergyMax());
11299 }
11300 }
11301
11302 else if (action_id ==
EActions.ADD_HEALTH)
11303 {
11304 AddHealth("","",GetMaxHealth("","Health")/5);
11305 }
11306 else if (action_id ==
EActions.REMOVE_HEALTH)
11307 {
11308 AddHealth("","",-GetMaxHealth("","Health")/5);
11309 }
11310 else if (action_id ==
EActions.DESTROY_HEALTH)
11311 {
11312 SetHealth01("","",0);
11313 }
11314 else if (action_id ==
EActions.WATCH_ITEM)
11315 {
11317 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11318 #ifdef DEVELOPER
11319 SetDebugDeveloper_item(this);
11320 #endif
11321 }
11322
11323 else if (action_id ==
EActions.ADD_TEMPERATURE)
11324 {
11325 AddTemperature(20);
11326
11327 }
11328
11329 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11330 {
11331 AddTemperature(-20);
11332
11333 }
11334
11335 else if (action_id ==
EActions.FLIP_FROZEN)
11336 {
11337 SetFrozen(!GetIsFrozen());
11338
11339 }
11340
11341 else if (action_id ==
EActions.ADD_WETNESS)
11342 {
11344
11345 }
11346
11347 else if (action_id ==
EActions.REMOVE_WETNESS)
11348 {
11350
11351 }
11352
11353 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11354 {
11357
11358
11359 }
11360
11361 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11362 {
11365 }
11366
11367 else if (action_id ==
EActions.MAKE_SPECIAL)
11368 {
11369 auto debugParams = DebugSpawnParams.WithPlayer(player);
11370 OnDebugSpawnEx(debugParams);
11371 }
11372
11373 }
11374
11375
11376 return false;
11377 }
11378
11379
11380
11381
11385
11388
11389
11390
11392 {
11393 return false;
11394 }
11395
11396
11398 {
11399 return true;
11400 }
11401
11402
11404 {
11405 return true;
11406 }
11407
11408
11409
11411 {
11412 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11414 }
11415
11418 {
11419 return null;
11420 }
11421
11423 {
11424 return false;
11425 }
11426
11428 {
11429 return false;
11430 }
11431
11435
11436
11438 {
11439 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11440 return module_repairing.CanRepair(this, item_repair_kit);
11441 }
11442
11443
11444 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11445 {
11446 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11447 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11448 }
11449
11450
11452 {
11453
11454
11455
11456
11457
11458
11459
11460
11461 return 1;
11462 }
11463
11464
11465
11467 {
11469 }
11470
11471
11472
11474 {
11476 }
11477
11478
11487 {
11488 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11489
11490 if (player)
11491 {
11492 player.MessageStatus(text);
11493 }
11494 }
11495
11496
11505 {
11506 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11507
11508 if (player)
11509 {
11510 player.MessageAction(text);
11511 }
11512 }
11513
11514
11523 {
11524 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11525
11526 if (player)
11527 {
11528 player.MessageFriendly(text);
11529 }
11530 }
11531
11532
11541 {
11542 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11543
11544 if (player)
11545 {
11546 player.MessageImportant(text);
11547 }
11548 }
11549
11551 {
11552 return true;
11553 }
11554
11555
11556 override bool KindOf(
string tag)
11557 {
11558 bool found = false;
11559 string item_name = this.
GetType();
11562
11563 int array_size = item_tag_array.Count();
11564 for (int i = 0; i < array_size; i++)
11565 {
11566 if (item_tag_array.Get(i) == tag)
11567 {
11568 found = true;
11569 break;
11570 }
11571 }
11572 return found;
11573 }
11574
11575
11577 {
11578
11579 super.OnRPC(sender, rpc_type,ctx);
11580
11581
11582 switch (rpc_type)
11583 {
11584 #ifndef SERVER
11585 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11586 Param2<bool, string> p = new Param2<bool, string>(false, "");
11587
11589 return;
11590
11591 bool play = p.param1;
11592 string soundSet = p.param2;
11593
11594 if (play)
11595 {
11597 {
11599 {
11601 }
11602 }
11603 else
11604 {
11606 }
11607 }
11608 else
11609 {
11611 }
11612
11613 break;
11614 #endif
11615
11616 }
11617
11619 {
11621 }
11622 }
11623
11624
11625
11626
11628 {
11629 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11630 return plugin.GetID(
name);
11631 }
11632
11634 {
11635 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11636 return plugin.GetName(id);
11637 }
11638
11641 {
11642
11643
11644 int varFlags;
11645 if (!ctx.
Read(varFlags))
11646 return;
11647
11648 if (varFlags & ItemVariableFlags.FLOAT)
11649 {
11651 }
11652 }
11653
11655 {
11656
11657 super.SerializeNumericalVars(floats_out);
11658
11659
11660
11662 {
11664 }
11665
11667 {
11669 }
11670
11672 {
11674 }
11675
11677 {
11682 }
11683
11685 {
11687 }
11688 }
11689
11691 {
11692
11693 super.DeSerializeNumericalVars(floats);
11694
11695
11696 int index = 0;
11697 int mask = Math.Round(floats.Get(index));
11698
11699 index++;
11700
11702 {
11704 {
11706 }
11707 else
11708 {
11709 float quantity = floats.Get(index);
11710 SetQuantity(quantity,
true,
false,
false,
false);
11711 }
11712 index++;
11713 }
11714
11716 {
11717 float wet = floats.Get(index);
11719 index++;
11720 }
11721
11723 {
11724 int liquidtype = Math.Round(floats.Get(index));
11726 index++;
11727 }
11728
11730 {
11732 index++;
11734 index++;
11736 index++;
11738 index++;
11739 }
11740
11742 {
11743 int cleanness = Math.Round(floats.Get(index));
11745 index++;
11746 }
11747 }
11748
11750 {
11751 super.WriteVarsToCTX(ctx);
11752
11753
11755 {
11757 }
11758
11760 {
11762 }
11763
11765 {
11767 }
11768
11770 {
11771 int r,g,b,a;
11777 }
11778
11780 {
11782 }
11783 }
11784
11786 {
11787 if (!super.ReadVarsFromCTX(ctx,version))
11788 return false;
11789
11790 int intValue;
11791 float value;
11792
11793 if (version < 140)
11794 {
11795 if (!ctx.
Read(intValue))
11796 return false;
11797
11798 m_VariablesMask = intValue;
11799 }
11800
11802 {
11803 if (!ctx.
Read(value))
11804 return false;
11805
11807 {
11809 }
11810 else
11811 {
11813 }
11814 }
11815
11816 if (version < 140)
11817 {
11819 {
11820 if (!ctx.
Read(value))
11821 return false;
11822 SetTemperatureDirect(value);
11823 }
11824 }
11825
11827 {
11828 if (!ctx.
Read(value))
11829 return false;
11831 }
11832
11834 {
11835 if (!ctx.
Read(intValue))
11836 return false;
11838 }
11839
11841 {
11842 int r,g,b,a;
11844 return false;
11846 return false;
11848 return false;
11850 return false;
11851
11853 }
11854
11856 {
11857 if (!ctx.
Read(intValue))
11858 return false;
11860 }
11861
11862 if (version >= 138 && version < 140)
11863 {
11865 {
11866 if (!ctx.
Read(intValue))
11867 return false;
11868 SetFrozen(intValue);
11869 }
11870 }
11871
11872 return true;
11873 }
11874
11875
11877 {
11880 {
11882 }
11883
11884 if (!super.OnStoreLoad(ctx, version))
11885 {
11887 return false;
11888 }
11889
11890 if (version >= 114)
11891 {
11892 bool hasQuickBarIndexSaved;
11893
11894 if (!ctx.
Read(hasQuickBarIndexSaved))
11895 {
11897 return false;
11898 }
11899
11900 if (hasQuickBarIndexSaved)
11901 {
11902 int itmQBIndex;
11903
11904
11905 if (!ctx.
Read(itmQBIndex))
11906 {
11908 return false;
11909 }
11910
11911 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11912 if (itmQBIndex != -1 && parentPlayer)
11913 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11914 }
11915 }
11916 else
11917 {
11918
11919 PlayerBase player;
11920 int itemQBIndex;
11921 if (version ==
int.
MAX)
11922 {
11923 if (!ctx.
Read(itemQBIndex))
11924 {
11926 return false;
11927 }
11928 }
11929 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11930 {
11931
11932 if (!ctx.
Read(itemQBIndex))
11933 {
11935 return false;
11936 }
11937 if (itemQBIndex != -1 && player)
11938 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11939 }
11940 }
11941
11942 if (version < 140)
11943 {
11944
11945 if (!LoadVariables(ctx, version))
11946 {
11948 return false;
11949 }
11950 }
11951
11952
11954 {
11956 return false;
11957 }
11958 if (version >= 132)
11959 {
11961 if (raib)
11962 {
11964 {
11966 return false;
11967 }
11968 }
11969 }
11970
11972 return true;
11973 }
11974
11975
11976
11978 {
11979 super.OnStoreSave(ctx);
11980
11981 PlayerBase player;
11982 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11983 {
11985
11986 int itemQBIndex = -1;
11987 itemQBIndex = player.FindQuickBarEntityIndex(this);
11988 ctx.
Write(itemQBIndex);
11989 }
11990 else
11991 {
11993 }
11994
11996
11998 if (raib)
11999 {
12001 }
12002 }
12003
12004
12006 {
12007 super.AfterStoreLoad();
12008
12010 {
12012 }
12013
12015 {
12018 }
12019 }
12020
12022 {
12023 super.EEOnAfterLoad();
12024
12026 {
12028 }
12029
12032 }
12033
12035 {
12036 return false;
12037 }
12038
12039
12040
12042 {
12044 {
12045 #ifdef PLATFORM_CONSOLE
12046
12048 {
12050 if (menu)
12051 {
12053 }
12054 }
12055 #endif
12056 }
12057
12059 {
12062 }
12063
12065 {
12066 SetWeightDirty();
12068 }
12070 {
12073 }
12074
12076 {
12079 }
12081 {
12084 }
12085
12086 super.OnVariablesSynchronized();
12087 }
12088
12089
12090
12092 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12093 {
12094 if (!IsServerCheck(allow_client))
12095 return false;
12096
12098 return false;
12099
12102
12103 if (value <= (min + 0.001))
12104 value = min;
12105
12106 if (value == min)
12107 {
12108 if (destroy_config)
12109 {
12110 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12111 if (dstr)
12112 {
12114 this.Delete();
12115 return true;
12116 }
12117 }
12118 else if (destroy_forced)
12119 {
12121 this.Delete();
12122 return true;
12123 }
12124
12126 }
12127
12130
12132 {
12134
12135 if (delta)
12137 }
12138
12140
12141 return false;
12142 }
12143
12144
12146 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12147 {
12149 }
12150
12152 {
12155 }
12156
12158 {
12161 }
12162
12164 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12165 {
12166 float value_clamped = Math.Clamp(value, 0, 1);
12168 SetQuantity(result, destroy_config, destroy_forced);
12169 }
12170
12171
12174 {
12176 }
12177
12179 {
12181 }
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12193 {
12194 int slot = -1;
12195 if (GetInventory())
12196 {
12197 InventoryLocation il = new InventoryLocation;
12198 GetInventory().GetCurrentInventoryLocation(il);
12200 }
12201
12203 }
12204
12206 {
12207 float quantity_max = 0;
12208
12210 {
12211 if (attSlotID != -1)
12212 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12213
12214 if (quantity_max <= 0)
12216 }
12217
12218 if (quantity_max <= 0)
12220
12221 return quantity_max;
12222 }
12223
12225 {
12227 }
12228
12230 {
12232 }
12233
12234
12236 {
12238 }
12239
12241 {
12243 }
12244
12246 {
12248 }
12249
12250
12252 {
12253
12254 float weightEx = GetWeightEx();
12255 float special = GetInventoryAndCargoWeight();
12256 return weightEx - special;
12257 }
12258
12259
12261 {
12263 }
12264
12266 {
12268 {
12269 #ifdef DEVELOPER
12270 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12271 {
12272 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12274 }
12275 #endif
12276
12277 return GetQuantity() * GetConfigWeightModified();
12278 }
12279 else if (HasEnergyManager())
12280 {
12281 #ifdef DEVELOPER
12282 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12283 {
12284 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12285 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12286 }
12287 #endif
12288 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12289 }
12290 else
12291 {
12292 #ifdef DEVELOPER
12293 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12294 {
12295 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12296 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12297 }
12298 #endif
12299 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12300 }
12301 }
12302
12305 {
12306 int item_count = 0;
12308
12309 if (GetInventory().GetCargo() != NULL)
12310 {
12311 item_count = GetInventory().GetCargo().GetItemCount();
12312 }
12313
12314 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
12315 {
12316 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
12317 if (item)
12318 item_count += item.GetNumberOfItems();
12319 }
12320 return item_count;
12321 }
12322
12325 {
12326 float weight = 0;
12327 float wetness = 1;
12328 if (include_wetness)
12331 {
12332 weight = wetness * m_ConfigWeight;
12333 }
12335 {
12336 weight = 1;
12337 }
12338 return weight;
12339 }
12340
12341
12342
12344 {
12345 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
12346 {
12347 GameInventory inv = GetInventory();
12348 array<EntityAI> items = new array<EntityAI>;
12350 for (int i = 0; i < items.Count(); i++)
12351 {
12353 if (item)
12354 {
12356 }
12357 }
12358 }
12359 }
12360
12361
12362
12363
12365 {
12366 float energy = 0;
12367 if (HasEnergyManager())
12368 {
12369 energy = GetCompEM().GetEnergy();
12370 }
12371 return energy;
12372 }
12373
12374
12376 {
12377 super.OnEnergyConsumed();
12378
12380 }
12381
12383 {
12384 super.OnEnergyAdded();
12385
12387 }
12388
12389
12391 {
12392 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12393 {
12395 {
12396 float energy_0to1 = GetCompEM().GetEnergy0To1();
12398 }
12399 }
12400 }
12401
12402
12404 {
12405 return ConfigGetFloat("heatIsolation");
12406 }
12407
12409 {
12411 }
12412
12414 {
12415 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12416 if (
GetGame().ConfigIsExisting(paramPath))
12418
12419 return 0.0;
12420 }
12421
12423 {
12424 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12425 if (
GetGame().ConfigIsExisting(paramPath))
12427
12428 return 0.0;
12429 }
12430
12431 override void SetWet(
float value,
bool allow_client =
false)
12432 {
12433 if (!IsServerCheck(allow_client))
12434 return;
12435
12438
12440
12441 m_VarWet = Math.Clamp(value, min, max);
12442
12444 {
12447 }
12448 }
12449
12450 override void AddWet(
float value)
12451 {
12453 }
12454
12456 {
12458 }
12459
12461 {
12463 }
12464
12466 {
12468 }
12469
12471 {
12473 }
12474
12476 {
12478 }
12479
12480 override void OnWetChanged(
float newVal,
float oldVal)
12481 {
12484 if (newLevel != oldLevel)
12485 {
12487 }
12488 }
12489
12491 {
12492 SetWeightDirty();
12493 }
12494
12496 {
12497 return GetWetLevelInternal(
m_VarWet);
12498 }
12499
12500
12501
12503 {
12505 }
12506
12508 {
12510 }
12511
12513 {
12515 }
12516
12518 {
12520 }
12521
12522
12523
12525 {
12526 if (ConfigIsExisting("itemModelLength"))
12527 {
12528 return ConfigGetFloat("itemModelLength");
12529 }
12530 return 0;
12531 }
12532
12534 {
12535 if (ConfigIsExisting("itemAttachOffset"))
12536 {
12537 return ConfigGetFloat("itemAttachOffset");
12538 }
12539 return 0;
12540 }
12541
12542 override void SetCleanness(
int value,
bool allow_client =
false)
12543 {
12544 if (!IsServerCheck(allow_client))
12545 return;
12546
12548
12550
12553 }
12554
12556 {
12558 }
12559
12561 {
12562 return true;
12563 }
12564
12565
12566
12567
12569 {
12571 }
12572
12574 {
12576 }
12577
12578
12579
12580
12581 override void SetColor(
int r,
int g,
int b,
int a)
12582 {
12588 }
12590 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12591 {
12596 }
12597
12599 {
12601 }
12602
12605 {
12606 int r,g,b,a;
12608 r = r/255;
12609 g = g/255;
12610 b = b/255;
12611 a = a/255;
12612 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12613 }
12614
12615
12616
12617 override void SetLiquidType(
int value,
bool allow_client =
false)
12618 {
12619 if (!IsServerCheck(allow_client))
12620 return;
12621
12626 }
12627
12629 {
12630 return ConfigGetInt("varLiquidTypeInit");
12631 }
12632
12634 {
12636 }
12637
12639 {
12641 SetFrozen(false);
12642 }
12643
12646 {
12647 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12648 }
12649
12650
12653 {
12654 PlayerBase nplayer;
12655 if (PlayerBase.CastTo(nplayer, player))
12656 {
12658
12659 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12660 }
12661 }
12662
12663
12666 {
12667 PlayerBase nplayer;
12668 if (PlayerBase.CastTo(nplayer,player))
12669 {
12670
12671 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12672
12673 }
12674
12675
12676 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12677
12678
12679 if (HasEnergyManager())
12680 {
12681 GetCompEM().UpdatePlugState();
12682 }
12683 }
12684
12685
12687 {
12688 super.OnPlacementStarted(player);
12689
12691 }
12692
12693 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12694 {
12696 {
12697 m_AdminLog.OnPlacementComplete(player,
this);
12698 }
12699
12700 super.OnPlacementComplete(player, position, orientation);
12701 }
12702
12703
12704
12705
12706
12708 {
12710 {
12711 return true;
12712 }
12713 else
12714 {
12715 return false;
12716 }
12717 }
12718
12719
12721 {
12723 {
12725 }
12726 }
12727
12728
12730 {
12732 }
12733
12735 {
12737 }
12738
12739 override void InsertAgent(
int agent,
float count = 1)
12740 {
12741 if (count < 1)
12742 return;
12743
12745 }
12746
12749 {
12751 }
12752
12753
12755 {
12757 }
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12801 {
12803 return false;
12804 return true;
12805 }
12806
12808 {
12809
12811 }
12812
12813
12816 {
12817 super.CheckForRoofLimited(timeTresholdMS);
12818
12820 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12821 {
12822 m_PreviousRoofTestTime = time;
12823 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12824 }
12825 }
12826
12827
12829 {
12831 {
12832 return 0;
12833 }
12834
12835 if (GetInventory().GetAttachmentSlotsCount() != 0)
12836 {
12837 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12838 if (filter)
12839 return filter.GetProtectionLevel(type, false, system);
12840 else
12841 return 0;
12842 }
12843
12844 string subclassPath, entryName;
12845
12846 switch (type)
12847 {
12849 entryName = "biological";
12850 break;
12852 entryName = "chemical";
12853 break;
12854 default:
12855 entryName = "biological";
12856 break;
12857 }
12858
12859 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12860
12862 }
12863
12864
12865
12868 {
12869 if (!IsMagazine())
12871
12873 }
12874
12875
12876
12877
12878
12883 {
12884 return true;
12885 }
12886
12888 {
12890 }
12891
12892
12893
12894
12895
12897 {
12898 if (parent)
12899 {
12900 if (parent.IsInherited(DayZInfected))
12901 return true;
12902
12903 if (!parent.IsRuined())
12904 return true;
12905 }
12906
12907 return true;
12908 }
12909
12911 {
12912 if (!super.CanPutAsAttachment(parent))
12913 {
12914 return false;
12915 }
12916
12917 if (!IsRuined() && !parent.IsRuined())
12918 {
12919 return true;
12920 }
12921
12922 return false;
12923 }
12924
12926 {
12927
12928
12929
12930
12931 return super.CanReceiveItemIntoCargo(item);
12932 }
12933
12935 {
12936
12937
12938
12939
12940 GameInventory attachmentInv = attachment.GetInventory();
12942 {
12943 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12944 return false;
12945 }
12946
12947 InventoryLocation loc = new InventoryLocation();
12948 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12949 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12950 return false;
12951
12952 return super.CanReceiveAttachment(attachment, slotId);
12953 }
12954
12956 {
12957 if (!super.CanReleaseAttachment(attachment))
12958 return false;
12959
12960 return GetInventory().AreChildrenAccessible();
12961 }
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976
12977
12978
12979
12980
12981
12982
12984 {
12985 int id = muzzle_owner.GetMuzzleID();
12986 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12987
12988 if (WPOF_array)
12989 {
12990 for (int i = 0; i < WPOF_array.Count(); i++)
12991 {
12992 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12993
12994 if (WPOF)
12995 {
12996 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12997 }
12998 }
12999 }
13000 }
13001
13002
13004 {
13005 int id = muzzle_owner.GetMuzzleID();
13007
13008 if (WPOBE_array)
13009 {
13010 for (int i = 0; i < WPOBE_array.Count(); i++)
13011 {
13012 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13013
13014 if (WPOBE)
13015 {
13016 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13017 }
13018 }
13019 }
13020 }
13021
13022
13024 {
13025 int id = muzzle_owner.GetMuzzleID();
13026 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13027
13028 if (WPOOH_array)
13029 {
13030 for (int i = 0; i < WPOOH_array.Count(); i++)
13031 {
13032 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13033
13034 if (WPOOH)
13035 {
13036 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13037 }
13038 }
13039 }
13040 }
13041
13042
13044 {
13045 int id = muzzle_owner.GetMuzzleID();
13046 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13047
13048 if (WPOOH_array)
13049 {
13050 for (int i = 0; i < WPOOH_array.Count(); i++)
13051 {
13052 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13053
13054 if (WPOOH)
13055 {
13056 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13057 }
13058 }
13059 }
13060 }
13061
13062
13064 {
13065 int id = muzzle_owner.GetMuzzleID();
13066 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13067
13068 if (WPOOH_array)
13069 {
13070 for (int i = 0; i < WPOOH_array.Count(); i++)
13071 {
13072 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13073
13074 if (WPOOH)
13075 {
13076 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13077 }
13078 }
13079 }
13080 }
13081
13082
13083
13085 {
13087 {
13088 return true;
13089 }
13090
13091 return false;
13092 }
13093
13095 {
13097 {
13098 return true;
13099 }
13100
13101 return false;
13102 }
13103
13105 {
13107 {
13108 return true;
13109 }
13110
13111 return false;
13112 }
13113
13115 {
13116 return false;
13117 }
13118
13121 {
13122 return UATimeSpent.DEFAULT_DEPLOY;
13123 }
13124
13125
13126
13127
13129 {
13131 SetSynchDirty();
13132 }
13133
13135 {
13137 }
13138
13139
13141 {
13142 return false;
13143 }
13144
13147 {
13148 string att_type = "None";
13149
13150 if (ConfigIsExisting("soundAttType"))
13151 {
13152 att_type = ConfigGetString("soundAttType");
13153 }
13154
13156 }
13157
13159 {
13161 }
13162
13163
13164
13165
13166
13172
13174 {
13177
13179 }
13180
13181
13183 {
13185 return;
13186
13188
13191
13194
13195 SoundParameters params = new SoundParameters();
13199 }
13200
13201
13203 {
13205 return;
13206
13208 SetSynchDirty();
13209
13212 }
13213
13214
13216 {
13218 return;
13219
13221 SetSynchDirty();
13222
13225 }
13226
13228 {
13230 }
13231
13233 {
13235 }
13236
13239 {
13240 if (!
GetGame().IsDedicatedServer())
13241 {
13242 if (ConfigIsExisting("attachSoundSet"))
13243 {
13244 string cfg_path = "";
13245 string soundset = "";
13246 string type_name =
GetType();
13247
13250 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13251 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13252
13253 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13254 {
13255 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13256 {
13257 if (cfg_slot_array[i] == slot_type)
13258 {
13259 soundset = cfg_soundset_array[i];
13260 break;
13261 }
13262 }
13263 }
13264
13265 if (soundset != "")
13266 {
13267 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13269 }
13270 }
13271 }
13272 }
13273
13275 {
13276
13277 }
13278
13279 void OnApply(PlayerBase player);
13280
13282 {
13283 return 1.0;
13284 };
13285
13287 {
13289 }
13290
13292 {
13294 }
13295
13297
13299 {
13300 SetDynamicPhysicsLifeTime(0.01);
13302 }
13303
13305 {
13306 array<string> zone_names = new array<string>;
13307 GetDamageZones(zone_names);
13308 for (int i = 0; i < zone_names.Count(); i++)
13309 {
13310 SetHealthMax(zone_names.Get(i),"Health");
13311 }
13312 SetHealthMax("","Health");
13313 }
13314
13317 {
13318 float global_health = GetHealth01("","Health");
13319 array<string> zones = new array<string>;
13320 GetDamageZones(zones);
13321
13322 for (int i = 0; i < zones.Count(); i++)
13323 {
13324 SetHealth01(zones.Get(i),"Health",global_health);
13325 }
13326 }
13327
13330 {
13331 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13332 }
13333
13335 {
13336 if (!hasRootAsPlayer)
13337 {
13338 if (refParentIB)
13339 {
13340
13341 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13342 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13343
13344 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13345 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13346
13349 }
13350 else
13351 {
13352
13355 }
13356 }
13357 }
13358
13360 {
13362 {
13363 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13364 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13365 {
13366 float heatPermCoef = 1.0;
13368 while (ent)
13369 {
13370 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13371 ent = ent.GetHierarchyParent();
13372 }
13373
13374 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13375 }
13376 }
13377 }
13378
13380 {
13381
13382 EntityAI parent = GetHierarchyParent();
13383 if (!parent)
13384 {
13385 hasParent = false;
13386 hasRootAsPlayer = false;
13387 }
13388 else
13389 {
13390 hasParent = true;
13391 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13392 refParentIB =
ItemBase.Cast(parent);
13393 }
13394 }
13395
13396 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13397 {
13398
13399 }
13400
13402 {
13403
13404 return false;
13405 }
13406
13408 {
13409
13410
13411 return false;
13412 }
13413
13415 {
13416
13417 return false;
13418 }
13419
13422 {
13423 return !GetIsFrozen() &&
IsOpen();
13424 }
13425
13427 {
13428 bool hasParent = false, hasRootAsPlayer = false;
13430
13431 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13432 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13433
13434 if (wwtu || foodDecay)
13435 {
13439
13440 if (processWetness || processTemperature || processDecay)
13441 {
13443
13444 if (processWetness)
13445 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13446
13447 if (processTemperature)
13449
13450 if (processDecay)
13451 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13452 }
13453 }
13454 }
13455
13458 {
13460 }
13461
13463 {
13466
13467 return super.GetTemperatureFreezeThreshold();
13468 }
13469
13471 {
13474
13475 return super.GetTemperatureThawThreshold();
13476 }
13477
13479 {
13482
13483 return super.GetItemOverheatThreshold();
13484 }
13485
13487 {
13489 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13490
13491 return super.GetTemperatureFreezeTime();
13492 }
13493
13495 {
13497 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13498
13499 return super.GetTemperatureThawTime();
13500 }
13501
13506
13508 {
13509 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13510 }
13511
13513 {
13514 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13515 }
13516
13519 {
13521 }
13522
13524 {
13526 }
13527
13529 {
13531 }
13532
13535 {
13536 return null;
13537 }
13538
13541 {
13542 return false;
13543 }
13544
13546 {
13548 {
13551 if (!trg)
13552 {
13554 explosive = this;
13555 }
13556
13557 explosive.PairRemote(trg);
13559
13560 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13561 trg.SetPersistentPairID(persistentID);
13562 explosive.SetPersistentPairID(persistentID);
13563
13564 return true;
13565 }
13566 return false;
13567 }
13568
13571 {
13572 float ret = 1.0;
13575 ret *= GetHealth01();
13576
13577 return ret;
13578 }
13579
13580 #ifdef DEVELOPER
13581 override void SetDebugItem()
13582 {
13583 super.SetDebugItem();
13584 _itemBase = this;
13585 }
13586
13588 {
13589 string text = super.GetDebugText();
13590
13592 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13593
13594 return text;
13595 }
13596 #endif
13597
13599 {
13600 return true;
13601 }
13602
13604
13606
13608 {
13611 }
13612
13613
13621
13637}
13638
13640{
13642 if (entity)
13643 {
13644 bool is_item = entity.IsInherited(
ItemBase);
13645 if (is_item && full_quantity)
13646 {
13649 }
13650 }
13651 else
13652 {
13654 return NULL;
13655 }
13656 return entity;
13657}
13658
13660{
13661 if (item)
13662 {
13663 if (health > 0)
13664 item.SetHealth("", "", health);
13665
13666 if (item.CanHaveTemperature())
13667 {
13669 if (item.CanFreeze())
13670 item.SetFrozen(false);
13671 }
13672
13673 if (item.HasEnergyManager())
13674 {
13675 if (quantity >= 0)
13676 {
13677 item.GetCompEM().SetEnergy0To1(quantity);
13678 }
13679 else
13680 {
13682 }
13683 }
13684 else if (item.IsMagazine())
13685 {
13686 Magazine mag = Magazine.Cast(item);
13687 if (quantity >= 0)
13688 {
13689 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13690 }
13691 else
13692 {
13694 }
13695
13696 }
13697 else
13698 {
13699 if (quantity >= 0)
13700 {
13701 item.SetQuantityNormalized(quantity, false);
13702 }
13703 else
13704 {
13706 }
13707
13708 }
13709 }
13710}
13711
13712#ifdef DEVELOPER
13714#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
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 CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
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
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)
void StartItemSoundServer(int id)
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()
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)
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
proto native void GizmoSelectObject(Object object)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
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 bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
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 void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, 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)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
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
proto native CGame GetGame()
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
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
class JsonUndergroundAreaTriggerData GetPosition
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.