8847{
8849 {
8850 return true;
8851 }
8852};
8853
8855{
8856
8857};
8858
8859
8860
8862{
8866
8868
8871
8872
8873
8874
8875
8884
8890
8895
8900
8921 protected bool m_IsResultOfSplit
8922
8924
8929
8930
8931
8933
8937
8938
8939
8941
8944
8945
8946
8952
8953
8961
8964
8965
8967
8968
8970
8971
8976
8977
8982
8984
8985
8987
8988
8990 {
8995
8996 if (!
g_Game.IsDedicatedServer())
8997 {
8999 {
9001
9003 {
9005 }
9006 }
9007
9010 }
9011
9012 m_OldLocation = null;
9013
9015 {
9017 }
9018
9019 if (ConfigIsExisting("headSelectionsToHide"))
9020 {
9023 }
9024
9026 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9027 {
9029 }
9030
9032
9033 m_IsResultOfSplit = false;
9034
9036 }
9037
9039 {
9040 super.InitItemVariables();
9041
9047 m_Count = ConfigGetInt(
"count");
9048
9051
9056
9059
9064
9076
9080
9081
9084 if (ConfigIsExisting("canBeSplit"))
9085 {
9088 }
9089
9091 if (ConfigIsExisting("itemBehaviour"))
9093
9094
9097 RegisterNetSyncVariableInt("m_VarLiquidType");
9098 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9099
9100 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9101 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9102 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9103
9104 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9105 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9106 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9107 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9108
9109 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9110 RegisterNetSyncVariableBool("m_IsTakeable");
9111 RegisterNetSyncVariableBool("m_IsHologram");
9112
9115 {
9118 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9119 }
9120
9122
9124 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9126
9128 }
9129
9131 {
9133 }
9134
9136 {
9139 {
9144 }
9145 }
9146
9147 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9148 {
9150 {
9153 }
9154
9156 }
9157
9159 {
9165 }
9166
9168
9170 {
9172
9173 if (!action)
9174 {
9175 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9176 return;
9177 }
9178
9180 if (!ai)
9181 {
9183 return;
9184 }
9185
9187 if (!action_array)
9188 {
9189 action_array = new array<ActionBase_Basic>;
9191 }
9192 if (LogManager.IsActionLogEnable())
9193 {
9194 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9195 }
9196
9197 if (action_array.Find(action) != -1)
9198 {
9199 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9200 }
9201 else
9202 {
9203 action_array.Insert(action);
9204 }
9205 }
9206
9208 {
9209 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9210 ActionBase action = player.GetActionManager().GetAction(actionName);
9213
9214 if (action_array)
9215 {
9216 action_array.RemoveItem(action);
9217 }
9218 }
9219
9220
9221
9223 {
9224 ActionOverrideData overrideData = new ActionOverrideData();
9228
9230 if (!actionMap)
9231 {
9234 }
9235
9236 actionMap.Insert(this.
Type(), overrideData);
9237
9238 }
9239
9241
9243
9244
9246 {
9249
9252
9253 string config_to_search = "CfgVehicles";
9254 string muzzle_owner_config;
9255
9257 {
9258 if (IsInherited(Weapon))
9259 config_to_search = "CfgWeapons";
9260
9261 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9262
9263 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9264
9265 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9266
9267 if (config_OnFire_subclass_count > 0)
9268 {
9269 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9270
9271 for (int i = 0; i < config_OnFire_subclass_count; i++)
9272 {
9273 string particle_class = "";
9274 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9275 string config_OnFire_entry = config_OnFire_class + particle_class;
9276 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9277 WPOF_array.Insert(WPOF);
9278 }
9279
9280
9282 }
9283 }
9284
9286 {
9287 config_to_search = "CfgWeapons";
9288 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9289
9290 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9291
9292 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9293
9294 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9295 {
9296 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9297
9298 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9299 {
9300 string particle_class2 = "";
9301 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9302 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9303 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9304 WPOBE_array.Insert(WPOBE);
9305 }
9306
9307
9309 }
9310 }
9311 }
9312
9313
9315 {
9318
9320 {
9321 string config_to_search = "CfgVehicles";
9322
9323 if (IsInherited(Weapon))
9324 config_to_search = "CfgWeapons";
9325
9326 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9327 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9328
9329 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9330 {
9331
9333
9335 {
9337 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9339 return;
9340 }
9341
9344
9345
9346
9347 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9348 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9349
9350 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9351 {
9352 string particle_class = "";
9353 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9354 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9355 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9356
9357 if (entry_type == CT_CLASS)
9358 {
9359 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9360 WPOOH_array.Insert(WPOF);
9361 }
9362 }
9363
9364
9366 }
9367 }
9368 }
9369
9371 {
9373 }
9374
9376 {
9378 {
9380
9383
9386
9387 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9388 }
9389 }
9390
9392 {
9394 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9395
9397 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9398
9400 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9401
9403 {
9405 }
9406 }
9407
9409 {
9411 }
9412
9414 {
9417 else
9419
9421 {
9424 }
9425 else
9426 {
9429
9432 }
9433
9435 }
9436
9438 {
9440 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9441 }
9442
9444 {
9446 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9448 }
9449
9451 {
9453 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9454 }
9455
9457 {
9460
9461 OverheatingParticle OP = new OverheatingParticle();
9466
9468 }
9469
9471 {
9474
9475 return -1;
9476 }
9477
9479 {
9481 {
9484
9485 for (int i = count; i > 0; --i)
9486 {
9487 int id = i - 1;
9490
9493
9494 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9495 {
9496 if (p)
9497 {
9500 }
9501 }
9502 }
9503 }
9504 }
9505
9507 {
9509 {
9511 {
9512 int id = i - 1;
9514
9515 if (OP)
9516 {
9518
9519 if (p)
9520 {
9522 }
9523
9524 delete OP;
9525 }
9526 }
9527
9530 }
9531 }
9532
9535 {
9536 return 0.0;
9537 }
9538
9539
9541 {
9542 return 250;
9543 }
9544
9546 {
9547 return 0;
9548 }
9549
9552 {
9554 return true;
9555
9556 return false;
9557 }
9558
9561 {
9564
9566 {
9568 }
9569 else
9570 {
9571
9573 }
9574
9576 }
9577
9584 {
9585 return -1;
9586 }
9587
9588
9589
9590
9592 {
9594 {
9595 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9596 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9597
9598 if (r_index >= 0)
9599 {
9600 InventoryLocation r_il = new InventoryLocation;
9601 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9602
9603 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9606 {
9607 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9608 }
9610 {
9611 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9612 }
9613
9614 }
9615
9616 player.GetHumanInventory().ClearUserReservedLocation(this);
9617 }
9618
9621 }
9622
9623
9624
9625
9627 {
9628 return ItemBase.m_DebugActionsMask;
9629 }
9630
9632 {
9633 return ItemBase.m_DebugActionsMask & mask;
9634 }
9635
9637 {
9638 ItemBase.m_DebugActionsMask = mask;
9639 }
9640
9642 {
9643 ItemBase.m_DebugActionsMask |= mask;
9644 }
9645
9647 {
9648 ItemBase.m_DebugActionsMask &= ~mask;
9649 }
9650
9652 {
9654 {
9656 }
9657 else
9658 {
9660 }
9661 }
9662
9663
9665 {
9666 if (GetEconomyProfile())
9667 {
9668 float q_max = GetEconomyProfile().GetQuantityMax();
9669 if (q_max > 0)
9670 {
9671 float q_min = GetEconomyProfile().GetQuantityMin();
9672 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9673
9675 {
9676 ComponentEnergyManager comp = GetCompEM();
9678 {
9680 }
9681 }
9683 {
9685
9686 }
9687
9688 }
9689 }
9690 }
9691
9694 {
9695 EntityAI parent = GetHierarchyParent();
9696
9697 if (parent)
9698 {
9699 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9700 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9701 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9702 }
9703 }
9704
9707 {
9708 EntityAI parent = GetHierarchyParent();
9709
9710 if (parent)
9711 {
9712 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9713 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9714 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9715 }
9716 }
9717
9719 {
9720
9721
9722
9723
9725
9727 {
9728 if (ScriptInputUserData.CanStoreInputUserData())
9729 {
9730 ScriptInputUserData ctx = new ScriptInputUserData;
9736 ctx.
Write(use_stack_max);
9739
9741 {
9742 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9743 }
9744 }
9745 }
9746 else if (!
g_Game.IsMultiplayer())
9747 {
9749 }
9750 }
9751
9753 {
9755 }
9756
9758 {
9760 }
9761
9763 {
9765 }
9766
9768 {
9769
9770 return false;
9771 }
9772
9774 {
9775 return false;
9776 }
9777
9781 {
9782 return false;
9783 }
9784
9786 {
9787 return "";
9788 }
9789
9791
9793 {
9794 return false;
9795 }
9796
9798 {
9799 return true;
9800 }
9801
9802
9803
9805 {
9806 return true;
9807 }
9808
9810 {
9811 return true;
9812 }
9813
9815 {
9816 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9818 }
9819
9821 {
9823 }
9824
9826 {
9828 if (!is_being_placed)
9830 SetSynchDirty();
9831 }
9832
9833
9835
9837 {
9839 }
9840
9842 {
9844 }
9845
9847 {
9848 return 1;
9849 }
9850
9852 {
9853 return false;
9854 }
9855
9857 {
9859 SetSynchDirty();
9860 }
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9897 {
9898 super.OnMovedInsideCargo(container);
9899
9900 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9901 }
9902
9903 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9904 {
9905 super.EEItemLocationChanged(oldLoc, newLoc);
9906
9907 PlayerBase newPlayer = null;
9908 PlayerBase oldPlayer = null;
9909
9910 if (newLoc.GetParent())
9911 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9912
9913 if (oldLoc.GetParent())
9914 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9915
9917 {
9918 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9919
9920 if (rIndex >= 0)
9921 {
9922 InventoryLocation rIl = new InventoryLocation;
9923 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9924
9925 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9928 {
9929 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9930 }
9932 {
9934 }
9935
9936 }
9937 }
9938
9940 {
9941 if (newPlayer)
9942 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9943
9944 if (newPlayer == oldPlayer)
9945 {
9946 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9947 {
9949 {
9950 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9951 {
9952 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9953 }
9954 }
9955 else
9956 {
9957 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9958 }
9959 }
9960
9961 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9962 {
9963 int type = oldLoc.GetType();
9965 {
9966 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9967 }
9969 {
9970 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9971 }
9972 }
9973 if (!m_OldLocation)
9974 {
9975 m_OldLocation = new InventoryLocation;
9976 }
9977 m_OldLocation.Copy(oldLoc);
9978 }
9979 else
9980 {
9981 if (m_OldLocation)
9982 {
9983 m_OldLocation.Reset();
9984 }
9985 }
9986
9987 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9988 }
9989 else
9990 {
9991 if (newPlayer)
9992 {
9993 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9994 if (resIndex >= 0)
9995 {
9996 InventoryLocation il = new InventoryLocation;
9997 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9999 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10002 {
10003 il.
GetParent().GetOnReleaseLock().Invoke(it);
10004 }
10006 {
10008 }
10009
10010 }
10011 }
10013 {
10014
10016 }
10017
10018 if (m_OldLocation)
10019 {
10020 m_OldLocation.Reset();
10021 }
10022 }
10023
10025 {
10026 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10027 }
10028
10030 {
10031 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10032 }
10033 }
10034
10035 override void EOnContact(IEntity other, Contact extra)
10036 {
10038 {
10039 int liquidType = -1;
10041 if (impactSpeed > 0.0)
10042 {
10044 #ifndef SERVER
10046 #else
10048 SetSynchDirty();
10049 #endif
10051 }
10052 }
10053
10054 #ifdef SERVER
10055 if (GetCompEM() && GetCompEM().IsPlugged())
10056 {
10057 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10058 GetCompEM().UnplugThis();
10059 }
10060 #endif
10061 }
10062
10064
10066 {
10068 }
10069
10071 {
10072
10073 }
10074
10076 {
10077 super.OnItemLocationChanged(old_owner, new_owner);
10078
10079 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10080 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10081
10082 if (!relatedPlayer && playerNew)
10083 relatedPlayer = playerNew;
10084
10085 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10086 {
10088 if (actionMgr)
10089 {
10090 ActionBase currentAction = actionMgr.GetRunningAction();
10091 if (currentAction)
10093 }
10094 }
10095
10096 Man ownerPlayerOld = null;
10097 Man ownerPlayerNew = null;
10098
10099 if (old_owner)
10100 {
10101 if (old_owner.
IsMan())
10102 {
10103 ownerPlayerOld = Man.Cast(old_owner);
10104 }
10105 else
10106 {
10107 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10108 }
10109 }
10110 else
10111 {
10113 {
10115
10116 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10117 {
10118 GetCompEM().UnplugThis();
10119 }
10120 }
10121 }
10122
10123 if (new_owner)
10124 {
10125 if (new_owner.
IsMan())
10126 {
10127 ownerPlayerNew = Man.Cast(new_owner);
10128 }
10129 else
10130 {
10131 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10132 }
10133 }
10134
10135 if (ownerPlayerOld != ownerPlayerNew)
10136 {
10137 if (ownerPlayerOld)
10138 {
10139 array<EntityAI> subItemsExit = new array<EntityAI>;
10141 for (int i = 0; i < subItemsExit.Count(); i++)
10142 {
10145 }
10146 }
10147
10148 if (ownerPlayerNew)
10149 {
10150 array<EntityAI> subItemsEnter = new array<EntityAI>;
10152 for (int j = 0; j < subItemsEnter.Count(); j++)
10153 {
10156 }
10157 }
10158 }
10159 else if (ownerPlayerNew != null)
10160 {
10161 PlayerBase nplayer;
10162 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10163 {
10164 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10166 for (int k = 0; k < subItemsUpdate.Count(); k++)
10167 {
10169 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10170 }
10171 }
10172 }
10173
10174 if (old_owner)
10175 old_owner.OnChildItemRemoved(this);
10176 if (new_owner)
10177 new_owner.OnChildItemReceived(this);
10178 }
10179
10180
10182 {
10183 super.EEDelete(parent);
10184 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10185 if (player)
10186 {
10188
10189 if (player.IsAlive())
10190 {
10191 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10192 if (r_index >= 0)
10193 {
10194 InventoryLocation r_il = new InventoryLocation;
10195 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10196
10197 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10200 {
10201 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10202 }
10204 {
10205 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10206 }
10207
10208 }
10209
10210 player.RemoveQuickBarEntityShortcut(this);
10211 }
10212 }
10213 }
10214
10216 {
10217 super.EEKilled(killer);
10218
10221 {
10222 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10223 {
10224 if (IsMagazine())
10225 {
10226 if (Magazine.Cast(this).GetAmmoCount() > 0)
10227 {
10229 }
10230 }
10231 else
10232 {
10234 }
10235 }
10236 }
10237 }
10238
10240 {
10241 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10242
10243 super.OnWasAttached(parent, slot_id);
10244
10247
10250 }
10251
10253 {
10254 super.OnWasDetached(parent, slot_id);
10255
10258
10261 }
10262
10264 {
10265 int idx;
10268
10269 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10270 if (inventory_slots.Count() < 1)
10271 {
10272 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10273 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10274 }
10275 else
10276 {
10277 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10278 }
10279
10280 idx = inventory_slots.Find(slot);
10281 if (idx < 0)
10282 return "";
10283
10284 return attach_types.Get(idx);
10285 }
10286
10288 {
10289 int idx = -1;
10290 string slot;
10291
10294
10295 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10296 if (inventory_slots.Count() < 1)
10297 {
10298 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10299 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10300 }
10301 else
10302 {
10303 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10304 if (detach_types.Count() < 1)
10305 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10306 }
10307
10308 for (int i = 0; i < inventory_slots.Count(); i++)
10309 {
10310 slot = inventory_slots.Get(i);
10311 }
10312
10313 if (slot != "")
10314 {
10315 if (detach_types.Count() == 1)
10316 idx = 0;
10317 else
10318 idx = inventory_slots.Find(slot);
10319 }
10320 if (idx < 0)
10321 return "";
10322
10323 return detach_types.Get(idx);
10324 }
10325
10327 {
10328
10330
10331
10332 float min_time = 1;
10333 float max_time = 3;
10334 float delay = Math.RandomFloat(min_time, max_time);
10335
10336 explode_timer.Run(delay, this, "DoAmmoExplosion");
10337 }
10338
10340 {
10341 Magazine magazine = Magazine.Cast(this);
10342 int pop_sounds_count = 6;
10343 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10344
10345
10346 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10347 string sound_name = pop_sounds[ sound_idx ];
10348 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10349
10350
10351 magazine.ServerAddAmmoCount(-1);
10352
10353
10354 float min_temp_to_explode = 100;
10355
10356 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10357 {
10359 }
10360 }
10361
10362
10363 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10364 {
10365 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10366
10367 const int CHANCE_DAMAGE_CARGO = 4;
10368 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10369 const int CHANCE_DAMAGE_NOTHING = 2;
10370
10372 {
10373 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10374 int chances;
10375 int rnd;
10376
10377 if (GetInventory().GetCargo())
10378 {
10379 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10380 rnd = Math.RandomInt(0,chances);
10381
10382 if (rnd < CHANCE_DAMAGE_CARGO)
10383 {
10385 }
10386 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10387 {
10389 }
10390 }
10391 else
10392 {
10393 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10394 rnd = Math.RandomInt(0,chances);
10395
10396 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10397 {
10399 }
10400 }
10401 }
10402 }
10403
10405 {
10406 CargoBase cargo = GetInventory().GetCargo();
10407 if (cargo)
10408 {
10410 if (item_count > 0)
10411 {
10412 int random_pick = Math.RandomInt(0, item_count);
10414 if (!item.IsExplosive())
10415 {
10416 item.AddHealth("","",damage);
10417 return true;
10418 }
10419 }
10420 }
10421 return false;
10422 }
10423
10425 {
10426 GameInventory inventory = GetInventory();
10428 if (attachment_count > 0)
10429 {
10430 int random_pick = Math.RandomInt(0, attachment_count);
10432 if (!attachment.IsExplosive())
10433 {
10434 attachment.AddHealth("","",damage);
10435 return true;
10436 }
10437 }
10438 return false;
10439 }
10440
10442 {
10444 }
10445
10447 {
10449 return GetInventory().CanRemoveEntity();
10450
10451 return false;
10452 }
10453
10455 {
10456
10458 return false;
10459
10460
10462 return false;
10463
10464
10465
10467 if (delta == 0)
10468 return false;
10469
10470
10471 return true;
10472 }
10473
10475 {
10477 {
10478 if (ScriptInputUserData.CanStoreInputUserData())
10479 {
10480 ScriptInputUserData ctx = new ScriptInputUserData;
10485 ctx.
Write(destination_entity);
10487 ctx.
Write(slot_id);
10489 }
10490 }
10491 else if (!
g_Game.IsMultiplayer())
10492 {
10494 }
10495 }
10496
10498 {
10499 float split_quantity_new;
10503 InventoryLocation loc = new InventoryLocation;
10504
10505 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10506 {
10508 split_quantity_new = stack_max;
10509 else
10511
10513 {
10514 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10515 if (new_item)
10516 {
10517 new_item.SetResultOfSplit(true);
10518 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10520 new_item.
SetQuantity(split_quantity_new,
false,
true);
10521 }
10522 }
10523 }
10524 else if (destination_entity && slot_id == -1)
10525 {
10526 if (quantity > stack_max)
10527 split_quantity_new = stack_max;
10528 else
10529 split_quantity_new = quantity;
10530
10532 {
10533 GameInventory destinationInventory = destination_entity.GetInventory();
10535 {
10538 }
10539
10540 if (new_item)
10541 {
10542 new_item.SetResultOfSplit(true);
10543 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10545 new_item.
SetQuantity(split_quantity_new,
false,
true);
10546 }
10547 }
10548 }
10549 else
10550 {
10551 if (stack_max != 0)
10552 {
10554 {
10556 }
10557
10558 if (split_quantity_new == 0)
10559 {
10560 if (!
g_Game.IsMultiplayer())
10561 player.PhysicalPredictiveDropItem(this);
10562 else
10563 player.ServerDropEntity(this);
10564 return;
10565 }
10566
10568 {
10570
10571 if (new_item)
10572 {
10573 new_item.SetResultOfSplit(true);
10574 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10577 new_item.PlaceOnSurface();
10578 }
10579 }
10580 }
10581 }
10582 }
10583
10585 {
10586 float split_quantity_new;
10590 InventoryLocation loc = new InventoryLocation;
10591
10592 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10593 {
10595 split_quantity_new = stack_max;
10596 else
10598
10600 {
10601 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10602 if (new_item)
10603 {
10604 new_item.SetResultOfSplit(true);
10605 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10607 new_item.
SetQuantity(split_quantity_new,
false,
true);
10608 }
10609 }
10610 }
10611 else if (destination_entity && slot_id == -1)
10612 {
10613 if (quantity > stack_max)
10614 split_quantity_new = stack_max;
10615 else
10616 split_quantity_new = quantity;
10617
10619 {
10620 GameInventory destinationInventory = destination_entity.GetInventory();
10622 {
10625 }
10626
10627 if (new_item)
10628 {
10629 new_item.SetResultOfSplit(true);
10630 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10632 new_item.
SetQuantity(split_quantity_new,
false,
true);
10633 }
10634 }
10635 }
10636 else
10637 {
10638 if (stack_max != 0)
10639 {
10641 {
10643 }
10644
10646 {
10648
10649 if (new_item)
10650 {
10651 new_item.SetResultOfSplit(true);
10652 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10655 new_item.PlaceOnSurface();
10656 }
10657 }
10658 }
10659 }
10660 }
10661
10663 {
10665 {
10666 if (ScriptInputUserData.CanStoreInputUserData())
10667 {
10668 ScriptInputUserData ctx = new ScriptInputUserData;
10673 dst.WriteToContext(ctx);
10675 }
10676 }
10677 else if (!
g_Game.IsMultiplayer())
10678 {
10680 }
10681 }
10682
10684 {
10686 {
10687 if (ScriptInputUserData.CanStoreInputUserData())
10688 {
10689 ScriptInputUserData ctx = new ScriptInputUserData;
10694 ctx.
Write(destination_entity);
10700 }
10701 }
10702 else if (!
g_Game.IsMultiplayer())
10703 {
10705 }
10706 }
10707
10709 {
10711 }
10712
10714 {
10716 float split_quantity_new;
10718 if (dst.IsValid())
10719 {
10720 int slot_id = dst.GetSlot();
10722
10723 if (quantity > stack_max)
10724 split_quantity_new = stack_max;
10725 else
10726 split_quantity_new = quantity;
10727
10729 {
10731
10732 if (new_item)
10733 {
10734 new_item.SetResultOfSplit(true);
10735 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10737 new_item.
SetQuantity(split_quantity_new,
false,
true);
10738 }
10739
10740 return new_item;
10741 }
10742 }
10743
10744 return null;
10745 }
10746
10748 {
10750 float split_quantity_new;
10752 if (destination_entity)
10753 {
10755 if (quantity > stackable)
10756 split_quantity_new = stackable;
10757 else
10758 split_quantity_new = quantity;
10759
10761 {
10762 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10763 if (new_item)
10764 {
10765 new_item.SetResultOfSplit(true);
10766 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10768 new_item.
SetQuantity(split_quantity_new,
false,
true);
10769 }
10770 }
10771 }
10772 }
10773
10775 {
10777 {
10778 if (ScriptInputUserData.CanStoreInputUserData())
10779 {
10780 ScriptInputUserData ctx = new ScriptInputUserData;
10785 ItemBase destination_entity =
this;
10786 ctx.
Write(destination_entity);
10790 }
10791 }
10792 else if (!
g_Game.IsMultiplayer())
10793 {
10795 }
10796 }
10797
10799 {
10801 float split_quantity_new;
10803 if (player)
10804 {
10806 if (quantity > stackable)
10807 split_quantity_new = stackable;
10808 else
10809 split_quantity_new = quantity;
10810
10812 {
10813 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10814 new_item =
ItemBase.Cast(in_hands);
10815 if (new_item)
10816 {
10817 new_item.SetResultOfSplit(true);
10818 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10820 new_item.SetQuantity(split_quantity_new, false, true);
10821 }
10822 }
10823 }
10824 }
10825
10827 {
10829 float split_quantity_new = Math.Floor(quantity * 0.5);
10830
10832 return;
10833
10835
10836 if (new_item)
10837 {
10838 if (new_item.GetQuantityMax() < split_quantity_new)
10839 {
10840 split_quantity_new = new_item.GetQuantityMax();
10841 }
10842
10843 new_item.SetResultOfSplit(true);
10844 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10845
10847 {
10850 }
10851 else
10852 {
10854 new_item.
SetQuantity(split_quantity_new,
false,
true);
10855 }
10856 }
10857 }
10858
10860 {
10862 float split_quantity_new = Math.Floor(quantity / 2);
10863
10865 return;
10866
10867 InventoryLocation invloc = new InventoryLocation;
10869
10871 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10872
10873 if (new_item)
10874 {
10875 if (new_item.GetQuantityMax() < split_quantity_new)
10876 {
10877 split_quantity_new = new_item.GetQuantityMax();
10878 }
10880 {
10883 }
10884 else if (split_quantity_new > 1)
10885 {
10887 new_item.
SetQuantity(split_quantity_new,
false,
true);
10888 }
10889 }
10890 }
10891
10894 {
10895 SetWeightDirty();
10897
10898 if (parent)
10899 parent.OnAttachmentQuantityChangedEx(this, delta);
10900
10902 {
10904 {
10906 }
10908 {
10909 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10911 }
10912 }
10913 }
10914
10917 {
10918
10919 }
10920
10923 {
10925 }
10926
10928 {
10929 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10930
10932 {
10933 if (newLevel == GameConstants.STATE_RUINED)
10934 {
10936 EntityAI parent = GetHierarchyParent();
10937 if (parent && parent.IsFireplace())
10938 {
10939 CargoBase cargo = GetInventory().GetCargo();
10940 if (cargo)
10941 {
10943 {
10945 }
10946 }
10947 }
10948 }
10949
10951 {
10952
10954 return;
10955 }
10956
10957 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10958 {
10960 }
10961 }
10962 }
10963
10964
10966 {
10967 super.OnRightClick();
10968
10970 {
10972 {
10973 if (ScriptInputUserData.CanStoreInputUserData())
10974 {
10975 EntityAI root = GetHierarchyRoot();
10976 Man playerOwner = GetHierarchyRootPlayer();
10977 InventoryLocation dst = new InventoryLocation;
10978
10979
10980 if (!playerOwner && root && root == this)
10981 {
10983 }
10984 else
10985 {
10986
10987 GetInventory().GetCurrentInventoryLocation(dst);
10989 {
10990 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10992 {
10994 }
10995 else
10996 {
10998
10999
11000 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11001 {
11003 }
11004 else
11005 {
11006 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11007 }
11008 }
11009 }
11010 }
11011
11012 ScriptInputUserData ctx = new ScriptInputUserData;
11020 }
11021 }
11022 else if (!
g_Game.IsMultiplayer())
11023 {
11025 }
11026 }
11027 }
11028
11030 {
11031 if (root)
11032 {
11033 vector m4[4];
11034 root.GetTransform(m4);
11035 dst.SetGround(this, m4);
11036 }
11037 else
11038 {
11039 GetInventory().GetCurrentInventoryLocation(dst);
11040 }
11041 }
11042
11043 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11044 {
11045
11046 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11047 return false;
11048
11049 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11050 return false;
11051
11052
11054 return false;
11055
11056
11057 Magazine mag = Magazine.Cast(this);
11058 if (mag)
11059 {
11060 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11061 return false;
11062
11063 if (stack_max_limit)
11064 {
11065 Magazine other_mag = Magazine.Cast(other_item);
11066 if (other_item)
11067 {
11068 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11069 return false;
11070 }
11071
11072 }
11073 }
11074 else
11075 {
11076
11078 return false;
11079
11081 return false;
11082 }
11083
11084 PlayerBase player = null;
11085 if (CastTo(player, GetHierarchyRootPlayer()))
11086 {
11087 if (player.GetInventory().HasAttachment(this))
11088 return false;
11089
11090 if (player.IsItemsToDelete())
11091 return false;
11092 }
11093
11094 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11095 return false;
11096
11097 int slotID;
11099 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11100 return false;
11101
11102 return true;
11103 }
11104
11106 {
11108 }
11109
11111 {
11112 return m_IsResultOfSplit;
11113 }
11114
11116 {
11117 m_IsResultOfSplit = value;
11118 }
11119
11121 {
11123 }
11124
11126 {
11127 float other_item_quantity = other_item.GetQuantity();
11128 float this_free_space;
11129
11131
11133
11134 if (other_item_quantity > this_free_space)
11135 {
11136 return this_free_space;
11137 }
11138 else
11139 {
11140 return other_item_quantity;
11141 }
11142 }
11143
11145 {
11147 }
11148
11150 {
11152 return;
11153
11154 if (!IsMagazine() && other_item)
11155 {
11157 if (quantity_used != 0)
11158 {
11159 float hp1 = GetHealth01("","");
11160 float hp2 = other_item.GetHealth01("","");
11161 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11162 hpResult = hpResult / (
GetQuantity() + quantity_used);
11163
11164 hpResult *= GetMaxHealth();
11165 Math.Round(hpResult);
11166 SetHealth("", "Health", hpResult);
11167
11169 other_item.AddQuantity(-quantity_used);
11170 }
11171 }
11173 }
11174
11176 {
11177 #ifdef SERVER
11178 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11179 GetHierarchyParent().IncreaseLifetimeUp();
11180 #endif
11181 };
11182
11184 {
11185 PlayerBase p = PlayerBase.Cast(player);
11186
11187 array<int> recipesIds = p.m_Recipes;
11188 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11189 if (moduleRecipesManager)
11190 {
11191 EntityAI itemInHands = player.GetEntityInHands();
11192 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11193 }
11194
11195 for (int i = 0;i < recipesIds.Count(); i++)
11196 {
11197 int key = recipesIds.Get(i);
11198 string recipeName = moduleRecipesManager.GetRecipeName(key);
11200 }
11201 }
11202
11203
11204 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11205 {
11206 super.GetDebugActions(outputList);
11207
11208
11214
11215
11220
11225
11226
11230
11231
11233 {
11237 }
11238
11241
11242
11246
11248
11249 InventoryLocation loc = new InventoryLocation();
11250 GetInventory().GetCurrentInventoryLocation(loc);
11252 {
11253 if (Gizmo_IsSupported())
11256 }
11257
11259 }
11260
11261
11262
11263
11265 {
11266 super.OnAction(action_id, player, ctx);
11267
11269 {
11270 switch (action_id)
11271 {
11275 return true;
11279 return true;
11280 }
11281 }
11282
11284 {
11285 switch (action_id)
11286 {
11288 Delete();
11289 return true;
11290 }
11291 }
11292
11293 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11294 {
11295 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11296 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11297 PlayerBase p = PlayerBase.Cast(player);
11298 if (
EActions.RECIPES_RANGE_START < 1000)
11299 {
11300 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11301 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11302 }
11303 }
11304 #ifndef SERVER
11305 else if (action_id ==
EActions.WATCH_PLAYER)
11306 {
11307 PluginDeveloper.SetDeveloperItemClientEx(player);
11308 }
11309 #endif
11311 {
11312 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11313 {
11314 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11315 OnDebugButtonPressServer(id + 1);
11316 }
11317
11318 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11319 {
11320 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11322 }
11323
11324 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11325 {
11326 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11328 }
11329
11330 else if (action_id ==
EActions.ADD_QUANTITY)
11331 {
11332 if (IsMagazine())
11333 {
11334 Magazine mag = Magazine.Cast(this);
11335 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11336 }
11337 else
11338 {
11340 }
11341
11342 if (m_EM)
11343 {
11344 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11345 }
11346
11347 }
11348
11349 else if (action_id ==
EActions.REMOVE_QUANTITY)
11350 {
11351 if (IsMagazine())
11352 {
11353 Magazine mag2 = Magazine.Cast(this);
11354 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11355 }
11356 else
11357 {
11359 }
11360 if (m_EM)
11361 {
11362 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11363 }
11364
11365 }
11366
11367 else if (action_id ==
EActions.SET_QUANTITY_0)
11368 {
11370
11371 if (m_EM)
11372 {
11373 m_EM.SetEnergy(0);
11374 }
11375 }
11376
11377 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11378 {
11380
11381 if (m_EM)
11382 {
11383 m_EM.SetEnergy(m_EM.GetEnergyMax());
11384 }
11385 }
11386
11387 else if (action_id ==
EActions.ADD_HEALTH)
11388 {
11389 AddHealth("","",GetMaxHealth("","Health")/5);
11390 }
11391 else if (action_id ==
EActions.REMOVE_HEALTH)
11392 {
11393 AddHealth("","",-GetMaxHealth("","Health")/5);
11394 }
11395 else if (action_id ==
EActions.DESTROY_HEALTH)
11396 {
11397 SetHealth01("","",0);
11398 }
11399 else if (action_id ==
EActions.WATCH_ITEM)
11400 {
11402 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11403 #ifdef DEVELOPER
11404 SetDebugDeveloper_item(this);
11405 #endif
11406 }
11407
11408 else if (action_id ==
EActions.ADD_TEMPERATURE)
11409 {
11410 AddTemperature(20);
11411
11412 }
11413
11414 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11415 {
11416 AddTemperature(-20);
11417
11418 }
11419
11420 else if (action_id ==
EActions.FLIP_FROZEN)
11421 {
11422 SetFrozen(!GetIsFrozen());
11423
11424 }
11425
11426 else if (action_id ==
EActions.ADD_WETNESS)
11427 {
11429
11430 }
11431
11432 else if (action_id ==
EActions.REMOVE_WETNESS)
11433 {
11435
11436 }
11437
11438 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11439 {
11442
11443
11444 }
11445
11446 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11447 {
11450 }
11451
11452 else if (action_id ==
EActions.MAKE_SPECIAL)
11453 {
11454 auto debugParams = DebugSpawnParams.WithPlayer(player);
11455 OnDebugSpawnEx(debugParams);
11456 }
11457
11458 }
11459
11460
11461 return false;
11462 }
11463
11464
11465
11466
11470
11473
11474
11475
11477 {
11478 return false;
11479 }
11480
11481
11483 {
11484 return true;
11485 }
11486
11487
11489 {
11490 return true;
11491 }
11492
11493
11494
11496 {
11497 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11498 return g_Game.ConfigIsExisting(config_path);
11499 }
11500
11503 {
11504 return null;
11505 }
11506
11508 {
11509 return false;
11510 }
11511
11513 {
11514 return false;
11515 }
11516
11520
11521
11523 {
11524 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11525 return module_repairing.CanRepair(this, item_repair_kit);
11526 }
11527
11528
11529 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11530 {
11531 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11532 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11533 }
11534
11535
11537 {
11538
11539
11540
11541
11542
11543
11544
11545
11546 return 1;
11547 }
11548
11549
11550
11552 {
11554 }
11555
11556
11557
11559 {
11561 }
11562
11563
11572 {
11573 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11574
11575 if (player)
11576 {
11577 player.MessageStatus(text);
11578 }
11579 }
11580
11581
11590 {
11591 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11592
11593 if (player)
11594 {
11595 player.MessageAction(text);
11596 }
11597 }
11598
11599
11608 {
11609 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11610
11611 if (player)
11612 {
11613 player.MessageFriendly(text);
11614 }
11615 }
11616
11617
11626 {
11627 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11628
11629 if (player)
11630 {
11631 player.MessageImportant(text);
11632 }
11633 }
11634
11636 {
11637 return true;
11638 }
11639
11640
11641 override bool KindOf(
string tag)
11642 {
11643 bool found = false;
11644 string item_name = this.
GetType();
11646 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11647
11648 int array_size = item_tag_array.Count();
11649 for (int i = 0; i < array_size; i++)
11650 {
11651 if (item_tag_array.Get(i) == tag)
11652 {
11653 found = true;
11654 break;
11655 }
11656 }
11657 return found;
11658 }
11659
11660
11662 {
11663
11664 super.OnRPC(sender, rpc_type,ctx);
11665
11666
11667 switch (rpc_type)
11668 {
11669 #ifndef SERVER
11670 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11671 Param2<bool, string> p = new Param2<bool, string>(false, "");
11672
11674 return;
11675
11676 bool play = p.param1;
11677 string soundSet = p.param2;
11678
11679 if (play)
11680 {
11682 {
11684 {
11686 }
11687 }
11688 else
11689 {
11691 }
11692 }
11693 else
11694 {
11696 }
11697
11698 break;
11699 #endif
11700
11701 }
11702
11704 {
11706 }
11707 }
11708
11709
11710
11711
11713 {
11714 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11715 return plugin.GetID(
name);
11716 }
11717
11719 {
11720 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11721 return plugin.GetName(id);
11722 }
11723
11726 {
11727
11728
11729 int varFlags;
11730 if (!ctx.
Read(varFlags))
11731 return;
11732
11733 if (varFlags & ItemVariableFlags.FLOAT)
11734 {
11736 }
11737 }
11738
11740 {
11741
11742 super.SerializeNumericalVars(floats_out);
11743
11744
11745
11747 {
11749 }
11750
11752 {
11754 }
11755
11757 {
11759 }
11760
11762 {
11767 }
11768
11770 {
11772 }
11773 }
11774
11776 {
11777
11778 super.DeSerializeNumericalVars(floats);
11779
11780
11781 int index = 0;
11782 int mask = Math.Round(floats.Get(index));
11783
11784 index++;
11785
11787 {
11789 {
11791 }
11792 else
11793 {
11794 float quantity = floats.Get(index);
11795 SetQuantity(quantity,
true,
false,
false,
false);
11796 }
11797 index++;
11798 }
11799
11801 {
11802 float wet = floats.Get(index);
11804 index++;
11805 }
11806
11808 {
11809 int liquidtype = Math.Round(floats.Get(index));
11811 index++;
11812 }
11813
11815 {
11817 index++;
11819 index++;
11821 index++;
11823 index++;
11824 }
11825
11827 {
11828 int cleanness = Math.Round(floats.Get(index));
11830 index++;
11831 }
11832 }
11833
11835 {
11836 super.WriteVarsToCTX(ctx);
11837
11838
11840 {
11842 }
11843
11845 {
11847 }
11848
11850 {
11852 }
11853
11855 {
11856 int r,g,b,a;
11862 }
11863
11865 {
11867 }
11868 }
11869
11871 {
11872 if (!super.ReadVarsFromCTX(ctx,version))
11873 return false;
11874
11875 int intValue;
11876 float value;
11877
11878 if (version < 140)
11879 {
11880 if (!ctx.
Read(intValue))
11881 return false;
11882
11883 m_VariablesMask = intValue;
11884 }
11885
11887 {
11888 if (!ctx.
Read(value))
11889 return false;
11890
11892 {
11894 }
11895 else
11896 {
11898 }
11899 }
11900
11901 if (version < 140)
11902 {
11904 {
11905 if (!ctx.
Read(value))
11906 return false;
11907 SetTemperatureDirect(value);
11908 }
11909 }
11910
11912 {
11913 if (!ctx.
Read(value))
11914 return false;
11916 }
11917
11919 {
11920 if (!ctx.
Read(intValue))
11921 return false;
11923 }
11924
11926 {
11927 int r,g,b,a;
11929 return false;
11931 return false;
11933 return false;
11935 return false;
11936
11938 }
11939
11941 {
11942 if (!ctx.
Read(intValue))
11943 return false;
11945 }
11946
11947 if (version >= 138 && version < 140)
11948 {
11950 {
11951 if (!ctx.
Read(intValue))
11952 return false;
11953 SetFrozen(intValue);
11954 }
11955 }
11956
11957 return true;
11958 }
11959
11960
11962 {
11965 {
11967 }
11968
11969 if (!super.OnStoreLoad(ctx, version))
11970 {
11972 return false;
11973 }
11974
11975 if (version >= 114)
11976 {
11977 bool hasQuickBarIndexSaved;
11978
11979 if (!ctx.
Read(hasQuickBarIndexSaved))
11980 {
11982 return false;
11983 }
11984
11985 if (hasQuickBarIndexSaved)
11986 {
11987 int itmQBIndex;
11988
11989
11990 if (!ctx.
Read(itmQBIndex))
11991 {
11993 return false;
11994 }
11995
11996 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11997 if (itmQBIndex != -1 && parentPlayer)
11998 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11999 }
12000 }
12001 else
12002 {
12003
12004 PlayerBase player;
12005 int itemQBIndex;
12006 if (version ==
int.
MAX)
12007 {
12008 if (!ctx.
Read(itemQBIndex))
12009 {
12011 return false;
12012 }
12013 }
12014 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12015 {
12016
12017 if (!ctx.
Read(itemQBIndex))
12018 {
12020 return false;
12021 }
12022 if (itemQBIndex != -1 && player)
12023 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12024 }
12025 }
12026
12027 if (version < 140)
12028 {
12029
12030 if (!LoadVariables(ctx, version))
12031 {
12033 return false;
12034 }
12035 }
12036
12037
12039 {
12041 return false;
12042 }
12043 if (version >= 132)
12044 {
12046 if (raib)
12047 {
12049 {
12051 return false;
12052 }
12053 }
12054 }
12055
12057 return true;
12058 }
12059
12060
12061
12063 {
12064 super.OnStoreSave(ctx);
12065
12066 PlayerBase player;
12067 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12068 {
12070
12071 int itemQBIndex = -1;
12072 itemQBIndex = player.FindQuickBarEntityIndex(this);
12073 ctx.
Write(itemQBIndex);
12074 }
12075 else
12076 {
12078 }
12079
12081
12083 if (raib)
12084 {
12086 }
12087 }
12088
12089
12091 {
12092 super.AfterStoreLoad();
12093
12095 {
12097 }
12098
12100 {
12103 }
12104 }
12105
12107 {
12108 super.EEOnAfterLoad();
12109
12111 {
12113 }
12114
12117 }
12118
12120 {
12121 return false;
12122 }
12123
12124
12125
12127 {
12129 {
12130 #ifdef PLATFORM_CONSOLE
12131
12133 {
12135 if (menu)
12136 {
12138 }
12139 }
12140 #endif
12141 }
12142
12144 {
12147 }
12148
12150 {
12151 SetWeightDirty();
12153 }
12155 {
12158 }
12159
12161 {
12164
12167 }
12169 {
12173 }
12174
12175 super.OnVariablesSynchronized();
12176 }
12177
12178
12179
12181 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12182 {
12183 if (!IsServerCheck(allow_client))
12184 return false;
12185
12187 return false;
12188
12191
12192 if (value <= (min + 0.001))
12193 value = min;
12194
12195 if (value == min)
12196 {
12197 if (destroy_config)
12198 {
12199 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12200 if (dstr)
12201 {
12203 this.Delete();
12204 return true;
12205 }
12206 }
12207 else if (destroy_forced)
12208 {
12210 this.Delete();
12211 return true;
12212 }
12213
12215 }
12216
12219
12221 {
12222 EntityAI parent = GetHierarchyRoot();
12223 InventoryLocation iLoc = new InventoryLocation();
12224 GetInventory().GetCurrentInventoryLocation(iLoc);
12226 {
12227 int iLocSlot = iLoc.
GetSlot();
12229 {
12231 }
12233 {
12235 }
12236 }
12237 }
12238
12240 {
12242
12243 if (delta)
12245 }
12246
12248
12249 return false;
12250 }
12251
12252
12254 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12255 {
12257 }
12258
12260 {
12263 }
12264
12266 {
12269 }
12270
12272 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12273 {
12274 float value_clamped = Math.Clamp(value, 0, 1);
12276 SetQuantity(result, destroy_config, destroy_forced);
12277 }
12278
12279
12282 {
12284 }
12285
12287 {
12289 }
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12301 {
12302 int slot = -1;
12303 GameInventory inventory = GetInventory();
12304 if (inventory)
12305 {
12306 InventoryLocation il = new InventoryLocation;
12309 }
12310
12312 }
12313
12315 {
12316 float quantity_max = 0;
12317
12319 {
12320 if (attSlotID != -1)
12321 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12322
12323 if (quantity_max <= 0)
12325 }
12326
12327 if (quantity_max <= 0)
12329
12330 return quantity_max;
12331 }
12332
12334 {
12336 }
12337
12339 {
12341 }
12342
12343
12345 {
12347 }
12348
12350 {
12352 }
12353
12355 {
12357 }
12358
12359
12361 {
12362
12363 float weightEx = GetWeightEx();
12364 float special = GetInventoryAndCargoWeight();
12365 return weightEx - special;
12366 }
12367
12368
12370 {
12372 }
12373
12375 {
12377 {
12378 #ifdef DEVELOPER
12379 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12380 {
12381 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12383 }
12384 #endif
12385
12386 return GetQuantity() * GetConfigWeightModified();
12387 }
12388 else if (HasEnergyManager())
12389 {
12390 #ifdef DEVELOPER
12391 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12392 {
12393 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12394 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12395 }
12396 #endif
12397 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12398 }
12399 else
12400 {
12401 #ifdef DEVELOPER
12402 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12403 {
12404 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12405 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12406 }
12407 #endif
12408 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12409 }
12410 }
12411
12414 {
12415 int item_count = 0;
12417
12418 GameInventory inventory = GetInventory();
12419 CargoBase cargo = inventory.
GetCargo();
12420 if (cargo != NULL)
12421 {
12423 }
12424
12426 for (int i = 0; i < nAttachments; ++i)
12427 {
12429 if (item)
12430 item_count += item.GetNumberOfItems();
12431 }
12432 return item_count;
12433 }
12434
12437 {
12438 float weight = 0;
12439 float wetness = 1;
12440 if (include_wetness)
12443 {
12444 weight = wetness * m_ConfigWeight;
12445 }
12447 {
12448 weight = 1;
12449 }
12450 return weight;
12451 }
12452
12453
12454
12456 {
12457 GameInventory inventory = GetInventory();
12458 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12459 {
12460 array<EntityAI> items = new array<EntityAI>;
12462 for (int i = 0; i < items.Count(); ++i)
12463 {
12465 if (item)
12466 {
12467 g_Game.ObjectDelete(item);
12468 }
12469 }
12470 }
12471 }
12472
12473
12474
12475
12477 {
12478 float energy = 0;
12479 if (HasEnergyManager())
12480 {
12481 energy = GetCompEM().GetEnergy();
12482 }
12483 return energy;
12484 }
12485
12486
12488 {
12489 super.OnEnergyConsumed();
12490
12492 }
12493
12495 {
12496 super.OnEnergyAdded();
12497
12499 }
12500
12501
12503 {
12504 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12505 {
12507 {
12508 float energy_0to1 = GetCompEM().GetEnergy0To1();
12510 }
12511 }
12512 }
12513
12514
12516 {
12517 return ConfigGetFloat("heatIsolation");
12518 }
12519
12521 {
12523 }
12524
12526 {
12527 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12528 if (
g_Game.ConfigIsExisting(paramPath))
12529 return g_Game.ConfigGetFloat(paramPath);
12530
12531 return 0.0;
12532 }
12533
12535 {
12536 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12537 if (
g_Game.ConfigIsExisting(paramPath))
12538 return g_Game.ConfigGetFloat(paramPath);
12539
12540 return 0.0;
12541 }
12542
12543 override void SetWet(
float value,
bool allow_client =
false)
12544 {
12545 if (!IsServerCheck(allow_client))
12546 return;
12547
12550
12552
12553 m_VarWet = Math.Clamp(value, min, max);
12554
12556 {
12559 }
12560 }
12561
12562 override void AddWet(
float value)
12563 {
12565 }
12566
12568 {
12570 }
12571
12573 {
12575 }
12576
12578 {
12580 }
12581
12583 {
12585 }
12586
12588 {
12590 }
12591
12592 override void OnWetChanged(
float newVal,
float oldVal)
12593 {
12596 if (newLevel != oldLevel)
12597 {
12599 }
12600 }
12601
12603 {
12604 SetWeightDirty();
12605 }
12606
12608 {
12609 return GetWetLevelInternal(
m_VarWet);
12610 }
12611
12612
12613
12615 {
12617 }
12618
12620 {
12622 }
12623
12625 {
12627 }
12628
12630 {
12632 }
12633
12634
12635
12637 {
12638 if (ConfigIsExisting("itemModelLength"))
12639 {
12640 return ConfigGetFloat("itemModelLength");
12641 }
12642 return 0;
12643 }
12644
12646 {
12647 if (ConfigIsExisting("itemAttachOffset"))
12648 {
12649 return ConfigGetFloat("itemAttachOffset");
12650 }
12651 return 0;
12652 }
12653
12654 override void SetCleanness(
int value,
bool allow_client =
false)
12655 {
12656 if (!IsServerCheck(allow_client))
12657 return;
12658
12660
12662
12665 }
12666
12668 {
12670 }
12671
12673 {
12674 return true;
12675 }
12676
12677
12678
12679
12681 {
12683 }
12684
12686 {
12688 }
12689
12690
12691
12692
12693 override void SetColor(
int r,
int g,
int b,
int a)
12694 {
12700 }
12702 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12703 {
12708 }
12709
12711 {
12713 }
12714
12717 {
12718 int r,g,b,a;
12720 r = r/255;
12721 g = g/255;
12722 b = b/255;
12723 a = a/255;
12724 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12725 }
12726
12727
12728
12729 override void SetLiquidType(
int value,
bool allow_client =
false)
12730 {
12731 if (!IsServerCheck(allow_client))
12732 return;
12733
12738 }
12739
12741 {
12742 return ConfigGetInt("varLiquidTypeInit");
12743 }
12744
12746 {
12748 }
12749
12751 {
12753 SetFrozen(false);
12754 }
12755
12758 {
12759 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12760 }
12761
12762
12765 {
12766 PlayerBase nplayer;
12767 if (PlayerBase.CastTo(nplayer, player))
12768 {
12770 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12771 }
12772 }
12773
12774
12777 {
12778 PlayerBase nplayer;
12779 if (PlayerBase.CastTo(nplayer,player))
12780 {
12781 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12782 }
12783
12784 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12785
12786 if (HasEnergyManager())
12787 {
12788 GetCompEM().UpdatePlugState();
12789 }
12790 }
12791
12792
12794 {
12795 super.OnPlacementStarted(player);
12796
12798 }
12799
12800 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12801 {
12803 {
12804 m_AdminLog.OnPlacementComplete(player,
this);
12805 }
12806
12807 super.OnPlacementComplete(player, position, orientation);
12808 }
12809
12810
12811
12812
12813
12815 {
12817 {
12818 return true;
12819 }
12820 else
12821 {
12822 return false;
12823 }
12824 }
12825
12826
12828 {
12830 {
12832 }
12833 }
12834
12835
12837 {
12839 }
12840
12842 {
12844 }
12845
12846 override void InsertAgent(
int agent,
float count = 1)
12847 {
12848 if (count < 1)
12849 return;
12850
12852 }
12853
12856 {
12858 }
12859
12860
12862 {
12864 }
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12908 {
12910 return false;
12911 return true;
12912 }
12913
12915 {
12916
12918 }
12919
12920
12923 {
12924 super.CheckForRoofLimited(timeTresholdMS);
12925
12926 float time =
g_Game.GetTime();
12927 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12928 {
12929 m_PreviousRoofTestTime = time;
12930 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12931 }
12932 }
12933
12934
12936 {
12938 {
12939 return 0;
12940 }
12941
12942 if (GetInventory().GetAttachmentSlotsCount() != 0)
12943 {
12944 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12945 if (filter)
12946 return filter.GetProtectionLevel(type, false, system);
12947 else
12948 return 0;
12949 }
12950
12951 string subclassPath, entryName;
12952
12953 switch (type)
12954 {
12956 entryName = "biological";
12957 break;
12959 entryName = "chemical";
12960 break;
12961 default:
12962 entryName = "biological";
12963 break;
12964 }
12965
12966 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12967
12968 return g_Game.ConfigGetFloat(subclassPath + entryName);
12969 }
12970
12971
12972
12975 {
12976 if (!IsMagazine())
12978
12980 }
12981
12982
12983
12984
12985
12990 {
12991 return true;
12992 }
12993
12995 {
12997 }
12998
12999
13000
13001
13002
13004 {
13005 if (parent)
13006 {
13007 if (parent.IsInherited(DayZInfected))
13008 return true;
13009
13010 if (!parent.IsRuined())
13011 return true;
13012 }
13013
13014 return true;
13015 }
13016
13018 {
13019 if (!super.CanPutAsAttachment(parent))
13020 {
13021 return false;
13022 }
13023
13024 if (!IsRuined() && !parent.IsRuined())
13025 {
13026 return true;
13027 }
13028
13029 return false;
13030 }
13031
13033 {
13034
13035
13036
13037
13038 return super.CanReceiveItemIntoCargo(item);
13039 }
13040
13042 {
13043
13044
13045
13046
13047 GameInventory attachmentInv = attachment.GetInventory();
13049 {
13050 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13051 return false;
13052 }
13053
13054 InventoryLocation loc = new InventoryLocation();
13055 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13056 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13057 return false;
13058
13059 return super.CanReceiveAttachment(attachment, slotId);
13060 }
13061
13063 {
13064 if (!super.CanReleaseAttachment(attachment))
13065 return false;
13066
13067 return GetInventory().AreChildrenAccessible();
13068 }
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13088
13089
13091 {
13092 int id = muzzle_owner.GetMuzzleID();
13093 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13094
13095 if (WPOF_array)
13096 {
13097 for (int i = 0; i < WPOF_array.Count(); i++)
13098 {
13099 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13100
13101 if (WPOF)
13102 {
13103 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13104 }
13105 }
13106 }
13107 }
13108
13109
13111 {
13112 int id = muzzle_owner.GetMuzzleID();
13114
13115 if (WPOBE_array)
13116 {
13117 for (int i = 0; i < WPOBE_array.Count(); i++)
13118 {
13119 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13120
13121 if (WPOBE)
13122 {
13123 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13124 }
13125 }
13126 }
13127 }
13128
13129
13131 {
13132 int id = muzzle_owner.GetMuzzleID();
13133 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13134
13135 if (WPOOH_array)
13136 {
13137 for (int i = 0; i < WPOOH_array.Count(); i++)
13138 {
13139 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13140
13141 if (WPOOH)
13142 {
13143 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13144 }
13145 }
13146 }
13147 }
13148
13149
13151 {
13152 int id = muzzle_owner.GetMuzzleID();
13153 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13154
13155 if (WPOOH_array)
13156 {
13157 for (int i = 0; i < WPOOH_array.Count(); i++)
13158 {
13159 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13160
13161 if (WPOOH)
13162 {
13163 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13164 }
13165 }
13166 }
13167 }
13168
13169
13171 {
13172 int id = muzzle_owner.GetMuzzleID();
13173 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13174
13175 if (WPOOH_array)
13176 {
13177 for (int i = 0; i < WPOOH_array.Count(); i++)
13178 {
13179 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13180
13181 if (WPOOH)
13182 {
13183 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13184 }
13185 }
13186 }
13187 }
13188
13189
13190
13192 {
13194 {
13195 return true;
13196 }
13197
13198 return false;
13199 }
13200
13202 {
13204 {
13205 return true;
13206 }
13207
13208 return false;
13209 }
13210
13212 {
13214 {
13215 return true;
13216 }
13217
13218 return false;
13219 }
13220
13222 {
13223 return false;
13224 }
13225
13228 {
13229 return UATimeSpent.DEFAULT_DEPLOY;
13230 }
13231
13232
13233
13234
13236 {
13238 SetSynchDirty();
13239 }
13240
13242 {
13244 }
13245
13246
13248 {
13249 return false;
13250 }
13251
13254 {
13255 string att_type = "None";
13256
13257 if (ConfigIsExisting("soundAttType"))
13258 {
13259 att_type = ConfigGetString("soundAttType");
13260 }
13261
13263 }
13264
13266 {
13268 }
13269
13270
13271
13272
13273
13279
13281 {
13284
13286 }
13287
13288
13290 {
13292 return;
13293
13295
13298
13301
13302 SoundParameters params = new SoundParameters();
13306 }
13307
13308
13310 {
13312 {
13315
13316 SetSynchDirty();
13317
13320 }
13321 }
13322
13324 {
13326 }
13327
13328
13330 {
13332 return;
13333
13335 SetSynchDirty();
13336
13339 }
13340
13342 {
13345 }
13346
13348 {
13350 }
13351
13352 void OnApply(PlayerBase player);
13353
13355 {
13356 return 1.0;
13357 };
13358
13360 {
13362 }
13363
13365 {
13367 }
13368
13370
13372 {
13373 SetDynamicPhysicsLifeTime(0.01);
13375 }
13376
13378 {
13379 array<string> zone_names = new array<string>;
13380 GetDamageZones(zone_names);
13381 for (int i = 0; i < zone_names.Count(); i++)
13382 {
13383 SetHealthMax(zone_names.Get(i),"Health");
13384 }
13385 SetHealthMax("","Health");
13386 }
13387
13390 {
13391 float global_health = GetHealth01("","Health");
13392 array<string> zones = new array<string>;
13393 GetDamageZones(zones);
13394
13395 for (int i = 0; i < zones.Count(); i++)
13396 {
13397 SetHealth01(zones.Get(i),"Health",global_health);
13398 }
13399 }
13400
13403 {
13404 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13405 }
13406
13408 {
13409 if (!hasRootAsPlayer)
13410 {
13411 if (refParentIB)
13412 {
13413
13414 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13415 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13416
13417 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13418 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13419
13422 }
13423 else
13424 {
13425
13428 }
13429 }
13430 }
13431
13433 {
13435 {
13436 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13437 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13438 {
13439 float heatPermCoef = 1.0;
13441 while (ent)
13442 {
13443 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13444 ent = ent.GetHierarchyParent();
13445 }
13446
13447 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13448 }
13449 }
13450 }
13451
13453 {
13454
13455 EntityAI parent = GetHierarchyParent();
13456 if (!parent)
13457 {
13458 hasParent = false;
13459 hasRootAsPlayer = false;
13460 }
13461 else
13462 {
13463 hasParent = true;
13464 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13465 refParentIB =
ItemBase.Cast(parent);
13466 }
13467 }
13468
13469 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13470 {
13471
13472 }
13473
13475 {
13476
13477 return false;
13478 }
13479
13481 {
13482
13483
13484 return false;
13485 }
13486
13488 {
13489
13490 return false;
13491 }
13492
13495 {
13496 return !GetIsFrozen() &&
IsOpen();
13497 }
13498
13500 {
13501 bool hasParent = false, hasRootAsPlayer = false;
13503
13504 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13505 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13506
13507 if (wwtu || foodDecay)
13508 {
13512
13513 if (processWetness || processTemperature || processDecay)
13514 {
13516
13517 if (processWetness)
13518 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13519
13520 if (processTemperature)
13522
13523 if (processDecay)
13524 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13525 }
13526 }
13527 }
13528
13531 {
13533 }
13534
13536 {
13539
13540 return super.GetTemperatureFreezeThreshold();
13541 }
13542
13544 {
13547
13548 return super.GetTemperatureThawThreshold();
13549 }
13550
13552 {
13555
13556 return super.GetItemOverheatThreshold();
13557 }
13558
13560 {
13562 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13563
13564 return super.GetTemperatureFreezeTime();
13565 }
13566
13568 {
13570 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13571
13572 return super.GetTemperatureThawTime();
13573 }
13574
13579
13581 {
13582 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13583 }
13584
13586 {
13587 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13588 }
13589
13592 {
13594 }
13595
13597 {
13599 }
13600
13602 {
13604 }
13605
13608 {
13609 return null;
13610 }
13611
13614 {
13615 return false;
13616 }
13617
13619 {
13621 {
13624 if (!trg)
13625 {
13627 explosive = this;
13628 }
13629
13630 explosive.PairRemote(trg);
13632
13633 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13634 trg.SetPersistentPairID(persistentID);
13635 explosive.SetPersistentPairID(persistentID);
13636
13637 return true;
13638 }
13639 return false;
13640 }
13641
13644 {
13645 float ret = 1.0;
13648 ret *= GetHealth01();
13649
13650 return ret;
13651 }
13652
13653 #ifdef DEVELOPER
13654 override void SetDebugItem()
13655 {
13656 super.SetDebugItem();
13657 _itemBase = this;
13658 }
13659
13661 {
13662 string text = super.GetDebugText();
13663
13665 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13666
13667 return text;
13668 }
13669 #endif
13670
13672 {
13673 return true;
13674 }
13675
13677
13679
13681 {
13684 }
13685
13686
13694
13710
13711 [
Obsolete(
"Use ItemSoundHandler instead")]
13714 {
13715 if (!
g_Game.IsDedicatedServer())
13716 {
13717 if (ConfigIsExisting("attachSoundSet"))
13718 {
13719 string cfg_path = "";
13720 string soundset = "";
13721 string type_name =
GetType();
13722
13725 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13726 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13727
13728 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13729 {
13730 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13731 {
13732 if (cfg_slot_array[i] == slot_type)
13733 {
13734 soundset = cfg_soundset_array[i];
13735 break;
13736 }
13737 }
13738 }
13739
13740 if (soundset != "")
13741 {
13742 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13744 }
13745 }
13746 }
13747 }
13748
13750}
13751
13753{
13755 if (entity)
13756 {
13757 bool is_item = entity.IsInherited(
ItemBase);
13758 if (is_item && full_quantity)
13759 {
13762 }
13763 }
13764 else
13765 {
13767 return NULL;
13768 }
13769 return entity;
13770}
13771
13773{
13774 if (item)
13775 {
13776 if (health > 0)
13777 item.SetHealth("", "", health);
13778
13779 if (item.CanHaveTemperature())
13780 {
13782 if (item.CanFreeze())
13783 item.SetFrozen(false);
13784 }
13785
13786 if (item.HasEnergyManager())
13787 {
13788 if (quantity >= 0)
13789 {
13790 item.GetCompEM().SetEnergy0To1(quantity);
13791 }
13792 else
13793 {
13795 }
13796 }
13797 else if (item.IsMagazine())
13798 {
13799 Magazine mag = Magazine.Cast(item);
13800 if (quantity >= 0)
13801 {
13802 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13803 }
13804 else
13805 {
13807 }
13808
13809 }
13810 else
13811 {
13812 if (quantity >= 0)
13813 {
13814 item.SetQuantityNormalized(quantity, false);
13815 }
13816 else
13817 {
13819 }
13820
13821 }
13822 }
13823}
13824
13825#ifdef DEVELOPER
13827#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.