8794{
8796 {
8797 return true;
8798 }
8799};
8800
8802{
8803
8804};
8805
8806
8807
8809{
8813
8815
8818
8819
8820
8821
8822
8831
8837
8842
8847
8868 protected bool m_IsResultOfSplit
8869
8871
8876
8877
8878
8880
8884
8885
8886
8888
8891
8892
8893
8899
8900
8908
8911
8912
8914
8915
8917
8918
8923
8924
8929
8931
8932
8934
8935
8937 {
8942
8943 if (!
g_Game.IsDedicatedServer())
8944 {
8946 {
8948
8950 {
8952 }
8953 }
8954
8957 }
8958
8959 m_OldLocation = null;
8960
8962 {
8964 }
8965
8966 if (ConfigIsExisting("headSelectionsToHide"))
8967 {
8970 }
8971
8973 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8974 {
8976 }
8977
8979
8980 m_IsResultOfSplit = false;
8981
8983 }
8984
8986 {
8987 super.InitItemVariables();
8988
8994 m_Count = ConfigGetInt(
"count");
8995
8998
9003
9006
9011
9023
9027
9028
9031 if (ConfigIsExisting("canBeSplit"))
9032 {
9035 }
9036
9038 if (ConfigIsExisting("itemBehaviour"))
9040
9041
9044 RegisterNetSyncVariableInt("m_VarLiquidType");
9045 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9046
9047 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9048 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9049 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9050
9051 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9052 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9053 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9054 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9055
9056 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9057 RegisterNetSyncVariableBool("m_IsTakeable");
9058 RegisterNetSyncVariableBool("m_IsHologram");
9059
9062 {
9065 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9066 }
9067
9069
9071 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9073
9075 }
9076
9078 {
9080 }
9081
9083 {
9086 {
9091 }
9092 }
9093
9094 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9095 {
9097 {
9100 }
9101
9103 }
9104
9106 {
9112 }
9113
9115
9117 {
9119
9120 if (!action)
9121 {
9122 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9123 return;
9124 }
9125
9127 if (!ai)
9128 {
9130 return;
9131 }
9132
9134 if (!action_array)
9135 {
9136 action_array = new array<ActionBase_Basic>;
9138 }
9139 if (LogManager.IsActionLogEnable())
9140 {
9141 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9142 }
9143
9144 if (action_array.Find(action) != -1)
9145 {
9146 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9147 }
9148 else
9149 {
9150 action_array.Insert(action);
9151 }
9152 }
9153
9155 {
9156 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9157 ActionBase action = player.GetActionManager().GetAction(actionName);
9160
9161 if (action_array)
9162 {
9163 action_array.RemoveItem(action);
9164 }
9165 }
9166
9167
9168
9170 {
9171 ActionOverrideData overrideData = new ActionOverrideData();
9175
9177 if (!actionMap)
9178 {
9181 }
9182
9183 actionMap.Insert(this.
Type(), overrideData);
9184
9185 }
9186
9188
9190
9191
9193 {
9196
9199
9200 string config_to_search = "CfgVehicles";
9201 string muzzle_owner_config;
9202
9204 {
9205 if (IsInherited(Weapon))
9206 config_to_search = "CfgWeapons";
9207
9208 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9209
9210 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9211
9212 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9213
9214 if (config_OnFire_subclass_count > 0)
9215 {
9216 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9217
9218 for (int i = 0; i < config_OnFire_subclass_count; i++)
9219 {
9220 string particle_class = "";
9221 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9222 string config_OnFire_entry = config_OnFire_class + particle_class;
9223 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9224 WPOF_array.Insert(WPOF);
9225 }
9226
9227
9229 }
9230 }
9231
9233 {
9234 config_to_search = "CfgWeapons";
9235 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9236
9237 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9238
9239 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9240
9241 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9242 {
9243 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9244
9245 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9246 {
9247 string particle_class2 = "";
9248 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9249 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9250 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9251 WPOBE_array.Insert(WPOBE);
9252 }
9253
9254
9256 }
9257 }
9258 }
9259
9260
9262 {
9265
9267 {
9268 string config_to_search = "CfgVehicles";
9269
9270 if (IsInherited(Weapon))
9271 config_to_search = "CfgWeapons";
9272
9273 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9274 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9275
9276 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9277 {
9278
9280
9282 {
9284 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9286 return;
9287 }
9288
9291
9292
9293
9294 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9295 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9296
9297 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9298 {
9299 string particle_class = "";
9300 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9301 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9302 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9303
9304 if (entry_type == CT_CLASS)
9305 {
9306 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9307 WPOOH_array.Insert(WPOF);
9308 }
9309 }
9310
9311
9313 }
9314 }
9315 }
9316
9318 {
9320 }
9321
9323 {
9325 {
9327
9330
9333
9334 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9335 }
9336 }
9337
9339 {
9341 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9342
9344 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9345
9347 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9348
9350 {
9352 }
9353 }
9354
9356 {
9358 }
9359
9361 {
9364 else
9366
9368 {
9371 }
9372 else
9373 {
9376
9379 }
9380
9382 }
9383
9385 {
9387 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9388 }
9389
9391 {
9393 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9395 }
9396
9398 {
9400 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9401 }
9402
9404 {
9407
9408 OverheatingParticle OP = new OverheatingParticle();
9413
9415 }
9416
9418 {
9421
9422 return -1;
9423 }
9424
9426 {
9428 {
9431
9432 for (int i = count; i > 0; --i)
9433 {
9434 int id = i - 1;
9437
9440
9441 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9442 {
9443 if (p)
9444 {
9447 }
9448 }
9449 }
9450 }
9451 }
9452
9454 {
9456 {
9458 {
9459 int id = i - 1;
9461
9462 if (OP)
9463 {
9465
9466 if (p)
9467 {
9469 }
9470
9471 delete OP;
9472 }
9473 }
9474
9477 }
9478 }
9479
9482 {
9483 return 0.0;
9484 }
9485
9486
9488 {
9489 return 250;
9490 }
9491
9493 {
9494 return 0;
9495 }
9496
9499 {
9501 return true;
9502
9503 return false;
9504 }
9505
9508 {
9511
9513 {
9515 }
9516 else
9517 {
9518
9520 }
9521
9523 }
9524
9531 {
9532 return -1;
9533 }
9534
9535
9536
9537
9539 {
9541 {
9542 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9543 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9544
9545 if (r_index >= 0)
9546 {
9547 InventoryLocation r_il = new InventoryLocation;
9548 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9549
9550 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9553 {
9554 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9555 }
9557 {
9558 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9559 }
9560
9561 }
9562
9563 player.GetHumanInventory().ClearUserReservedLocation(this);
9564 }
9565
9568 }
9569
9570
9571
9572
9574 {
9575 return ItemBase.m_DebugActionsMask;
9576 }
9577
9579 {
9580 return ItemBase.m_DebugActionsMask & mask;
9581 }
9582
9584 {
9585 ItemBase.m_DebugActionsMask = mask;
9586 }
9587
9589 {
9590 ItemBase.m_DebugActionsMask |= mask;
9591 }
9592
9594 {
9595 ItemBase.m_DebugActionsMask &= ~mask;
9596 }
9597
9599 {
9601 {
9603 }
9604 else
9605 {
9607 }
9608 }
9609
9610
9612 {
9613 if (GetEconomyProfile())
9614 {
9615 float q_max = GetEconomyProfile().GetQuantityMax();
9616 if (q_max > 0)
9617 {
9618 float q_min = GetEconomyProfile().GetQuantityMin();
9619 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9620
9622 {
9623 ComponentEnergyManager comp = GetCompEM();
9625 {
9627 }
9628 }
9630 {
9632
9633 }
9634
9635 }
9636 }
9637 }
9638
9641 {
9642 EntityAI parent = GetHierarchyParent();
9643
9644 if (parent)
9645 {
9646 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9647 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9648 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9649 }
9650 }
9651
9654 {
9655 EntityAI parent = GetHierarchyParent();
9656
9657 if (parent)
9658 {
9659 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9660 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9661 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9662 }
9663 }
9664
9666 {
9667
9668
9669
9670
9672
9674 {
9675 if (ScriptInputUserData.CanStoreInputUserData())
9676 {
9677 ScriptInputUserData ctx = new ScriptInputUserData;
9683 ctx.
Write(use_stack_max);
9686
9688 {
9689 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9690 }
9691 }
9692 }
9693 else if (!
g_Game.IsMultiplayer())
9694 {
9696 }
9697 }
9698
9700 {
9702 }
9703
9705 {
9707 }
9708
9710 {
9712 }
9713
9715 {
9716
9717 return false;
9718 }
9719
9721 {
9722 return false;
9723 }
9724
9728 {
9729 return false;
9730 }
9731
9733 {
9734 return "";
9735 }
9736
9738
9740 {
9741 return false;
9742 }
9743
9745 {
9746 return true;
9747 }
9748
9749
9750
9752 {
9753 return true;
9754 }
9755
9757 {
9758 return true;
9759 }
9760
9762 {
9763 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9765 }
9766
9768 {
9770 }
9771
9773 {
9775 if (!is_being_placed)
9777 SetSynchDirty();
9778 }
9779
9780
9782
9784 {
9786 }
9787
9789 {
9791 }
9792
9794 {
9795 return 1;
9796 }
9797
9799 {
9800 return false;
9801 }
9802
9804 {
9806 SetSynchDirty();
9807 }
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9844 {
9845 super.OnMovedInsideCargo(container);
9846
9847 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9848 }
9849
9850 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9851 {
9852 super.EEItemLocationChanged(oldLoc, newLoc);
9853
9854 PlayerBase newPlayer = null;
9855 PlayerBase oldPlayer = null;
9856
9857 if (newLoc.GetParent())
9858 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9859
9860 if (oldLoc.GetParent())
9861 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9862
9864 {
9865 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9866
9867 if (rIndex >= 0)
9868 {
9869 InventoryLocation rIl = new InventoryLocation;
9870 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9871
9872 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9875 {
9876 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9877 }
9879 {
9881 }
9882
9883 }
9884 }
9885
9887 {
9888 if (newPlayer)
9889 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9890
9891 if (newPlayer == oldPlayer)
9892 {
9893 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9894 {
9896 {
9897 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9898 {
9899 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9900 }
9901 }
9902 else
9903 {
9904 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9905 }
9906 }
9907
9908 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9909 {
9910 int type = oldLoc.GetType();
9912 {
9913 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9914 }
9916 {
9917 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9918 }
9919 }
9920 if (!m_OldLocation)
9921 {
9922 m_OldLocation = new InventoryLocation;
9923 }
9924 m_OldLocation.Copy(oldLoc);
9925 }
9926 else
9927 {
9928 if (m_OldLocation)
9929 {
9930 m_OldLocation.Reset();
9931 }
9932 }
9933
9934 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9935 }
9936 else
9937 {
9938 if (newPlayer)
9939 {
9940 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9941 if (resIndex >= 0)
9942 {
9943 InventoryLocation il = new InventoryLocation;
9944 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9946 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9949 {
9950 il.
GetParent().GetOnReleaseLock().Invoke(it);
9951 }
9953 {
9955 }
9956
9957 }
9958 }
9960 {
9961
9963 }
9964
9965 if (m_OldLocation)
9966 {
9967 m_OldLocation.Reset();
9968 }
9969 }
9970
9972 {
9973 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9974 }
9975
9977 {
9978 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9979 }
9980 }
9981
9982 override void EOnContact(IEntity other, Contact extra)
9983 {
9985 {
9986 int liquidType = -1;
9988 if (impactSpeed > 0.0)
9989 {
9991 #ifndef SERVER
9993 #else
9995 SetSynchDirty();
9996 #endif
9998 }
9999 }
10000
10001 #ifdef SERVER
10002 if (GetCompEM() && GetCompEM().IsPlugged())
10003 {
10004 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10005 GetCompEM().UnplugThis();
10006 }
10007 #endif
10008 }
10009
10011
10013 {
10015 }
10016
10018 {
10019
10020 }
10021
10023 {
10024 super.OnItemLocationChanged(old_owner, new_owner);
10025
10026 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10027 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10028
10029 if (!relatedPlayer && playerNew)
10030 relatedPlayer = playerNew;
10031
10032 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10033 {
10035 if (actionMgr)
10036 {
10037 ActionBase currentAction = actionMgr.GetRunningAction();
10038 if (currentAction)
10040 }
10041 }
10042
10043 Man ownerPlayerOld = null;
10044 Man ownerPlayerNew = null;
10045
10046 if (old_owner)
10047 {
10048 if (old_owner.
IsMan())
10049 {
10050 ownerPlayerOld = Man.Cast(old_owner);
10051 }
10052 else
10053 {
10054 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10055 }
10056 }
10057 else
10058 {
10060 {
10062
10063 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10064 {
10065 GetCompEM().UnplugThis();
10066 }
10067 }
10068 }
10069
10070 if (new_owner)
10071 {
10072 if (new_owner.
IsMan())
10073 {
10074 ownerPlayerNew = Man.Cast(new_owner);
10075 }
10076 else
10077 {
10078 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10079 }
10080 }
10081
10082 if (ownerPlayerOld != ownerPlayerNew)
10083 {
10084 if (ownerPlayerOld)
10085 {
10086 array<EntityAI> subItemsExit = new array<EntityAI>;
10088 for (int i = 0; i < subItemsExit.Count(); i++)
10089 {
10092 }
10093 }
10094
10095 if (ownerPlayerNew)
10096 {
10097 array<EntityAI> subItemsEnter = new array<EntityAI>;
10099 for (int j = 0; j < subItemsEnter.Count(); j++)
10100 {
10103 }
10104 }
10105 }
10106 else if (ownerPlayerNew != null)
10107 {
10108 PlayerBase nplayer;
10109 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10110 {
10111 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10113 for (int k = 0; k < subItemsUpdate.Count(); k++)
10114 {
10116 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10117 }
10118 }
10119 }
10120
10121 if (old_owner)
10122 old_owner.OnChildItemRemoved(this);
10123 if (new_owner)
10124 new_owner.OnChildItemReceived(this);
10125 }
10126
10127
10129 {
10130 super.EEDelete(parent);
10131 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10132 if (player)
10133 {
10135
10136 if (player.IsAlive())
10137 {
10138 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10139 if (r_index >= 0)
10140 {
10141 InventoryLocation r_il = new InventoryLocation;
10142 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10143
10144 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10147 {
10148 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10149 }
10151 {
10152 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10153 }
10154
10155 }
10156
10157 player.RemoveQuickBarEntityShortcut(this);
10158 }
10159 }
10160 }
10161
10163 {
10164 super.EEKilled(killer);
10165
10168 {
10169 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10170 {
10171 if (IsMagazine())
10172 {
10173 if (Magazine.Cast(this).GetAmmoCount() > 0)
10174 {
10176 }
10177 }
10178 else
10179 {
10181 }
10182 }
10183 }
10184 }
10185
10187 {
10188 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10189
10190 super.OnWasAttached(parent, slot_id);
10191
10194
10197 }
10198
10200 {
10201 super.OnWasDetached(parent, slot_id);
10202
10205
10208 }
10209
10211 {
10212 int idx;
10215
10216 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10217 if (inventory_slots.Count() < 1)
10218 {
10219 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10220 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10221 }
10222 else
10223 {
10224 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10225 }
10226
10227 idx = inventory_slots.Find(slot);
10228 if (idx < 0)
10229 return "";
10230
10231 return attach_types.Get(idx);
10232 }
10233
10235 {
10236 int idx = -1;
10237 string slot;
10238
10241
10242 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10243 if (inventory_slots.Count() < 1)
10244 {
10245 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10246 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10247 }
10248 else
10249 {
10250 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10251 if (detach_types.Count() < 1)
10252 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10253 }
10254
10255 for (int i = 0; i < inventory_slots.Count(); i++)
10256 {
10257 slot = inventory_slots.Get(i);
10258 }
10259
10260 if (slot != "")
10261 {
10262 if (detach_types.Count() == 1)
10263 idx = 0;
10264 else
10265 idx = inventory_slots.Find(slot);
10266 }
10267 if (idx < 0)
10268 return "";
10269
10270 return detach_types.Get(idx);
10271 }
10272
10274 {
10275
10277
10278
10279 float min_time = 1;
10280 float max_time = 3;
10281 float delay = Math.RandomFloat(min_time, max_time);
10282
10283 explode_timer.Run(delay, this, "DoAmmoExplosion");
10284 }
10285
10287 {
10288 Magazine magazine = Magazine.Cast(this);
10289 int pop_sounds_count = 6;
10290 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10291
10292
10293 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10294 string sound_name = pop_sounds[ sound_idx ];
10295 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10296
10297
10298 magazine.ServerAddAmmoCount(-1);
10299
10300
10301 float min_temp_to_explode = 100;
10302
10303 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10304 {
10306 }
10307 }
10308
10309
10310 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10311 {
10312 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10313
10314 const int CHANCE_DAMAGE_CARGO = 4;
10315 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10316 const int CHANCE_DAMAGE_NOTHING = 2;
10317
10319 {
10320 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10321 int chances;
10322 int rnd;
10323
10324 if (GetInventory().GetCargo())
10325 {
10326 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10327 rnd = Math.RandomInt(0,chances);
10328
10329 if (rnd < CHANCE_DAMAGE_CARGO)
10330 {
10332 }
10333 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10334 {
10336 }
10337 }
10338 else
10339 {
10340 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10341 rnd = Math.RandomInt(0,chances);
10342
10343 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10344 {
10346 }
10347 }
10348 }
10349 }
10350
10352 {
10353 CargoBase cargo = GetInventory().GetCargo();
10354 if (cargo)
10355 {
10357 if (item_count > 0)
10358 {
10359 int random_pick = Math.RandomInt(0, item_count);
10361 if (!item.IsExplosive())
10362 {
10363 item.AddHealth("","",damage);
10364 return true;
10365 }
10366 }
10367 }
10368 return false;
10369 }
10370
10372 {
10373 GameInventory inventory = GetInventory();
10375 if (attachment_count > 0)
10376 {
10377 int random_pick = Math.RandomInt(0, attachment_count);
10379 if (!attachment.IsExplosive())
10380 {
10381 attachment.AddHealth("","",damage);
10382 return true;
10383 }
10384 }
10385 return false;
10386 }
10387
10389 {
10391 }
10392
10394 {
10396 return GetInventory().CanRemoveEntity();
10397
10398 return false;
10399 }
10400
10402 {
10403
10405 return false;
10406
10407
10409 return false;
10410
10411
10412
10414 if (delta == 0)
10415 return false;
10416
10417
10418 return true;
10419 }
10420
10422 {
10424 {
10425 if (ScriptInputUserData.CanStoreInputUserData())
10426 {
10427 ScriptInputUserData ctx = new ScriptInputUserData;
10432 ctx.
Write(destination_entity);
10434 ctx.
Write(slot_id);
10436 }
10437 }
10438 else if (!
g_Game.IsMultiplayer())
10439 {
10441 }
10442 }
10443
10445 {
10446 float split_quantity_new;
10450 InventoryLocation loc = new InventoryLocation;
10451
10452 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10453 {
10455 split_quantity_new = stack_max;
10456 else
10458
10460 {
10461 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10462 if (new_item)
10463 {
10464 new_item.SetResultOfSplit(true);
10465 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10467 new_item.
SetQuantity(split_quantity_new,
false,
true);
10468 }
10469 }
10470 }
10471 else if (destination_entity && slot_id == -1)
10472 {
10473 if (quantity > stack_max)
10474 split_quantity_new = stack_max;
10475 else
10476 split_quantity_new = quantity;
10477
10479 {
10480 GameInventory destinationInventory = destination_entity.GetInventory();
10482 {
10485 }
10486
10487 if (new_item)
10488 {
10489 new_item.SetResultOfSplit(true);
10490 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10492 new_item.
SetQuantity(split_quantity_new,
false,
true);
10493 }
10494 }
10495 }
10496 else
10497 {
10498 if (stack_max != 0)
10499 {
10501 {
10503 }
10504
10505 if (split_quantity_new == 0)
10506 {
10507 if (!
g_Game.IsMultiplayer())
10508 player.PhysicalPredictiveDropItem(this);
10509 else
10510 player.ServerDropEntity(this);
10511 return;
10512 }
10513
10515 {
10517
10518 if (new_item)
10519 {
10520 new_item.SetResultOfSplit(true);
10521 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10524 new_item.PlaceOnSurface();
10525 }
10526 }
10527 }
10528 }
10529 }
10530
10532 {
10533 float split_quantity_new;
10537 InventoryLocation loc = new InventoryLocation;
10538
10539 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10540 {
10542 split_quantity_new = stack_max;
10543 else
10545
10547 {
10548 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10549 if (new_item)
10550 {
10551 new_item.SetResultOfSplit(true);
10552 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10554 new_item.
SetQuantity(split_quantity_new,
false,
true);
10555 }
10556 }
10557 }
10558 else if (destination_entity && slot_id == -1)
10559 {
10560 if (quantity > stack_max)
10561 split_quantity_new = stack_max;
10562 else
10563 split_quantity_new = quantity;
10564
10566 {
10567 GameInventory destinationInventory = destination_entity.GetInventory();
10569 {
10572 }
10573
10574 if (new_item)
10575 {
10576 new_item.SetResultOfSplit(true);
10577 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10579 new_item.
SetQuantity(split_quantity_new,
false,
true);
10580 }
10581 }
10582 }
10583 else
10584 {
10585 if (stack_max != 0)
10586 {
10588 {
10590 }
10591
10593 {
10595
10596 if (new_item)
10597 {
10598 new_item.SetResultOfSplit(true);
10599 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10602 new_item.PlaceOnSurface();
10603 }
10604 }
10605 }
10606 }
10607 }
10608
10610 {
10612 {
10613 if (ScriptInputUserData.CanStoreInputUserData())
10614 {
10615 ScriptInputUserData ctx = new ScriptInputUserData;
10620 dst.WriteToContext(ctx);
10622 }
10623 }
10624 else if (!
g_Game.IsMultiplayer())
10625 {
10627 }
10628 }
10629
10631 {
10633 {
10634 if (ScriptInputUserData.CanStoreInputUserData())
10635 {
10636 ScriptInputUserData ctx = new ScriptInputUserData;
10641 ctx.
Write(destination_entity);
10647 }
10648 }
10649 else if (!
g_Game.IsMultiplayer())
10650 {
10652 }
10653 }
10654
10656 {
10658 }
10659
10661 {
10663 float split_quantity_new;
10665 if (dst.IsValid())
10666 {
10667 int slot_id = dst.GetSlot();
10669
10670 if (quantity > stack_max)
10671 split_quantity_new = stack_max;
10672 else
10673 split_quantity_new = quantity;
10674
10676 {
10678
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 return new_item;
10688 }
10689 }
10690
10691 return null;
10692 }
10693
10695 {
10697 float split_quantity_new;
10699 if (destination_entity)
10700 {
10702 if (quantity > stackable)
10703 split_quantity_new = stackable;
10704 else
10705 split_quantity_new = quantity;
10706
10708 {
10709 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10710 if (new_item)
10711 {
10712 new_item.SetResultOfSplit(true);
10713 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10715 new_item.
SetQuantity(split_quantity_new,
false,
true);
10716 }
10717 }
10718 }
10719 }
10720
10722 {
10724 {
10725 if (ScriptInputUserData.CanStoreInputUserData())
10726 {
10727 ScriptInputUserData ctx = new ScriptInputUserData;
10732 ItemBase destination_entity =
this;
10733 ctx.
Write(destination_entity);
10737 }
10738 }
10739 else if (!
g_Game.IsMultiplayer())
10740 {
10742 }
10743 }
10744
10746 {
10748 float split_quantity_new;
10750 if (player)
10751 {
10753 if (quantity > stackable)
10754 split_quantity_new = stackable;
10755 else
10756 split_quantity_new = quantity;
10757
10759 {
10760 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10761 new_item =
ItemBase.Cast(in_hands);
10762 if (new_item)
10763 {
10764 new_item.SetResultOfSplit(true);
10765 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10767 new_item.SetQuantity(split_quantity_new, false, true);
10768 }
10769 }
10770 }
10771 }
10772
10774 {
10776 float split_quantity_new = Math.Floor(quantity * 0.5);
10777
10779 return;
10780
10782
10783 if (new_item)
10784 {
10785 if (new_item.GetQuantityMax() < split_quantity_new)
10786 {
10787 split_quantity_new = new_item.GetQuantityMax();
10788 }
10789
10790 new_item.SetResultOfSplit(true);
10791 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10792
10794 {
10797 }
10798 else
10799 {
10801 new_item.
SetQuantity(split_quantity_new,
false,
true);
10802 }
10803 }
10804 }
10805
10807 {
10809 float split_quantity_new = Math.Floor(quantity / 2);
10810
10812 return;
10813
10814 InventoryLocation invloc = new InventoryLocation;
10816
10818 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10819
10820 if (new_item)
10821 {
10822 if (new_item.GetQuantityMax() < split_quantity_new)
10823 {
10824 split_quantity_new = new_item.GetQuantityMax();
10825 }
10827 {
10830 }
10831 else if (split_quantity_new > 1)
10832 {
10834 new_item.
SetQuantity(split_quantity_new,
false,
true);
10835 }
10836 }
10837 }
10838
10841 {
10842 SetWeightDirty();
10844
10845 if (parent)
10846 parent.OnAttachmentQuantityChangedEx(this, delta);
10847
10849 {
10851 {
10853 }
10855 {
10856 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10858 }
10859 }
10860 }
10861
10864 {
10865
10866 }
10867
10870 {
10872 }
10873
10875 {
10876 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10877
10879 {
10880 if (newLevel == GameConstants.STATE_RUINED)
10881 {
10883 EntityAI parent = GetHierarchyParent();
10884 if (parent && parent.IsFireplace())
10885 {
10886 CargoBase cargo = GetInventory().GetCargo();
10887 if (cargo)
10888 {
10890 {
10892 }
10893 }
10894 }
10895 }
10896
10898 {
10899
10901 return;
10902 }
10903
10904 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10905 {
10907 }
10908 }
10909 }
10910
10911
10913 {
10914 super.OnRightClick();
10915
10917 {
10919 {
10920 if (ScriptInputUserData.CanStoreInputUserData())
10921 {
10922 EntityAI root = GetHierarchyRoot();
10923 Man playerOwner = GetHierarchyRootPlayer();
10924 InventoryLocation dst = new InventoryLocation;
10925
10926
10927 if (!playerOwner && root && root == this)
10928 {
10930 }
10931 else
10932 {
10933
10934 GetInventory().GetCurrentInventoryLocation(dst);
10936 {
10937 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10939 {
10941 }
10942 else
10943 {
10945
10946
10947 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10948 {
10950 }
10951 else
10952 {
10953 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10954 }
10955 }
10956 }
10957 }
10958
10959 ScriptInputUserData ctx = new ScriptInputUserData;
10967 }
10968 }
10969 else if (!
g_Game.IsMultiplayer())
10970 {
10972 }
10973 }
10974 }
10975
10977 {
10978 if (root)
10979 {
10980 vector m4[4];
10981 root.GetTransform(m4);
10982 dst.SetGround(this, m4);
10983 }
10984 else
10985 {
10986 GetInventory().GetCurrentInventoryLocation(dst);
10987 }
10988 }
10989
10990 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10991 {
10992
10993 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10994 return false;
10995
10996 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10997 return false;
10998
10999
11001 return false;
11002
11003
11004 Magazine mag = Magazine.Cast(this);
11005 if (mag)
11006 {
11007 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11008 return false;
11009
11010 if (stack_max_limit)
11011 {
11012 Magazine other_mag = Magazine.Cast(other_item);
11013 if (other_item)
11014 {
11015 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11016 return false;
11017 }
11018
11019 }
11020 }
11021 else
11022 {
11023
11025 return false;
11026
11028 return false;
11029 }
11030
11031 PlayerBase player = null;
11032 if (CastTo(player, GetHierarchyRootPlayer()))
11033 {
11034 if (player.GetInventory().HasAttachment(this))
11035 return false;
11036
11037 if (player.IsItemsToDelete())
11038 return false;
11039 }
11040
11041 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11042 return false;
11043
11044 int slotID;
11046 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11047 return false;
11048
11049 return true;
11050 }
11051
11053 {
11055 }
11056
11058 {
11059 return m_IsResultOfSplit;
11060 }
11061
11063 {
11064 m_IsResultOfSplit = value;
11065 }
11066
11068 {
11070 }
11071
11073 {
11074 float other_item_quantity = other_item.GetQuantity();
11075 float this_free_space;
11076
11078
11080
11081 if (other_item_quantity > this_free_space)
11082 {
11083 return this_free_space;
11084 }
11085 else
11086 {
11087 return other_item_quantity;
11088 }
11089 }
11090
11092 {
11094 }
11095
11097 {
11099 return;
11100
11101 if (!IsMagazine() && other_item)
11102 {
11104 if (quantity_used != 0)
11105 {
11106 float hp1 = GetHealth01("","");
11107 float hp2 = other_item.GetHealth01("","");
11108 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11109 hpResult = hpResult / (
GetQuantity() + quantity_used);
11110
11111 hpResult *= GetMaxHealth();
11112 Math.Round(hpResult);
11113 SetHealth("", "Health", hpResult);
11114
11116 other_item.AddQuantity(-quantity_used);
11117 }
11118 }
11120 }
11121
11123 {
11124 #ifdef SERVER
11125 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11126 GetHierarchyParent().IncreaseLifetimeUp();
11127 #endif
11128 };
11129
11131 {
11132 PlayerBase p = PlayerBase.Cast(player);
11133
11134 array<int> recipesIds = p.m_Recipes;
11135 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11136 if (moduleRecipesManager)
11137 {
11138 EntityAI itemInHands = player.GetEntityInHands();
11139 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11140 }
11141
11142 for (int i = 0;i < recipesIds.Count(); i++)
11143 {
11144 int key = recipesIds.Get(i);
11145 string recipeName = moduleRecipesManager.GetRecipeName(key);
11147 }
11148 }
11149
11150
11151 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11152 {
11153 super.GetDebugActions(outputList);
11154
11155
11161
11162
11167
11172
11173
11177
11178
11180 {
11184 }
11185
11188
11189
11193
11195
11196 InventoryLocation loc = new InventoryLocation();
11197 GetInventory().GetCurrentInventoryLocation(loc);
11199 {
11200 if (Gizmo_IsSupported())
11203 }
11204
11206 }
11207
11208
11209
11210
11212 {
11213 super.OnAction(action_id, player, ctx);
11214
11216 {
11217 switch (action_id)
11218 {
11222 return true;
11226 return true;
11227 }
11228 }
11229
11231 {
11232 switch (action_id)
11233 {
11235 Delete();
11236 return true;
11237 }
11238 }
11239
11240 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11241 {
11242 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11243 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11244 PlayerBase p = PlayerBase.Cast(player);
11245 if (
EActions.RECIPES_RANGE_START < 1000)
11246 {
11247 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11248 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11249 }
11250 }
11251 #ifndef SERVER
11252 else if (action_id ==
EActions.WATCH_PLAYER)
11253 {
11254 PluginDeveloper.SetDeveloperItemClientEx(player);
11255 }
11256 #endif
11258 {
11259 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11260 {
11261 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11262 OnDebugButtonPressServer(id + 1);
11263 }
11264
11265 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11266 {
11267 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11269 }
11270
11271 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11272 {
11273 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11275 }
11276
11277 else if (action_id ==
EActions.ADD_QUANTITY)
11278 {
11279 if (IsMagazine())
11280 {
11281 Magazine mag = Magazine.Cast(this);
11282 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11283 }
11284 else
11285 {
11287 }
11288
11289 if (m_EM)
11290 {
11291 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11292 }
11293
11294 }
11295
11296 else if (action_id ==
EActions.REMOVE_QUANTITY)
11297 {
11298 if (IsMagazine())
11299 {
11300 Magazine mag2 = Magazine.Cast(this);
11301 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11302 }
11303 else
11304 {
11306 }
11307 if (m_EM)
11308 {
11309 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11310 }
11311
11312 }
11313
11314 else if (action_id ==
EActions.SET_QUANTITY_0)
11315 {
11317
11318 if (m_EM)
11319 {
11320 m_EM.SetEnergy(0);
11321 }
11322 }
11323
11324 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11325 {
11327
11328 if (m_EM)
11329 {
11330 m_EM.SetEnergy(m_EM.GetEnergyMax());
11331 }
11332 }
11333
11334 else if (action_id ==
EActions.ADD_HEALTH)
11335 {
11336 AddHealth("","",GetMaxHealth("","Health")/5);
11337 }
11338 else if (action_id ==
EActions.REMOVE_HEALTH)
11339 {
11340 AddHealth("","",-GetMaxHealth("","Health")/5);
11341 }
11342 else if (action_id ==
EActions.DESTROY_HEALTH)
11343 {
11344 SetHealth01("","",0);
11345 }
11346 else if (action_id ==
EActions.WATCH_ITEM)
11347 {
11349 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11350 #ifdef DEVELOPER
11351 SetDebugDeveloper_item(this);
11352 #endif
11353 }
11354
11355 else if (action_id ==
EActions.ADD_TEMPERATURE)
11356 {
11357 AddTemperature(20);
11358
11359 }
11360
11361 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11362 {
11363 AddTemperature(-20);
11364
11365 }
11366
11367 else if (action_id ==
EActions.FLIP_FROZEN)
11368 {
11369 SetFrozen(!GetIsFrozen());
11370
11371 }
11372
11373 else if (action_id ==
EActions.ADD_WETNESS)
11374 {
11376
11377 }
11378
11379 else if (action_id ==
EActions.REMOVE_WETNESS)
11380 {
11382
11383 }
11384
11385 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11386 {
11389
11390
11391 }
11392
11393 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11394 {
11397 }
11398
11399 else if (action_id ==
EActions.MAKE_SPECIAL)
11400 {
11401 auto debugParams = DebugSpawnParams.WithPlayer(player);
11402 OnDebugSpawnEx(debugParams);
11403 }
11404
11405 }
11406
11407
11408 return false;
11409 }
11410
11411
11412
11413
11417
11420
11421
11422
11424 {
11425 return false;
11426 }
11427
11428
11430 {
11431 return true;
11432 }
11433
11434
11436 {
11437 return true;
11438 }
11439
11440
11441
11443 {
11444 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11445 return g_Game.ConfigIsExisting(config_path);
11446 }
11447
11450 {
11451 return null;
11452 }
11453
11455 {
11456 return false;
11457 }
11458
11460 {
11461 return false;
11462 }
11463
11467
11468
11470 {
11471 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11472 return module_repairing.CanRepair(this, item_repair_kit);
11473 }
11474
11475
11476 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11477 {
11478 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11479 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11480 }
11481
11482
11484 {
11485
11486
11487
11488
11489
11490
11491
11492
11493 return 1;
11494 }
11495
11496
11497
11499 {
11501 }
11502
11503
11504
11506 {
11508 }
11509
11510
11519 {
11520 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11521
11522 if (player)
11523 {
11524 player.MessageStatus(text);
11525 }
11526 }
11527
11528
11537 {
11538 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11539
11540 if (player)
11541 {
11542 player.MessageAction(text);
11543 }
11544 }
11545
11546
11555 {
11556 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11557
11558 if (player)
11559 {
11560 player.MessageFriendly(text);
11561 }
11562 }
11563
11564
11573 {
11574 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11575
11576 if (player)
11577 {
11578 player.MessageImportant(text);
11579 }
11580 }
11581
11583 {
11584 return true;
11585 }
11586
11587
11588 override bool KindOf(
string tag)
11589 {
11590 bool found = false;
11591 string item_name = this.
GetType();
11593 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11594
11595 int array_size = item_tag_array.Count();
11596 for (int i = 0; i < array_size; i++)
11597 {
11598 if (item_tag_array.Get(i) == tag)
11599 {
11600 found = true;
11601 break;
11602 }
11603 }
11604 return found;
11605 }
11606
11607
11609 {
11610
11611 super.OnRPC(sender, rpc_type,ctx);
11612
11613
11614 switch (rpc_type)
11615 {
11616 #ifndef SERVER
11617 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11618 Param2<bool, string> p = new Param2<bool, string>(false, "");
11619
11621 return;
11622
11623 bool play = p.param1;
11624 string soundSet = p.param2;
11625
11626 if (play)
11627 {
11629 {
11631 {
11633 }
11634 }
11635 else
11636 {
11638 }
11639 }
11640 else
11641 {
11643 }
11644
11645 break;
11646 #endif
11647
11648 }
11649
11651 {
11653 }
11654 }
11655
11656
11657
11658
11660 {
11661 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11662 return plugin.GetID(
name);
11663 }
11664
11666 {
11667 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11668 return plugin.GetName(id);
11669 }
11670
11673 {
11674
11675
11676 int varFlags;
11677 if (!ctx.
Read(varFlags))
11678 return;
11679
11680 if (varFlags & ItemVariableFlags.FLOAT)
11681 {
11683 }
11684 }
11685
11687 {
11688
11689 super.SerializeNumericalVars(floats_out);
11690
11691
11692
11694 {
11696 }
11697
11699 {
11701 }
11702
11704 {
11706 }
11707
11709 {
11714 }
11715
11717 {
11719 }
11720 }
11721
11723 {
11724
11725 super.DeSerializeNumericalVars(floats);
11726
11727
11728 int index = 0;
11729 int mask = Math.Round(floats.Get(index));
11730
11731 index++;
11732
11734 {
11736 {
11738 }
11739 else
11740 {
11741 float quantity = floats.Get(index);
11742 SetQuantity(quantity,
true,
false,
false,
false);
11743 }
11744 index++;
11745 }
11746
11748 {
11749 float wet = floats.Get(index);
11751 index++;
11752 }
11753
11755 {
11756 int liquidtype = Math.Round(floats.Get(index));
11758 index++;
11759 }
11760
11762 {
11764 index++;
11766 index++;
11768 index++;
11770 index++;
11771 }
11772
11774 {
11775 int cleanness = Math.Round(floats.Get(index));
11777 index++;
11778 }
11779 }
11780
11782 {
11783 super.WriteVarsToCTX(ctx);
11784
11785
11787 {
11789 }
11790
11792 {
11794 }
11795
11797 {
11799 }
11800
11802 {
11803 int r,g,b,a;
11809 }
11810
11812 {
11814 }
11815 }
11816
11818 {
11819 if (!super.ReadVarsFromCTX(ctx,version))
11820 return false;
11821
11822 int intValue;
11823 float value;
11824
11825 if (version < 140)
11826 {
11827 if (!ctx.
Read(intValue))
11828 return false;
11829
11830 m_VariablesMask = intValue;
11831 }
11832
11834 {
11835 if (!ctx.
Read(value))
11836 return false;
11837
11839 {
11841 }
11842 else
11843 {
11845 }
11846 }
11847
11848 if (version < 140)
11849 {
11851 {
11852 if (!ctx.
Read(value))
11853 return false;
11854 SetTemperatureDirect(value);
11855 }
11856 }
11857
11859 {
11860 if (!ctx.
Read(value))
11861 return false;
11863 }
11864
11866 {
11867 if (!ctx.
Read(intValue))
11868 return false;
11870 }
11871
11873 {
11874 int r,g,b,a;
11876 return false;
11878 return false;
11880 return false;
11882 return false;
11883
11885 }
11886
11888 {
11889 if (!ctx.
Read(intValue))
11890 return false;
11892 }
11893
11894 if (version >= 138 && version < 140)
11895 {
11897 {
11898 if (!ctx.
Read(intValue))
11899 return false;
11900 SetFrozen(intValue);
11901 }
11902 }
11903
11904 return true;
11905 }
11906
11907
11909 {
11912 {
11914 }
11915
11916 if (!super.OnStoreLoad(ctx, version))
11917 {
11919 return false;
11920 }
11921
11922 if (version >= 114)
11923 {
11924 bool hasQuickBarIndexSaved;
11925
11926 if (!ctx.
Read(hasQuickBarIndexSaved))
11927 {
11929 return false;
11930 }
11931
11932 if (hasQuickBarIndexSaved)
11933 {
11934 int itmQBIndex;
11935
11936
11937 if (!ctx.
Read(itmQBIndex))
11938 {
11940 return false;
11941 }
11942
11943 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11944 if (itmQBIndex != -1 && parentPlayer)
11945 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11946 }
11947 }
11948 else
11949 {
11950
11951 PlayerBase player;
11952 int itemQBIndex;
11953 if (version ==
int.
MAX)
11954 {
11955 if (!ctx.
Read(itemQBIndex))
11956 {
11958 return false;
11959 }
11960 }
11961 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11962 {
11963
11964 if (!ctx.
Read(itemQBIndex))
11965 {
11967 return false;
11968 }
11969 if (itemQBIndex != -1 && player)
11970 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11971 }
11972 }
11973
11974 if (version < 140)
11975 {
11976
11977 if (!LoadVariables(ctx, version))
11978 {
11980 return false;
11981 }
11982 }
11983
11984
11986 {
11988 return false;
11989 }
11990 if (version >= 132)
11991 {
11993 if (raib)
11994 {
11996 {
11998 return false;
11999 }
12000 }
12001 }
12002
12004 return true;
12005 }
12006
12007
12008
12010 {
12011 super.OnStoreSave(ctx);
12012
12013 PlayerBase player;
12014 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12015 {
12017
12018 int itemQBIndex = -1;
12019 itemQBIndex = player.FindQuickBarEntityIndex(this);
12020 ctx.
Write(itemQBIndex);
12021 }
12022 else
12023 {
12025 }
12026
12028
12030 if (raib)
12031 {
12033 }
12034 }
12035
12036
12038 {
12039 super.AfterStoreLoad();
12040
12042 {
12044 }
12045
12047 {
12050 }
12051 }
12052
12054 {
12055 super.EEOnAfterLoad();
12056
12058 {
12060 }
12061
12064 }
12065
12067 {
12068 return false;
12069 }
12070
12071
12072
12074 {
12076 {
12077 #ifdef PLATFORM_CONSOLE
12078
12080 {
12082 if (menu)
12083 {
12085 }
12086 }
12087 #endif
12088 }
12089
12091 {
12094 }
12095
12097 {
12098 SetWeightDirty();
12100 }
12102 {
12105 }
12106
12108 {
12111
12114 }
12116 {
12120 }
12121
12122 super.OnVariablesSynchronized();
12123 }
12124
12125
12126
12128 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12129 {
12130 if (!IsServerCheck(allow_client))
12131 return false;
12132
12134 return false;
12135
12138
12139 if (value <= (min + 0.001))
12140 value = min;
12141
12142 if (value == min)
12143 {
12144 if (destroy_config)
12145 {
12146 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12147 if (dstr)
12148 {
12150 this.Delete();
12151 return true;
12152 }
12153 }
12154 else if (destroy_forced)
12155 {
12157 this.Delete();
12158 return true;
12159 }
12160
12162 }
12163
12166
12168 {
12169 EntityAI parent = GetHierarchyRoot();
12170 InventoryLocation iLoc = new InventoryLocation();
12171 GetInventory().GetCurrentInventoryLocation(iLoc);
12173 {
12174 int iLocSlot = iLoc.
GetSlot();
12176 {
12178 }
12180 {
12182 }
12183 }
12184 }
12185
12187 {
12189
12190 if (delta)
12192 }
12193
12195
12196 return false;
12197 }
12198
12199
12201 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12202 {
12204 }
12205
12207 {
12210 }
12211
12213 {
12216 }
12217
12219 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12220 {
12221 float value_clamped = Math.Clamp(value, 0, 1);
12223 SetQuantity(result, destroy_config, destroy_forced);
12224 }
12225
12226
12229 {
12231 }
12232
12234 {
12236 }
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12248 {
12249 int slot = -1;
12250 GameInventory inventory = GetInventory();
12251 if (inventory)
12252 {
12253 InventoryLocation il = new InventoryLocation;
12256 }
12257
12259 }
12260
12262 {
12263 float quantity_max = 0;
12264
12266 {
12267 if (attSlotID != -1)
12268 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12269
12270 if (quantity_max <= 0)
12272 }
12273
12274 if (quantity_max <= 0)
12276
12277 return quantity_max;
12278 }
12279
12281 {
12283 }
12284
12286 {
12288 }
12289
12290
12292 {
12294 }
12295
12297 {
12299 }
12300
12302 {
12304 }
12305
12306
12308 {
12309
12310 float weightEx = GetWeightEx();
12311 float special = GetInventoryAndCargoWeight();
12312 return weightEx - special;
12313 }
12314
12315
12317 {
12319 }
12320
12322 {
12324 {
12325 #ifdef DEVELOPER
12326 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12327 {
12328 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12330 }
12331 #endif
12332
12333 return GetQuantity() * GetConfigWeightModified();
12334 }
12335 else if (HasEnergyManager())
12336 {
12337 #ifdef DEVELOPER
12338 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12339 {
12340 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12341 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12342 }
12343 #endif
12344 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12345 }
12346 else
12347 {
12348 #ifdef DEVELOPER
12349 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12350 {
12351 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12352 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12353 }
12354 #endif
12355 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12356 }
12357 }
12358
12361 {
12362 int item_count = 0;
12364
12365 GameInventory inventory = GetInventory();
12366 CargoBase cargo = inventory.
GetCargo();
12367 if (cargo != NULL)
12368 {
12370 }
12371
12373 for (int i = 0; i < nAttachments; ++i)
12374 {
12376 if (item)
12377 item_count += item.GetNumberOfItems();
12378 }
12379 return item_count;
12380 }
12381
12384 {
12385 float weight = 0;
12386 float wetness = 1;
12387 if (include_wetness)
12390 {
12391 weight = wetness * m_ConfigWeight;
12392 }
12394 {
12395 weight = 1;
12396 }
12397 return weight;
12398 }
12399
12400
12401
12403 {
12404 GameInventory inventory = GetInventory();
12405 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12406 {
12407 array<EntityAI> items = new array<EntityAI>;
12409 for (int i = 0; i < items.Count(); ++i)
12410 {
12412 if (item)
12413 {
12414 g_Game.ObjectDelete(item);
12415 }
12416 }
12417 }
12418 }
12419
12420
12421
12422
12424 {
12425 float energy = 0;
12426 if (HasEnergyManager())
12427 {
12428 energy = GetCompEM().GetEnergy();
12429 }
12430 return energy;
12431 }
12432
12433
12435 {
12436 super.OnEnergyConsumed();
12437
12439 }
12440
12442 {
12443 super.OnEnergyAdded();
12444
12446 }
12447
12448
12450 {
12451 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12452 {
12454 {
12455 float energy_0to1 = GetCompEM().GetEnergy0To1();
12457 }
12458 }
12459 }
12460
12461
12463 {
12464 return ConfigGetFloat("heatIsolation");
12465 }
12466
12468 {
12470 }
12471
12473 {
12474 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12475 if (
g_Game.ConfigIsExisting(paramPath))
12476 return g_Game.ConfigGetFloat(paramPath);
12477
12478 return 0.0;
12479 }
12480
12482 {
12483 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12484 if (
g_Game.ConfigIsExisting(paramPath))
12485 return g_Game.ConfigGetFloat(paramPath);
12486
12487 return 0.0;
12488 }
12489
12490 override void SetWet(
float value,
bool allow_client =
false)
12491 {
12492 if (!IsServerCheck(allow_client))
12493 return;
12494
12497
12499
12500 m_VarWet = Math.Clamp(value, min, max);
12501
12503 {
12506 }
12507 }
12508
12509 override void AddWet(
float value)
12510 {
12512 }
12513
12515 {
12517 }
12518
12520 {
12522 }
12523
12525 {
12527 }
12528
12530 {
12532 }
12533
12535 {
12537 }
12538
12539 override void OnWetChanged(
float newVal,
float oldVal)
12540 {
12543 if (newLevel != oldLevel)
12544 {
12546 }
12547 }
12548
12550 {
12551 SetWeightDirty();
12552 }
12553
12555 {
12556 return GetWetLevelInternal(
m_VarWet);
12557 }
12558
12559
12560
12562 {
12564 }
12565
12567 {
12569 }
12570
12572 {
12574 }
12575
12577 {
12579 }
12580
12581
12582
12584 {
12585 if (ConfigIsExisting("itemModelLength"))
12586 {
12587 return ConfigGetFloat("itemModelLength");
12588 }
12589 return 0;
12590 }
12591
12593 {
12594 if (ConfigIsExisting("itemAttachOffset"))
12595 {
12596 return ConfigGetFloat("itemAttachOffset");
12597 }
12598 return 0;
12599 }
12600
12601 override void SetCleanness(
int value,
bool allow_client =
false)
12602 {
12603 if (!IsServerCheck(allow_client))
12604 return;
12605
12607
12609
12612 }
12613
12615 {
12617 }
12618
12620 {
12621 return true;
12622 }
12623
12624
12625
12626
12628 {
12630 }
12631
12633 {
12635 }
12636
12637
12638
12639
12640 override void SetColor(
int r,
int g,
int b,
int a)
12641 {
12647 }
12649 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12650 {
12655 }
12656
12658 {
12660 }
12661
12664 {
12665 int r,g,b,a;
12667 r = r/255;
12668 g = g/255;
12669 b = b/255;
12670 a = a/255;
12671 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12672 }
12673
12674
12675
12676 override void SetLiquidType(
int value,
bool allow_client =
false)
12677 {
12678 if (!IsServerCheck(allow_client))
12679 return;
12680
12685 }
12686
12688 {
12689 return ConfigGetInt("varLiquidTypeInit");
12690 }
12691
12693 {
12695 }
12696
12698 {
12700 SetFrozen(false);
12701 }
12702
12705 {
12706 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12707 }
12708
12709
12712 {
12713 PlayerBase nplayer;
12714 if (PlayerBase.CastTo(nplayer, player))
12715 {
12717 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12718 }
12719 }
12720
12721
12724 {
12725 PlayerBase nplayer;
12726 if (PlayerBase.CastTo(nplayer,player))
12727 {
12728 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12729 }
12730
12731 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12732
12733 if (HasEnergyManager())
12734 {
12735 GetCompEM().UpdatePlugState();
12736 }
12737 }
12738
12739
12741 {
12742 super.OnPlacementStarted(player);
12743
12745 }
12746
12747 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12748 {
12750 {
12751 m_AdminLog.OnPlacementComplete(player,
this);
12752 }
12753
12754 super.OnPlacementComplete(player, position, orientation);
12755 }
12756
12757
12758
12759
12760
12762 {
12764 {
12765 return true;
12766 }
12767 else
12768 {
12769 return false;
12770 }
12771 }
12772
12773
12775 {
12777 {
12779 }
12780 }
12781
12782
12784 {
12786 }
12787
12789 {
12791 }
12792
12793 override void InsertAgent(
int agent,
float count = 1)
12794 {
12795 if (count < 1)
12796 return;
12797
12799 }
12800
12803 {
12805 }
12806
12807
12809 {
12811 }
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12855 {
12857 return false;
12858 return true;
12859 }
12860
12862 {
12863
12865 }
12866
12867
12870 {
12871 super.CheckForRoofLimited(timeTresholdMS);
12872
12873 float time =
g_Game.GetTime();
12874 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12875 {
12876 m_PreviousRoofTestTime = time;
12877 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12878 }
12879 }
12880
12881
12883 {
12885 {
12886 return 0;
12887 }
12888
12889 if (GetInventory().GetAttachmentSlotsCount() != 0)
12890 {
12891 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12892 if (filter)
12893 return filter.GetProtectionLevel(type, false, system);
12894 else
12895 return 0;
12896 }
12897
12898 string subclassPath, entryName;
12899
12900 switch (type)
12901 {
12903 entryName = "biological";
12904 break;
12906 entryName = "chemical";
12907 break;
12908 default:
12909 entryName = "biological";
12910 break;
12911 }
12912
12913 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12914
12915 return g_Game.ConfigGetFloat(subclassPath + entryName);
12916 }
12917
12918
12919
12922 {
12923 if (!IsMagazine())
12925
12927 }
12928
12929
12930
12931
12932
12937 {
12938 return true;
12939 }
12940
12942 {
12944 }
12945
12946
12947
12948
12949
12951 {
12952 if (parent)
12953 {
12954 if (parent.IsInherited(DayZInfected))
12955 return true;
12956
12957 if (!parent.IsRuined())
12958 return true;
12959 }
12960
12961 return true;
12962 }
12963
12965 {
12966 if (!super.CanPutAsAttachment(parent))
12967 {
12968 return false;
12969 }
12970
12971 if (!IsRuined() && !parent.IsRuined())
12972 {
12973 return true;
12974 }
12975
12976 return false;
12977 }
12978
12980 {
12981
12982
12983
12984
12985 return super.CanReceiveItemIntoCargo(item);
12986 }
12987
12989 {
12990
12991
12992
12993
12994 GameInventory attachmentInv = attachment.GetInventory();
12996 {
12997 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12998 return false;
12999 }
13000
13001 InventoryLocation loc = new InventoryLocation();
13002 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13003 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13004 return false;
13005
13006 return super.CanReceiveAttachment(attachment, slotId);
13007 }
13008
13010 {
13011 if (!super.CanReleaseAttachment(attachment))
13012 return false;
13013
13014 return GetInventory().AreChildrenAccessible();
13015 }
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13038 {
13039 int id = muzzle_owner.GetMuzzleID();
13040 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13041
13042 if (WPOF_array)
13043 {
13044 for (int i = 0; i < WPOF_array.Count(); i++)
13045 {
13046 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13047
13048 if (WPOF)
13049 {
13050 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13051 }
13052 }
13053 }
13054 }
13055
13056
13058 {
13059 int id = muzzle_owner.GetMuzzleID();
13061
13062 if (WPOBE_array)
13063 {
13064 for (int i = 0; i < WPOBE_array.Count(); i++)
13065 {
13066 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13067
13068 if (WPOBE)
13069 {
13070 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13071 }
13072 }
13073 }
13074 }
13075
13076
13078 {
13079 int id = muzzle_owner.GetMuzzleID();
13080 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13081
13082 if (WPOOH_array)
13083 {
13084 for (int i = 0; i < WPOOH_array.Count(); i++)
13085 {
13086 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13087
13088 if (WPOOH)
13089 {
13090 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13091 }
13092 }
13093 }
13094 }
13095
13096
13098 {
13099 int id = muzzle_owner.GetMuzzleID();
13100 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13101
13102 if (WPOOH_array)
13103 {
13104 for (int i = 0; i < WPOOH_array.Count(); i++)
13105 {
13106 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13107
13108 if (WPOOH)
13109 {
13110 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13111 }
13112 }
13113 }
13114 }
13115
13116
13118 {
13119 int id = muzzle_owner.GetMuzzleID();
13120 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13121
13122 if (WPOOH_array)
13123 {
13124 for (int i = 0; i < WPOOH_array.Count(); i++)
13125 {
13126 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13127
13128 if (WPOOH)
13129 {
13130 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13131 }
13132 }
13133 }
13134 }
13135
13136
13137
13139 {
13141 {
13142 return true;
13143 }
13144
13145 return false;
13146 }
13147
13149 {
13151 {
13152 return true;
13153 }
13154
13155 return false;
13156 }
13157
13159 {
13161 {
13162 return true;
13163 }
13164
13165 return false;
13166 }
13167
13169 {
13170 return false;
13171 }
13172
13175 {
13176 return UATimeSpent.DEFAULT_DEPLOY;
13177 }
13178
13179
13180
13181
13183 {
13185 SetSynchDirty();
13186 }
13187
13189 {
13191 }
13192
13193
13195 {
13196 return false;
13197 }
13198
13201 {
13202 string att_type = "None";
13203
13204 if (ConfigIsExisting("soundAttType"))
13205 {
13206 att_type = ConfigGetString("soundAttType");
13207 }
13208
13210 }
13211
13213 {
13215 }
13216
13217
13218
13219
13220
13226
13228 {
13231
13233 }
13234
13235
13237 {
13239 return;
13240
13242
13245
13248
13249 SoundParameters params = new SoundParameters();
13253 }
13254
13255
13257 {
13259 {
13262
13263 SetSynchDirty();
13264
13267 }
13268 }
13269
13271 {
13273 }
13274
13275
13277 {
13279 return;
13280
13282 SetSynchDirty();
13283
13286 }
13287
13289 {
13292 }
13293
13295 {
13297 }
13298
13299 void OnApply(PlayerBase player);
13300
13302 {
13303 return 1.0;
13304 };
13305
13307 {
13309 }
13310
13312 {
13314 }
13315
13317
13319 {
13320 SetDynamicPhysicsLifeTime(0.01);
13322 }
13323
13325 {
13326 array<string> zone_names = new array<string>;
13327 GetDamageZones(zone_names);
13328 for (int i = 0; i < zone_names.Count(); i++)
13329 {
13330 SetHealthMax(zone_names.Get(i),"Health");
13331 }
13332 SetHealthMax("","Health");
13333 }
13334
13337 {
13338 float global_health = GetHealth01("","Health");
13339 array<string> zones = new array<string>;
13340 GetDamageZones(zones);
13341
13342 for (int i = 0; i < zones.Count(); i++)
13343 {
13344 SetHealth01(zones.Get(i),"Health",global_health);
13345 }
13346 }
13347
13350 {
13351 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13352 }
13353
13355 {
13356 if (!hasRootAsPlayer)
13357 {
13358 if (refParentIB)
13359 {
13360
13361 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13362 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13363
13364 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13365 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13366
13369 }
13370 else
13371 {
13372
13375 }
13376 }
13377 }
13378
13380 {
13382 {
13383 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13384 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13385 {
13386 float heatPermCoef = 1.0;
13388 while (ent)
13389 {
13390 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13391 ent = ent.GetHierarchyParent();
13392 }
13393
13394 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13395 }
13396 }
13397 }
13398
13400 {
13401
13402 EntityAI parent = GetHierarchyParent();
13403 if (!parent)
13404 {
13405 hasParent = false;
13406 hasRootAsPlayer = false;
13407 }
13408 else
13409 {
13410 hasParent = true;
13411 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13412 refParentIB =
ItemBase.Cast(parent);
13413 }
13414 }
13415
13416 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13417 {
13418
13419 }
13420
13422 {
13423
13424 return false;
13425 }
13426
13428 {
13429
13430
13431 return false;
13432 }
13433
13435 {
13436
13437 return false;
13438 }
13439
13442 {
13443 return !GetIsFrozen() &&
IsOpen();
13444 }
13445
13447 {
13448 bool hasParent = false, hasRootAsPlayer = false;
13450
13451 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13452 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13453
13454 if (wwtu || foodDecay)
13455 {
13459
13460 if (processWetness || processTemperature || processDecay)
13461 {
13463
13464 if (processWetness)
13465 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13466
13467 if (processTemperature)
13469
13470 if (processDecay)
13471 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13472 }
13473 }
13474 }
13475
13478 {
13480 }
13481
13483 {
13486
13487 return super.GetTemperatureFreezeThreshold();
13488 }
13489
13491 {
13494
13495 return super.GetTemperatureThawThreshold();
13496 }
13497
13499 {
13502
13503 return super.GetItemOverheatThreshold();
13504 }
13505
13507 {
13509 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13510
13511 return super.GetTemperatureFreezeTime();
13512 }
13513
13515 {
13517 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13518
13519 return super.GetTemperatureThawTime();
13520 }
13521
13526
13528 {
13529 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13530 }
13531
13533 {
13534 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13535 }
13536
13539 {
13541 }
13542
13544 {
13546 }
13547
13549 {
13551 }
13552
13555 {
13556 return null;
13557 }
13558
13561 {
13562 return false;
13563 }
13564
13566 {
13568 {
13571 if (!trg)
13572 {
13574 explosive = this;
13575 }
13576
13577 explosive.PairRemote(trg);
13579
13580 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13581 trg.SetPersistentPairID(persistentID);
13582 explosive.SetPersistentPairID(persistentID);
13583
13584 return true;
13585 }
13586 return false;
13587 }
13588
13591 {
13592 float ret = 1.0;
13595 ret *= GetHealth01();
13596
13597 return ret;
13598 }
13599
13600 #ifdef DEVELOPER
13601 override void SetDebugItem()
13602 {
13603 super.SetDebugItem();
13604 _itemBase = this;
13605 }
13606
13608 {
13609 string text = super.GetDebugText();
13610
13612 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13613
13614 return text;
13615 }
13616 #endif
13617
13619 {
13620 return true;
13621 }
13622
13624
13626
13628 {
13631 }
13632
13633
13641
13657
13658 [
Obsolete(
"Use ItemSoundHandler instead")]
13661 {
13662 if (!
g_Game.IsDedicatedServer())
13663 {
13664 if (ConfigIsExisting("attachSoundSet"))
13665 {
13666 string cfg_path = "";
13667 string soundset = "";
13668 string type_name =
GetType();
13669
13672 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13673 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13674
13675 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13676 {
13677 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13678 {
13679 if (cfg_slot_array[i] == slot_type)
13680 {
13681 soundset = cfg_soundset_array[i];
13682 break;
13683 }
13684 }
13685 }
13686
13687 if (soundset != "")
13688 {
13689 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13691 }
13692 }
13693 }
13694 }
13695
13697}
13698
13700{
13702 if (entity)
13703 {
13704 bool is_item = entity.IsInherited(
ItemBase);
13705 if (is_item && full_quantity)
13706 {
13709 }
13710 }
13711 else
13712 {
13714 return NULL;
13715 }
13716 return entity;
13717}
13718
13720{
13721 if (item)
13722 {
13723 if (health > 0)
13724 item.SetHealth("", "", health);
13725
13726 if (item.CanHaveTemperature())
13727 {
13729 if (item.CanFreeze())
13730 item.SetFrozen(false);
13731 }
13732
13733 if (item.HasEnergyManager())
13734 {
13735 if (quantity >= 0)
13736 {
13737 item.GetCompEM().SetEnergy0To1(quantity);
13738 }
13739 else
13740 {
13742 }
13743 }
13744 else if (item.IsMagazine())
13745 {
13746 Magazine mag = Magazine.Cast(item);
13747 if (quantity >= 0)
13748 {
13749 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13750 }
13751 else
13752 {
13754 }
13755
13756 }
13757 else
13758 {
13759 if (quantity >= 0)
13760 {
13761 item.SetQuantityNormalized(quantity, false);
13762 }
13763 else
13764 {
13766 }
13767
13768 }
13769 }
13770}
13771
13772#ifdef DEVELOPER
13774#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
bool SetAttachSoundEvent()
bool SetDetachSoundEvent()
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionManagerBase(PlayerBase player)
map< typename, ref array< ActionBase_Basic > > TInputActionMap
void AddAction(typename actionName)
void RemoveAction(typename actionName)
TInputActionMap m_InputActionMap
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
const int ECE_PLACE_ON_SURFACE
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
Open
Implementations only.
override void EEOnCECreate()
DamageType
exposed from C++ (do not change)
PluginAdminLog m_AdminLog
override bool IsExplosive()
override bool IsPrepareToDelete()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
proto GizmoApi GetGizmoApi()
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
static bool HasDebugActionsMask(int mask)
bool HidesSelectionBySlot()
void SplitItem(PlayerBase player)
void CopyScriptPropertiesFrom(EntityAI oldItem)
override void InsertAgent(int agent, float count=1)
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
static void SetDebugActionsMask(int mask)
void SetIsDeploySound(bool is_deploy_sound)
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
override bool IsHeavyBehaviour()
override void SetWetMax()
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
void ClearStartItemSoundServer()
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
override void RemoveAllAgentsExcept(int agent_to_keep)
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
bool CanBeMovedOverride()
override void SetWet(float value, bool allow_client=false)
ref TIntArray m_SingleUseActions
void StartItemSoundServer(int id, int slotId)
override void ProcessVariables()
ref TStringArray m_HeadHidingSelections
float GetWeightSpecialized(bool forceRecalc=false)
bool LoadAgents(ParamsReadContext ctx, int version)
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
ref array< ref OverheatingParticle > m_OverheatingParticles
override float GetTemperatureFreezeThreshold()
bool m_IsSoundSynchRemote
void StopItemSoundServer(int id)
static void ToggleDebugActionsMask(int mask)
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetTemperatureFreezeTime()
ref array< int > m_CompatibleLocks
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
float m_TemperaturePerQuantityWeight
bool m_RecipesInitialized
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
override float GetTemperatureThawThreshold()
override void OnEnergyConsumed()
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
override EWetnessLevel GetWetLevel()
float GetSingleInventoryItemWeight()
ref TIntArray m_InteractActions
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
bool CanPlayDeployLoopSound()
override float GetWetMax()
bool CanBeUsedForSuicide()
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
bool m_CanBeMovedOverride
override string ChangeIntoOnAttach(string slot)
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
override float GetQuantity()
int m_ShotsToStartOverheating
override void OnWetChanged(float newVal, float oldVal)
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void OnOverheatingDecay()
float GetDryingIncrement(string pIncrementName)
void SoundSynchRemoteReset()
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
override bool CanReleaseAttachment(EntityAI attachment)
override void OnMovedInsideCargo(EntityAI container)
void SetCEBasedQuantity()
bool m_CanPlayImpactSound
override string GetAttachmentSoundType()
float GetOverheatingCoef()
array< string > GetHeadHidingSelection()
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
override bool IsStoreLoad()
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
void SetResultOfSplit(bool value)
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
void UpdateAllOverheatingParticles()
float GetSoakingIncrement(string pIncrementName)
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetStoreLoadedQuantity()
const int ITEM_SOUNDS_MAX
float GetItemModelLength()
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
void CombineItems(ItemBase other_item, bool use_stack_max=true)
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
void TransferAgents(int agents)
transfer agents from another item
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
float GetHeatIsolationInit()
void SetCanBeMovedOverride(bool setting)
override bool HasQuantity()
bool IsCargoException4x3(EntityAI item)
ref TIntArray m_ContinuousActions
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
void LoadParticleConfigOnFire(int id)
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
override float GetWetInit()
int m_ImpactSoundSurfaceHash
int m_MaxOverheatingValue
void SetupSpawnedItem(ItemBase item, float health, float quantity)
bool ShouldSplitQuantity(float quantity)
static ref map< string, int > m_WeaponTypeToID
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
array< int > GetValidFinishers()
returns an array of possible finishers
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
ItemSoundHandler GetItemSoundHandler()
override int GetQuantityMin()
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
override int GetQuickBarBonus()
override void SetTakeable(bool pState)
float m_OverheatingDecayInterval
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
void RemoveAudioVisualsOnClient()
static void AddDebugActionsMask(int mask)
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
bool CanRepair(ItemBase item_repair_kit)
bool can_this_be_combined
EffectSound m_SoundDeploy
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
float GetDeployTime()
how long it takes to deploy this item in seconds
override bool IsSplitable()
bool DamageItemAttachments(float damage)
override void WriteVarsToCTX(ParamsWriteContext ctx)
void ConvertEnergyToQuantity()
override void RemoveAllAgents()
override void SetQuantityToMinimum()
bool m_WantPlayImpactSound
override float GetTemperatureThawTime()
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
float m_StoreLoadedQuantity
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
float GetFilterDamageRatio()
override void SetLiquidType(int value, bool allow_client=false)
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
void OnApply(PlayerBase player)
override void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
ref Timer m_CheckOverheating
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool IsOneHandedBehaviour()
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetDisinfectQuantity(int system=0, Param param1=null)
override bool IsHologram()
float GetItemAttachOffset()
static int GetDebugActionsMask()
override int GetLiquidType()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnEnergyAdded()
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
EffectSound m_DeployLoopSoundEx
override void DeSerializeNumericalVars(array< float > floats)
void StopItemDynamicPhysics()
override void SetStoreLoad(bool value)
float GetOverheatingValue()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
override void EOnContact(IEntity other, Contact extra)
void SplitIntoStackMaxHands(PlayerBase player)
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override void SetStoreLoadedQuantity(float value)
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void OnLiquidTypeChanged(int oldType, int newType)
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void PlayDeployFinishSound()
bool AllowFoodConsumption()
bool m_IsOverheatingEffectActive
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
bool PairWithDevice(notnull ItemBase otherDevice)
static void RemoveDebugActionsMask(int mask)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void PerformDamageSystemReinit()
override void ClearInventory()
static int m_LastRegisteredWeaponID
ItemBase GetLightSourceItem()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
override float GetItemOverheatThreshold()
void StopDeployLoopSoundEx()
override void SerializeNumericalVars(array< float > floats_out)
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
static int m_DebugActionsMask
void KillAllOverheatingParticles()
bool CanBeCookedOnStick()
override int GetQuantityMax()
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
void OnActivatedByTripWire()
override void RemoveAgent(int agent_id)
bool m_ItemBeingDroppedPhys
override bool CanPutAsAttachment(EntityAI parent)
void PlayDetachSound(string slot_type)
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override bool IsBeingPlaced()
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
bool m_FixDamageSystemInit
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
void LoadParticleConfigOnOverheating(int id)
bool IsSoundSynchRemote()
override void OnRightClick()
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
bool IsActionTargetVisible()
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
int NameToID(string name)
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
void ClearStopItemSoundServer()
override string ChangeIntoOnDetach()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
EffectSound m_SoundDeployFinish
float GetQuantityNormalizedScripted()
override void SetCleanness(int value, bool allow_client=false)
override float GetWetMin()
ref ItemSoundHandler m_ItemSoundHandler
override bool KindOf(string tag)
void ItemSoundHandler(ItemBase parent)
EffectSound m_LockingSound
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
void RemoteDetonatorTrigger()
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
override void Explode(int damageType, string ammoType="")
void OnItemLocationChanged(ItemBase item)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
proto native EntityAI GetAttachmentFromIndex(int index)
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
proto native int AttachmentCount()
Returns count of attachments attached to this item.
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
bool WriteToContext(ParamsWriteContext ctx)
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
override bool CanDisplayCargo()
override void OnInventoryEnter(Man player)
override string GetFoldSoundset()
override bool CanPutAsAttachment(EntityAI parent)
override bool CanReceiveItemIntoCargo(EntityAI item)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
override void EEDelete(EntityAI parent)
override bool CanBeRepairedByCrafting()
override void OnPlacementStarted(Man player)
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override bool IsElectricAppliance()
override bool IsItemTent()
override void SetActions()
override string GetLoopFoldSoundset()
override bool CanMakeGardenplot()
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override WrittenNoteData GetWrittenNoteData()
override int GetDamageSystemVersionChange()
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
override void InitItemVariables()
override void SetActionAnimOverrides()
override void OnCreatePhysics()
override string GetDeploySoundset()
override float GetBandagingEffectivity()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void OnStoreSave(ParamsWriteContext ctx)
override void AfterStoreLoad()
override int GetOnDigWormsAmount()
override bool IsSelfAdjustingTemperature()
override bool IsPlayerInside(PlayerBase player, string selection)
override void OnVariablesSynchronized()
override void RefreshPhysics()
override bool CanObstruct()
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanPutInCargo(EntityAI parent)
override string GetLoopDeploySoundset()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override void OnInventoryExit(Man player)
override bool IsTakeable()
override bool IsIgnoredByConstruction()
override void InitItemSounds()
override void EEKilled(Object killer)
override void OnCombine(ItemBase other_item)
override bool CanExplodeInFire()
override bool IsFacingPlayer(PlayerBase player, string selection)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
override bool IsBloodContainer()
override bool IsClothing()
override bool CanBeSplit()
override bool IsDeployable()
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
override bool CanBeDisinfected()
override float GetInfectionChance(int system=0, Param param=null)
override void OnEndPlacement()
float GetOverheatingLimitMax()
void SetOverheatingLimitMax(float max)
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
float GetOverheatingLimitMin()
void SetOverheatingLimitMin(float min)
void RegisterParticle(Particle p)
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
void SetControlledDevice(EntityAI pDevice)
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
void SetCalcDetails(string details)
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Serializer ParamsReadContext
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Serializer ParamsWriteContext
const int COMP_TYPE_ENERGY_MANAGER
void Error(string err)
Messagebox with error message.
proto native void SetColor(int color)
array< string > TStringArray
void Obsolete(string msg="")
EntityEvent
Entity events for event-mask, or throwing event from code.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
const int VARIABLE_LIQUIDTYPE
const int VARIABLE_CLEANNESS
const int VARIABLE_TEMPERATURE
const int VARIABLE_QUANTITY
static proto float AbsFloat(float f)
Returns absolute value.
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_DEBUG_ACTION
vector GetPosition()
Get the world position of the Effect.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.