8739{
8741 {
8742 return true;
8743 }
8744};
8745
8747{
8748
8749};
8750
8751
8752
8754{
8758
8760
8763
8764
8765
8766
8767
8776
8782
8787
8792
8813 protected bool m_IsResultOfSplit
8814
8816
8821
8822
8823
8825
8829
8830
8831
8833
8836
8837
8838
8844
8845
8853
8856
8857
8859
8860
8862
8863
8868
8869
8874
8876
8877
8879
8880
8882 {
8887
8888 if (!
g_Game.IsDedicatedServer())
8889 {
8891 {
8893
8895 {
8897 }
8898 }
8899
8902 }
8903
8904 m_OldLocation = null;
8905
8907 {
8909 }
8910
8911 if (ConfigIsExisting("headSelectionsToHide"))
8912 {
8915 }
8916
8918 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8919 {
8921 }
8922
8924
8925 m_IsResultOfSplit = false;
8926
8928 }
8929
8931 {
8932 super.InitItemVariables();
8933
8939 m_Count = ConfigGetInt(
"count");
8940
8943
8948
8951
8956
8968
8972
8973
8976 if (ConfigIsExisting("canBeSplit"))
8977 {
8980 }
8981
8983 if (ConfigIsExisting("itemBehaviour"))
8985
8986
8989 RegisterNetSyncVariableInt("m_VarLiquidType");
8990 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8991
8992 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8993 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8994 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8995
8996 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8997 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8998 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8999 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9000
9001 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9002 RegisterNetSyncVariableBool("m_IsTakeable");
9003 RegisterNetSyncVariableBool("m_IsHologram");
9004
9007 {
9010 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9011 }
9012
9014
9016 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9018
9020 }
9021
9023 {
9025 }
9026
9028 {
9031 {
9036 }
9037 }
9038
9039 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9040 {
9042 {
9045 }
9046
9048 }
9049
9051 {
9057 }
9058
9060
9062 {
9064
9065 if (!action)
9066 {
9067 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9068 return;
9069 }
9070
9072 if (!ai)
9073 {
9075 return;
9076 }
9077
9079 if (!action_array)
9080 {
9081 action_array = new array<ActionBase_Basic>;
9083 }
9084 if (LogManager.IsActionLogEnable())
9085 {
9086 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9087 }
9088
9089 if (action_array.Find(action) != -1)
9090 {
9091 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9092 }
9093 else
9094 {
9095 action_array.Insert(action);
9096 }
9097 }
9098
9100 {
9101 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9102 ActionBase action = player.GetActionManager().GetAction(actionName);
9105
9106 if (action_array)
9107 {
9108 action_array.RemoveItem(action);
9109 }
9110 }
9111
9112
9113
9115 {
9116 ActionOverrideData overrideData = new ActionOverrideData();
9120
9122 if (!actionMap)
9123 {
9126 }
9127
9128 actionMap.Insert(this.
Type(), overrideData);
9129
9130 }
9131
9133
9135
9136
9138 {
9141
9144
9145 string config_to_search = "CfgVehicles";
9146 string muzzle_owner_config;
9147
9149 {
9150 if (IsInherited(Weapon))
9151 config_to_search = "CfgWeapons";
9152
9153 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9154
9155 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9156
9157 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9158
9159 if (config_OnFire_subclass_count > 0)
9160 {
9161 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9162
9163 for (int i = 0; i < config_OnFire_subclass_count; i++)
9164 {
9165 string particle_class = "";
9166 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9167 string config_OnFire_entry = config_OnFire_class + particle_class;
9168 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9169 WPOF_array.Insert(WPOF);
9170 }
9171
9172
9174 }
9175 }
9176
9178 {
9179 config_to_search = "CfgWeapons";
9180 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9181
9182 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9183
9184 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9185
9186 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9187 {
9188 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9189
9190 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9191 {
9192 string particle_class2 = "";
9193 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9194 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9195 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9196 WPOBE_array.Insert(WPOBE);
9197 }
9198
9199
9201 }
9202 }
9203 }
9204
9205
9207 {
9210
9212 {
9213 string config_to_search = "CfgVehicles";
9214
9215 if (IsInherited(Weapon))
9216 config_to_search = "CfgWeapons";
9217
9218 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9219 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9220
9221 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9222 {
9223
9225
9227 {
9229 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9231 return;
9232 }
9233
9236
9237
9238
9239 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9240 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9241
9242 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9243 {
9244 string particle_class = "";
9245 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9246 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9247 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9248
9249 if (entry_type == CT_CLASS)
9250 {
9251 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9252 WPOOH_array.Insert(WPOF);
9253 }
9254 }
9255
9256
9258 }
9259 }
9260 }
9261
9263 {
9265 }
9266
9268 {
9270 {
9272
9275
9278
9279 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9280 }
9281 }
9282
9284 {
9286 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9287
9289 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9290
9292 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9293
9295 {
9297 }
9298 }
9299
9301 {
9303 }
9304
9306 {
9309 else
9311
9313 {
9316 }
9317 else
9318 {
9321
9324 }
9325
9327 }
9328
9330 {
9332 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9333 }
9334
9336 {
9338 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9340 }
9341
9343 {
9345 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9346 }
9347
9349 {
9352
9353 OverheatingParticle OP = new OverheatingParticle();
9358
9360 }
9361
9363 {
9366
9367 return -1;
9368 }
9369
9371 {
9373 {
9376
9377 for (int i = count; i > 0; --i)
9378 {
9379 int id = i - 1;
9382
9385
9386 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9387 {
9388 if (p)
9389 {
9392 }
9393 }
9394 }
9395 }
9396 }
9397
9399 {
9401 {
9403 {
9404 int id = i - 1;
9406
9407 if (OP)
9408 {
9410
9411 if (p)
9412 {
9414 }
9415
9416 delete OP;
9417 }
9418 }
9419
9422 }
9423 }
9424
9427 {
9428 return 0.0;
9429 }
9430
9431
9433 {
9434 return 250;
9435 }
9436
9438 {
9439 return 0;
9440 }
9441
9444 {
9446 return true;
9447
9448 return false;
9449 }
9450
9453 {
9456
9458 {
9460 }
9461 else
9462 {
9463
9465 }
9466
9468 }
9469
9476 {
9477 return -1;
9478 }
9479
9480
9481
9482
9484 {
9486 {
9487 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9488 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9489
9490 if (r_index >= 0)
9491 {
9492 InventoryLocation r_il = new InventoryLocation;
9493 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9494
9495 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9498 {
9499 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9500 }
9502 {
9503 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9504 }
9505
9506 }
9507
9508 player.GetHumanInventory().ClearUserReservedLocation(this);
9509 }
9510
9513 }
9514
9515
9516
9517
9519 {
9520 return ItemBase.m_DebugActionsMask;
9521 }
9522
9524 {
9525 return ItemBase.m_DebugActionsMask & mask;
9526 }
9527
9529 {
9530 ItemBase.m_DebugActionsMask = mask;
9531 }
9532
9534 {
9535 ItemBase.m_DebugActionsMask |= mask;
9536 }
9537
9539 {
9540 ItemBase.m_DebugActionsMask &= ~mask;
9541 }
9542
9544 {
9546 {
9548 }
9549 else
9550 {
9552 }
9553 }
9554
9555
9557 {
9558 if (GetEconomyProfile())
9559 {
9560 float q_max = GetEconomyProfile().GetQuantityMax();
9561 if (q_max > 0)
9562 {
9563 float q_min = GetEconomyProfile().GetQuantityMin();
9564 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9565
9567 {
9568 ComponentEnergyManager comp = GetCompEM();
9570 {
9572 }
9573 }
9575 {
9577
9578 }
9579
9580 }
9581 }
9582 }
9583
9586 {
9587 EntityAI parent = GetHierarchyParent();
9588
9589 if (parent)
9590 {
9591 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9592 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9593 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9594 }
9595 }
9596
9599 {
9600 EntityAI parent = GetHierarchyParent();
9601
9602 if (parent)
9603 {
9604 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9605 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9606 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9607 }
9608 }
9609
9611 {
9612
9613
9614
9615
9617
9619 {
9620 if (ScriptInputUserData.CanStoreInputUserData())
9621 {
9622 ScriptInputUserData ctx = new ScriptInputUserData;
9628 ctx.
Write(use_stack_max);
9631
9633 {
9634 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9635 }
9636 }
9637 }
9638 else if (!
g_Game.IsMultiplayer())
9639 {
9641 }
9642 }
9643
9645 {
9647 }
9648
9650 {
9652 }
9653
9655 {
9657 }
9658
9660 {
9661
9662 return false;
9663 }
9664
9666 {
9667 return false;
9668 }
9669
9673 {
9674 return false;
9675 }
9676
9678 {
9679 return "";
9680 }
9681
9683
9685 {
9686 return false;
9687 }
9688
9690 {
9691 return true;
9692 }
9693
9694
9695
9697 {
9698 return true;
9699 }
9700
9702 {
9703 return true;
9704 }
9705
9707 {
9708 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9710 }
9711
9713 {
9715 }
9716
9718 {
9720 if (!is_being_placed)
9722 SetSynchDirty();
9723 }
9724
9725
9727
9729 {
9731 }
9732
9734 {
9736 }
9737
9739 {
9740 return 1;
9741 }
9742
9744 {
9745 return false;
9746 }
9747
9749 {
9751 SetSynchDirty();
9752 }
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9789 {
9790 super.OnMovedInsideCargo(container);
9791
9792 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9793 }
9794
9795 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9796 {
9797 super.EEItemLocationChanged(oldLoc, newLoc);
9798
9799 PlayerBase newPlayer = null;
9800 PlayerBase oldPlayer = null;
9801
9802 if (newLoc.GetParent())
9803 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9804
9805 if (oldLoc.GetParent())
9806 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9807
9809 {
9810 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9811
9812 if (rIndex >= 0)
9813 {
9814 InventoryLocation rIl = new InventoryLocation;
9815 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9816
9817 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9820 {
9821 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9822 }
9824 {
9826 }
9827
9828 }
9829 }
9830
9832 {
9833 if (newPlayer)
9834 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9835
9836 if (newPlayer == oldPlayer)
9837 {
9838 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9839 {
9841 {
9842 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9843 {
9844 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9845 }
9846 }
9847 else
9848 {
9849 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9850 }
9851 }
9852
9853 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9854 {
9855 int type = oldLoc.GetType();
9857 {
9858 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9859 }
9861 {
9862 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9863 }
9864 }
9865 if (!m_OldLocation)
9866 {
9867 m_OldLocation = new InventoryLocation;
9868 }
9869 m_OldLocation.Copy(oldLoc);
9870 }
9871 else
9872 {
9873 if (m_OldLocation)
9874 {
9875 m_OldLocation.Reset();
9876 }
9877 }
9878
9879 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9880 }
9881 else
9882 {
9883 if (newPlayer)
9884 {
9885 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9886 if (resIndex >= 0)
9887 {
9888 InventoryLocation il = new InventoryLocation;
9889 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9891 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9894 {
9895 il.
GetParent().GetOnReleaseLock().Invoke(it);
9896 }
9898 {
9900 }
9901
9902 }
9903 }
9905 {
9906
9908 }
9909
9910 if (m_OldLocation)
9911 {
9912 m_OldLocation.Reset();
9913 }
9914 }
9915
9917 {
9918 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9919 }
9920
9922 {
9923 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9924 }
9925 }
9926
9927 override void EOnContact(IEntity other, Contact extra)
9928 {
9930 {
9931 int liquidType = -1;
9933 if (impactSpeed > 0.0)
9934 {
9936 #ifndef SERVER
9938 #else
9940 SetSynchDirty();
9941 #endif
9943 }
9944 }
9945
9946 #ifdef SERVER
9947 if (GetCompEM() && GetCompEM().IsPlugged())
9948 {
9949 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9950 GetCompEM().UnplugThis();
9951 }
9952 #endif
9953 }
9954
9956
9958 {
9960 }
9961
9963 {
9964
9965 }
9966
9968 {
9969 super.OnItemLocationChanged(old_owner, new_owner);
9970
9971 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9972 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9973
9974 if (!relatedPlayer && playerNew)
9975 relatedPlayer = playerNew;
9976
9977 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9978 {
9980 if (actionMgr)
9981 {
9982 ActionBase currentAction = actionMgr.GetRunningAction();
9983 if (currentAction)
9985 }
9986 }
9987
9988 Man ownerPlayerOld = null;
9989 Man ownerPlayerNew = null;
9990
9991 if (old_owner)
9992 {
9993 if (old_owner.
IsMan())
9994 {
9995 ownerPlayerOld = Man.Cast(old_owner);
9996 }
9997 else
9998 {
9999 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10000 }
10001 }
10002 else
10003 {
10005 {
10007
10008 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10009 {
10010 GetCompEM().UnplugThis();
10011 }
10012 }
10013 }
10014
10015 if (new_owner)
10016 {
10017 if (new_owner.
IsMan())
10018 {
10019 ownerPlayerNew = Man.Cast(new_owner);
10020 }
10021 else
10022 {
10023 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10024 }
10025 }
10026
10027 if (ownerPlayerOld != ownerPlayerNew)
10028 {
10029 if (ownerPlayerOld)
10030 {
10031 array<EntityAI> subItemsExit = new array<EntityAI>;
10033 for (int i = 0; i < subItemsExit.Count(); i++)
10034 {
10037 }
10038 }
10039
10040 if (ownerPlayerNew)
10041 {
10042 array<EntityAI> subItemsEnter = new array<EntityAI>;
10044 for (int j = 0; j < subItemsEnter.Count(); j++)
10045 {
10048 }
10049 }
10050 }
10051 else if (ownerPlayerNew != null)
10052 {
10053 PlayerBase nplayer;
10054 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10055 {
10056 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10058 for (int k = 0; k < subItemsUpdate.Count(); k++)
10059 {
10061 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10062 }
10063 }
10064 }
10065
10066 if (old_owner)
10067 old_owner.OnChildItemRemoved(this);
10068 if (new_owner)
10069 new_owner.OnChildItemReceived(this);
10070 }
10071
10072
10074 {
10075 super.EEDelete(parent);
10076 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10077 if (player)
10078 {
10080
10081 if (player.IsAlive())
10082 {
10083 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10084 if (r_index >= 0)
10085 {
10086 InventoryLocation r_il = new InventoryLocation;
10087 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10088
10089 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10092 {
10093 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10094 }
10096 {
10097 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10098 }
10099
10100 }
10101
10102 player.RemoveQuickBarEntityShortcut(this);
10103 }
10104 }
10105 }
10106
10108 {
10109 super.EEKilled(killer);
10110
10113 {
10114 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10115 {
10116 if (IsMagazine())
10117 {
10118 if (Magazine.Cast(this).GetAmmoCount() > 0)
10119 {
10121 }
10122 }
10123 else
10124 {
10126 }
10127 }
10128 }
10129 }
10130
10132 {
10133 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10134
10135 super.OnWasAttached(parent, slot_id);
10136
10139
10142 }
10143
10145 {
10146 super.OnWasDetached(parent, slot_id);
10147
10150
10153 }
10154
10156 {
10157 int idx;
10160
10161 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10162 if (inventory_slots.Count() < 1)
10163 {
10164 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10165 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10166 }
10167 else
10168 {
10169 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10170 }
10171
10172 idx = inventory_slots.Find(slot);
10173 if (idx < 0)
10174 return "";
10175
10176 return attach_types.Get(idx);
10177 }
10178
10180 {
10181 int idx = -1;
10182 string slot;
10183
10186
10187 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10188 if (inventory_slots.Count() < 1)
10189 {
10190 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10191 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10192 }
10193 else
10194 {
10195 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10196 if (detach_types.Count() < 1)
10197 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10198 }
10199
10200 for (int i = 0; i < inventory_slots.Count(); i++)
10201 {
10202 slot = inventory_slots.Get(i);
10203 }
10204
10205 if (slot != "")
10206 {
10207 if (detach_types.Count() == 1)
10208 idx = 0;
10209 else
10210 idx = inventory_slots.Find(slot);
10211 }
10212 if (idx < 0)
10213 return "";
10214
10215 return detach_types.Get(idx);
10216 }
10217
10219 {
10220
10222
10223
10224 float min_time = 1;
10225 float max_time = 3;
10226 float delay = Math.RandomFloat(min_time, max_time);
10227
10228 explode_timer.Run(delay, this, "DoAmmoExplosion");
10229 }
10230
10232 {
10233 Magazine magazine = Magazine.Cast(this);
10234 int pop_sounds_count = 6;
10235 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10236
10237
10238 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10239 string sound_name = pop_sounds[ sound_idx ];
10240 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10241
10242
10243 magazine.ServerAddAmmoCount(-1);
10244
10245
10246 float min_temp_to_explode = 100;
10247
10248 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10249 {
10251 }
10252 }
10253
10254
10255 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10256 {
10257 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10258
10259 const int CHANCE_DAMAGE_CARGO = 4;
10260 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10261 const int CHANCE_DAMAGE_NOTHING = 2;
10262
10264 {
10265 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10266 int chances;
10267 int rnd;
10268
10269 if (GetInventory().GetCargo())
10270 {
10271 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10272 rnd = Math.RandomInt(0,chances);
10273
10274 if (rnd < CHANCE_DAMAGE_CARGO)
10275 {
10277 }
10278 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10279 {
10281 }
10282 }
10283 else
10284 {
10285 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10286 rnd = Math.RandomInt(0,chances);
10287
10288 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10289 {
10291 }
10292 }
10293 }
10294 }
10295
10297 {
10298 CargoBase cargo = GetInventory().GetCargo();
10299 if (cargo)
10300 {
10302 if (item_count > 0)
10303 {
10304 int random_pick = Math.RandomInt(0, item_count);
10306 if (!item.IsExplosive())
10307 {
10308 item.AddHealth("","",damage);
10309 return true;
10310 }
10311 }
10312 }
10313 return false;
10314 }
10315
10317 {
10318 GameInventory inventory = GetInventory();
10320 if (attachment_count > 0)
10321 {
10322 int random_pick = Math.RandomInt(0, attachment_count);
10324 if (!attachment.IsExplosive())
10325 {
10326 attachment.AddHealth("","",damage);
10327 return true;
10328 }
10329 }
10330 return false;
10331 }
10332
10334 {
10336 }
10337
10339 {
10341 return GetInventory().CanRemoveEntity();
10342
10343 return false;
10344 }
10345
10347 {
10348
10350 return false;
10351
10352
10354 return false;
10355
10356
10357
10359 if (delta == 0)
10360 return false;
10361
10362
10363 return true;
10364 }
10365
10367 {
10369 {
10370 if (ScriptInputUserData.CanStoreInputUserData())
10371 {
10372 ScriptInputUserData ctx = new ScriptInputUserData;
10377 ctx.
Write(destination_entity);
10379 ctx.
Write(slot_id);
10381 }
10382 }
10383 else if (!
g_Game.IsMultiplayer())
10384 {
10386 }
10387 }
10388
10390 {
10391 float split_quantity_new;
10395 InventoryLocation loc = new InventoryLocation;
10396
10397 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10398 {
10400 split_quantity_new = stack_max;
10401 else
10403
10405 {
10406 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10407 if (new_item)
10408 {
10409 new_item.SetResultOfSplit(true);
10410 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10412 new_item.
SetQuantity(split_quantity_new,
false,
true);
10413 }
10414 }
10415 }
10416 else if (destination_entity && slot_id == -1)
10417 {
10418 if (quantity > stack_max)
10419 split_quantity_new = stack_max;
10420 else
10421 split_quantity_new = quantity;
10422
10424 {
10425 GameInventory destinationInventory = destination_entity.GetInventory();
10427 {
10430 }
10431
10432 if (new_item)
10433 {
10434 new_item.SetResultOfSplit(true);
10435 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10437 new_item.
SetQuantity(split_quantity_new,
false,
true);
10438 }
10439 }
10440 }
10441 else
10442 {
10443 if (stack_max != 0)
10444 {
10446 {
10448 }
10449
10450 if (split_quantity_new == 0)
10451 {
10452 if (!
g_Game.IsMultiplayer())
10453 player.PhysicalPredictiveDropItem(this);
10454 else
10455 player.ServerDropEntity(this);
10456 return;
10457 }
10458
10460 {
10462
10463 if (new_item)
10464 {
10465 new_item.SetResultOfSplit(true);
10466 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10469 new_item.PlaceOnSurface();
10470 }
10471 }
10472 }
10473 }
10474 }
10475
10477 {
10478 float split_quantity_new;
10482 InventoryLocation loc = new InventoryLocation;
10483
10484 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10485 {
10487 split_quantity_new = stack_max;
10488 else
10490
10492 {
10493 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10494 if (new_item)
10495 {
10496 new_item.SetResultOfSplit(true);
10497 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10499 new_item.
SetQuantity(split_quantity_new,
false,
true);
10500 }
10501 }
10502 }
10503 else if (destination_entity && slot_id == -1)
10504 {
10505 if (quantity > stack_max)
10506 split_quantity_new = stack_max;
10507 else
10508 split_quantity_new = quantity;
10509
10511 {
10512 GameInventory destinationInventory = destination_entity.GetInventory();
10514 {
10517 }
10518
10519 if (new_item)
10520 {
10521 new_item.SetResultOfSplit(true);
10522 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10524 new_item.
SetQuantity(split_quantity_new,
false,
true);
10525 }
10526 }
10527 }
10528 else
10529 {
10530 if (stack_max != 0)
10531 {
10533 {
10535 }
10536
10538 {
10540
10541 if (new_item)
10542 {
10543 new_item.SetResultOfSplit(true);
10544 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10547 new_item.PlaceOnSurface();
10548 }
10549 }
10550 }
10551 }
10552 }
10553
10555 {
10557 {
10558 if (ScriptInputUserData.CanStoreInputUserData())
10559 {
10560 ScriptInputUserData ctx = new ScriptInputUserData;
10565 dst.WriteToContext(ctx);
10567 }
10568 }
10569 else if (!
g_Game.IsMultiplayer())
10570 {
10572 }
10573 }
10574
10576 {
10578 {
10579 if (ScriptInputUserData.CanStoreInputUserData())
10580 {
10581 ScriptInputUserData ctx = new ScriptInputUserData;
10586 ctx.
Write(destination_entity);
10592 }
10593 }
10594 else if (!
g_Game.IsMultiplayer())
10595 {
10597 }
10598 }
10599
10601 {
10603 }
10604
10606 {
10608 float split_quantity_new;
10610 if (dst.IsValid())
10611 {
10612 int slot_id = dst.GetSlot();
10614
10615 if (quantity > stack_max)
10616 split_quantity_new = stack_max;
10617 else
10618 split_quantity_new = quantity;
10619
10621 {
10623
10624 if (new_item)
10625 {
10626 new_item.SetResultOfSplit(true);
10627 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10629 new_item.
SetQuantity(split_quantity_new,
false,
true);
10630 }
10631
10632 return new_item;
10633 }
10634 }
10635
10636 return null;
10637 }
10638
10640 {
10642 float split_quantity_new;
10644 if (destination_entity)
10645 {
10647 if (quantity > stackable)
10648 split_quantity_new = stackable;
10649 else
10650 split_quantity_new = quantity;
10651
10653 {
10654 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10655 if (new_item)
10656 {
10657 new_item.SetResultOfSplit(true);
10658 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10660 new_item.
SetQuantity(split_quantity_new,
false,
true);
10661 }
10662 }
10663 }
10664 }
10665
10667 {
10669 {
10670 if (ScriptInputUserData.CanStoreInputUserData())
10671 {
10672 ScriptInputUserData ctx = new ScriptInputUserData;
10677 ItemBase destination_entity =
this;
10678 ctx.
Write(destination_entity);
10682 }
10683 }
10684 else if (!
g_Game.IsMultiplayer())
10685 {
10687 }
10688 }
10689
10691 {
10693 float split_quantity_new;
10695 if (player)
10696 {
10698 if (quantity > stackable)
10699 split_quantity_new = stackable;
10700 else
10701 split_quantity_new = quantity;
10702
10704 {
10705 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10706 new_item =
ItemBase.Cast(in_hands);
10707 if (new_item)
10708 {
10709 new_item.SetResultOfSplit(true);
10710 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10712 new_item.SetQuantity(split_quantity_new, false, true);
10713 }
10714 }
10715 }
10716 }
10717
10719 {
10721 float split_quantity_new = Math.Floor(quantity * 0.5);
10722
10724 return;
10725
10727
10728 if (new_item)
10729 {
10730 if (new_item.GetQuantityMax() < split_quantity_new)
10731 {
10732 split_quantity_new = new_item.GetQuantityMax();
10733 }
10734
10735 new_item.SetResultOfSplit(true);
10736 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10737
10739 {
10742 }
10743 else
10744 {
10746 new_item.
SetQuantity(split_quantity_new,
false,
true);
10747 }
10748 }
10749 }
10750
10752 {
10754 float split_quantity_new = Math.Floor(quantity / 2);
10755
10757 return;
10758
10759 InventoryLocation invloc = new InventoryLocation;
10761
10763 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10764
10765 if (new_item)
10766 {
10767 if (new_item.GetQuantityMax() < split_quantity_new)
10768 {
10769 split_quantity_new = new_item.GetQuantityMax();
10770 }
10772 {
10775 }
10776 else if (split_quantity_new > 1)
10777 {
10779 new_item.
SetQuantity(split_quantity_new,
false,
true);
10780 }
10781 }
10782 }
10783
10786 {
10787 SetWeightDirty();
10789
10790 if (parent)
10791 parent.OnAttachmentQuantityChangedEx(this, delta);
10792
10794 {
10796 {
10798 }
10800 {
10801 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10803 }
10804 }
10805 }
10806
10809 {
10810
10811 }
10812
10815 {
10817 }
10818
10820 {
10821 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10822
10824 {
10825 if (newLevel == GameConstants.STATE_RUINED)
10826 {
10828 EntityAI parent = GetHierarchyParent();
10829 if (parent && parent.IsFireplace())
10830 {
10831 CargoBase cargo = GetInventory().GetCargo();
10832 if (cargo)
10833 {
10835 {
10837 }
10838 }
10839 }
10840 }
10841
10843 {
10844
10846 return;
10847 }
10848
10849 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10850 {
10852 }
10853 }
10854 }
10855
10856
10858 {
10859 super.OnRightClick();
10860
10862 {
10864 {
10865 if (ScriptInputUserData.CanStoreInputUserData())
10866 {
10867 EntityAI root = GetHierarchyRoot();
10868 Man playerOwner = GetHierarchyRootPlayer();
10869 InventoryLocation dst = new InventoryLocation;
10870
10871
10872 if (!playerOwner && root && root == this)
10873 {
10875 }
10876 else
10877 {
10878
10879 GetInventory().GetCurrentInventoryLocation(dst);
10881 {
10882 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10884 {
10886 }
10887 else
10888 {
10890
10891
10892 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10893 {
10895 }
10896 else
10897 {
10898 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10899 }
10900 }
10901 }
10902 }
10903
10904 ScriptInputUserData ctx = new ScriptInputUserData;
10912 }
10913 }
10914 else if (!
g_Game.IsMultiplayer())
10915 {
10917 }
10918 }
10919 }
10920
10922 {
10923 if (root)
10924 {
10925 vector m4[4];
10926 root.GetTransform(m4);
10927 dst.SetGround(this, m4);
10928 }
10929 else
10930 {
10931 GetInventory().GetCurrentInventoryLocation(dst);
10932 }
10933 }
10934
10935 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10936 {
10937
10938 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10939 return false;
10940
10941 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10942 return false;
10943
10944
10946 return false;
10947
10948
10949 Magazine mag = Magazine.Cast(this);
10950 if (mag)
10951 {
10952 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10953 return false;
10954
10955 if (stack_max_limit)
10956 {
10957 Magazine other_mag = Magazine.Cast(other_item);
10958 if (other_item)
10959 {
10960 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10961 return false;
10962 }
10963
10964 }
10965 }
10966 else
10967 {
10968
10970 return false;
10971
10973 return false;
10974 }
10975
10976 PlayerBase player = null;
10977 if (CastTo(player, GetHierarchyRootPlayer()))
10978 {
10979 if (player.GetInventory().HasAttachment(this))
10980 return false;
10981
10982 if (player.IsItemsToDelete())
10983 return false;
10984 }
10985
10986 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10987 return false;
10988
10989 int slotID;
10991 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10992 return false;
10993
10994 return true;
10995 }
10996
10998 {
11000 }
11001
11003 {
11004 return m_IsResultOfSplit;
11005 }
11006
11008 {
11009 m_IsResultOfSplit = value;
11010 }
11011
11013 {
11015 }
11016
11018 {
11019 float other_item_quantity = other_item.GetQuantity();
11020 float this_free_space;
11021
11023
11025
11026 if (other_item_quantity > this_free_space)
11027 {
11028 return this_free_space;
11029 }
11030 else
11031 {
11032 return other_item_quantity;
11033 }
11034 }
11035
11037 {
11039 }
11040
11042 {
11044 return;
11045
11046 if (!IsMagazine() && other_item)
11047 {
11049 if (quantity_used != 0)
11050 {
11051 float hp1 = GetHealth01("","");
11052 float hp2 = other_item.GetHealth01("","");
11053 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11054 hpResult = hpResult / (
GetQuantity() + quantity_used);
11055
11056 hpResult *= GetMaxHealth();
11057 Math.Round(hpResult);
11058 SetHealth("", "Health", hpResult);
11059
11061 other_item.AddQuantity(-quantity_used);
11062 }
11063 }
11065 }
11066
11068 {
11069 #ifdef SERVER
11070 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11071 GetHierarchyParent().IncreaseLifetimeUp();
11072 #endif
11073 };
11074
11076 {
11077 PlayerBase p = PlayerBase.Cast(player);
11078
11079 array<int> recipesIds = p.m_Recipes;
11080 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11081 if (moduleRecipesManager)
11082 {
11083 EntityAI itemInHands = player.GetEntityInHands();
11084 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11085 }
11086
11087 for (int i = 0;i < recipesIds.Count(); i++)
11088 {
11089 int key = recipesIds.Get(i);
11090 string recipeName = moduleRecipesManager.GetRecipeName(key);
11092 }
11093 }
11094
11095
11096 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11097 {
11098 super.GetDebugActions(outputList);
11099
11100
11106
11107
11112
11117
11118
11122
11123
11125 {
11129 }
11130
11133
11134
11138
11140
11141 InventoryLocation loc = new InventoryLocation();
11142 GetInventory().GetCurrentInventoryLocation(loc);
11144 {
11145 if (Gizmo_IsSupported())
11148 }
11149
11151 }
11152
11153
11154
11155
11157 {
11158 super.OnAction(action_id, player, ctx);
11159
11161 {
11162 switch (action_id)
11163 {
11167 return true;
11171 return true;
11172 }
11173 }
11174
11176 {
11177 switch (action_id)
11178 {
11180 Delete();
11181 return true;
11182 }
11183 }
11184
11185 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11186 {
11187 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11188 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11189 PlayerBase p = PlayerBase.Cast(player);
11190 if (
EActions.RECIPES_RANGE_START < 1000)
11191 {
11192 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11193 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11194 }
11195 }
11196 #ifndef SERVER
11197 else if (action_id ==
EActions.WATCH_PLAYER)
11198 {
11199 PluginDeveloper.SetDeveloperItemClientEx(player);
11200 }
11201 #endif
11203 {
11204 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11205 {
11206 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11207 OnDebugButtonPressServer(id + 1);
11208 }
11209
11210 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11211 {
11212 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11214 }
11215
11216 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11217 {
11218 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11220 }
11221
11222 else if (action_id ==
EActions.ADD_QUANTITY)
11223 {
11224 if (IsMagazine())
11225 {
11226 Magazine mag = Magazine.Cast(this);
11227 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11228 }
11229 else
11230 {
11232 }
11233
11234 if (m_EM)
11235 {
11236 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11237 }
11238
11239 }
11240
11241 else if (action_id ==
EActions.REMOVE_QUANTITY)
11242 {
11243 if (IsMagazine())
11244 {
11245 Magazine mag2 = Magazine.Cast(this);
11246 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11247 }
11248 else
11249 {
11251 }
11252 if (m_EM)
11253 {
11254 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11255 }
11256
11257 }
11258
11259 else if (action_id ==
EActions.SET_QUANTITY_0)
11260 {
11262
11263 if (m_EM)
11264 {
11265 m_EM.SetEnergy(0);
11266 }
11267 }
11268
11269 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11270 {
11272
11273 if (m_EM)
11274 {
11275 m_EM.SetEnergy(m_EM.GetEnergyMax());
11276 }
11277 }
11278
11279 else if (action_id ==
EActions.ADD_HEALTH)
11280 {
11281 AddHealth("","",GetMaxHealth("","Health")/5);
11282 }
11283 else if (action_id ==
EActions.REMOVE_HEALTH)
11284 {
11285 AddHealth("","",-GetMaxHealth("","Health")/5);
11286 }
11287 else if (action_id ==
EActions.DESTROY_HEALTH)
11288 {
11289 SetHealth01("","",0);
11290 }
11291 else if (action_id ==
EActions.WATCH_ITEM)
11292 {
11294 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11295 #ifdef DEVELOPER
11296 SetDebugDeveloper_item(this);
11297 #endif
11298 }
11299
11300 else if (action_id ==
EActions.ADD_TEMPERATURE)
11301 {
11302 AddTemperature(20);
11303
11304 }
11305
11306 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11307 {
11308 AddTemperature(-20);
11309
11310 }
11311
11312 else if (action_id ==
EActions.FLIP_FROZEN)
11313 {
11314 SetFrozen(!GetIsFrozen());
11315
11316 }
11317
11318 else if (action_id ==
EActions.ADD_WETNESS)
11319 {
11321
11322 }
11323
11324 else if (action_id ==
EActions.REMOVE_WETNESS)
11325 {
11327
11328 }
11329
11330 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11331 {
11334
11335
11336 }
11337
11338 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11339 {
11342 }
11343
11344 else if (action_id ==
EActions.MAKE_SPECIAL)
11345 {
11346 auto debugParams = DebugSpawnParams.WithPlayer(player);
11347 OnDebugSpawnEx(debugParams);
11348 }
11349
11350 }
11351
11352
11353 return false;
11354 }
11355
11356
11357
11358
11362
11365
11366
11367
11369 {
11370 return false;
11371 }
11372
11373
11375 {
11376 return true;
11377 }
11378
11379
11381 {
11382 return true;
11383 }
11384
11385
11386
11388 {
11389 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11390 return g_Game.ConfigIsExisting(config_path);
11391 }
11392
11395 {
11396 return null;
11397 }
11398
11400 {
11401 return false;
11402 }
11403
11405 {
11406 return false;
11407 }
11408
11412
11413
11415 {
11416 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11417 return module_repairing.CanRepair(this, item_repair_kit);
11418 }
11419
11420
11421 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11422 {
11423 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11424 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11425 }
11426
11427
11429 {
11430
11431
11432
11433
11434
11435
11436
11437
11438 return 1;
11439 }
11440
11441
11442
11444 {
11446 }
11447
11448
11449
11451 {
11453 }
11454
11455
11464 {
11465 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11466
11467 if (player)
11468 {
11469 player.MessageStatus(text);
11470 }
11471 }
11472
11473
11482 {
11483 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11484
11485 if (player)
11486 {
11487 player.MessageAction(text);
11488 }
11489 }
11490
11491
11500 {
11501 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11502
11503 if (player)
11504 {
11505 player.MessageFriendly(text);
11506 }
11507 }
11508
11509
11518 {
11519 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11520
11521 if (player)
11522 {
11523 player.MessageImportant(text);
11524 }
11525 }
11526
11528 {
11529 return true;
11530 }
11531
11532
11533 override bool KindOf(
string tag)
11534 {
11535 bool found = false;
11536 string item_name = this.
GetType();
11538 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11539
11540 int array_size = item_tag_array.Count();
11541 for (int i = 0; i < array_size; i++)
11542 {
11543 if (item_tag_array.Get(i) == tag)
11544 {
11545 found = true;
11546 break;
11547 }
11548 }
11549 return found;
11550 }
11551
11552
11554 {
11555
11556 super.OnRPC(sender, rpc_type,ctx);
11557
11558
11559 switch (rpc_type)
11560 {
11561 #ifndef SERVER
11562 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11563 Param2<bool, string> p = new Param2<bool, string>(false, "");
11564
11566 return;
11567
11568 bool play = p.param1;
11569 string soundSet = p.param2;
11570
11571 if (play)
11572 {
11574 {
11576 {
11578 }
11579 }
11580 else
11581 {
11583 }
11584 }
11585 else
11586 {
11588 }
11589
11590 break;
11591 #endif
11592
11593 }
11594
11596 {
11598 }
11599 }
11600
11601
11602
11603
11605 {
11606 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11607 return plugin.GetID(
name);
11608 }
11609
11611 {
11612 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11613 return plugin.GetName(id);
11614 }
11615
11618 {
11619
11620
11621 int varFlags;
11622 if (!ctx.
Read(varFlags))
11623 return;
11624
11625 if (varFlags & ItemVariableFlags.FLOAT)
11626 {
11628 }
11629 }
11630
11632 {
11633
11634 super.SerializeNumericalVars(floats_out);
11635
11636
11637
11639 {
11641 }
11642
11644 {
11646 }
11647
11649 {
11651 }
11652
11654 {
11659 }
11660
11662 {
11664 }
11665 }
11666
11668 {
11669
11670 super.DeSerializeNumericalVars(floats);
11671
11672
11673 int index = 0;
11674 int mask = Math.Round(floats.Get(index));
11675
11676 index++;
11677
11679 {
11681 {
11683 }
11684 else
11685 {
11686 float quantity = floats.Get(index);
11687 SetQuantity(quantity,
true,
false,
false,
false);
11688 }
11689 index++;
11690 }
11691
11693 {
11694 float wet = floats.Get(index);
11696 index++;
11697 }
11698
11700 {
11701 int liquidtype = Math.Round(floats.Get(index));
11703 index++;
11704 }
11705
11707 {
11709 index++;
11711 index++;
11713 index++;
11715 index++;
11716 }
11717
11719 {
11720 int cleanness = Math.Round(floats.Get(index));
11722 index++;
11723 }
11724 }
11725
11727 {
11728 super.WriteVarsToCTX(ctx);
11729
11730
11732 {
11734 }
11735
11737 {
11739 }
11740
11742 {
11744 }
11745
11747 {
11748 int r,g,b,a;
11754 }
11755
11757 {
11759 }
11760 }
11761
11763 {
11764 if (!super.ReadVarsFromCTX(ctx,version))
11765 return false;
11766
11767 int intValue;
11768 float value;
11769
11770 if (version < 140)
11771 {
11772 if (!ctx.
Read(intValue))
11773 return false;
11774
11775 m_VariablesMask = intValue;
11776 }
11777
11779 {
11780 if (!ctx.
Read(value))
11781 return false;
11782
11784 {
11786 }
11787 else
11788 {
11790 }
11791 }
11792
11793 if (version < 140)
11794 {
11796 {
11797 if (!ctx.
Read(value))
11798 return false;
11799 SetTemperatureDirect(value);
11800 }
11801 }
11802
11804 {
11805 if (!ctx.
Read(value))
11806 return false;
11808 }
11809
11811 {
11812 if (!ctx.
Read(intValue))
11813 return false;
11815 }
11816
11818 {
11819 int r,g,b,a;
11821 return false;
11823 return false;
11825 return false;
11827 return false;
11828
11830 }
11831
11833 {
11834 if (!ctx.
Read(intValue))
11835 return false;
11837 }
11838
11839 if (version >= 138 && version < 140)
11840 {
11842 {
11843 if (!ctx.
Read(intValue))
11844 return false;
11845 SetFrozen(intValue);
11846 }
11847 }
11848
11849 return true;
11850 }
11851
11852
11854 {
11857 {
11859 }
11860
11861 if (!super.OnStoreLoad(ctx, version))
11862 {
11864 return false;
11865 }
11866
11867 if (version >= 114)
11868 {
11869 bool hasQuickBarIndexSaved;
11870
11871 if (!ctx.
Read(hasQuickBarIndexSaved))
11872 {
11874 return false;
11875 }
11876
11877 if (hasQuickBarIndexSaved)
11878 {
11879 int itmQBIndex;
11880
11881
11882 if (!ctx.
Read(itmQBIndex))
11883 {
11885 return false;
11886 }
11887
11888 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11889 if (itmQBIndex != -1 && parentPlayer)
11890 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11891 }
11892 }
11893 else
11894 {
11895
11896 PlayerBase player;
11897 int itemQBIndex;
11898 if (version ==
int.
MAX)
11899 {
11900 if (!ctx.
Read(itemQBIndex))
11901 {
11903 return false;
11904 }
11905 }
11906 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11907 {
11908
11909 if (!ctx.
Read(itemQBIndex))
11910 {
11912 return false;
11913 }
11914 if (itemQBIndex != -1 && player)
11915 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11916 }
11917 }
11918
11919 if (version < 140)
11920 {
11921
11922 if (!LoadVariables(ctx, version))
11923 {
11925 return false;
11926 }
11927 }
11928
11929
11931 {
11933 return false;
11934 }
11935 if (version >= 132)
11936 {
11938 if (raib)
11939 {
11941 {
11943 return false;
11944 }
11945 }
11946 }
11947
11949 return true;
11950 }
11951
11952
11953
11955 {
11956 super.OnStoreSave(ctx);
11957
11958 PlayerBase player;
11959 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11960 {
11962
11963 int itemQBIndex = -1;
11964 itemQBIndex = player.FindQuickBarEntityIndex(this);
11965 ctx.
Write(itemQBIndex);
11966 }
11967 else
11968 {
11970 }
11971
11973
11975 if (raib)
11976 {
11978 }
11979 }
11980
11981
11983 {
11984 super.AfterStoreLoad();
11985
11987 {
11989 }
11990
11992 {
11995 }
11996 }
11997
11999 {
12000 super.EEOnAfterLoad();
12001
12003 {
12005 }
12006
12009 }
12010
12012 {
12013 return false;
12014 }
12015
12016
12017
12019 {
12021 {
12022 #ifdef PLATFORM_CONSOLE
12023
12025 {
12027 if (menu)
12028 {
12030 }
12031 }
12032 #endif
12033 }
12034
12036 {
12039 }
12040
12042 {
12043 SetWeightDirty();
12045 }
12047 {
12050 }
12051
12053 {
12056
12059 }
12061 {
12065 }
12066
12067 super.OnVariablesSynchronized();
12068 }
12069
12070
12071
12073 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12074 {
12075 if (!IsServerCheck(allow_client))
12076 return false;
12077
12079 return false;
12080
12083
12084 if (value <= (min + 0.001))
12085 value = min;
12086
12087 if (value == min)
12088 {
12089 if (destroy_config)
12090 {
12091 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12092 if (dstr)
12093 {
12095 this.Delete();
12096 return true;
12097 }
12098 }
12099 else if (destroy_forced)
12100 {
12102 this.Delete();
12103 return true;
12104 }
12105
12107 }
12108
12111
12113 {
12114 EntityAI parent = GetHierarchyRoot();
12115 InventoryLocation iLoc = new InventoryLocation();
12116 GetInventory().GetCurrentInventoryLocation(iLoc);
12118 {
12119 int iLocSlot = iLoc.
GetSlot();
12121 {
12123 }
12125 {
12127 }
12128 }
12129 }
12130
12132 {
12134
12135 if (delta)
12137 }
12138
12140
12141 return false;
12142 }
12143
12144
12146 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12147 {
12149 }
12150
12152 {
12155 }
12156
12158 {
12161 }
12162
12164 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12165 {
12166 float value_clamped = Math.Clamp(value, 0, 1);
12168 SetQuantity(result, destroy_config, destroy_forced);
12169 }
12170
12171
12174 {
12176 }
12177
12179 {
12181 }
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12193 {
12194 int slot = -1;
12195 GameInventory inventory = GetInventory();
12196 if (inventory)
12197 {
12198 InventoryLocation il = new InventoryLocation;
12201 }
12202
12204 }
12205
12207 {
12208 float quantity_max = 0;
12209
12211 {
12212 if (attSlotID != -1)
12213 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12214
12215 if (quantity_max <= 0)
12217 }
12218
12219 if (quantity_max <= 0)
12221
12222 return quantity_max;
12223 }
12224
12226 {
12228 }
12229
12231 {
12233 }
12234
12235
12237 {
12239 }
12240
12242 {
12244 }
12245
12247 {
12249 }
12250
12251
12253 {
12254
12255 float weightEx = GetWeightEx();
12256 float special = GetInventoryAndCargoWeight();
12257 return weightEx - special;
12258 }
12259
12260
12262 {
12264 }
12265
12267 {
12269 {
12270 #ifdef DEVELOPER
12271 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12272 {
12273 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12275 }
12276 #endif
12277
12278 return GetQuantity() * GetConfigWeightModified();
12279 }
12280 else if (HasEnergyManager())
12281 {
12282 #ifdef DEVELOPER
12283 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12284 {
12285 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12286 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12287 }
12288 #endif
12289 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12290 }
12291 else
12292 {
12293 #ifdef DEVELOPER
12294 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12295 {
12296 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12297 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12298 }
12299 #endif
12300 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12301 }
12302 }
12303
12306 {
12307 int item_count = 0;
12309
12310 GameInventory inventory = GetInventory();
12311 CargoBase cargo = inventory.
GetCargo();
12312 if (cargo != NULL)
12313 {
12315 }
12316
12318 for (int i = 0; i < nAttachments; ++i)
12319 {
12321 if (item)
12322 item_count += item.GetNumberOfItems();
12323 }
12324 return item_count;
12325 }
12326
12329 {
12330 float weight = 0;
12331 float wetness = 1;
12332 if (include_wetness)
12335 {
12336 weight = wetness * m_ConfigWeight;
12337 }
12339 {
12340 weight = 1;
12341 }
12342 return weight;
12343 }
12344
12345
12346
12348 {
12349 GameInventory inventory = GetInventory();
12350 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12351 {
12352 array<EntityAI> items = new array<EntityAI>;
12354 for (int i = 0; i < items.Count(); ++i)
12355 {
12357 if (item)
12358 {
12359 g_Game.ObjectDelete(item);
12360 }
12361 }
12362 }
12363 }
12364
12365
12366
12367
12369 {
12370 float energy = 0;
12371 if (HasEnergyManager())
12372 {
12373 energy = GetCompEM().GetEnergy();
12374 }
12375 return energy;
12376 }
12377
12378
12380 {
12381 super.OnEnergyConsumed();
12382
12384 }
12385
12387 {
12388 super.OnEnergyAdded();
12389
12391 }
12392
12393
12395 {
12396 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12397 {
12399 {
12400 float energy_0to1 = GetCompEM().GetEnergy0To1();
12402 }
12403 }
12404 }
12405
12406
12408 {
12409 return ConfigGetFloat("heatIsolation");
12410 }
12411
12413 {
12415 }
12416
12418 {
12419 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12420 if (
g_Game.ConfigIsExisting(paramPath))
12421 return g_Game.ConfigGetFloat(paramPath);
12422
12423 return 0.0;
12424 }
12425
12427 {
12428 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12429 if (
g_Game.ConfigIsExisting(paramPath))
12430 return g_Game.ConfigGetFloat(paramPath);
12431
12432 return 0.0;
12433 }
12434
12435 override void SetWet(
float value,
bool allow_client =
false)
12436 {
12437 if (!IsServerCheck(allow_client))
12438 return;
12439
12442
12444
12445 m_VarWet = Math.Clamp(value, min, max);
12446
12448 {
12451 }
12452 }
12453
12454 override void AddWet(
float value)
12455 {
12457 }
12458
12460 {
12462 }
12463
12465 {
12467 }
12468
12470 {
12472 }
12473
12475 {
12477 }
12478
12480 {
12482 }
12483
12484 override void OnWetChanged(
float newVal,
float oldVal)
12485 {
12488 if (newLevel != oldLevel)
12489 {
12491 }
12492 }
12493
12495 {
12496 SetWeightDirty();
12497 }
12498
12500 {
12501 return GetWetLevelInternal(
m_VarWet);
12502 }
12503
12504
12505
12507 {
12509 }
12510
12512 {
12514 }
12515
12517 {
12519 }
12520
12522 {
12524 }
12525
12526
12527
12529 {
12530 if (ConfigIsExisting("itemModelLength"))
12531 {
12532 return ConfigGetFloat("itemModelLength");
12533 }
12534 return 0;
12535 }
12536
12538 {
12539 if (ConfigIsExisting("itemAttachOffset"))
12540 {
12541 return ConfigGetFloat("itemAttachOffset");
12542 }
12543 return 0;
12544 }
12545
12546 override void SetCleanness(
int value,
bool allow_client =
false)
12547 {
12548 if (!IsServerCheck(allow_client))
12549 return;
12550
12552
12554
12557 }
12558
12560 {
12562 }
12563
12565 {
12566 return true;
12567 }
12568
12569
12570
12571
12573 {
12575 }
12576
12578 {
12580 }
12581
12582
12583
12584
12585 override void SetColor(
int r,
int g,
int b,
int a)
12586 {
12592 }
12594 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12595 {
12600 }
12601
12603 {
12605 }
12606
12609 {
12610 int r,g,b,a;
12612 r = r/255;
12613 g = g/255;
12614 b = b/255;
12615 a = a/255;
12616 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12617 }
12618
12619
12620
12621 override void SetLiquidType(
int value,
bool allow_client =
false)
12622 {
12623 if (!IsServerCheck(allow_client))
12624 return;
12625
12630 }
12631
12633 {
12634 return ConfigGetInt("varLiquidTypeInit");
12635 }
12636
12638 {
12640 }
12641
12643 {
12645 SetFrozen(false);
12646 }
12647
12650 {
12651 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12652 }
12653
12654
12657 {
12658 PlayerBase nplayer;
12659 if (PlayerBase.CastTo(nplayer, player))
12660 {
12662 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12663 }
12664 }
12665
12666
12669 {
12670 PlayerBase nplayer;
12671 if (PlayerBase.CastTo(nplayer,player))
12672 {
12673 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12674 }
12675
12676 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12677
12678 if (HasEnergyManager())
12679 {
12680 GetCompEM().UpdatePlugState();
12681 }
12682 }
12683
12684
12686 {
12687 super.OnPlacementStarted(player);
12688
12690 }
12691
12692 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12693 {
12695 {
12696 m_AdminLog.OnPlacementComplete(player,
this);
12697 }
12698
12699 super.OnPlacementComplete(player, position, orientation);
12700 }
12701
12702
12703
12704
12705
12707 {
12709 {
12710 return true;
12711 }
12712 else
12713 {
12714 return false;
12715 }
12716 }
12717
12718
12720 {
12722 {
12724 }
12725 }
12726
12727
12729 {
12731 }
12732
12734 {
12736 }
12737
12738 override void InsertAgent(
int agent,
float count = 1)
12739 {
12740 if (count < 1)
12741 return;
12742
12744 }
12745
12748 {
12750 }
12751
12752
12754 {
12756 }
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12800 {
12802 return false;
12803 return true;
12804 }
12805
12807 {
12808
12810 }
12811
12812
12815 {
12816 super.CheckForRoofLimited(timeTresholdMS);
12817
12818 float time =
g_Game.GetTime();
12819 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12820 {
12821 m_PreviousRoofTestTime = time;
12822 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12823 }
12824 }
12825
12826
12828 {
12830 {
12831 return 0;
12832 }
12833
12834 if (GetInventory().GetAttachmentSlotsCount() != 0)
12835 {
12836 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12837 if (filter)
12838 return filter.GetProtectionLevel(type, false, system);
12839 else
12840 return 0;
12841 }
12842
12843 string subclassPath, entryName;
12844
12845 switch (type)
12846 {
12848 entryName = "biological";
12849 break;
12851 entryName = "chemical";
12852 break;
12853 default:
12854 entryName = "biological";
12855 break;
12856 }
12857
12858 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12859
12860 return g_Game.ConfigGetFloat(subclassPath + entryName);
12861 }
12862
12863
12864
12867 {
12868 if (!IsMagazine())
12870
12872 }
12873
12874
12875
12876
12877
12882 {
12883 return true;
12884 }
12885
12887 {
12889 }
12890
12891
12892
12893
12894
12896 {
12897 if (parent)
12898 {
12899 if (parent.IsInherited(DayZInfected))
12900 return true;
12901
12902 if (!parent.IsRuined())
12903 return true;
12904 }
12905
12906 return true;
12907 }
12908
12910 {
12911 if (!super.CanPutAsAttachment(parent))
12912 {
12913 return false;
12914 }
12915
12916 if (!IsRuined() && !parent.IsRuined())
12917 {
12918 return true;
12919 }
12920
12921 return false;
12922 }
12923
12925 {
12926
12927
12928
12929
12930 return super.CanReceiveItemIntoCargo(item);
12931 }
12932
12934 {
12935
12936
12937
12938
12939 GameInventory attachmentInv = attachment.GetInventory();
12941 {
12942 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12943 return false;
12944 }
12945
12946 InventoryLocation loc = new InventoryLocation();
12947 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12948 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12949 return false;
12950
12951 return super.CanReceiveAttachment(attachment, slotId);
12952 }
12953
12955 {
12956 if (!super.CanReleaseAttachment(attachment))
12957 return false;
12958
12959 return GetInventory().AreChildrenAccessible();
12960 }
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976
12977
12978
12979
12980
12981
12983 {
12984 int id = muzzle_owner.GetMuzzleID();
12985 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12986
12987 if (WPOF_array)
12988 {
12989 for (int i = 0; i < WPOF_array.Count(); i++)
12990 {
12991 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12992
12993 if (WPOF)
12994 {
12995 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12996 }
12997 }
12998 }
12999 }
13000
13001
13003 {
13004 int id = muzzle_owner.GetMuzzleID();
13006
13007 if (WPOBE_array)
13008 {
13009 for (int i = 0; i < WPOBE_array.Count(); i++)
13010 {
13011 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13012
13013 if (WPOBE)
13014 {
13015 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13016 }
13017 }
13018 }
13019 }
13020
13021
13023 {
13024 int id = muzzle_owner.GetMuzzleID();
13025 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13026
13027 if (WPOOH_array)
13028 {
13029 for (int i = 0; i < WPOOH_array.Count(); i++)
13030 {
13031 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13032
13033 if (WPOOH)
13034 {
13035 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13036 }
13037 }
13038 }
13039 }
13040
13041
13043 {
13044 int id = muzzle_owner.GetMuzzleID();
13045 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13046
13047 if (WPOOH_array)
13048 {
13049 for (int i = 0; i < WPOOH_array.Count(); i++)
13050 {
13051 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13052
13053 if (WPOOH)
13054 {
13055 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13056 }
13057 }
13058 }
13059 }
13060
13061
13063 {
13064 int id = muzzle_owner.GetMuzzleID();
13065 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13066
13067 if (WPOOH_array)
13068 {
13069 for (int i = 0; i < WPOOH_array.Count(); i++)
13070 {
13071 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13072
13073 if (WPOOH)
13074 {
13075 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13076 }
13077 }
13078 }
13079 }
13080
13081
13082
13084 {
13086 {
13087 return true;
13088 }
13089
13090 return false;
13091 }
13092
13094 {
13096 {
13097 return true;
13098 }
13099
13100 return false;
13101 }
13102
13104 {
13106 {
13107 return true;
13108 }
13109
13110 return false;
13111 }
13112
13114 {
13115 return false;
13116 }
13117
13120 {
13121 return UATimeSpent.DEFAULT_DEPLOY;
13122 }
13123
13124
13125
13126
13128 {
13130 SetSynchDirty();
13131 }
13132
13134 {
13136 }
13137
13138
13140 {
13141 return false;
13142 }
13143
13146 {
13147 string att_type = "None";
13148
13149 if (ConfigIsExisting("soundAttType"))
13150 {
13151 att_type = ConfigGetString("soundAttType");
13152 }
13153
13155 }
13156
13158 {
13160 }
13161
13162
13163
13164
13165
13171
13173 {
13176
13178 }
13179
13180
13182 {
13184 return;
13185
13187
13190
13193
13194 SoundParameters params = new SoundParameters();
13198 }
13199
13200
13202 {
13204 {
13207
13208 SetSynchDirty();
13209
13212 }
13213 }
13214
13216 {
13218 }
13219
13220
13222 {
13224 return;
13225
13227 SetSynchDirty();
13228
13231 }
13232
13234 {
13237 }
13238
13240 {
13242 }
13243
13244 void OnApply(PlayerBase player);
13245
13247 {
13248 return 1.0;
13249 };
13250
13252 {
13254 }
13255
13257 {
13259 }
13260
13262
13264 {
13265 SetDynamicPhysicsLifeTime(0.01);
13267 }
13268
13270 {
13271 array<string> zone_names = new array<string>;
13272 GetDamageZones(zone_names);
13273 for (int i = 0; i < zone_names.Count(); i++)
13274 {
13275 SetHealthMax(zone_names.Get(i),"Health");
13276 }
13277 SetHealthMax("","Health");
13278 }
13279
13282 {
13283 float global_health = GetHealth01("","Health");
13284 array<string> zones = new array<string>;
13285 GetDamageZones(zones);
13286
13287 for (int i = 0; i < zones.Count(); i++)
13288 {
13289 SetHealth01(zones.Get(i),"Health",global_health);
13290 }
13291 }
13292
13295 {
13296 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13297 }
13298
13300 {
13301 if (!hasRootAsPlayer)
13302 {
13303 if (refParentIB)
13304 {
13305
13306 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13307 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13308
13309 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13310 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13311
13314 }
13315 else
13316 {
13317
13320 }
13321 }
13322 }
13323
13325 {
13327 {
13328 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13329 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13330 {
13331 float heatPermCoef = 1.0;
13333 while (ent)
13334 {
13335 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13336 ent = ent.GetHierarchyParent();
13337 }
13338
13339 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13340 }
13341 }
13342 }
13343
13345 {
13346
13347 EntityAI parent = GetHierarchyParent();
13348 if (!parent)
13349 {
13350 hasParent = false;
13351 hasRootAsPlayer = false;
13352 }
13353 else
13354 {
13355 hasParent = true;
13356 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13357 refParentIB =
ItemBase.Cast(parent);
13358 }
13359 }
13360
13361 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13362 {
13363
13364 }
13365
13367 {
13368
13369 return false;
13370 }
13371
13373 {
13374
13375
13376 return false;
13377 }
13378
13380 {
13381
13382 return false;
13383 }
13384
13387 {
13388 return !GetIsFrozen() &&
IsOpen();
13389 }
13390
13392 {
13393 bool hasParent = false, hasRootAsPlayer = false;
13395
13396 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13397 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13398
13399 if (wwtu || foodDecay)
13400 {
13404
13405 if (processWetness || processTemperature || processDecay)
13406 {
13408
13409 if (processWetness)
13410 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13411
13412 if (processTemperature)
13414
13415 if (processDecay)
13416 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13417 }
13418 }
13419 }
13420
13423 {
13425 }
13426
13428 {
13431
13432 return super.GetTemperatureFreezeThreshold();
13433 }
13434
13436 {
13439
13440 return super.GetTemperatureThawThreshold();
13441 }
13442
13444 {
13447
13448 return super.GetItemOverheatThreshold();
13449 }
13450
13452 {
13454 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13455
13456 return super.GetTemperatureFreezeTime();
13457 }
13458
13460 {
13462 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13463
13464 return super.GetTemperatureThawTime();
13465 }
13466
13471
13473 {
13474 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13475 }
13476
13478 {
13479 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13480 }
13481
13484 {
13486 }
13487
13489 {
13491 }
13492
13494 {
13496 }
13497
13500 {
13501 return null;
13502 }
13503
13506 {
13507 return false;
13508 }
13509
13511 {
13513 {
13516 if (!trg)
13517 {
13519 explosive = this;
13520 }
13521
13522 explosive.PairRemote(trg);
13524
13525 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13526 trg.SetPersistentPairID(persistentID);
13527 explosive.SetPersistentPairID(persistentID);
13528
13529 return true;
13530 }
13531 return false;
13532 }
13533
13536 {
13537 float ret = 1.0;
13540 ret *= GetHealth01();
13541
13542 return ret;
13543 }
13544
13545 #ifdef DEVELOPER
13546 override void SetDebugItem()
13547 {
13548 super.SetDebugItem();
13549 _itemBase = this;
13550 }
13551
13553 {
13554 string text = super.GetDebugText();
13555
13557 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13558
13559 return text;
13560 }
13561 #endif
13562
13564 {
13565 return true;
13566 }
13567
13569
13571
13573 {
13576 }
13577
13578
13586
13602
13603 [
Obsolete(
"Use ItemSoundHandler instead")]
13606 {
13607 if (!
g_Game.IsDedicatedServer())
13608 {
13609 if (ConfigIsExisting("attachSoundSet"))
13610 {
13611 string cfg_path = "";
13612 string soundset = "";
13613 string type_name =
GetType();
13614
13617 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13618 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13619
13620 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13621 {
13622 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13623 {
13624 if (cfg_slot_array[i] == slot_type)
13625 {
13626 soundset = cfg_soundset_array[i];
13627 break;
13628 }
13629 }
13630 }
13631
13632 if (soundset != "")
13633 {
13634 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13636 }
13637 }
13638 }
13639 }
13640
13642}
13643
13645{
13647 if (entity)
13648 {
13649 bool is_item = entity.IsInherited(
ItemBase);
13650 if (is_item && full_quantity)
13651 {
13654 }
13655 }
13656 else
13657 {
13659 return NULL;
13660 }
13661 return entity;
13662}
13663
13665{
13666 if (item)
13667 {
13668 if (health > 0)
13669 item.SetHealth("", "", health);
13670
13671 if (item.CanHaveTemperature())
13672 {
13674 if (item.CanFreeze())
13675 item.SetFrozen(false);
13676 }
13677
13678 if (item.HasEnergyManager())
13679 {
13680 if (quantity >= 0)
13681 {
13682 item.GetCompEM().SetEnergy0To1(quantity);
13683 }
13684 else
13685 {
13687 }
13688 }
13689 else if (item.IsMagazine())
13690 {
13691 Magazine mag = Magazine.Cast(item);
13692 if (quantity >= 0)
13693 {
13694 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13695 }
13696 else
13697 {
13699 }
13700
13701 }
13702 else
13703 {
13704 if (quantity >= 0)
13705 {
13706 item.SetQuantityNormalized(quantity, false);
13707 }
13708 else
13709 {
13711 }
13712
13713 }
13714 }
13715}
13716
13717#ifdef DEVELOPER
13719#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.