8726{
8728 {
8729 return true;
8730 }
8731};
8732
8734{
8735
8736};
8737
8738
8739
8741{
8745
8747
8750
8751
8752
8753
8754
8763
8769
8774
8779
8800 protected bool m_IsResultOfSplit
8801
8803
8808
8809
8810
8812
8816
8817
8818
8820
8823
8824
8825
8831
8832
8840
8843
8844
8846
8847
8849
8850
8855
8856
8861
8863
8864
8866
8867
8869 {
8874
8875 if (!
g_Game.IsDedicatedServer())
8876 {
8878 {
8880
8882 {
8884 }
8885 }
8886
8889 }
8890
8891 m_OldLocation = null;
8892
8894 {
8896 }
8897
8898 if (ConfigIsExisting("headSelectionsToHide"))
8899 {
8902 }
8903
8905 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8906 {
8908 }
8909
8911
8912 m_IsResultOfSplit = false;
8913
8915 }
8916
8918 {
8919 super.InitItemVariables();
8920
8926 m_Count = ConfigGetInt(
"count");
8927
8930
8935
8938
8943
8955
8959
8960
8963 if (ConfigIsExisting("canBeSplit"))
8964 {
8967 }
8968
8970 if (ConfigIsExisting("itemBehaviour"))
8972
8973
8976 RegisterNetSyncVariableInt("m_VarLiquidType");
8977 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8978
8979 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8980 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8981 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8982
8983 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8984 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8985 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8986 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8987
8988 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8989 RegisterNetSyncVariableBool("m_IsTakeable");
8990 RegisterNetSyncVariableBool("m_IsHologram");
8991
8994 {
8997 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8998 }
8999
9001
9003 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9005
9007 }
9008
9010 {
9012 }
9013
9015 {
9018 {
9023 }
9024 }
9025
9026 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9027 {
9029 {
9032 }
9033
9035 }
9036
9038 {
9044 }
9045
9047
9049 {
9051
9052 if (!action)
9053 {
9054 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9055 return;
9056 }
9057
9059 if (!ai)
9060 {
9062 return;
9063 }
9064
9066 if (!action_array)
9067 {
9068 action_array = new array<ActionBase_Basic>;
9070 }
9071 if (LogManager.IsActionLogEnable())
9072 {
9073 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9074 }
9075
9076 if (action_array.Find(action) != -1)
9077 {
9078 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9079 }
9080 else
9081 {
9082 action_array.Insert(action);
9083 }
9084 }
9085
9087 {
9088 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9089 ActionBase action = player.GetActionManager().GetAction(actionName);
9092
9093 if (action_array)
9094 {
9095 action_array.RemoveItem(action);
9096 }
9097 }
9098
9099
9100
9102 {
9103 ActionOverrideData overrideData = new ActionOverrideData();
9107
9109 if (!actionMap)
9110 {
9113 }
9114
9115 actionMap.Insert(this.
Type(), overrideData);
9116
9117 }
9118
9120
9122
9123
9125 {
9128
9131
9132 string config_to_search = "CfgVehicles";
9133 string muzzle_owner_config;
9134
9136 {
9137 if (IsInherited(Weapon))
9138 config_to_search = "CfgWeapons";
9139
9140 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9141
9142 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9143
9144 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9145
9146 if (config_OnFire_subclass_count > 0)
9147 {
9148 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9149
9150 for (int i = 0; i < config_OnFire_subclass_count; i++)
9151 {
9152 string particle_class = "";
9153 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9154 string config_OnFire_entry = config_OnFire_class + particle_class;
9155 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9156 WPOF_array.Insert(WPOF);
9157 }
9158
9159
9161 }
9162 }
9163
9165 {
9166 config_to_search = "CfgWeapons";
9167 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9168
9169 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9170
9171 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9172
9173 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9174 {
9175 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9176
9177 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9178 {
9179 string particle_class2 = "";
9180 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9181 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9182 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9183 WPOBE_array.Insert(WPOBE);
9184 }
9185
9186
9188 }
9189 }
9190 }
9191
9192
9194 {
9197
9199 {
9200 string config_to_search = "CfgVehicles";
9201
9202 if (IsInherited(Weapon))
9203 config_to_search = "CfgWeapons";
9204
9205 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9206 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9207
9208 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9209 {
9210
9212
9214 {
9216 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9218 return;
9219 }
9220
9223
9224
9225
9226 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9227 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9228
9229 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9230 {
9231 string particle_class = "";
9232 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9233 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9234 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9235
9236 if (entry_type == CT_CLASS)
9237 {
9238 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9239 WPOOH_array.Insert(WPOF);
9240 }
9241 }
9242
9243
9245 }
9246 }
9247 }
9248
9250 {
9252 }
9253
9255 {
9257 {
9259
9262
9265
9266 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9267 }
9268 }
9269
9271 {
9273 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9274
9276 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9277
9279 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9280
9282 {
9284 }
9285 }
9286
9288 {
9290 }
9291
9293 {
9296 else
9298
9300 {
9303 }
9304 else
9305 {
9308
9311 }
9312
9314 }
9315
9317 {
9319 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9320 }
9321
9323 {
9325 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9327 }
9328
9330 {
9332 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9333 }
9334
9336 {
9339
9340 OverheatingParticle OP = new OverheatingParticle();
9345
9347 }
9348
9350 {
9353
9354 return -1;
9355 }
9356
9358 {
9360 {
9363
9364 for (int i = count; i > 0; --i)
9365 {
9366 int id = i - 1;
9369
9372
9373 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9374 {
9375 if (p)
9376 {
9379 }
9380 }
9381 }
9382 }
9383 }
9384
9386 {
9388 {
9390 {
9391 int id = i - 1;
9393
9394 if (OP)
9395 {
9397
9398 if (p)
9399 {
9401 }
9402
9403 delete OP;
9404 }
9405 }
9406
9409 }
9410 }
9411
9414 {
9415 return 0.0;
9416 }
9417
9418
9420 {
9421 return 250;
9422 }
9423
9425 {
9426 return 0;
9427 }
9428
9431 {
9433 return true;
9434
9435 return false;
9436 }
9437
9440 {
9443
9445 {
9447 }
9448 else
9449 {
9450
9452 }
9453
9455 }
9456
9463 {
9464 return -1;
9465 }
9466
9467
9468
9469
9471 {
9473 {
9474 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9475 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9476
9477 if (r_index >= 0)
9478 {
9479 InventoryLocation r_il = new InventoryLocation;
9480 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9481
9482 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9485 {
9486 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9487 }
9489 {
9490 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9491 }
9492
9493 }
9494
9495 player.GetHumanInventory().ClearUserReservedLocation(this);
9496 }
9497
9500 }
9501
9502
9503
9504
9506 {
9507 return ItemBase.m_DebugActionsMask;
9508 }
9509
9511 {
9512 return ItemBase.m_DebugActionsMask & mask;
9513 }
9514
9516 {
9517 ItemBase.m_DebugActionsMask = mask;
9518 }
9519
9521 {
9522 ItemBase.m_DebugActionsMask |= mask;
9523 }
9524
9526 {
9527 ItemBase.m_DebugActionsMask &= ~mask;
9528 }
9529
9531 {
9533 {
9535 }
9536 else
9537 {
9539 }
9540 }
9541
9542
9544 {
9545 if (GetEconomyProfile())
9546 {
9547 float q_max = GetEconomyProfile().GetQuantityMax();
9548 if (q_max > 0)
9549 {
9550 float q_min = GetEconomyProfile().GetQuantityMin();
9551 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9552
9554 {
9555 ComponentEnergyManager comp = GetCompEM();
9557 {
9559 }
9560 }
9562 {
9564
9565 }
9566
9567 }
9568 }
9569 }
9570
9573 {
9574 EntityAI parent = GetHierarchyParent();
9575
9576 if (parent)
9577 {
9578 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9579 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9580 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9581 }
9582 }
9583
9586 {
9587 EntityAI parent = GetHierarchyParent();
9588
9589 if (parent)
9590 {
9591 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9592 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9593 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9594 }
9595 }
9596
9598 {
9599
9600
9601
9602
9604
9606 {
9607 if (ScriptInputUserData.CanStoreInputUserData())
9608 {
9609 ScriptInputUserData ctx = new ScriptInputUserData;
9615 ctx.
Write(use_stack_max);
9618
9620 {
9621 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9622 }
9623 }
9624 }
9625 else if (!
g_Game.IsMultiplayer())
9626 {
9628 }
9629 }
9630
9632 {
9634 }
9635
9637 {
9639 }
9640
9642 {
9644 }
9645
9647 {
9648
9649 return false;
9650 }
9651
9653 {
9654 return false;
9655 }
9656
9660 {
9661 return false;
9662 }
9663
9665 {
9666 return "";
9667 }
9668
9670
9672 {
9673 return false;
9674 }
9675
9677 {
9678 return true;
9679 }
9680
9681
9682
9684 {
9685 return true;
9686 }
9687
9689 {
9690 return true;
9691 }
9692
9694 {
9695 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9697 }
9698
9700 {
9702 }
9703
9705 {
9707 if (!is_being_placed)
9709 SetSynchDirty();
9710 }
9711
9712
9714
9716 {
9718 }
9719
9721 {
9723 }
9724
9726 {
9727 return 1;
9728 }
9729
9731 {
9732 return false;
9733 }
9734
9736 {
9738 SetSynchDirty();
9739 }
9740
9741
9742
9743
9744
9745
9746
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
9776 {
9777 super.OnMovedInsideCargo(container);
9778
9779 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9780 }
9781
9782 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9783 {
9784 super.EEItemLocationChanged(oldLoc, newLoc);
9785
9786 PlayerBase newPlayer = null;
9787 PlayerBase oldPlayer = null;
9788
9789 if (newLoc.GetParent())
9790 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9791
9792 if (oldLoc.GetParent())
9793 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9794
9796 {
9797 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9798
9799 if (rIndex >= 0)
9800 {
9801 InventoryLocation rIl = new InventoryLocation;
9802 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9803
9804 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9807 {
9808 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9809 }
9811 {
9813 }
9814
9815 }
9816 }
9817
9819 {
9820 if (newPlayer)
9821 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9822
9823 if (newPlayer == oldPlayer)
9824 {
9825 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9826 {
9828 {
9829 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9830 {
9831 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9832 }
9833 }
9834 else
9835 {
9836 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9837 }
9838 }
9839
9840 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9841 {
9842 int type = oldLoc.GetType();
9844 {
9845 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9846 }
9848 {
9849 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9850 }
9851 }
9852 if (!m_OldLocation)
9853 {
9854 m_OldLocation = new InventoryLocation;
9855 }
9856 m_OldLocation.Copy(oldLoc);
9857 }
9858 else
9859 {
9860 if (m_OldLocation)
9861 {
9862 m_OldLocation.Reset();
9863 }
9864 }
9865
9866 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9867 }
9868 else
9869 {
9870 if (newPlayer)
9871 {
9872 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9873 if (resIndex >= 0)
9874 {
9875 InventoryLocation il = new InventoryLocation;
9876 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9878 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9881 {
9882 il.
GetParent().GetOnReleaseLock().Invoke(it);
9883 }
9885 {
9887 }
9888
9889 }
9890 }
9892 {
9893
9895 }
9896
9897 if (m_OldLocation)
9898 {
9899 m_OldLocation.Reset();
9900 }
9901 }
9902
9904 {
9905 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9906 }
9907
9909 {
9910 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9911 }
9912 }
9913
9914 override void EOnContact(IEntity other, Contact extra)
9915 {
9917 {
9918 int liquidType = -1;
9920 if (impactSpeed > 0.0)
9921 {
9923 #ifndef SERVER
9925 #else
9927 SetSynchDirty();
9928 #endif
9930 }
9931 }
9932
9933 #ifdef SERVER
9934 if (GetCompEM() && GetCompEM().IsPlugged())
9935 {
9936 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9937 GetCompEM().UnplugThis();
9938 }
9939 #endif
9940 }
9941
9943
9945 {
9947 }
9948
9950 {
9951
9952 }
9953
9955 {
9956 super.OnItemLocationChanged(old_owner, new_owner);
9957
9958 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9959 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9960
9961 if (!relatedPlayer && playerNew)
9962 relatedPlayer = playerNew;
9963
9964 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9965 {
9967 if (actionMgr)
9968 {
9969 ActionBase currentAction = actionMgr.GetRunningAction();
9970 if (currentAction)
9972 }
9973 }
9974
9975 Man ownerPlayerOld = null;
9976 Man ownerPlayerNew = null;
9977
9978 if (old_owner)
9979 {
9980 if (old_owner.
IsMan())
9981 {
9982 ownerPlayerOld = Man.Cast(old_owner);
9983 }
9984 else
9985 {
9986 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9987 }
9988 }
9989 else
9990 {
9992 {
9994
9995 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9996 {
9997 GetCompEM().UnplugThis();
9998 }
9999 }
10000 }
10001
10002 if (new_owner)
10003 {
10004 if (new_owner.
IsMan())
10005 {
10006 ownerPlayerNew = Man.Cast(new_owner);
10007 }
10008 else
10009 {
10010 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10011 }
10012 }
10013
10014 if (ownerPlayerOld != ownerPlayerNew)
10015 {
10016 if (ownerPlayerOld)
10017 {
10018 array<EntityAI> subItemsExit = new array<EntityAI>;
10020 for (int i = 0; i < subItemsExit.Count(); i++)
10021 {
10024 }
10025 }
10026
10027 if (ownerPlayerNew)
10028 {
10029 array<EntityAI> subItemsEnter = new array<EntityAI>;
10031 for (int j = 0; j < subItemsEnter.Count(); j++)
10032 {
10035 }
10036 }
10037 }
10038 else if (ownerPlayerNew != null)
10039 {
10040 PlayerBase nplayer;
10041 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10042 {
10043 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10045 for (int k = 0; k < subItemsUpdate.Count(); k++)
10046 {
10048 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10049 }
10050 }
10051 }
10052
10053 if (old_owner)
10054 old_owner.OnChildItemRemoved(this);
10055 if (new_owner)
10056 new_owner.OnChildItemReceived(this);
10057 }
10058
10059
10061 {
10062 super.EEDelete(parent);
10063 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10064 if (player)
10065 {
10067
10068 if (player.IsAlive())
10069 {
10070 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10071 if (r_index >= 0)
10072 {
10073 InventoryLocation r_il = new InventoryLocation;
10074 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10075
10076 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10079 {
10080 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10081 }
10083 {
10084 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10085 }
10086
10087 }
10088
10089 player.RemoveQuickBarEntityShortcut(this);
10090 }
10091 }
10092 }
10093
10095 {
10096 super.EEKilled(killer);
10097
10100 {
10101 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10102 {
10103 if (IsMagazine())
10104 {
10105 if (Magazine.Cast(this).GetAmmoCount() > 0)
10106 {
10108 }
10109 }
10110 else
10111 {
10113 }
10114 }
10115 }
10116 }
10117
10119 {
10120 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10121
10122 super.OnWasAttached(parent, slot_id);
10123
10126
10129 }
10130
10132 {
10133 super.OnWasDetached(parent, slot_id);
10134
10137
10140 }
10141
10143 {
10144 int idx;
10147
10148 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10149 if (inventory_slots.Count() < 1)
10150 {
10151 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10152 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10153 }
10154 else
10155 {
10156 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10157 }
10158
10159 idx = inventory_slots.Find(slot);
10160 if (idx < 0)
10161 return "";
10162
10163 return attach_types.Get(idx);
10164 }
10165
10167 {
10168 int idx = -1;
10169 string slot;
10170
10173
10174 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10175 if (inventory_slots.Count() < 1)
10176 {
10177 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10178 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10179 }
10180 else
10181 {
10182 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10183 if (detach_types.Count() < 1)
10184 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10185 }
10186
10187 for (int i = 0; i < inventory_slots.Count(); i++)
10188 {
10189 slot = inventory_slots.Get(i);
10190 }
10191
10192 if (slot != "")
10193 {
10194 if (detach_types.Count() == 1)
10195 idx = 0;
10196 else
10197 idx = inventory_slots.Find(slot);
10198 }
10199 if (idx < 0)
10200 return "";
10201
10202 return detach_types.Get(idx);
10203 }
10204
10206 {
10207
10209
10210
10211 float min_time = 1;
10212 float max_time = 3;
10213 float delay = Math.RandomFloat(min_time, max_time);
10214
10215 explode_timer.Run(delay, this, "DoAmmoExplosion");
10216 }
10217
10219 {
10220 Magazine magazine = Magazine.Cast(this);
10221 int pop_sounds_count = 6;
10222 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10223
10224
10225 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10226 string sound_name = pop_sounds[ sound_idx ];
10227 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10228
10229
10230 magazine.ServerAddAmmoCount(-1);
10231
10232
10233 float min_temp_to_explode = 100;
10234
10235 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10236 {
10238 }
10239 }
10240
10241
10242 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10243 {
10244 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10245
10246 const int CHANCE_DAMAGE_CARGO = 4;
10247 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10248 const int CHANCE_DAMAGE_NOTHING = 2;
10249
10251 {
10252 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10253 int chances;
10254 int rnd;
10255
10256 if (GetInventory().GetCargo())
10257 {
10258 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10259 rnd = Math.RandomInt(0,chances);
10260
10261 if (rnd < CHANCE_DAMAGE_CARGO)
10262 {
10264 }
10265 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10266 {
10268 }
10269 }
10270 else
10271 {
10272 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10273 rnd = Math.RandomInt(0,chances);
10274
10275 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10276 {
10278 }
10279 }
10280 }
10281 }
10282
10284 {
10285 CargoBase cargo = GetInventory().GetCargo();
10286 if (cargo)
10287 {
10289 if (item_count > 0)
10290 {
10291 int random_pick = Math.RandomInt(0, item_count);
10293 if (!item.IsExplosive())
10294 {
10295 item.AddHealth("","",damage);
10296 return true;
10297 }
10298 }
10299 }
10300 return false;
10301 }
10302
10304 {
10305 GameInventory inventory = GetInventory();
10307 if (attachment_count > 0)
10308 {
10309 int random_pick = Math.RandomInt(0, attachment_count);
10311 if (!attachment.IsExplosive())
10312 {
10313 attachment.AddHealth("","",damage);
10314 return true;
10315 }
10316 }
10317 return false;
10318 }
10319
10321 {
10323 }
10324
10326 {
10328 return GetInventory().CanRemoveEntity();
10329
10330 return false;
10331 }
10332
10334 {
10335
10337 return false;
10338
10339
10341 return false;
10342
10343
10344
10346 if (delta == 0)
10347 return false;
10348
10349
10350 return true;
10351 }
10352
10354 {
10356 {
10357 if (ScriptInputUserData.CanStoreInputUserData())
10358 {
10359 ScriptInputUserData ctx = new ScriptInputUserData;
10364 ctx.
Write(destination_entity);
10366 ctx.
Write(slot_id);
10368 }
10369 }
10370 else if (!
g_Game.IsMultiplayer())
10371 {
10373 }
10374 }
10375
10377 {
10378 float split_quantity_new;
10382 InventoryLocation loc = new InventoryLocation;
10383
10384 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10385 {
10387 split_quantity_new = stack_max;
10388 else
10390
10392 {
10393 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10394 if (new_item)
10395 {
10396 new_item.SetResultOfSplit(true);
10397 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10399 new_item.
SetQuantity(split_quantity_new,
false,
true);
10400 }
10401 }
10402 }
10403 else if (destination_entity && slot_id == -1)
10404 {
10405 if (quantity > stack_max)
10406 split_quantity_new = stack_max;
10407 else
10408 split_quantity_new = quantity;
10409
10411 {
10412 GameInventory destinationInventory = destination_entity.GetInventory();
10414 {
10417 }
10418
10419 if (new_item)
10420 {
10421 new_item.SetResultOfSplit(true);
10422 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10424 new_item.
SetQuantity(split_quantity_new,
false,
true);
10425 }
10426 }
10427 }
10428 else
10429 {
10430 if (stack_max != 0)
10431 {
10433 {
10435 }
10436
10437 if (split_quantity_new == 0)
10438 {
10439 if (!
g_Game.IsMultiplayer())
10440 player.PhysicalPredictiveDropItem(this);
10441 else
10442 player.ServerDropEntity(this);
10443 return;
10444 }
10445
10447 {
10449
10450 if (new_item)
10451 {
10452 new_item.SetResultOfSplit(true);
10453 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10456 new_item.PlaceOnSurface();
10457 }
10458 }
10459 }
10460 }
10461 }
10462
10464 {
10465 float split_quantity_new;
10469 InventoryLocation loc = new InventoryLocation;
10470
10471 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10472 {
10474 split_quantity_new = stack_max;
10475 else
10477
10479 {
10480 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10481 if (new_item)
10482 {
10483 new_item.SetResultOfSplit(true);
10484 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10486 new_item.
SetQuantity(split_quantity_new,
false,
true);
10487 }
10488 }
10489 }
10490 else if (destination_entity && slot_id == -1)
10491 {
10492 if (quantity > stack_max)
10493 split_quantity_new = stack_max;
10494 else
10495 split_quantity_new = quantity;
10496
10498 {
10499 GameInventory destinationInventory = destination_entity.GetInventory();
10501 {
10504 }
10505
10506 if (new_item)
10507 {
10508 new_item.SetResultOfSplit(true);
10509 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10511 new_item.
SetQuantity(split_quantity_new,
false,
true);
10512 }
10513 }
10514 }
10515 else
10516 {
10517 if (stack_max != 0)
10518 {
10520 {
10522 }
10523
10525 {
10527
10528 if (new_item)
10529 {
10530 new_item.SetResultOfSplit(true);
10531 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10534 new_item.PlaceOnSurface();
10535 }
10536 }
10537 }
10538 }
10539 }
10540
10542 {
10544 {
10545 if (ScriptInputUserData.CanStoreInputUserData())
10546 {
10547 ScriptInputUserData ctx = new ScriptInputUserData;
10552 dst.WriteToContext(ctx);
10554 }
10555 }
10556 else if (!
g_Game.IsMultiplayer())
10557 {
10559 }
10560 }
10561
10563 {
10565 {
10566 if (ScriptInputUserData.CanStoreInputUserData())
10567 {
10568 ScriptInputUserData ctx = new ScriptInputUserData;
10573 ctx.
Write(destination_entity);
10579 }
10580 }
10581 else if (!
g_Game.IsMultiplayer())
10582 {
10584 }
10585 }
10586
10588 {
10590 }
10591
10593 {
10595 float split_quantity_new;
10597 if (dst.IsValid())
10598 {
10599 int slot_id = dst.GetSlot();
10601
10602 if (quantity > stack_max)
10603 split_quantity_new = stack_max;
10604 else
10605 split_quantity_new = quantity;
10606
10608 {
10610
10611 if (new_item)
10612 {
10613 new_item.SetResultOfSplit(true);
10614 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10616 new_item.
SetQuantity(split_quantity_new,
false,
true);
10617 }
10618
10619 return new_item;
10620 }
10621 }
10622
10623 return null;
10624 }
10625
10627 {
10629 float split_quantity_new;
10631 if (destination_entity)
10632 {
10634 if (quantity > stackable)
10635 split_quantity_new = stackable;
10636 else
10637 split_quantity_new = quantity;
10638
10640 {
10641 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10642 if (new_item)
10643 {
10644 new_item.SetResultOfSplit(true);
10645 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10647 new_item.
SetQuantity(split_quantity_new,
false,
true);
10648 }
10649 }
10650 }
10651 }
10652
10654 {
10656 {
10657 if (ScriptInputUserData.CanStoreInputUserData())
10658 {
10659 ScriptInputUserData ctx = new ScriptInputUserData;
10664 ItemBase destination_entity =
this;
10665 ctx.
Write(destination_entity);
10669 }
10670 }
10671 else if (!
g_Game.IsMultiplayer())
10672 {
10674 }
10675 }
10676
10678 {
10680 float split_quantity_new;
10682 if (player)
10683 {
10685 if (quantity > stackable)
10686 split_quantity_new = stackable;
10687 else
10688 split_quantity_new = quantity;
10689
10691 {
10692 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10693 new_item =
ItemBase.Cast(in_hands);
10694 if (new_item)
10695 {
10696 new_item.SetResultOfSplit(true);
10697 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10699 new_item.SetQuantity(split_quantity_new, false, true);
10700 }
10701 }
10702 }
10703 }
10704
10706 {
10708 float split_quantity_new = Math.Floor(quantity * 0.5);
10709
10711 return;
10712
10714
10715 if (new_item)
10716 {
10717 if (new_item.GetQuantityMax() < split_quantity_new)
10718 {
10719 split_quantity_new = new_item.GetQuantityMax();
10720 }
10721
10722 new_item.SetResultOfSplit(true);
10723 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10724
10726 {
10729 }
10730 else
10731 {
10733 new_item.
SetQuantity(split_quantity_new,
false,
true);
10734 }
10735 }
10736 }
10737
10739 {
10741 float split_quantity_new = Math.Floor(quantity / 2);
10742
10744 return;
10745
10746 InventoryLocation invloc = new InventoryLocation;
10748
10750 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10751
10752 if (new_item)
10753 {
10754 if (new_item.GetQuantityMax() < split_quantity_new)
10755 {
10756 split_quantity_new = new_item.GetQuantityMax();
10757 }
10759 {
10762 }
10763 else if (split_quantity_new > 1)
10764 {
10766 new_item.
SetQuantity(split_quantity_new,
false,
true);
10767 }
10768 }
10769 }
10770
10773 {
10774 SetWeightDirty();
10776
10777 if (parent)
10778 parent.OnAttachmentQuantityChangedEx(this, delta);
10779
10781 {
10783 {
10785 }
10787 {
10788 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10790 }
10791 }
10792 }
10793
10796 {
10797
10798 }
10799
10802 {
10804 }
10805
10807 {
10808 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10809
10811 {
10812 if (newLevel == GameConstants.STATE_RUINED)
10813 {
10815 EntityAI parent = GetHierarchyParent();
10816 if (parent && parent.IsFireplace())
10817 {
10818 CargoBase cargo = GetInventory().GetCargo();
10819 if (cargo)
10820 {
10822 {
10824 }
10825 }
10826 }
10827 }
10828
10830 {
10831
10833 return;
10834 }
10835
10836 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10837 {
10839 }
10840 }
10841 }
10842
10843
10845 {
10846 super.OnRightClick();
10847
10849 {
10851 {
10852 if (ScriptInputUserData.CanStoreInputUserData())
10853 {
10854 EntityAI root = GetHierarchyRoot();
10855 Man playerOwner = GetHierarchyRootPlayer();
10856 InventoryLocation dst = new InventoryLocation;
10857
10858
10859 if (!playerOwner && root && root == this)
10860 {
10862 }
10863 else
10864 {
10865
10866 GetInventory().GetCurrentInventoryLocation(dst);
10868 {
10869 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10871 {
10873 }
10874 else
10875 {
10877
10878
10879 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10880 {
10882 }
10883 else
10884 {
10885 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10886 }
10887 }
10888 }
10889 }
10890
10891 ScriptInputUserData ctx = new ScriptInputUserData;
10899 }
10900 }
10901 else if (!
g_Game.IsMultiplayer())
10902 {
10904 }
10905 }
10906 }
10907
10909 {
10910 if (root)
10911 {
10912 vector m4[4];
10913 root.GetTransform(m4);
10914 dst.SetGround(this, m4);
10915 }
10916 else
10917 {
10918 GetInventory().GetCurrentInventoryLocation(dst);
10919 }
10920 }
10921
10922 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10923 {
10924
10925 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10926 return false;
10927
10928 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10929 return false;
10930
10931
10933 return false;
10934
10935
10936 Magazine mag = Magazine.Cast(this);
10937 if (mag)
10938 {
10939 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10940 return false;
10941
10942 if (stack_max_limit)
10943 {
10944 Magazine other_mag = Magazine.Cast(other_item);
10945 if (other_item)
10946 {
10947 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10948 return false;
10949 }
10950
10951 }
10952 }
10953 else
10954 {
10955
10957 return false;
10958
10960 return false;
10961 }
10962
10963 PlayerBase player = null;
10964 if (CastTo(player, GetHierarchyRootPlayer()))
10965 {
10966 if (player.GetInventory().HasAttachment(this))
10967 return false;
10968
10969 if (player.IsItemsToDelete())
10970 return false;
10971 }
10972
10973 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10974 return false;
10975
10976 int slotID;
10978 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10979 return false;
10980
10981 return true;
10982 }
10983
10985 {
10987 }
10988
10990 {
10991 return m_IsResultOfSplit;
10992 }
10993
10995 {
10996 m_IsResultOfSplit = value;
10997 }
10998
11000 {
11002 }
11003
11005 {
11006 float other_item_quantity = other_item.GetQuantity();
11007 float this_free_space;
11008
11010
11012
11013 if (other_item_quantity > this_free_space)
11014 {
11015 return this_free_space;
11016 }
11017 else
11018 {
11019 return other_item_quantity;
11020 }
11021 }
11022
11024 {
11026 }
11027
11029 {
11031 return;
11032
11033 if (!IsMagazine() && other_item)
11034 {
11036 if (quantity_used != 0)
11037 {
11038 float hp1 = GetHealth01("","");
11039 float hp2 = other_item.GetHealth01("","");
11040 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11041 hpResult = hpResult / (
GetQuantity() + quantity_used);
11042
11043 hpResult *= GetMaxHealth();
11044 Math.Round(hpResult);
11045 SetHealth("", "Health", hpResult);
11046
11048 other_item.AddQuantity(-quantity_used);
11049 }
11050 }
11052 }
11053
11055 {
11056 #ifdef SERVER
11057 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11058 GetHierarchyParent().IncreaseLifetimeUp();
11059 #endif
11060 };
11061
11063 {
11064 PlayerBase p = PlayerBase.Cast(player);
11065
11066 array<int> recipesIds = p.m_Recipes;
11067 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11068 if (moduleRecipesManager)
11069 {
11070 EntityAI itemInHands = player.GetEntityInHands();
11071 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11072 }
11073
11074 for (int i = 0;i < recipesIds.Count(); i++)
11075 {
11076 int key = recipesIds.Get(i);
11077 string recipeName = moduleRecipesManager.GetRecipeName(key);
11079 }
11080 }
11081
11082
11083 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11084 {
11085 super.GetDebugActions(outputList);
11086
11087
11093
11094
11099
11104
11105
11109
11110
11112 {
11116 }
11117
11120
11121
11125
11127
11128 InventoryLocation loc = new InventoryLocation();
11129 GetInventory().GetCurrentInventoryLocation(loc);
11131 {
11132 if (Gizmo_IsSupported())
11135 }
11136
11138 }
11139
11140
11141
11142
11144 {
11145 super.OnAction(action_id, player, ctx);
11146
11148 {
11149 switch (action_id)
11150 {
11154 return true;
11158 return true;
11159 }
11160 }
11161
11163 {
11164 switch (action_id)
11165 {
11167 Delete();
11168 return true;
11169 }
11170 }
11171
11172 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11173 {
11174 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11175 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11176 PlayerBase p = PlayerBase.Cast(player);
11177 if (
EActions.RECIPES_RANGE_START < 1000)
11178 {
11179 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11180 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11181 }
11182 }
11183 #ifndef SERVER
11184 else if (action_id ==
EActions.WATCH_PLAYER)
11185 {
11186 PluginDeveloper.SetDeveloperItemClientEx(player);
11187 }
11188 #endif
11190 {
11191 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11192 {
11193 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11194 OnDebugButtonPressServer(id + 1);
11195 }
11196
11197 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11198 {
11199 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11201 }
11202
11203 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11204 {
11205 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11207 }
11208
11209 else if (action_id ==
EActions.ADD_QUANTITY)
11210 {
11211 if (IsMagazine())
11212 {
11213 Magazine mag = Magazine.Cast(this);
11214 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11215 }
11216 else
11217 {
11219 }
11220
11221 if (m_EM)
11222 {
11223 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11224 }
11225
11226 }
11227
11228 else if (action_id ==
EActions.REMOVE_QUANTITY)
11229 {
11230 if (IsMagazine())
11231 {
11232 Magazine mag2 = Magazine.Cast(this);
11233 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11234 }
11235 else
11236 {
11238 }
11239 if (m_EM)
11240 {
11241 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11242 }
11243
11244 }
11245
11246 else if (action_id ==
EActions.SET_QUANTITY_0)
11247 {
11249
11250 if (m_EM)
11251 {
11252 m_EM.SetEnergy(0);
11253 }
11254 }
11255
11256 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11257 {
11259
11260 if (m_EM)
11261 {
11262 m_EM.SetEnergy(m_EM.GetEnergyMax());
11263 }
11264 }
11265
11266 else if (action_id ==
EActions.ADD_HEALTH)
11267 {
11268 AddHealth("","",GetMaxHealth("","Health")/5);
11269 }
11270 else if (action_id ==
EActions.REMOVE_HEALTH)
11271 {
11272 AddHealth("","",-GetMaxHealth("","Health")/5);
11273 }
11274 else if (action_id ==
EActions.DESTROY_HEALTH)
11275 {
11276 SetHealth01("","",0);
11277 }
11278 else if (action_id ==
EActions.WATCH_ITEM)
11279 {
11281 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11282 #ifdef DEVELOPER
11283 SetDebugDeveloper_item(this);
11284 #endif
11285 }
11286
11287 else if (action_id ==
EActions.ADD_TEMPERATURE)
11288 {
11289 AddTemperature(20);
11290
11291 }
11292
11293 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11294 {
11295 AddTemperature(-20);
11296
11297 }
11298
11299 else if (action_id ==
EActions.FLIP_FROZEN)
11300 {
11301 SetFrozen(!GetIsFrozen());
11302
11303 }
11304
11305 else if (action_id ==
EActions.ADD_WETNESS)
11306 {
11308
11309 }
11310
11311 else if (action_id ==
EActions.REMOVE_WETNESS)
11312 {
11314
11315 }
11316
11317 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11318 {
11321
11322
11323 }
11324
11325 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11326 {
11329 }
11330
11331 else if (action_id ==
EActions.MAKE_SPECIAL)
11332 {
11333 auto debugParams = DebugSpawnParams.WithPlayer(player);
11334 OnDebugSpawnEx(debugParams);
11335 }
11336
11337 }
11338
11339
11340 return false;
11341 }
11342
11343
11344
11345
11349
11352
11353
11354
11356 {
11357 return false;
11358 }
11359
11360
11362 {
11363 return true;
11364 }
11365
11366
11368 {
11369 return true;
11370 }
11371
11372
11373
11375 {
11376 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11377 return g_Game.ConfigIsExisting(config_path);
11378 }
11379
11382 {
11383 return null;
11384 }
11385
11387 {
11388 return false;
11389 }
11390
11392 {
11393 return false;
11394 }
11395
11399
11400
11402 {
11403 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11404 return module_repairing.CanRepair(this, item_repair_kit);
11405 }
11406
11407
11408 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11409 {
11410 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11411 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11412 }
11413
11414
11416 {
11417
11418
11419
11420
11421
11422
11423
11424
11425 return 1;
11426 }
11427
11428
11429
11431 {
11433 }
11434
11435
11436
11438 {
11440 }
11441
11442
11451 {
11452 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11453
11454 if (player)
11455 {
11456 player.MessageStatus(text);
11457 }
11458 }
11459
11460
11469 {
11470 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11471
11472 if (player)
11473 {
11474 player.MessageAction(text);
11475 }
11476 }
11477
11478
11487 {
11488 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11489
11490 if (player)
11491 {
11492 player.MessageFriendly(text);
11493 }
11494 }
11495
11496
11505 {
11506 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11507
11508 if (player)
11509 {
11510 player.MessageImportant(text);
11511 }
11512 }
11513
11515 {
11516 return true;
11517 }
11518
11519
11520 override bool KindOf(
string tag)
11521 {
11522 bool found = false;
11523 string item_name = this.
GetType();
11525 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11526
11527 int array_size = item_tag_array.Count();
11528 for (int i = 0; i < array_size; i++)
11529 {
11530 if (item_tag_array.Get(i) == tag)
11531 {
11532 found = true;
11533 break;
11534 }
11535 }
11536 return found;
11537 }
11538
11539
11541 {
11542
11543 super.OnRPC(sender, rpc_type,ctx);
11544
11545
11546 switch (rpc_type)
11547 {
11548 #ifndef SERVER
11549 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11550 Param2<bool, string> p = new Param2<bool, string>(false, "");
11551
11553 return;
11554
11555 bool play = p.param1;
11556 string soundSet = p.param2;
11557
11558 if (play)
11559 {
11561 {
11563 {
11565 }
11566 }
11567 else
11568 {
11570 }
11571 }
11572 else
11573 {
11575 }
11576
11577 break;
11578 #endif
11579
11580 }
11581
11583 {
11585 }
11586 }
11587
11588
11589
11590
11592 {
11593 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11594 return plugin.GetID(
name);
11595 }
11596
11598 {
11599 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11600 return plugin.GetName(id);
11601 }
11602
11605 {
11606
11607
11608 int varFlags;
11609 if (!ctx.
Read(varFlags))
11610 return;
11611
11612 if (varFlags & ItemVariableFlags.FLOAT)
11613 {
11615 }
11616 }
11617
11619 {
11620
11621 super.SerializeNumericalVars(floats_out);
11622
11623
11624
11626 {
11628 }
11629
11631 {
11633 }
11634
11636 {
11638 }
11639
11641 {
11646 }
11647
11649 {
11651 }
11652 }
11653
11655 {
11656
11657 super.DeSerializeNumericalVars(floats);
11658
11659
11660 int index = 0;
11661 int mask = Math.Round(floats.Get(index));
11662
11663 index++;
11664
11666 {
11668 {
11670 }
11671 else
11672 {
11673 float quantity = floats.Get(index);
11674 SetQuantity(quantity,
true,
false,
false,
false);
11675 }
11676 index++;
11677 }
11678
11680 {
11681 float wet = floats.Get(index);
11683 index++;
11684 }
11685
11687 {
11688 int liquidtype = Math.Round(floats.Get(index));
11690 index++;
11691 }
11692
11694 {
11696 index++;
11698 index++;
11700 index++;
11702 index++;
11703 }
11704
11706 {
11707 int cleanness = Math.Round(floats.Get(index));
11709 index++;
11710 }
11711 }
11712
11714 {
11715 super.WriteVarsToCTX(ctx);
11716
11717
11719 {
11721 }
11722
11724 {
11726 }
11727
11729 {
11731 }
11732
11734 {
11735 int r,g,b,a;
11741 }
11742
11744 {
11746 }
11747 }
11748
11750 {
11751 if (!super.ReadVarsFromCTX(ctx,version))
11752 return false;
11753
11754 int intValue;
11755 float value;
11756
11757 if (version < 140)
11758 {
11759 if (!ctx.
Read(intValue))
11760 return false;
11761
11762 m_VariablesMask = intValue;
11763 }
11764
11766 {
11767 if (!ctx.
Read(value))
11768 return false;
11769
11771 {
11773 }
11774 else
11775 {
11777 }
11778 }
11779
11780 if (version < 140)
11781 {
11783 {
11784 if (!ctx.
Read(value))
11785 return false;
11786 SetTemperatureDirect(value);
11787 }
11788 }
11789
11791 {
11792 if (!ctx.
Read(value))
11793 return false;
11795 }
11796
11798 {
11799 if (!ctx.
Read(intValue))
11800 return false;
11802 }
11803
11805 {
11806 int r,g,b,a;
11808 return false;
11810 return false;
11812 return false;
11814 return false;
11815
11817 }
11818
11820 {
11821 if (!ctx.
Read(intValue))
11822 return false;
11824 }
11825
11826 if (version >= 138 && version < 140)
11827 {
11829 {
11830 if (!ctx.
Read(intValue))
11831 return false;
11832 SetFrozen(intValue);
11833 }
11834 }
11835
11836 return true;
11837 }
11838
11839
11841 {
11844 {
11846 }
11847
11848 if (!super.OnStoreLoad(ctx, version))
11849 {
11851 return false;
11852 }
11853
11854 if (version >= 114)
11855 {
11856 bool hasQuickBarIndexSaved;
11857
11858 if (!ctx.
Read(hasQuickBarIndexSaved))
11859 {
11861 return false;
11862 }
11863
11864 if (hasQuickBarIndexSaved)
11865 {
11866 int itmQBIndex;
11867
11868
11869 if (!ctx.
Read(itmQBIndex))
11870 {
11872 return false;
11873 }
11874
11875 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11876 if (itmQBIndex != -1 && parentPlayer)
11877 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11878 }
11879 }
11880 else
11881 {
11882
11883 PlayerBase player;
11884 int itemQBIndex;
11885 if (version ==
int.
MAX)
11886 {
11887 if (!ctx.
Read(itemQBIndex))
11888 {
11890 return false;
11891 }
11892 }
11893 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11894 {
11895
11896 if (!ctx.
Read(itemQBIndex))
11897 {
11899 return false;
11900 }
11901 if (itemQBIndex != -1 && player)
11902 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11903 }
11904 }
11905
11906 if (version < 140)
11907 {
11908
11909 if (!LoadVariables(ctx, version))
11910 {
11912 return false;
11913 }
11914 }
11915
11916
11918 {
11920 return false;
11921 }
11922 if (version >= 132)
11923 {
11925 if (raib)
11926 {
11928 {
11930 return false;
11931 }
11932 }
11933 }
11934
11936 return true;
11937 }
11938
11939
11940
11942 {
11943 super.OnStoreSave(ctx);
11944
11945 PlayerBase player;
11946 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11947 {
11949
11950 int itemQBIndex = -1;
11951 itemQBIndex = player.FindQuickBarEntityIndex(this);
11952 ctx.
Write(itemQBIndex);
11953 }
11954 else
11955 {
11957 }
11958
11960
11962 if (raib)
11963 {
11965 }
11966 }
11967
11968
11970 {
11971 super.AfterStoreLoad();
11972
11974 {
11976 }
11977
11979 {
11982 }
11983 }
11984
11986 {
11987 super.EEOnAfterLoad();
11988
11990 {
11992 }
11993
11996 }
11997
11999 {
12000 return false;
12001 }
12002
12003
12004
12006 {
12008 {
12009 #ifdef PLATFORM_CONSOLE
12010
12012 {
12014 if (menu)
12015 {
12017 }
12018 }
12019 #endif
12020 }
12021
12023 {
12026 }
12027
12029 {
12030 SetWeightDirty();
12032 }
12034 {
12037 }
12038
12040 {
12043
12046 }
12048 {
12052 }
12053
12054 super.OnVariablesSynchronized();
12055 }
12056
12057
12058
12060 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12061 {
12062 if (!IsServerCheck(allow_client))
12063 return false;
12064
12066 return false;
12067
12070
12071 if (value <= (min + 0.001))
12072 value = min;
12073
12074 if (value == min)
12075 {
12076 if (destroy_config)
12077 {
12078 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12079 if (dstr)
12080 {
12082 this.Delete();
12083 return true;
12084 }
12085 }
12086 else if (destroy_forced)
12087 {
12089 this.Delete();
12090 return true;
12091 }
12092
12094 }
12095
12098
12100 {
12101 EntityAI parent = GetHierarchyRoot();
12102 InventoryLocation iLoc = new InventoryLocation();
12103 GetInventory().GetCurrentInventoryLocation(iLoc);
12105 {
12106 int iLocSlot = iLoc.
GetSlot();
12108 {
12110 }
12112 {
12114 }
12115 }
12116 }
12117
12119 {
12121
12122 if (delta)
12124 }
12125
12127
12128 return false;
12129 }
12130
12131
12133 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12134 {
12136 }
12137
12139 {
12142 }
12143
12145 {
12148 }
12149
12151 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12152 {
12153 float value_clamped = Math.Clamp(value, 0, 1);
12155 SetQuantity(result, destroy_config, destroy_forced);
12156 }
12157
12158
12161 {
12163 }
12164
12166 {
12168 }
12169
12170
12171
12172
12173
12174
12175
12176
12177
12178
12180 {
12181 int slot = -1;
12182 GameInventory inventory = GetInventory();
12183 if (inventory)
12184 {
12185 InventoryLocation il = new InventoryLocation;
12188 }
12189
12191 }
12192
12194 {
12195 float quantity_max = 0;
12196
12198 {
12199 if (attSlotID != -1)
12200 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12201
12202 if (quantity_max <= 0)
12204 }
12205
12206 if (quantity_max <= 0)
12208
12209 return quantity_max;
12210 }
12211
12213 {
12215 }
12216
12218 {
12220 }
12221
12222
12224 {
12226 }
12227
12229 {
12231 }
12232
12234 {
12236 }
12237
12238
12240 {
12241
12242 float weightEx = GetWeightEx();
12243 float special = GetInventoryAndCargoWeight();
12244 return weightEx - special;
12245 }
12246
12247
12249 {
12251 }
12252
12254 {
12256 {
12257 #ifdef DEVELOPER
12258 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12259 {
12260 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12262 }
12263 #endif
12264
12265 return GetQuantity() * GetConfigWeightModified();
12266 }
12267 else if (HasEnergyManager())
12268 {
12269 #ifdef DEVELOPER
12270 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12271 {
12272 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12273 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12274 }
12275 #endif
12276 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12277 }
12278 else
12279 {
12280 #ifdef DEVELOPER
12281 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12282 {
12283 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12284 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12285 }
12286 #endif
12287 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12288 }
12289 }
12290
12293 {
12294 int item_count = 0;
12296
12297 GameInventory inventory = GetInventory();
12298 CargoBase cargo = inventory.
GetCargo();
12299 if (cargo != NULL)
12300 {
12302 }
12303
12305 for (int i = 0; i < nAttachments; ++i)
12306 {
12308 if (item)
12309 item_count += item.GetNumberOfItems();
12310 }
12311 return item_count;
12312 }
12313
12316 {
12317 float weight = 0;
12318 float wetness = 1;
12319 if (include_wetness)
12322 {
12323 weight = wetness * m_ConfigWeight;
12324 }
12326 {
12327 weight = 1;
12328 }
12329 return weight;
12330 }
12331
12332
12333
12335 {
12336 GameInventory inventory = GetInventory();
12337 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12338 {
12339 array<EntityAI> items = new array<EntityAI>;
12341 for (int i = 0; i < items.Count(); ++i)
12342 {
12344 if (item)
12345 {
12346 g_Game.ObjectDelete(item);
12347 }
12348 }
12349 }
12350 }
12351
12352
12353
12354
12356 {
12357 float energy = 0;
12358 if (HasEnergyManager())
12359 {
12360 energy = GetCompEM().GetEnergy();
12361 }
12362 return energy;
12363 }
12364
12365
12367 {
12368 super.OnEnergyConsumed();
12369
12371 }
12372
12374 {
12375 super.OnEnergyAdded();
12376
12378 }
12379
12380
12382 {
12383 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12384 {
12386 {
12387 float energy_0to1 = GetCompEM().GetEnergy0To1();
12389 }
12390 }
12391 }
12392
12393
12395 {
12396 return ConfigGetFloat("heatIsolation");
12397 }
12398
12400 {
12402 }
12403
12405 {
12406 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12407 if (
g_Game.ConfigIsExisting(paramPath))
12408 return g_Game.ConfigGetFloat(paramPath);
12409
12410 return 0.0;
12411 }
12412
12414 {
12415 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12416 if (
g_Game.ConfigIsExisting(paramPath))
12417 return g_Game.ConfigGetFloat(paramPath);
12418
12419 return 0.0;
12420 }
12421
12422 override void SetWet(
float value,
bool allow_client =
false)
12423 {
12424 if (!IsServerCheck(allow_client))
12425 return;
12426
12429
12431
12432 m_VarWet = Math.Clamp(value, min, max);
12433
12435 {
12438 }
12439 }
12440
12441 override void AddWet(
float value)
12442 {
12444 }
12445
12447 {
12449 }
12450
12452 {
12454 }
12455
12457 {
12459 }
12460
12462 {
12464 }
12465
12467 {
12469 }
12470
12471 override void OnWetChanged(
float newVal,
float oldVal)
12472 {
12475 if (newLevel != oldLevel)
12476 {
12478 }
12479 }
12480
12482 {
12483 SetWeightDirty();
12484 }
12485
12487 {
12488 return GetWetLevelInternal(
m_VarWet);
12489 }
12490
12491
12492
12494 {
12496 }
12497
12499 {
12501 }
12502
12504 {
12506 }
12507
12509 {
12511 }
12512
12513
12514
12516 {
12517 if (ConfigIsExisting("itemModelLength"))
12518 {
12519 return ConfigGetFloat("itemModelLength");
12520 }
12521 return 0;
12522 }
12523
12525 {
12526 if (ConfigIsExisting("itemAttachOffset"))
12527 {
12528 return ConfigGetFloat("itemAttachOffset");
12529 }
12530 return 0;
12531 }
12532
12533 override void SetCleanness(
int value,
bool allow_client =
false)
12534 {
12535 if (!IsServerCheck(allow_client))
12536 return;
12537
12539
12541
12544 }
12545
12547 {
12549 }
12550
12552 {
12553 return true;
12554 }
12555
12556
12557
12558
12560 {
12562 }
12563
12565 {
12567 }
12568
12569
12570
12571
12572 override void SetColor(
int r,
int g,
int b,
int a)
12573 {
12579 }
12581 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12582 {
12587 }
12588
12590 {
12592 }
12593
12596 {
12597 int r,g,b,a;
12599 r = r/255;
12600 g = g/255;
12601 b = b/255;
12602 a = a/255;
12603 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12604 }
12605
12606
12607
12608 override void SetLiquidType(
int value,
bool allow_client =
false)
12609 {
12610 if (!IsServerCheck(allow_client))
12611 return;
12612
12617 }
12618
12620 {
12621 return ConfigGetInt("varLiquidTypeInit");
12622 }
12623
12625 {
12627 }
12628
12630 {
12632 SetFrozen(false);
12633 }
12634
12637 {
12638 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12639 }
12640
12641
12644 {
12645 PlayerBase nplayer;
12646 if (PlayerBase.CastTo(nplayer, player))
12647 {
12649 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12650 }
12651 }
12652
12653
12656 {
12657 PlayerBase nplayer;
12658 if (PlayerBase.CastTo(nplayer,player))
12659 {
12660 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12661 }
12662
12663 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12664
12665 if (HasEnergyManager())
12666 {
12667 GetCompEM().UpdatePlugState();
12668 }
12669 }
12670
12671
12673 {
12674 super.OnPlacementStarted(player);
12675
12677 }
12678
12679 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12680 {
12682 {
12683 m_AdminLog.OnPlacementComplete(player,
this);
12684 }
12685
12686 super.OnPlacementComplete(player, position, orientation);
12687 }
12688
12689
12690
12691
12692
12694 {
12696 {
12697 return true;
12698 }
12699 else
12700 {
12701 return false;
12702 }
12703 }
12704
12705
12707 {
12709 {
12711 }
12712 }
12713
12714
12716 {
12718 }
12719
12721 {
12723 }
12724
12725 override void InsertAgent(
int agent,
float count = 1)
12726 {
12727 if (count < 1)
12728 return;
12729
12731 }
12732
12735 {
12737 }
12738
12739
12741 {
12743 }
12744
12745
12746
12747
12748
12749
12750
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
12787 {
12789 return false;
12790 return true;
12791 }
12792
12794 {
12795
12797 }
12798
12799
12802 {
12803 super.CheckForRoofLimited(timeTresholdMS);
12804
12805 float time =
g_Game.GetTime();
12806 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12807 {
12808 m_PreviousRoofTestTime = time;
12809 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12810 }
12811 }
12812
12813
12815 {
12817 {
12818 return 0;
12819 }
12820
12821 if (GetInventory().GetAttachmentSlotsCount() != 0)
12822 {
12823 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12824 if (filter)
12825 return filter.GetProtectionLevel(type, false, system);
12826 else
12827 return 0;
12828 }
12829
12830 string subclassPath, entryName;
12831
12832 switch (type)
12833 {
12835 entryName = "biological";
12836 break;
12838 entryName = "chemical";
12839 break;
12840 default:
12841 entryName = "biological";
12842 break;
12843 }
12844
12845 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12846
12847 return g_Game.ConfigGetFloat(subclassPath + entryName);
12848 }
12849
12850
12851
12854 {
12855 if (!IsMagazine())
12857
12859 }
12860
12861
12862
12863
12864
12869 {
12870 return true;
12871 }
12872
12874 {
12876 }
12877
12878
12879
12880
12881
12883 {
12884 if (parent)
12885 {
12886 if (parent.IsInherited(DayZInfected))
12887 return true;
12888
12889 if (!parent.IsRuined())
12890 return true;
12891 }
12892
12893 return true;
12894 }
12895
12897 {
12898 if (!super.CanPutAsAttachment(parent))
12899 {
12900 return false;
12901 }
12902
12903 if (!IsRuined() && !parent.IsRuined())
12904 {
12905 return true;
12906 }
12907
12908 return false;
12909 }
12910
12912 {
12913
12914
12915
12916
12917 return super.CanReceiveItemIntoCargo(item);
12918 }
12919
12921 {
12922
12923
12924
12925
12926 GameInventory attachmentInv = attachment.GetInventory();
12928 {
12929 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12930 return false;
12931 }
12932
12933 InventoryLocation loc = new InventoryLocation();
12934 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12935 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12936 return false;
12937
12938 return super.CanReceiveAttachment(attachment, slotId);
12939 }
12940
12942 {
12943 if (!super.CanReleaseAttachment(attachment))
12944 return false;
12945
12946 return GetInventory().AreChildrenAccessible();
12947 }
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12970 {
12971 int id = muzzle_owner.GetMuzzleID();
12972 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12973
12974 if (WPOF_array)
12975 {
12976 for (int i = 0; i < WPOF_array.Count(); i++)
12977 {
12978 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12979
12980 if (WPOF)
12981 {
12982 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12983 }
12984 }
12985 }
12986 }
12987
12988
12990 {
12991 int id = muzzle_owner.GetMuzzleID();
12993
12994 if (WPOBE_array)
12995 {
12996 for (int i = 0; i < WPOBE_array.Count(); i++)
12997 {
12998 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12999
13000 if (WPOBE)
13001 {
13002 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13003 }
13004 }
13005 }
13006 }
13007
13008
13010 {
13011 int id = muzzle_owner.GetMuzzleID();
13012 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13013
13014 if (WPOOH_array)
13015 {
13016 for (int i = 0; i < WPOOH_array.Count(); i++)
13017 {
13018 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13019
13020 if (WPOOH)
13021 {
13022 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13023 }
13024 }
13025 }
13026 }
13027
13028
13030 {
13031 int id = muzzle_owner.GetMuzzleID();
13032 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13033
13034 if (WPOOH_array)
13035 {
13036 for (int i = 0; i < WPOOH_array.Count(); i++)
13037 {
13038 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13039
13040 if (WPOOH)
13041 {
13042 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13043 }
13044 }
13045 }
13046 }
13047
13048
13050 {
13051 int id = muzzle_owner.GetMuzzleID();
13052 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13053
13054 if (WPOOH_array)
13055 {
13056 for (int i = 0; i < WPOOH_array.Count(); i++)
13057 {
13058 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13059
13060 if (WPOOH)
13061 {
13062 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13063 }
13064 }
13065 }
13066 }
13067
13068
13069
13071 {
13073 {
13074 return true;
13075 }
13076
13077 return false;
13078 }
13079
13081 {
13083 {
13084 return true;
13085 }
13086
13087 return false;
13088 }
13089
13091 {
13093 {
13094 return true;
13095 }
13096
13097 return false;
13098 }
13099
13101 {
13102 return false;
13103 }
13104
13107 {
13108 return UATimeSpent.DEFAULT_DEPLOY;
13109 }
13110
13111
13112
13113
13115 {
13117 SetSynchDirty();
13118 }
13119
13121 {
13123 }
13124
13125
13127 {
13128 return false;
13129 }
13130
13133 {
13134 string att_type = "None";
13135
13136 if (ConfigIsExisting("soundAttType"))
13137 {
13138 att_type = ConfigGetString("soundAttType");
13139 }
13140
13142 }
13143
13145 {
13147 }
13148
13149
13150
13151
13152
13158
13160 {
13163
13165 }
13166
13167
13169 {
13171 return;
13172
13174
13177
13180
13181 SoundParameters params = new SoundParameters();
13185 }
13186
13187
13189 {
13191 {
13194
13195 SetSynchDirty();
13196
13199 }
13200 }
13201
13203 {
13205 }
13206
13207
13209 {
13211 return;
13212
13214 SetSynchDirty();
13215
13218 }
13219
13221 {
13224 }
13225
13227 {
13229 }
13230
13231 void OnApply(PlayerBase player);
13232
13234 {
13235 return 1.0;
13236 };
13237
13239 {
13241 }
13242
13244 {
13246 }
13247
13249
13251 {
13252 SetDynamicPhysicsLifeTime(0.01);
13254 }
13255
13257 {
13258 array<string> zone_names = new array<string>;
13259 GetDamageZones(zone_names);
13260 for (int i = 0; i < zone_names.Count(); i++)
13261 {
13262 SetHealthMax(zone_names.Get(i),"Health");
13263 }
13264 SetHealthMax("","Health");
13265 }
13266
13269 {
13270 float global_health = GetHealth01("","Health");
13271 array<string> zones = new array<string>;
13272 GetDamageZones(zones);
13273
13274 for (int i = 0; i < zones.Count(); i++)
13275 {
13276 SetHealth01(zones.Get(i),"Health",global_health);
13277 }
13278 }
13279
13282 {
13283 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13284 }
13285
13287 {
13288 if (!hasRootAsPlayer)
13289 {
13290 if (refParentIB)
13291 {
13292
13293 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13294 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13295
13296 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13297 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13298
13301 }
13302 else
13303 {
13304
13307 }
13308 }
13309 }
13310
13312 {
13314 {
13315 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13316 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13317 {
13318 float heatPermCoef = 1.0;
13320 while (ent)
13321 {
13322 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13323 ent = ent.GetHierarchyParent();
13324 }
13325
13326 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13327 }
13328 }
13329 }
13330
13332 {
13333
13334 EntityAI parent = GetHierarchyParent();
13335 if (!parent)
13336 {
13337 hasParent = false;
13338 hasRootAsPlayer = false;
13339 }
13340 else
13341 {
13342 hasParent = true;
13343 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13344 refParentIB =
ItemBase.Cast(parent);
13345 }
13346 }
13347
13348 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13349 {
13350
13351 }
13352
13354 {
13355
13356 return false;
13357 }
13358
13360 {
13361
13362
13363 return false;
13364 }
13365
13367 {
13368
13369 return false;
13370 }
13371
13374 {
13375 return !GetIsFrozen() &&
IsOpen();
13376 }
13377
13379 {
13380 bool hasParent = false, hasRootAsPlayer = false;
13382
13383 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13384 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13385
13386 if (wwtu || foodDecay)
13387 {
13391
13392 if (processWetness || processTemperature || processDecay)
13393 {
13395
13396 if (processWetness)
13397 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13398
13399 if (processTemperature)
13401
13402 if (processDecay)
13403 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13404 }
13405 }
13406 }
13407
13410 {
13412 }
13413
13415 {
13418
13419 return super.GetTemperatureFreezeThreshold();
13420 }
13421
13423 {
13426
13427 return super.GetTemperatureThawThreshold();
13428 }
13429
13431 {
13434
13435 return super.GetItemOverheatThreshold();
13436 }
13437
13439 {
13441 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13442
13443 return super.GetTemperatureFreezeTime();
13444 }
13445
13447 {
13449 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13450
13451 return super.GetTemperatureThawTime();
13452 }
13453
13458
13460 {
13461 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13462 }
13463
13465 {
13466 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13467 }
13468
13471 {
13473 }
13474
13476 {
13478 }
13479
13481 {
13483 }
13484
13487 {
13488 return null;
13489 }
13490
13493 {
13494 return false;
13495 }
13496
13498 {
13500 {
13503 if (!trg)
13504 {
13506 explosive = this;
13507 }
13508
13509 explosive.PairRemote(trg);
13511
13512 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13513 trg.SetPersistentPairID(persistentID);
13514 explosive.SetPersistentPairID(persistentID);
13515
13516 return true;
13517 }
13518 return false;
13519 }
13520
13523 {
13524 float ret = 1.0;
13527 ret *= GetHealth01();
13528
13529 return ret;
13530 }
13531
13532 #ifdef DEVELOPER
13533 override void SetDebugItem()
13534 {
13535 super.SetDebugItem();
13536 _itemBase = this;
13537 }
13538
13540 {
13541 string text = super.GetDebugText();
13542
13544 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13545
13546 return text;
13547 }
13548 #endif
13549
13551 {
13552 return true;
13553 }
13554
13556
13558
13560 {
13563 }
13564
13565
13573
13589
13590 [
Obsolete(
"Use ItemSoundHandler instead")]
13593 {
13594 if (!
g_Game.IsDedicatedServer())
13595 {
13596 if (ConfigIsExisting("attachSoundSet"))
13597 {
13598 string cfg_path = "";
13599 string soundset = "";
13600 string type_name =
GetType();
13601
13604 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13605 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13606
13607 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13608 {
13609 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13610 {
13611 if (cfg_slot_array[i] == slot_type)
13612 {
13613 soundset = cfg_soundset_array[i];
13614 break;
13615 }
13616 }
13617 }
13618
13619 if (soundset != "")
13620 {
13621 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13623 }
13624 }
13625 }
13626 }
13627
13629}
13630
13632{
13634 if (entity)
13635 {
13636 bool is_item = entity.IsInherited(
ItemBase);
13637 if (is_item && full_quantity)
13638 {
13641 }
13642 }
13643 else
13644 {
13646 return NULL;
13647 }
13648 return entity;
13649}
13650
13652{
13653 if (item)
13654 {
13655 if (health > 0)
13656 item.SetHealth("", "", health);
13657
13658 if (item.CanHaveTemperature())
13659 {
13661 if (item.CanFreeze())
13662 item.SetFrozen(false);
13663 }
13664
13665 if (item.HasEnergyManager())
13666 {
13667 if (quantity >= 0)
13668 {
13669 item.GetCompEM().SetEnergy0To1(quantity);
13670 }
13671 else
13672 {
13674 }
13675 }
13676 else if (item.IsMagazine())
13677 {
13678 Magazine mag = Magazine.Cast(item);
13679 if (quantity >= 0)
13680 {
13681 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13682 }
13683 else
13684 {
13686 }
13687
13688 }
13689 else
13690 {
13691 if (quantity >= 0)
13692 {
13693 item.SetQuantityNormalized(quantity, false);
13694 }
13695 else
13696 {
13698 }
13699
13700 }
13701 }
13702}
13703
13704#ifdef DEVELOPER
13706#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.