8734{
8736 {
8737 return true;
8738 }
8739};
8740
8742{
8743
8744};
8745
8746
8747
8749{
8753
8755
8758
8759
8760
8761
8762
8771
8777
8782
8787
8808 protected bool m_IsResultOfSplit
8809
8811
8816
8817
8818
8820
8824
8825
8826
8828
8831
8832
8833
8839
8840
8848
8851
8852
8854
8855
8857
8858
8863
8864
8869
8871
8872
8874
8875
8877 {
8882
8883 if (!
g_Game.IsDedicatedServer())
8884 {
8886 {
8888
8890 {
8892 }
8893 }
8894
8897 }
8898
8899 m_OldLocation = null;
8900
8902 {
8904 }
8905
8906 if (ConfigIsExisting("headSelectionsToHide"))
8907 {
8910 }
8911
8913 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8914 {
8916 }
8917
8919
8920 m_IsResultOfSplit = false;
8921
8923 }
8924
8926 {
8927 super.InitItemVariables();
8928
8934 m_Count = ConfigGetInt(
"count");
8935
8938
8943
8946
8951
8963
8967
8968
8971 if (ConfigIsExisting("canBeSplit"))
8972 {
8975 }
8976
8978 if (ConfigIsExisting("itemBehaviour"))
8980
8981
8984 RegisterNetSyncVariableInt("m_VarLiquidType");
8985 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8986
8987 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8988 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8989 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8990
8991 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8992 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8993 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8994 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8995
8996 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8997 RegisterNetSyncVariableBool("m_IsTakeable");
8998 RegisterNetSyncVariableBool("m_IsHologram");
8999
9002 {
9005 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9006 }
9007
9009
9011 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9013
9015 }
9016
9018 {
9020 }
9021
9023 {
9026 {
9031 }
9032 }
9033
9034 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9035 {
9037 {
9040 }
9041
9043 }
9044
9046 {
9052 }
9053
9055
9057 {
9059
9060 if (!action)
9061 {
9062 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9063 return;
9064 }
9065
9067 if (!ai)
9068 {
9070 return;
9071 }
9072
9074 if (!action_array)
9075 {
9076 action_array = new array<ActionBase_Basic>;
9078 }
9079 if (LogManager.IsActionLogEnable())
9080 {
9081 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9082 }
9083
9084 if (action_array.Find(action) != -1)
9085 {
9086 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9087 }
9088 else
9089 {
9090 action_array.Insert(action);
9091 }
9092 }
9093
9095 {
9096 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9097 ActionBase action = player.GetActionManager().GetAction(actionName);
9100
9101 if (action_array)
9102 {
9103 action_array.RemoveItem(action);
9104 }
9105 }
9106
9107
9108
9110 {
9111 ActionOverrideData overrideData = new ActionOverrideData();
9115
9117 if (!actionMap)
9118 {
9121 }
9122
9123 actionMap.Insert(this.
Type(), overrideData);
9124
9125 }
9126
9128
9130
9131
9133 {
9136
9139
9140 string config_to_search = "CfgVehicles";
9141 string muzzle_owner_config;
9142
9144 {
9145 if (IsInherited(Weapon))
9146 config_to_search = "CfgWeapons";
9147
9148 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9149
9150 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9151
9152 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9153
9154 if (config_OnFire_subclass_count > 0)
9155 {
9156 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9157
9158 for (int i = 0; i < config_OnFire_subclass_count; i++)
9159 {
9160 string particle_class = "";
9161 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9162 string config_OnFire_entry = config_OnFire_class + particle_class;
9163 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9164 WPOF_array.Insert(WPOF);
9165 }
9166
9167
9169 }
9170 }
9171
9173 {
9174 config_to_search = "CfgWeapons";
9175 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9176
9177 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9178
9179 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9180
9181 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9182 {
9183 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9184
9185 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9186 {
9187 string particle_class2 = "";
9188 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9189 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9190 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9191 WPOBE_array.Insert(WPOBE);
9192 }
9193
9194
9196 }
9197 }
9198 }
9199
9200
9202 {
9205
9207 {
9208 string config_to_search = "CfgVehicles";
9209
9210 if (IsInherited(Weapon))
9211 config_to_search = "CfgWeapons";
9212
9213 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9214 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9215
9216 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9217 {
9218
9220
9222 {
9224 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9226 return;
9227 }
9228
9231
9232
9233
9234 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9235 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9236
9237 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9238 {
9239 string particle_class = "";
9240 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9241 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9242 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9243
9244 if (entry_type == CT_CLASS)
9245 {
9246 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9247 WPOOH_array.Insert(WPOF);
9248 }
9249 }
9250
9251
9253 }
9254 }
9255 }
9256
9258 {
9260 }
9261
9263 {
9265 {
9267
9270
9273
9274 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9275 }
9276 }
9277
9279 {
9281 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9282
9284 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9285
9287 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9288
9290 {
9292 }
9293 }
9294
9296 {
9298 }
9299
9301 {
9304 else
9306
9308 {
9311 }
9312 else
9313 {
9316
9319 }
9320
9322 }
9323
9325 {
9327 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9328 }
9329
9331 {
9333 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9335 }
9336
9338 {
9340 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9341 }
9342
9344 {
9347
9348 OverheatingParticle OP = new OverheatingParticle();
9353
9355 }
9356
9358 {
9361
9362 return -1;
9363 }
9364
9366 {
9368 {
9371
9372 for (int i = count; i > 0; --i)
9373 {
9374 int id = i - 1;
9377
9380
9381 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9382 {
9383 if (p)
9384 {
9387 }
9388 }
9389 }
9390 }
9391 }
9392
9394 {
9396 {
9398 {
9399 int id = i - 1;
9401
9402 if (OP)
9403 {
9405
9406 if (p)
9407 {
9409 }
9410
9411 delete OP;
9412 }
9413 }
9414
9417 }
9418 }
9419
9422 {
9423 return 0.0;
9424 }
9425
9426
9428 {
9429 return 250;
9430 }
9431
9433 {
9434 return 0;
9435 }
9436
9439 {
9441 return true;
9442
9443 return false;
9444 }
9445
9448 {
9451
9453 {
9455 }
9456 else
9457 {
9458
9460 }
9461
9463 }
9464
9471 {
9472 return -1;
9473 }
9474
9475
9476
9477
9479 {
9481 {
9482 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9483 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9484
9485 if (r_index >= 0)
9486 {
9487 InventoryLocation r_il = new InventoryLocation;
9488 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9489
9490 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9493 {
9494 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9495 }
9497 {
9498 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9499 }
9500
9501 }
9502
9503 player.GetHumanInventory().ClearUserReservedLocation(this);
9504 }
9505
9508 }
9509
9510
9511
9512
9514 {
9515 return ItemBase.m_DebugActionsMask;
9516 }
9517
9519 {
9520 return ItemBase.m_DebugActionsMask & mask;
9521 }
9522
9524 {
9525 ItemBase.m_DebugActionsMask = mask;
9526 }
9527
9529 {
9530 ItemBase.m_DebugActionsMask |= mask;
9531 }
9532
9534 {
9535 ItemBase.m_DebugActionsMask &= ~mask;
9536 }
9537
9539 {
9541 {
9543 }
9544 else
9545 {
9547 }
9548 }
9549
9550
9552 {
9553 if (GetEconomyProfile())
9554 {
9555 float q_max = GetEconomyProfile().GetQuantityMax();
9556 if (q_max > 0)
9557 {
9558 float q_min = GetEconomyProfile().GetQuantityMin();
9559 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9560
9562 {
9563 ComponentEnergyManager comp = GetCompEM();
9565 {
9567 }
9568 }
9570 {
9572
9573 }
9574
9575 }
9576 }
9577 }
9578
9581 {
9582 EntityAI parent = GetHierarchyParent();
9583
9584 if (parent)
9585 {
9586 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9587 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9588 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9589 }
9590 }
9591
9594 {
9595 EntityAI parent = GetHierarchyParent();
9596
9597 if (parent)
9598 {
9599 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9600 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9601 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9602 }
9603 }
9604
9606 {
9607
9608
9609
9610
9612
9614 {
9615 if (ScriptInputUserData.CanStoreInputUserData())
9616 {
9617 ScriptInputUserData ctx = new ScriptInputUserData;
9623 ctx.
Write(use_stack_max);
9626
9628 {
9629 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9630 }
9631 }
9632 }
9633 else if (!
g_Game.IsMultiplayer())
9634 {
9636 }
9637 }
9638
9640 {
9642 }
9643
9645 {
9647 }
9648
9650 {
9652 }
9653
9655 {
9656
9657 return false;
9658 }
9659
9661 {
9662 return false;
9663 }
9664
9668 {
9669 return false;
9670 }
9671
9673 {
9674 return "";
9675 }
9676
9678
9680 {
9681 return false;
9682 }
9683
9685 {
9686 return true;
9687 }
9688
9689
9690
9692 {
9693 return true;
9694 }
9695
9697 {
9698 return true;
9699 }
9700
9702 {
9703 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9705 }
9706
9708 {
9710 }
9711
9713 {
9715 if (!is_being_placed)
9717 SetSynchDirty();
9718 }
9719
9720
9722
9724 {
9726 }
9727
9729 {
9731 }
9732
9734 {
9735 return 1;
9736 }
9737
9739 {
9740 return false;
9741 }
9742
9744 {
9746 SetSynchDirty();
9747 }
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9784 {
9785 super.OnMovedInsideCargo(container);
9786
9787 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9788 }
9789
9790 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9791 {
9792 super.EEItemLocationChanged(oldLoc, newLoc);
9793
9794 PlayerBase newPlayer = null;
9795 PlayerBase oldPlayer = null;
9796
9797 if (newLoc.GetParent())
9798 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9799
9800 if (oldLoc.GetParent())
9801 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9802
9804 {
9805 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9806
9807 if (rIndex >= 0)
9808 {
9809 InventoryLocation rIl = new InventoryLocation;
9810 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9811
9812 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9815 {
9816 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9817 }
9819 {
9821 }
9822
9823 }
9824 }
9825
9827 {
9828 if (newPlayer)
9829 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9830
9831 if (newPlayer == oldPlayer)
9832 {
9833 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9834 {
9836 {
9837 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9838 {
9839 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9840 }
9841 }
9842 else
9843 {
9844 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9845 }
9846 }
9847
9848 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9849 {
9850 int type = oldLoc.GetType();
9852 {
9853 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9854 }
9856 {
9857 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9858 }
9859 }
9860 if (!m_OldLocation)
9861 {
9862 m_OldLocation = new InventoryLocation;
9863 }
9864 m_OldLocation.Copy(oldLoc);
9865 }
9866 else
9867 {
9868 if (m_OldLocation)
9869 {
9870 m_OldLocation.Reset();
9871 }
9872 }
9873
9874 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9875 }
9876 else
9877 {
9878 if (newPlayer)
9879 {
9880 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9881 if (resIndex >= 0)
9882 {
9883 InventoryLocation il = new InventoryLocation;
9884 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9886 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9889 {
9890 il.
GetParent().GetOnReleaseLock().Invoke(it);
9891 }
9893 {
9895 }
9896
9897 }
9898 }
9900 {
9901
9903 }
9904
9905 if (m_OldLocation)
9906 {
9907 m_OldLocation.Reset();
9908 }
9909 }
9910
9912 {
9913 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9914 }
9915
9917 {
9918 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9919 }
9920 }
9921
9922 override void EOnContact(IEntity other, Contact extra)
9923 {
9925 {
9926 int liquidType = -1;
9928 if (impactSpeed > 0.0)
9929 {
9931 #ifndef SERVER
9933 #else
9935 SetSynchDirty();
9936 #endif
9938 }
9939 }
9940
9941 #ifdef SERVER
9942 if (GetCompEM() && GetCompEM().IsPlugged())
9943 {
9944 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9945 GetCompEM().UnplugThis();
9946 }
9947 #endif
9948 }
9949
9951
9953 {
9955 }
9956
9958 {
9959
9960 }
9961
9963 {
9964 super.OnItemLocationChanged(old_owner, new_owner);
9965
9966 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9967 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9968
9969 if (!relatedPlayer && playerNew)
9970 relatedPlayer = playerNew;
9971
9972 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9973 {
9975 if (actionMgr)
9976 {
9977 ActionBase currentAction = actionMgr.GetRunningAction();
9978 if (currentAction)
9980 }
9981 }
9982
9983 Man ownerPlayerOld = null;
9984 Man ownerPlayerNew = null;
9985
9986 if (old_owner)
9987 {
9988 if (old_owner.
IsMan())
9989 {
9990 ownerPlayerOld = Man.Cast(old_owner);
9991 }
9992 else
9993 {
9994 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9995 }
9996 }
9997 else
9998 {
10000 {
10002
10003 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10004 {
10005 GetCompEM().UnplugThis();
10006 }
10007 }
10008 }
10009
10010 if (new_owner)
10011 {
10012 if (new_owner.
IsMan())
10013 {
10014 ownerPlayerNew = Man.Cast(new_owner);
10015 }
10016 else
10017 {
10018 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10019 }
10020 }
10021
10022 if (ownerPlayerOld != ownerPlayerNew)
10023 {
10024 if (ownerPlayerOld)
10025 {
10026 array<EntityAI> subItemsExit = new array<EntityAI>;
10028 for (int i = 0; i < subItemsExit.Count(); i++)
10029 {
10032 }
10033 }
10034
10035 if (ownerPlayerNew)
10036 {
10037 array<EntityAI> subItemsEnter = new array<EntityAI>;
10039 for (int j = 0; j < subItemsEnter.Count(); j++)
10040 {
10043 }
10044 }
10045 }
10046 else if (ownerPlayerNew != null)
10047 {
10048 PlayerBase nplayer;
10049 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10050 {
10051 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10053 for (int k = 0; k < subItemsUpdate.Count(); k++)
10054 {
10056 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10057 }
10058 }
10059 }
10060
10061 if (old_owner)
10062 old_owner.OnChildItemRemoved(this);
10063 if (new_owner)
10064 new_owner.OnChildItemReceived(this);
10065 }
10066
10067
10069 {
10070 super.EEDelete(parent);
10071 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10072 if (player)
10073 {
10075
10076 if (player.IsAlive())
10077 {
10078 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10079 if (r_index >= 0)
10080 {
10081 InventoryLocation r_il = new InventoryLocation;
10082 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10083
10084 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10087 {
10088 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10089 }
10091 {
10092 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10093 }
10094
10095 }
10096
10097 player.RemoveQuickBarEntityShortcut(this);
10098 }
10099 }
10100 }
10101
10103 {
10104 super.EEKilled(killer);
10105
10108 {
10109 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10110 {
10111 if (IsMagazine())
10112 {
10113 if (Magazine.Cast(this).GetAmmoCount() > 0)
10114 {
10116 }
10117 }
10118 else
10119 {
10121 }
10122 }
10123 }
10124 }
10125
10127 {
10128 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10129
10130 super.OnWasAttached(parent, slot_id);
10131
10134
10137 }
10138
10140 {
10141 super.OnWasDetached(parent, slot_id);
10142
10145
10148 }
10149
10151 {
10152 int idx;
10155
10156 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10157 if (inventory_slots.Count() < 1)
10158 {
10159 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10160 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10161 }
10162 else
10163 {
10164 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10165 }
10166
10167 idx = inventory_slots.Find(slot);
10168 if (idx < 0)
10169 return "";
10170
10171 return attach_types.Get(idx);
10172 }
10173
10175 {
10176 int idx = -1;
10177 string slot;
10178
10181
10182 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10183 if (inventory_slots.Count() < 1)
10184 {
10185 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10186 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10187 }
10188 else
10189 {
10190 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10191 if (detach_types.Count() < 1)
10192 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10193 }
10194
10195 for (int i = 0; i < inventory_slots.Count(); i++)
10196 {
10197 slot = inventory_slots.Get(i);
10198 }
10199
10200 if (slot != "")
10201 {
10202 if (detach_types.Count() == 1)
10203 idx = 0;
10204 else
10205 idx = inventory_slots.Find(slot);
10206 }
10207 if (idx < 0)
10208 return "";
10209
10210 return detach_types.Get(idx);
10211 }
10212
10214 {
10215
10217
10218
10219 float min_time = 1;
10220 float max_time = 3;
10221 float delay = Math.RandomFloat(min_time, max_time);
10222
10223 explode_timer.Run(delay, this, "DoAmmoExplosion");
10224 }
10225
10227 {
10228 Magazine magazine = Magazine.Cast(this);
10229 int pop_sounds_count = 6;
10230 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10231
10232
10233 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10234 string sound_name = pop_sounds[ sound_idx ];
10235 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10236
10237
10238 magazine.ServerAddAmmoCount(-1);
10239
10240
10241 float min_temp_to_explode = 100;
10242
10243 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10244 {
10246 }
10247 }
10248
10249
10250 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10251 {
10252 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10253
10254 const int CHANCE_DAMAGE_CARGO = 4;
10255 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10256 const int CHANCE_DAMAGE_NOTHING = 2;
10257
10259 {
10260 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10261 int chances;
10262 int rnd;
10263
10264 if (GetInventory().GetCargo())
10265 {
10266 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10267 rnd = Math.RandomInt(0,chances);
10268
10269 if (rnd < CHANCE_DAMAGE_CARGO)
10270 {
10272 }
10273 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10274 {
10276 }
10277 }
10278 else
10279 {
10280 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10281 rnd = Math.RandomInt(0,chances);
10282
10283 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10284 {
10286 }
10287 }
10288 }
10289 }
10290
10292 {
10293 CargoBase cargo = GetInventory().GetCargo();
10294 if (cargo)
10295 {
10297 if (item_count > 0)
10298 {
10299 int random_pick = Math.RandomInt(0, item_count);
10301 if (!item.IsExplosive())
10302 {
10303 item.AddHealth("","",damage);
10304 return true;
10305 }
10306 }
10307 }
10308 return false;
10309 }
10310
10312 {
10313 GameInventory inventory = GetInventory();
10315 if (attachment_count > 0)
10316 {
10317 int random_pick = Math.RandomInt(0, attachment_count);
10319 if (!attachment.IsExplosive())
10320 {
10321 attachment.AddHealth("","",damage);
10322 return true;
10323 }
10324 }
10325 return false;
10326 }
10327
10329 {
10331 }
10332
10334 {
10336 return GetInventory().CanRemoveEntity();
10337
10338 return false;
10339 }
10340
10342 {
10343
10345 return false;
10346
10347
10349 return false;
10350
10351
10352
10354 if (delta == 0)
10355 return false;
10356
10357
10358 return true;
10359 }
10360
10362 {
10364 {
10365 if (ScriptInputUserData.CanStoreInputUserData())
10366 {
10367 ScriptInputUserData ctx = new ScriptInputUserData;
10372 ctx.
Write(destination_entity);
10374 ctx.
Write(slot_id);
10376 }
10377 }
10378 else if (!
g_Game.IsMultiplayer())
10379 {
10381 }
10382 }
10383
10385 {
10386 float split_quantity_new;
10390 InventoryLocation loc = new InventoryLocation;
10391
10392 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10393 {
10395 split_quantity_new = stack_max;
10396 else
10398
10400 {
10401 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10402 if (new_item)
10403 {
10404 new_item.SetResultOfSplit(true);
10405 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10407 new_item.
SetQuantity(split_quantity_new,
false,
true);
10408 }
10409 }
10410 }
10411 else if (destination_entity && slot_id == -1)
10412 {
10413 if (quantity > stack_max)
10414 split_quantity_new = stack_max;
10415 else
10416 split_quantity_new = quantity;
10417
10419 {
10420 GameInventory destinationInventory = destination_entity.GetInventory();
10422 {
10425 }
10426
10427 if (new_item)
10428 {
10429 new_item.SetResultOfSplit(true);
10430 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10432 new_item.
SetQuantity(split_quantity_new,
false,
true);
10433 }
10434 }
10435 }
10436 else
10437 {
10438 if (stack_max != 0)
10439 {
10441 {
10443 }
10444
10445 if (split_quantity_new == 0)
10446 {
10447 if (!
g_Game.IsMultiplayer())
10448 player.PhysicalPredictiveDropItem(this);
10449 else
10450 player.ServerDropEntity(this);
10451 return;
10452 }
10453
10455 {
10457
10458 if (new_item)
10459 {
10460 new_item.SetResultOfSplit(true);
10461 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10464 new_item.PlaceOnSurface();
10465 }
10466 }
10467 }
10468 }
10469 }
10470
10472 {
10473 float split_quantity_new;
10477 InventoryLocation loc = new InventoryLocation;
10478
10479 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10480 {
10482 split_quantity_new = stack_max;
10483 else
10485
10487 {
10488 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10489 if (new_item)
10490 {
10491 new_item.SetResultOfSplit(true);
10492 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10494 new_item.
SetQuantity(split_quantity_new,
false,
true);
10495 }
10496 }
10497 }
10498 else if (destination_entity && slot_id == -1)
10499 {
10500 if (quantity > stack_max)
10501 split_quantity_new = stack_max;
10502 else
10503 split_quantity_new = quantity;
10504
10506 {
10507 GameInventory destinationInventory = destination_entity.GetInventory();
10509 {
10512 }
10513
10514 if (new_item)
10515 {
10516 new_item.SetResultOfSplit(true);
10517 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10519 new_item.
SetQuantity(split_quantity_new,
false,
true);
10520 }
10521 }
10522 }
10523 else
10524 {
10525 if (stack_max != 0)
10526 {
10528 {
10530 }
10531
10533 {
10535
10536 if (new_item)
10537 {
10538 new_item.SetResultOfSplit(true);
10539 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10542 new_item.PlaceOnSurface();
10543 }
10544 }
10545 }
10546 }
10547 }
10548
10550 {
10552 {
10553 if (ScriptInputUserData.CanStoreInputUserData())
10554 {
10555 ScriptInputUserData ctx = new ScriptInputUserData;
10560 dst.WriteToContext(ctx);
10562 }
10563 }
10564 else if (!
g_Game.IsMultiplayer())
10565 {
10567 }
10568 }
10569
10571 {
10573 {
10574 if (ScriptInputUserData.CanStoreInputUserData())
10575 {
10576 ScriptInputUserData ctx = new ScriptInputUserData;
10581 ctx.
Write(destination_entity);
10587 }
10588 }
10589 else if (!
g_Game.IsMultiplayer())
10590 {
10592 }
10593 }
10594
10596 {
10598 }
10599
10601 {
10603 float split_quantity_new;
10605 if (dst.IsValid())
10606 {
10607 int slot_id = dst.GetSlot();
10609
10610 if (quantity > stack_max)
10611 split_quantity_new = stack_max;
10612 else
10613 split_quantity_new = quantity;
10614
10616 {
10618
10619 if (new_item)
10620 {
10621 new_item.SetResultOfSplit(true);
10622 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10624 new_item.
SetQuantity(split_quantity_new,
false,
true);
10625 }
10626
10627 return new_item;
10628 }
10629 }
10630
10631 return null;
10632 }
10633
10635 {
10637 float split_quantity_new;
10639 if (destination_entity)
10640 {
10642 if (quantity > stackable)
10643 split_quantity_new = stackable;
10644 else
10645 split_quantity_new = quantity;
10646
10648 {
10649 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10650 if (new_item)
10651 {
10652 new_item.SetResultOfSplit(true);
10653 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10655 new_item.
SetQuantity(split_quantity_new,
false,
true);
10656 }
10657 }
10658 }
10659 }
10660
10662 {
10664 {
10665 if (ScriptInputUserData.CanStoreInputUserData())
10666 {
10667 ScriptInputUserData ctx = new ScriptInputUserData;
10672 ItemBase destination_entity =
this;
10673 ctx.
Write(destination_entity);
10677 }
10678 }
10679 else if (!
g_Game.IsMultiplayer())
10680 {
10682 }
10683 }
10684
10686 {
10688 float split_quantity_new;
10690 if (player)
10691 {
10693 if (quantity > stackable)
10694 split_quantity_new = stackable;
10695 else
10696 split_quantity_new = quantity;
10697
10699 {
10700 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10701 new_item =
ItemBase.Cast(in_hands);
10702 if (new_item)
10703 {
10704 new_item.SetResultOfSplit(true);
10705 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10707 new_item.SetQuantity(split_quantity_new, false, true);
10708 }
10709 }
10710 }
10711 }
10712
10714 {
10716 float split_quantity_new = Math.Floor(quantity * 0.5);
10717
10719 return;
10720
10722
10723 if (new_item)
10724 {
10725 if (new_item.GetQuantityMax() < split_quantity_new)
10726 {
10727 split_quantity_new = new_item.GetQuantityMax();
10728 }
10729
10730 new_item.SetResultOfSplit(true);
10731 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10732
10734 {
10737 }
10738 else
10739 {
10741 new_item.
SetQuantity(split_quantity_new,
false,
true);
10742 }
10743 }
10744 }
10745
10747 {
10749 float split_quantity_new = Math.Floor(quantity / 2);
10750
10752 return;
10753
10754 InventoryLocation invloc = new InventoryLocation;
10756
10758 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10759
10760 if (new_item)
10761 {
10762 if (new_item.GetQuantityMax() < split_quantity_new)
10763 {
10764 split_quantity_new = new_item.GetQuantityMax();
10765 }
10767 {
10770 }
10771 else if (split_quantity_new > 1)
10772 {
10774 new_item.
SetQuantity(split_quantity_new,
false,
true);
10775 }
10776 }
10777 }
10778
10781 {
10782 SetWeightDirty();
10784
10785 if (parent)
10786 parent.OnAttachmentQuantityChangedEx(this, delta);
10787
10789 {
10791 {
10793 }
10795 {
10796 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10798 }
10799 }
10800 }
10801
10804 {
10805
10806 }
10807
10810 {
10812 }
10813
10815 {
10816 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10817
10819 {
10820 if (newLevel == GameConstants.STATE_RUINED)
10821 {
10823 EntityAI parent = GetHierarchyParent();
10824 if (parent && parent.IsFireplace())
10825 {
10826 CargoBase cargo = GetInventory().GetCargo();
10827 if (cargo)
10828 {
10830 {
10832 }
10833 }
10834 }
10835 }
10836
10838 {
10839
10841 return;
10842 }
10843
10844 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10845 {
10847 }
10848 }
10849 }
10850
10851
10853 {
10854 super.OnRightClick();
10855
10857 {
10859 {
10860 if (ScriptInputUserData.CanStoreInputUserData())
10861 {
10862 EntityAI root = GetHierarchyRoot();
10863 Man playerOwner = GetHierarchyRootPlayer();
10864 InventoryLocation dst = new InventoryLocation;
10865
10866
10867 if (!playerOwner && root && root == this)
10868 {
10870 }
10871 else
10872 {
10873
10874 GetInventory().GetCurrentInventoryLocation(dst);
10876 {
10877 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10879 {
10881 }
10882 else
10883 {
10885
10886
10887 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10888 {
10890 }
10891 else
10892 {
10893 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10894 }
10895 }
10896 }
10897 }
10898
10899 ScriptInputUserData ctx = new ScriptInputUserData;
10907 }
10908 }
10909 else if (!
g_Game.IsMultiplayer())
10910 {
10912 }
10913 }
10914 }
10915
10917 {
10918 if (root)
10919 {
10920 vector m4[4];
10921 root.GetTransform(m4);
10922 dst.SetGround(this, m4);
10923 }
10924 else
10925 {
10926 GetInventory().GetCurrentInventoryLocation(dst);
10927 }
10928 }
10929
10930 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10931 {
10932
10933 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10934 return false;
10935
10936 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10937 return false;
10938
10939
10941 return false;
10942
10943
10944 Magazine mag = Magazine.Cast(this);
10945 if (mag)
10946 {
10947 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10948 return false;
10949
10950 if (stack_max_limit)
10951 {
10952 Magazine other_mag = Magazine.Cast(other_item);
10953 if (other_item)
10954 {
10955 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10956 return false;
10957 }
10958
10959 }
10960 }
10961 else
10962 {
10963
10965 return false;
10966
10968 return false;
10969 }
10970
10971 PlayerBase player = null;
10972 if (CastTo(player, GetHierarchyRootPlayer()))
10973 {
10974 if (player.GetInventory().HasAttachment(this))
10975 return false;
10976
10977 if (player.IsItemsToDelete())
10978 return false;
10979 }
10980
10981 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10982 return false;
10983
10984 int slotID;
10986 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10987 return false;
10988
10989 return true;
10990 }
10991
10993 {
10995 }
10996
10998 {
10999 return m_IsResultOfSplit;
11000 }
11001
11003 {
11004 m_IsResultOfSplit = value;
11005 }
11006
11008 {
11010 }
11011
11013 {
11014 float other_item_quantity = other_item.GetQuantity();
11015 float this_free_space;
11016
11018
11020
11021 if (other_item_quantity > this_free_space)
11022 {
11023 return this_free_space;
11024 }
11025 else
11026 {
11027 return other_item_quantity;
11028 }
11029 }
11030
11032 {
11034 }
11035
11037 {
11039 return;
11040
11041 if (!IsMagazine() && other_item)
11042 {
11044 if (quantity_used != 0)
11045 {
11046 float hp1 = GetHealth01("","");
11047 float hp2 = other_item.GetHealth01("","");
11048 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11049 hpResult = hpResult / (
GetQuantity() + quantity_used);
11050
11051 hpResult *= GetMaxHealth();
11052 Math.Round(hpResult);
11053 SetHealth("", "Health", hpResult);
11054
11056 other_item.AddQuantity(-quantity_used);
11057 }
11058 }
11060 }
11061
11063 {
11064 #ifdef SERVER
11065 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11066 GetHierarchyParent().IncreaseLifetimeUp();
11067 #endif
11068 };
11069
11071 {
11072 PlayerBase p = PlayerBase.Cast(player);
11073
11074 array<int> recipesIds = p.m_Recipes;
11075 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11076 if (moduleRecipesManager)
11077 {
11078 EntityAI itemInHands = player.GetEntityInHands();
11079 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11080 }
11081
11082 for (int i = 0;i < recipesIds.Count(); i++)
11083 {
11084 int key = recipesIds.Get(i);
11085 string recipeName = moduleRecipesManager.GetRecipeName(key);
11087 }
11088 }
11089
11090
11091 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11092 {
11093 super.GetDebugActions(outputList);
11094
11095
11101
11102
11107
11112
11113
11117
11118
11120 {
11124 }
11125
11128
11129
11133
11135
11136 InventoryLocation loc = new InventoryLocation();
11137 GetInventory().GetCurrentInventoryLocation(loc);
11139 {
11140 if (Gizmo_IsSupported())
11143 }
11144
11146 }
11147
11148
11149
11150
11152 {
11153 super.OnAction(action_id, player, ctx);
11154
11156 {
11157 switch (action_id)
11158 {
11162 return true;
11166 return true;
11167 }
11168 }
11169
11171 {
11172 switch (action_id)
11173 {
11175 Delete();
11176 return true;
11177 }
11178 }
11179
11180 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11181 {
11182 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11183 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11184 PlayerBase p = PlayerBase.Cast(player);
11185 if (
EActions.RECIPES_RANGE_START < 1000)
11186 {
11187 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11188 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11189 }
11190 }
11191 #ifndef SERVER
11192 else if (action_id ==
EActions.WATCH_PLAYER)
11193 {
11194 PluginDeveloper.SetDeveloperItemClientEx(player);
11195 }
11196 #endif
11198 {
11199 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11200 {
11201 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11202 OnDebugButtonPressServer(id + 1);
11203 }
11204
11205 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11206 {
11207 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11209 }
11210
11211 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11212 {
11213 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11215 }
11216
11217 else if (action_id ==
EActions.ADD_QUANTITY)
11218 {
11219 if (IsMagazine())
11220 {
11221 Magazine mag = Magazine.Cast(this);
11222 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11223 }
11224 else
11225 {
11227 }
11228
11229 if (m_EM)
11230 {
11231 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11232 }
11233
11234 }
11235
11236 else if (action_id ==
EActions.REMOVE_QUANTITY)
11237 {
11238 if (IsMagazine())
11239 {
11240 Magazine mag2 = Magazine.Cast(this);
11241 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11242 }
11243 else
11244 {
11246 }
11247 if (m_EM)
11248 {
11249 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11250 }
11251
11252 }
11253
11254 else if (action_id ==
EActions.SET_QUANTITY_0)
11255 {
11257
11258 if (m_EM)
11259 {
11260 m_EM.SetEnergy(0);
11261 }
11262 }
11263
11264 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11265 {
11267
11268 if (m_EM)
11269 {
11270 m_EM.SetEnergy(m_EM.GetEnergyMax());
11271 }
11272 }
11273
11274 else if (action_id ==
EActions.ADD_HEALTH)
11275 {
11276 AddHealth("","",GetMaxHealth("","Health")/5);
11277 }
11278 else if (action_id ==
EActions.REMOVE_HEALTH)
11279 {
11280 AddHealth("","",-GetMaxHealth("","Health")/5);
11281 }
11282 else if (action_id ==
EActions.DESTROY_HEALTH)
11283 {
11284 SetHealth01("","",0);
11285 }
11286 else if (action_id ==
EActions.WATCH_ITEM)
11287 {
11289 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11290 #ifdef DEVELOPER
11291 SetDebugDeveloper_item(this);
11292 #endif
11293 }
11294
11295 else if (action_id ==
EActions.ADD_TEMPERATURE)
11296 {
11297 AddTemperature(20);
11298
11299 }
11300
11301 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11302 {
11303 AddTemperature(-20);
11304
11305 }
11306
11307 else if (action_id ==
EActions.FLIP_FROZEN)
11308 {
11309 SetFrozen(!GetIsFrozen());
11310
11311 }
11312
11313 else if (action_id ==
EActions.ADD_WETNESS)
11314 {
11316
11317 }
11318
11319 else if (action_id ==
EActions.REMOVE_WETNESS)
11320 {
11322
11323 }
11324
11325 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11326 {
11329
11330
11331 }
11332
11333 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11334 {
11337 }
11338
11339 else if (action_id ==
EActions.MAKE_SPECIAL)
11340 {
11341 auto debugParams = DebugSpawnParams.WithPlayer(player);
11342 OnDebugSpawnEx(debugParams);
11343 }
11344
11345 }
11346
11347
11348 return false;
11349 }
11350
11351
11352
11353
11357
11360
11361
11362
11364 {
11365 return false;
11366 }
11367
11368
11370 {
11371 return true;
11372 }
11373
11374
11376 {
11377 return true;
11378 }
11379
11380
11381
11383 {
11384 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11385 return g_Game.ConfigIsExisting(config_path);
11386 }
11387
11390 {
11391 return null;
11392 }
11393
11395 {
11396 return false;
11397 }
11398
11400 {
11401 return false;
11402 }
11403
11407
11408
11410 {
11411 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11412 return module_repairing.CanRepair(this, item_repair_kit);
11413 }
11414
11415
11416 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11417 {
11418 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11419 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11420 }
11421
11422
11424 {
11425
11426
11427
11428
11429
11430
11431
11432
11433 return 1;
11434 }
11435
11436
11437
11439 {
11441 }
11442
11443
11444
11446 {
11448 }
11449
11450
11459 {
11460 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11461
11462 if (player)
11463 {
11464 player.MessageStatus(text);
11465 }
11466 }
11467
11468
11477 {
11478 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11479
11480 if (player)
11481 {
11482 player.MessageAction(text);
11483 }
11484 }
11485
11486
11495 {
11496 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11497
11498 if (player)
11499 {
11500 player.MessageFriendly(text);
11501 }
11502 }
11503
11504
11513 {
11514 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11515
11516 if (player)
11517 {
11518 player.MessageImportant(text);
11519 }
11520 }
11521
11523 {
11524 return true;
11525 }
11526
11527
11528 override bool KindOf(
string tag)
11529 {
11530 bool found = false;
11531 string item_name = this.
GetType();
11533 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11534
11535 int array_size = item_tag_array.Count();
11536 for (int i = 0; i < array_size; i++)
11537 {
11538 if (item_tag_array.Get(i) == tag)
11539 {
11540 found = true;
11541 break;
11542 }
11543 }
11544 return found;
11545 }
11546
11547
11549 {
11550
11551 super.OnRPC(sender, rpc_type,ctx);
11552
11553
11554 switch (rpc_type)
11555 {
11556 #ifndef SERVER
11557 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11558 Param2<bool, string> p = new Param2<bool, string>(false, "");
11559
11561 return;
11562
11563 bool play = p.param1;
11564 string soundSet = p.param2;
11565
11566 if (play)
11567 {
11569 {
11571 {
11573 }
11574 }
11575 else
11576 {
11578 }
11579 }
11580 else
11581 {
11583 }
11584
11585 break;
11586 #endif
11587
11588 }
11589
11591 {
11593 }
11594 }
11595
11596
11597
11598
11600 {
11601 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11602 return plugin.GetID(
name);
11603 }
11604
11606 {
11607 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11608 return plugin.GetName(id);
11609 }
11610
11613 {
11614
11615
11616 int varFlags;
11617 if (!ctx.
Read(varFlags))
11618 return;
11619
11620 if (varFlags & ItemVariableFlags.FLOAT)
11621 {
11623 }
11624 }
11625
11627 {
11628
11629 super.SerializeNumericalVars(floats_out);
11630
11631
11632
11634 {
11636 }
11637
11639 {
11641 }
11642
11644 {
11646 }
11647
11649 {
11654 }
11655
11657 {
11659 }
11660 }
11661
11663 {
11664
11665 super.DeSerializeNumericalVars(floats);
11666
11667
11668 int index = 0;
11669 int mask = Math.Round(floats.Get(index));
11670
11671 index++;
11672
11674 {
11676 {
11678 }
11679 else
11680 {
11681 float quantity = floats.Get(index);
11682 SetQuantity(quantity,
true,
false,
false,
false);
11683 }
11684 index++;
11685 }
11686
11688 {
11689 float wet = floats.Get(index);
11691 index++;
11692 }
11693
11695 {
11696 int liquidtype = Math.Round(floats.Get(index));
11698 index++;
11699 }
11700
11702 {
11704 index++;
11706 index++;
11708 index++;
11710 index++;
11711 }
11712
11714 {
11715 int cleanness = Math.Round(floats.Get(index));
11717 index++;
11718 }
11719 }
11720
11722 {
11723 super.WriteVarsToCTX(ctx);
11724
11725
11727 {
11729 }
11730
11732 {
11734 }
11735
11737 {
11739 }
11740
11742 {
11743 int r,g,b,a;
11749 }
11750
11752 {
11754 }
11755 }
11756
11758 {
11759 if (!super.ReadVarsFromCTX(ctx,version))
11760 return false;
11761
11762 int intValue;
11763 float value;
11764
11765 if (version < 140)
11766 {
11767 if (!ctx.
Read(intValue))
11768 return false;
11769
11770 m_VariablesMask = intValue;
11771 }
11772
11774 {
11775 if (!ctx.
Read(value))
11776 return false;
11777
11779 {
11781 }
11782 else
11783 {
11785 }
11786 }
11787
11788 if (version < 140)
11789 {
11791 {
11792 if (!ctx.
Read(value))
11793 return false;
11794 SetTemperatureDirect(value);
11795 }
11796 }
11797
11799 {
11800 if (!ctx.
Read(value))
11801 return false;
11803 }
11804
11806 {
11807 if (!ctx.
Read(intValue))
11808 return false;
11810 }
11811
11813 {
11814 int r,g,b,a;
11816 return false;
11818 return false;
11820 return false;
11822 return false;
11823
11825 }
11826
11828 {
11829 if (!ctx.
Read(intValue))
11830 return false;
11832 }
11833
11834 if (version >= 138 && version < 140)
11835 {
11837 {
11838 if (!ctx.
Read(intValue))
11839 return false;
11840 SetFrozen(intValue);
11841 }
11842 }
11843
11844 return true;
11845 }
11846
11847
11849 {
11852 {
11854 }
11855
11856 if (!super.OnStoreLoad(ctx, version))
11857 {
11859 return false;
11860 }
11861
11862 if (version >= 114)
11863 {
11864 bool hasQuickBarIndexSaved;
11865
11866 if (!ctx.
Read(hasQuickBarIndexSaved))
11867 {
11869 return false;
11870 }
11871
11872 if (hasQuickBarIndexSaved)
11873 {
11874 int itmQBIndex;
11875
11876
11877 if (!ctx.
Read(itmQBIndex))
11878 {
11880 return false;
11881 }
11882
11883 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11884 if (itmQBIndex != -1 && parentPlayer)
11885 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11886 }
11887 }
11888 else
11889 {
11890
11891 PlayerBase player;
11892 int itemQBIndex;
11893 if (version ==
int.
MAX)
11894 {
11895 if (!ctx.
Read(itemQBIndex))
11896 {
11898 return false;
11899 }
11900 }
11901 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11902 {
11903
11904 if (!ctx.
Read(itemQBIndex))
11905 {
11907 return false;
11908 }
11909 if (itemQBIndex != -1 && player)
11910 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11911 }
11912 }
11913
11914 if (version < 140)
11915 {
11916
11917 if (!LoadVariables(ctx, version))
11918 {
11920 return false;
11921 }
11922 }
11923
11924
11926 {
11928 return false;
11929 }
11930 if (version >= 132)
11931 {
11933 if (raib)
11934 {
11936 {
11938 return false;
11939 }
11940 }
11941 }
11942
11944 return true;
11945 }
11946
11947
11948
11950 {
11951 super.OnStoreSave(ctx);
11952
11953 PlayerBase player;
11954 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11955 {
11957
11958 int itemQBIndex = -1;
11959 itemQBIndex = player.FindQuickBarEntityIndex(this);
11960 ctx.
Write(itemQBIndex);
11961 }
11962 else
11963 {
11965 }
11966
11968
11970 if (raib)
11971 {
11973 }
11974 }
11975
11976
11978 {
11979 super.AfterStoreLoad();
11980
11982 {
11984 }
11985
11987 {
11990 }
11991 }
11992
11994 {
11995 super.EEOnAfterLoad();
11996
11998 {
12000 }
12001
12004 }
12005
12007 {
12008 return false;
12009 }
12010
12011
12012
12014 {
12016 {
12017 #ifdef PLATFORM_CONSOLE
12018
12020 {
12022 if (menu)
12023 {
12025 }
12026 }
12027 #endif
12028 }
12029
12031 {
12034 }
12035
12037 {
12038 SetWeightDirty();
12040 }
12042 {
12045 }
12046
12048 {
12051
12054 }
12056 {
12060 }
12061
12062 super.OnVariablesSynchronized();
12063 }
12064
12065
12066
12068 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12069 {
12070 if (!IsServerCheck(allow_client))
12071 return false;
12072
12074 return false;
12075
12078
12079 if (value <= (min + 0.001))
12080 value = min;
12081
12082 if (value == min)
12083 {
12084 if (destroy_config)
12085 {
12086 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12087 if (dstr)
12088 {
12090 this.Delete();
12091 return true;
12092 }
12093 }
12094 else if (destroy_forced)
12095 {
12097 this.Delete();
12098 return true;
12099 }
12100
12102 }
12103
12106
12108 {
12109 EntityAI parent = GetHierarchyRoot();
12110 InventoryLocation iLoc = new InventoryLocation();
12111 GetInventory().GetCurrentInventoryLocation(iLoc);
12113 {
12114 int iLocSlot = iLoc.
GetSlot();
12116 {
12118 }
12120 {
12122 }
12123 }
12124 }
12125
12127 {
12129
12130 if (delta)
12132 }
12133
12135
12136 return false;
12137 }
12138
12139
12141 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12142 {
12144 }
12145
12147 {
12150 }
12151
12153 {
12156 }
12157
12159 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12160 {
12161 float value_clamped = Math.Clamp(value, 0, 1);
12163 SetQuantity(result, destroy_config, destroy_forced);
12164 }
12165
12166
12169 {
12171 }
12172
12174 {
12176 }
12177
12178
12179
12180
12181
12182
12183
12184
12185
12186
12188 {
12189 int slot = -1;
12190 GameInventory inventory = GetInventory();
12191 if (inventory)
12192 {
12193 InventoryLocation il = new InventoryLocation;
12196 }
12197
12199 }
12200
12202 {
12203 float quantity_max = 0;
12204
12206 {
12207 if (attSlotID != -1)
12208 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12209
12210 if (quantity_max <= 0)
12212 }
12213
12214 if (quantity_max <= 0)
12216
12217 return quantity_max;
12218 }
12219
12221 {
12223 }
12224
12226 {
12228 }
12229
12230
12232 {
12234 }
12235
12237 {
12239 }
12240
12242 {
12244 }
12245
12246
12248 {
12249
12250 float weightEx = GetWeightEx();
12251 float special = GetInventoryAndCargoWeight();
12252 return weightEx - special;
12253 }
12254
12255
12257 {
12259 }
12260
12262 {
12264 {
12265 #ifdef DEVELOPER
12266 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12267 {
12268 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12270 }
12271 #endif
12272
12273 return GetQuantity() * GetConfigWeightModified();
12274 }
12275 else if (HasEnergyManager())
12276 {
12277 #ifdef DEVELOPER
12278 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12279 {
12280 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12281 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12282 }
12283 #endif
12284 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12285 }
12286 else
12287 {
12288 #ifdef DEVELOPER
12289 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12290 {
12291 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12292 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12293 }
12294 #endif
12295 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12296 }
12297 }
12298
12301 {
12302 int item_count = 0;
12304
12305 GameInventory inventory = GetInventory();
12306 CargoBase cargo = inventory.
GetCargo();
12307 if (cargo != NULL)
12308 {
12310 }
12311
12313 for (int i = 0; i < nAttachments; ++i)
12314 {
12316 if (item)
12317 item_count += item.GetNumberOfItems();
12318 }
12319 return item_count;
12320 }
12321
12324 {
12325 float weight = 0;
12326 float wetness = 1;
12327 if (include_wetness)
12330 {
12331 weight = wetness * m_ConfigWeight;
12332 }
12334 {
12335 weight = 1;
12336 }
12337 return weight;
12338 }
12339
12340
12341
12343 {
12344 GameInventory inventory = GetInventory();
12345 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12346 {
12347 array<EntityAI> items = new array<EntityAI>;
12349 for (int i = 0; i < items.Count(); ++i)
12350 {
12352 if (item)
12353 {
12354 g_Game.ObjectDelete(item);
12355 }
12356 }
12357 }
12358 }
12359
12360
12361
12362
12364 {
12365 float energy = 0;
12366 if (HasEnergyManager())
12367 {
12368 energy = GetCompEM().GetEnergy();
12369 }
12370 return energy;
12371 }
12372
12373
12375 {
12376 super.OnEnergyConsumed();
12377
12379 }
12380
12382 {
12383 super.OnEnergyAdded();
12384
12386 }
12387
12388
12390 {
12391 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12392 {
12394 {
12395 float energy_0to1 = GetCompEM().GetEnergy0To1();
12397 }
12398 }
12399 }
12400
12401
12403 {
12404 return ConfigGetFloat("heatIsolation");
12405 }
12406
12408 {
12410 }
12411
12413 {
12414 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12415 if (
g_Game.ConfigIsExisting(paramPath))
12416 return g_Game.ConfigGetFloat(paramPath);
12417
12418 return 0.0;
12419 }
12420
12422 {
12423 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12424 if (
g_Game.ConfigIsExisting(paramPath))
12425 return g_Game.ConfigGetFloat(paramPath);
12426
12427 return 0.0;
12428 }
12429
12430 override void SetWet(
float value,
bool allow_client =
false)
12431 {
12432 if (!IsServerCheck(allow_client))
12433 return;
12434
12437
12439
12440 m_VarWet = Math.Clamp(value, min, max);
12441
12443 {
12446 }
12447 }
12448
12449 override void AddWet(
float value)
12450 {
12452 }
12453
12455 {
12457 }
12458
12460 {
12462 }
12463
12465 {
12467 }
12468
12470 {
12472 }
12473
12475 {
12477 }
12478
12479 override void OnWetChanged(
float newVal,
float oldVal)
12480 {
12483 if (newLevel != oldLevel)
12484 {
12486 }
12487 }
12488
12490 {
12491 SetWeightDirty();
12492 }
12493
12495 {
12496 return GetWetLevelInternal(
m_VarWet);
12497 }
12498
12499
12500
12502 {
12504 }
12505
12507 {
12509 }
12510
12512 {
12514 }
12515
12517 {
12519 }
12520
12521
12522
12524 {
12525 if (ConfigIsExisting("itemModelLength"))
12526 {
12527 return ConfigGetFloat("itemModelLength");
12528 }
12529 return 0;
12530 }
12531
12533 {
12534 if (ConfigIsExisting("itemAttachOffset"))
12535 {
12536 return ConfigGetFloat("itemAttachOffset");
12537 }
12538 return 0;
12539 }
12540
12541 override void SetCleanness(
int value,
bool allow_client =
false)
12542 {
12543 if (!IsServerCheck(allow_client))
12544 return;
12545
12547
12549
12552 }
12553
12555 {
12557 }
12558
12560 {
12561 return true;
12562 }
12563
12564
12565
12566
12568 {
12570 }
12571
12573 {
12575 }
12576
12577
12578
12579
12580 override void SetColor(
int r,
int g,
int b,
int a)
12581 {
12587 }
12589 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12590 {
12595 }
12596
12598 {
12600 }
12601
12604 {
12605 int r,g,b,a;
12607 r = r/255;
12608 g = g/255;
12609 b = b/255;
12610 a = a/255;
12611 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12612 }
12613
12614
12615
12616 override void SetLiquidType(
int value,
bool allow_client =
false)
12617 {
12618 if (!IsServerCheck(allow_client))
12619 return;
12620
12625 }
12626
12628 {
12629 return ConfigGetInt("varLiquidTypeInit");
12630 }
12631
12633 {
12635 }
12636
12638 {
12640 SetFrozen(false);
12641 }
12642
12645 {
12646 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12647 }
12648
12649
12652 {
12653 PlayerBase nplayer;
12654 if (PlayerBase.CastTo(nplayer, player))
12655 {
12657 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12658 }
12659 }
12660
12661
12664 {
12665 PlayerBase nplayer;
12666 if (PlayerBase.CastTo(nplayer,player))
12667 {
12668 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12669 }
12670
12671 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12672
12673 if (HasEnergyManager())
12674 {
12675 GetCompEM().UpdatePlugState();
12676 }
12677 }
12678
12679
12681 {
12682 super.OnPlacementStarted(player);
12683
12685 }
12686
12687 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12688 {
12690 {
12691 m_AdminLog.OnPlacementComplete(player,
this);
12692 }
12693
12694 super.OnPlacementComplete(player, position, orientation);
12695 }
12696
12697
12698
12699
12700
12702 {
12704 {
12705 return true;
12706 }
12707 else
12708 {
12709 return false;
12710 }
12711 }
12712
12713
12715 {
12717 {
12719 }
12720 }
12721
12722
12724 {
12726 }
12727
12729 {
12731 }
12732
12733 override void InsertAgent(
int agent,
float count = 1)
12734 {
12735 if (count < 1)
12736 return;
12737
12739 }
12740
12743 {
12745 }
12746
12747
12749 {
12751 }
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12795 {
12797 return false;
12798 return true;
12799 }
12800
12802 {
12803
12805 }
12806
12807
12810 {
12811 super.CheckForRoofLimited(timeTresholdMS);
12812
12813 float time =
g_Game.GetTime();
12814 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12815 {
12816 m_PreviousRoofTestTime = time;
12817 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12818 }
12819 }
12820
12821
12823 {
12825 {
12826 return 0;
12827 }
12828
12829 if (GetInventory().GetAttachmentSlotsCount() != 0)
12830 {
12831 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12832 if (filter)
12833 return filter.GetProtectionLevel(type, false, system);
12834 else
12835 return 0;
12836 }
12837
12838 string subclassPath, entryName;
12839
12840 switch (type)
12841 {
12843 entryName = "biological";
12844 break;
12846 entryName = "chemical";
12847 break;
12848 default:
12849 entryName = "biological";
12850 break;
12851 }
12852
12853 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12854
12855 return g_Game.ConfigGetFloat(subclassPath + entryName);
12856 }
12857
12858
12859
12862 {
12863 if (!IsMagazine())
12865
12867 }
12868
12869
12870
12871
12872
12877 {
12878 return true;
12879 }
12880
12882 {
12884 }
12885
12886
12887
12888
12889
12891 {
12892 if (parent)
12893 {
12894 if (parent.IsInherited(DayZInfected))
12895 return true;
12896
12897 if (!parent.IsRuined())
12898 return true;
12899 }
12900
12901 return true;
12902 }
12903
12905 {
12906 if (!super.CanPutAsAttachment(parent))
12907 {
12908 return false;
12909 }
12910
12911 if (!IsRuined() && !parent.IsRuined())
12912 {
12913 return true;
12914 }
12915
12916 return false;
12917 }
12918
12920 {
12921
12922
12923
12924
12925 return super.CanReceiveItemIntoCargo(item);
12926 }
12927
12929 {
12930
12931
12932
12933
12934 GameInventory attachmentInv = attachment.GetInventory();
12936 {
12937 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12938 return false;
12939 }
12940
12941 InventoryLocation loc = new InventoryLocation();
12942 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12943 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12944 return false;
12945
12946 return super.CanReceiveAttachment(attachment, slotId);
12947 }
12948
12950 {
12951 if (!super.CanReleaseAttachment(attachment))
12952 return false;
12953
12954 return GetInventory().AreChildrenAccessible();
12955 }
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976
12978 {
12979 int id = muzzle_owner.GetMuzzleID();
12980 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12981
12982 if (WPOF_array)
12983 {
12984 for (int i = 0; i < WPOF_array.Count(); i++)
12985 {
12986 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12987
12988 if (WPOF)
12989 {
12990 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12991 }
12992 }
12993 }
12994 }
12995
12996
12998 {
12999 int id = muzzle_owner.GetMuzzleID();
13001
13002 if (WPOBE_array)
13003 {
13004 for (int i = 0; i < WPOBE_array.Count(); i++)
13005 {
13006 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13007
13008 if (WPOBE)
13009 {
13010 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13011 }
13012 }
13013 }
13014 }
13015
13016
13018 {
13019 int id = muzzle_owner.GetMuzzleID();
13020 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13021
13022 if (WPOOH_array)
13023 {
13024 for (int i = 0; i < WPOOH_array.Count(); i++)
13025 {
13026 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13027
13028 if (WPOOH)
13029 {
13030 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13031 }
13032 }
13033 }
13034 }
13035
13036
13038 {
13039 int id = muzzle_owner.GetMuzzleID();
13040 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13041
13042 if (WPOOH_array)
13043 {
13044 for (int i = 0; i < WPOOH_array.Count(); i++)
13045 {
13046 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13047
13048 if (WPOOH)
13049 {
13050 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13051 }
13052 }
13053 }
13054 }
13055
13056
13058 {
13059 int id = muzzle_owner.GetMuzzleID();
13060 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13061
13062 if (WPOOH_array)
13063 {
13064 for (int i = 0; i < WPOOH_array.Count(); i++)
13065 {
13066 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13067
13068 if (WPOOH)
13069 {
13070 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13071 }
13072 }
13073 }
13074 }
13075
13076
13077
13079 {
13081 {
13082 return true;
13083 }
13084
13085 return false;
13086 }
13087
13089 {
13091 {
13092 return true;
13093 }
13094
13095 return false;
13096 }
13097
13099 {
13101 {
13102 return true;
13103 }
13104
13105 return false;
13106 }
13107
13109 {
13110 return false;
13111 }
13112
13115 {
13116 return UATimeSpent.DEFAULT_DEPLOY;
13117 }
13118
13119
13120
13121
13123 {
13125 SetSynchDirty();
13126 }
13127
13129 {
13131 }
13132
13133
13135 {
13136 return false;
13137 }
13138
13141 {
13142 string att_type = "None";
13143
13144 if (ConfigIsExisting("soundAttType"))
13145 {
13146 att_type = ConfigGetString("soundAttType");
13147 }
13148
13150 }
13151
13153 {
13155 }
13156
13157
13158
13159
13160
13166
13168 {
13171
13173 }
13174
13175
13177 {
13179 return;
13180
13182
13185
13188
13189 SoundParameters params = new SoundParameters();
13193 }
13194
13195
13197 {
13199 {
13202
13203 SetSynchDirty();
13204
13207 }
13208 }
13209
13211 {
13213 }
13214
13215
13217 {
13219 return;
13220
13222 SetSynchDirty();
13223
13226 }
13227
13229 {
13232 }
13233
13235 {
13237 }
13238
13239 void OnApply(PlayerBase player);
13240
13242 {
13243 return 1.0;
13244 };
13245
13247 {
13249 }
13250
13252 {
13254 }
13255
13257
13259 {
13260 SetDynamicPhysicsLifeTime(0.01);
13262 }
13263
13265 {
13266 array<string> zone_names = new array<string>;
13267 GetDamageZones(zone_names);
13268 for (int i = 0; i < zone_names.Count(); i++)
13269 {
13270 SetHealthMax(zone_names.Get(i),"Health");
13271 }
13272 SetHealthMax("","Health");
13273 }
13274
13277 {
13278 float global_health = GetHealth01("","Health");
13279 array<string> zones = new array<string>;
13280 GetDamageZones(zones);
13281
13282 for (int i = 0; i < zones.Count(); i++)
13283 {
13284 SetHealth01(zones.Get(i),"Health",global_health);
13285 }
13286 }
13287
13290 {
13291 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13292 }
13293
13295 {
13296 if (!hasRootAsPlayer)
13297 {
13298 if (refParentIB)
13299 {
13300
13301 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13302 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13303
13304 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13305 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13306
13309 }
13310 else
13311 {
13312
13315 }
13316 }
13317 }
13318
13320 {
13322 {
13323 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13324 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13325 {
13326 float heatPermCoef = 1.0;
13328 while (ent)
13329 {
13330 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13331 ent = ent.GetHierarchyParent();
13332 }
13333
13334 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13335 }
13336 }
13337 }
13338
13340 {
13341
13342 EntityAI parent = GetHierarchyParent();
13343 if (!parent)
13344 {
13345 hasParent = false;
13346 hasRootAsPlayer = false;
13347 }
13348 else
13349 {
13350 hasParent = true;
13351 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13352 refParentIB =
ItemBase.Cast(parent);
13353 }
13354 }
13355
13356 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13357 {
13358
13359 }
13360
13362 {
13363
13364 return false;
13365 }
13366
13368 {
13369
13370
13371 return false;
13372 }
13373
13375 {
13376
13377 return false;
13378 }
13379
13382 {
13383 return !GetIsFrozen() &&
IsOpen();
13384 }
13385
13387 {
13388 bool hasParent = false, hasRootAsPlayer = false;
13390
13391 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13392 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13393
13394 if (wwtu || foodDecay)
13395 {
13399
13400 if (processWetness || processTemperature || processDecay)
13401 {
13403
13404 if (processWetness)
13405 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13406
13407 if (processTemperature)
13409
13410 if (processDecay)
13411 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13412 }
13413 }
13414 }
13415
13418 {
13420 }
13421
13423 {
13426
13427 return super.GetTemperatureFreezeThreshold();
13428 }
13429
13431 {
13434
13435 return super.GetTemperatureThawThreshold();
13436 }
13437
13439 {
13442
13443 return super.GetItemOverheatThreshold();
13444 }
13445
13447 {
13449 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13450
13451 return super.GetTemperatureFreezeTime();
13452 }
13453
13455 {
13457 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13458
13459 return super.GetTemperatureThawTime();
13460 }
13461
13466
13468 {
13469 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13470 }
13471
13473 {
13474 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13475 }
13476
13479 {
13481 }
13482
13484 {
13486 }
13487
13489 {
13491 }
13492
13495 {
13496 return null;
13497 }
13498
13501 {
13502 return false;
13503 }
13504
13506 {
13508 {
13511 if (!trg)
13512 {
13514 explosive = this;
13515 }
13516
13517 explosive.PairRemote(trg);
13519
13520 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13521 trg.SetPersistentPairID(persistentID);
13522 explosive.SetPersistentPairID(persistentID);
13523
13524 return true;
13525 }
13526 return false;
13527 }
13528
13531 {
13532 float ret = 1.0;
13535 ret *= GetHealth01();
13536
13537 return ret;
13538 }
13539
13540 #ifdef DEVELOPER
13541 override void SetDebugItem()
13542 {
13543 super.SetDebugItem();
13544 _itemBase = this;
13545 }
13546
13548 {
13549 string text = super.GetDebugText();
13550
13552 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13553
13554 return text;
13555 }
13556 #endif
13557
13559 {
13560 return true;
13561 }
13562
13564
13566
13568 {
13571 }
13572
13573
13581
13597
13598 [
Obsolete(
"Use ItemSoundHandler instead")]
13601 {
13602 if (!
g_Game.IsDedicatedServer())
13603 {
13604 if (ConfigIsExisting("attachSoundSet"))
13605 {
13606 string cfg_path = "";
13607 string soundset = "";
13608 string type_name =
GetType();
13609
13612 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13613 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13614
13615 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13616 {
13617 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13618 {
13619 if (cfg_slot_array[i] == slot_type)
13620 {
13621 soundset = cfg_soundset_array[i];
13622 break;
13623 }
13624 }
13625 }
13626
13627 if (soundset != "")
13628 {
13629 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13631 }
13632 }
13633 }
13634 }
13635
13637}
13638
13640{
13642 if (entity)
13643 {
13644 bool is_item = entity.IsInherited(
ItemBase);
13645 if (is_item && full_quantity)
13646 {
13649 }
13650 }
13651 else
13652 {
13654 return NULL;
13655 }
13656 return entity;
13657}
13658
13660{
13661 if (item)
13662 {
13663 if (health > 0)
13664 item.SetHealth("", "", health);
13665
13666 if (item.CanHaveTemperature())
13667 {
13669 if (item.CanFreeze())
13670 item.SetFrozen(false);
13671 }
13672
13673 if (item.HasEnergyManager())
13674 {
13675 if (quantity >= 0)
13676 {
13677 item.GetCompEM().SetEnergy0To1(quantity);
13678 }
13679 else
13680 {
13682 }
13683 }
13684 else if (item.IsMagazine())
13685 {
13686 Magazine mag = Magazine.Cast(item);
13687 if (quantity >= 0)
13688 {
13689 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13690 }
13691 else
13692 {
13694 }
13695
13696 }
13697 else
13698 {
13699 if (quantity >= 0)
13700 {
13701 item.SetQuantityNormalized(quantity, false);
13702 }
13703 else
13704 {
13706 }
13707
13708 }
13709 }
13710}
13711
13712#ifdef DEVELOPER
13714#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
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.