8588{
8590 {
8591 return true;
8592 }
8593};
8594
8596{
8597
8598};
8599
8600
8601
8603{
8607
8609
8612
8613
8614
8615
8616
8625
8631
8636
8641
8662 protected bool m_IsResultOfSplit
8663
8665
8670
8671
8672
8674
8678
8679
8680
8682
8685
8686
8687
8693
8694
8702
8705
8706
8708
8709
8711
8712
8717
8718
8723
8725
8726
8728
8729
8731 {
8736
8737 if (!
g_Game.IsDedicatedServer())
8738 {
8740 {
8742
8744 {
8746 }
8747 }
8748
8751 }
8752
8753 m_OldLocation = null;
8754
8756 {
8758 }
8759
8760 if (ConfigIsExisting("headSelectionsToHide"))
8761 {
8764 }
8765
8767 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8768 {
8770 }
8771
8773
8774 m_IsResultOfSplit = false;
8775
8777 }
8778
8780 {
8781 super.InitItemVariables();
8782
8788 m_Count = ConfigGetInt(
"count");
8789
8792
8797
8800
8805
8817
8821
8822
8825 if (ConfigIsExisting("canBeSplit"))
8826 {
8829 }
8830
8832 if (ConfigIsExisting("itemBehaviour"))
8834
8835
8838 RegisterNetSyncVariableInt("m_VarLiquidType");
8839 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8840
8841 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8842 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8843 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8844
8845 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8846 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8847 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8848 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8849
8850 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8851 RegisterNetSyncVariableBool("m_IsTakeable");
8852 RegisterNetSyncVariableBool("m_IsHologram");
8853
8856 {
8859 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8860 }
8861
8863
8865 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8867
8869 }
8870
8872 {
8874 }
8875
8877 {
8880 {
8885 }
8886 }
8887
8888 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8889 {
8891 {
8894 }
8895
8897 }
8898
8900 {
8906 }
8907
8909
8911 {
8913
8914 if (!action)
8915 {
8916 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8917 return;
8918 }
8919
8921 if (!ai)
8922 {
8924 return;
8925 }
8926
8928 if (!action_array)
8929 {
8930 action_array = new array<ActionBase_Basic>;
8932 }
8933 if (LogManager.IsActionLogEnable())
8934 {
8935 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8936 }
8937
8938 if (action_array.Find(action) != -1)
8939 {
8940 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8941 }
8942 else
8943 {
8944 action_array.Insert(action);
8945 }
8946 }
8947
8949 {
8950 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8951 ActionBase action = player.GetActionManager().GetAction(actionName);
8954
8955 if (action_array)
8956 {
8957 action_array.RemoveItem(action);
8958 }
8959 }
8960
8961
8962
8964 {
8965 ActionOverrideData overrideData = new ActionOverrideData();
8969
8971 if (!actionMap)
8972 {
8975 }
8976
8977 actionMap.Insert(this.
Type(), overrideData);
8978
8979 }
8980
8982
8984
8985
8987 {
8990
8993
8994 string config_to_search = "CfgVehicles";
8995 string muzzle_owner_config;
8996
8998 {
8999 if (IsInherited(Weapon))
9000 config_to_search = "CfgWeapons";
9001
9002 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9003
9004 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9005
9006 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9007
9008 if (config_OnFire_subclass_count > 0)
9009 {
9010 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9011
9012 for (int i = 0; i < config_OnFire_subclass_count; i++)
9013 {
9014 string particle_class = "";
9015 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9016 string config_OnFire_entry = config_OnFire_class + particle_class;
9017 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9018 WPOF_array.Insert(WPOF);
9019 }
9020
9021
9023 }
9024 }
9025
9027 {
9028 config_to_search = "CfgWeapons";
9029 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9030
9031 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9032
9033 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9034
9035 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9036 {
9037 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9038
9039 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9040 {
9041 string particle_class2 = "";
9042 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9043 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9044 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9045 WPOBE_array.Insert(WPOBE);
9046 }
9047
9048
9050 }
9051 }
9052 }
9053
9054
9056 {
9059
9061 {
9062 string config_to_search = "CfgVehicles";
9063
9064 if (IsInherited(Weapon))
9065 config_to_search = "CfgWeapons";
9066
9067 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9068 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9069
9070 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9071 {
9072
9074
9076 {
9078 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9080 return;
9081 }
9082
9085
9086
9087
9088 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9089 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9090
9091 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9092 {
9093 string particle_class = "";
9094 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9095 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9096 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9097
9098 if (entry_type == CT_CLASS)
9099 {
9100 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9101 WPOOH_array.Insert(WPOF);
9102 }
9103 }
9104
9105
9107 }
9108 }
9109 }
9110
9112 {
9114 }
9115
9117 {
9119 {
9121
9124
9127
9128 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9129 }
9130 }
9131
9133 {
9135 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9136
9138 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9139
9141 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9142
9144 {
9146 }
9147 }
9148
9150 {
9152 }
9153
9155 {
9158 else
9160
9162 {
9165 }
9166 else
9167 {
9170
9173 }
9174
9176 }
9177
9179 {
9181 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9182 }
9183
9185 {
9187 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9189 }
9190
9192 {
9194 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9195 }
9196
9198 {
9201
9202 OverheatingParticle OP = new OverheatingParticle();
9207
9209 }
9210
9212 {
9215
9216 return -1;
9217 }
9218
9220 {
9222 {
9225
9226 for (int i = count; i > 0; --i)
9227 {
9228 int id = i - 1;
9231
9234
9235 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9236 {
9237 if (p)
9238 {
9241 }
9242 }
9243 }
9244 }
9245 }
9246
9248 {
9250 {
9252 {
9253 int id = i - 1;
9255
9256 if (OP)
9257 {
9259
9260 if (p)
9261 {
9263 }
9264
9265 delete OP;
9266 }
9267 }
9268
9271 }
9272 }
9273
9276 {
9277 return 0.0;
9278 }
9279
9280
9282 {
9283 return 250;
9284 }
9285
9287 {
9288 return 0;
9289 }
9290
9293 {
9295 return true;
9296
9297 return false;
9298 }
9299
9302 {
9305
9307 {
9309 }
9310 else
9311 {
9312
9314 }
9315
9317 }
9318
9325 {
9326 return -1;
9327 }
9328
9329
9330
9331
9333 {
9335 {
9336 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9337 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9338
9339 if (r_index >= 0)
9340 {
9341 InventoryLocation r_il = new InventoryLocation;
9342 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9343
9344 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9347 {
9348 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9349 }
9351 {
9352 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9353 }
9354
9355 }
9356
9357 player.GetHumanInventory().ClearUserReservedLocation(this);
9358 }
9359
9362 }
9363
9364
9365
9366
9368 {
9369 return ItemBase.m_DebugActionsMask;
9370 }
9371
9373 {
9374 return ItemBase.m_DebugActionsMask & mask;
9375 }
9376
9378 {
9379 ItemBase.m_DebugActionsMask = mask;
9380 }
9381
9383 {
9384 ItemBase.m_DebugActionsMask |= mask;
9385 }
9386
9388 {
9389 ItemBase.m_DebugActionsMask &= ~mask;
9390 }
9391
9393 {
9395 {
9397 }
9398 else
9399 {
9401 }
9402 }
9403
9404
9406 {
9407 if (GetEconomyProfile())
9408 {
9409 float q_max = GetEconomyProfile().GetQuantityMax();
9410 if (q_max > 0)
9411 {
9412 float q_min = GetEconomyProfile().GetQuantityMin();
9413 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9414
9416 {
9417 ComponentEnergyManager comp = GetCompEM();
9419 {
9421 }
9422 }
9424 {
9426
9427 }
9428
9429 }
9430 }
9431 }
9432
9435 {
9436 EntityAI parent = GetHierarchyParent();
9437
9438 if (parent)
9439 {
9440 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9441 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9442 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9443 }
9444 }
9445
9448 {
9449 EntityAI parent = GetHierarchyParent();
9450
9451 if (parent)
9452 {
9453 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9454 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9455 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9456 }
9457 }
9458
9460 {
9461
9462
9463
9464
9466
9468 {
9469 if (ScriptInputUserData.CanStoreInputUserData())
9470 {
9471 ScriptInputUserData ctx = new ScriptInputUserData;
9477 ctx.
Write(use_stack_max);
9480
9482 {
9483 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9484 }
9485 }
9486 }
9487 else if (!
g_Game.IsMultiplayer())
9488 {
9490 }
9491 }
9492
9494 {
9496 }
9497
9499 {
9501 }
9502
9504 {
9506 }
9507
9509 {
9510
9511 return false;
9512 }
9513
9515 {
9516 return false;
9517 }
9518
9522 {
9523 return false;
9524 }
9525
9527 {
9528 return "";
9529 }
9530
9532
9534 {
9535 return false;
9536 }
9537
9539 {
9540 return true;
9541 }
9542
9543
9544
9546 {
9547 return true;
9548 }
9549
9551 {
9552 return true;
9553 }
9554
9556 {
9557 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9559 }
9560
9562 {
9564 }
9565
9567 {
9569 if (!is_being_placed)
9571 SetSynchDirty();
9572 }
9573
9574
9576
9578 {
9580 }
9581
9583 {
9585 }
9586
9588 {
9589 return 1;
9590 }
9591
9593 {
9594 return false;
9595 }
9596
9598 {
9600 SetSynchDirty();
9601 }
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9638 {
9639 super.OnMovedInsideCargo(container);
9640
9641 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9642 }
9643
9644 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9645 {
9646 super.EEItemLocationChanged(oldLoc, newLoc);
9647
9648 PlayerBase newPlayer = null;
9649 PlayerBase oldPlayer = null;
9650
9651 if (newLoc.GetParent())
9652 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9653
9654 if (oldLoc.GetParent())
9655 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9656
9658 {
9659 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9660
9661 if (rIndex >= 0)
9662 {
9663 InventoryLocation rIl = new InventoryLocation;
9664 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9665
9666 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9669 {
9670 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9671 }
9673 {
9675 }
9676
9677 }
9678 }
9679
9681 {
9682 if (newPlayer)
9683 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9684
9685 if (newPlayer == oldPlayer)
9686 {
9687 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9688 {
9690 {
9691 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9692 {
9693 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9694 }
9695 }
9696 else
9697 {
9698 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9699 }
9700 }
9701
9702 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9703 {
9704 int type = oldLoc.GetType();
9706 {
9707 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9708 }
9710 {
9711 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9712 }
9713 }
9714 if (!m_OldLocation)
9715 {
9716 m_OldLocation = new InventoryLocation;
9717 }
9718 m_OldLocation.Copy(oldLoc);
9719 }
9720 else
9721 {
9722 if (m_OldLocation)
9723 {
9724 m_OldLocation.Reset();
9725 }
9726 }
9727
9728 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9729 }
9730 else
9731 {
9732 if (newPlayer)
9733 {
9734 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9735 if (resIndex >= 0)
9736 {
9737 InventoryLocation il = new InventoryLocation;
9738 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9740 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9743 {
9744 il.
GetParent().GetOnReleaseLock().Invoke(it);
9745 }
9747 {
9749 }
9750
9751 }
9752 }
9754 {
9755
9757 }
9758
9759 if (m_OldLocation)
9760 {
9761 m_OldLocation.Reset();
9762 }
9763 }
9764
9766 {
9767 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9768 }
9769
9771 {
9772 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9773 }
9774 }
9775
9776 override void EOnContact(IEntity other, Contact extra)
9777 {
9779 {
9780 int liquidType = -1;
9782 if (impactSpeed > 0.0)
9783 {
9785 #ifndef SERVER
9787 #else
9789 SetSynchDirty();
9790 #endif
9792 }
9793 }
9794
9795 #ifdef SERVER
9796 if (GetCompEM() && GetCompEM().IsPlugged())
9797 {
9798 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
9799 GetCompEM().UnplugThis();
9800 }
9801 #endif
9802 }
9803
9805
9807 {
9809 }
9810
9812 {
9813
9814 }
9815
9817 {
9818 super.OnItemLocationChanged(old_owner, new_owner);
9819
9820 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9821 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9822
9823 if (!relatedPlayer && playerNew)
9824 relatedPlayer = playerNew;
9825
9826 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9827 {
9829 if (actionMgr)
9830 {
9831 ActionBase currentAction = actionMgr.GetRunningAction();
9832 if (currentAction)
9834 }
9835 }
9836
9837 Man ownerPlayerOld = null;
9838 Man ownerPlayerNew = null;
9839
9840 if (old_owner)
9841 {
9842 if (old_owner.
IsMan())
9843 {
9844 ownerPlayerOld = Man.Cast(old_owner);
9845 }
9846 else
9847 {
9848 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9849 }
9850 }
9851 else
9852 {
9854 {
9856
9857 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9858 {
9859 GetCompEM().UnplugThis();
9860 }
9861 }
9862 }
9863
9864 if (new_owner)
9865 {
9866 if (new_owner.
IsMan())
9867 {
9868 ownerPlayerNew = Man.Cast(new_owner);
9869 }
9870 else
9871 {
9872 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9873 }
9874 }
9875
9876 if (ownerPlayerOld != ownerPlayerNew)
9877 {
9878 if (ownerPlayerOld)
9879 {
9880 array<EntityAI> subItemsExit = new array<EntityAI>;
9882 for (int i = 0; i < subItemsExit.Count(); i++)
9883 {
9886 }
9887 }
9888
9889 if (ownerPlayerNew)
9890 {
9891 array<EntityAI> subItemsEnter = new array<EntityAI>;
9893 for (int j = 0; j < subItemsEnter.Count(); j++)
9894 {
9897 }
9898 }
9899 }
9900 else if (ownerPlayerNew != null)
9901 {
9902 PlayerBase nplayer;
9903 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9904 {
9905 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9907 for (int k = 0; k < subItemsUpdate.Count(); k++)
9908 {
9910 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9911 }
9912 }
9913 }
9914
9915 if (old_owner)
9916 old_owner.OnChildItemRemoved(this);
9917 if (new_owner)
9918 new_owner.OnChildItemReceived(this);
9919 }
9920
9921
9923 {
9924 super.EEDelete(parent);
9925 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9926 if (player)
9927 {
9929
9930 if (player.IsAlive())
9931 {
9932 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9933 if (r_index >= 0)
9934 {
9935 InventoryLocation r_il = new InventoryLocation;
9936 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9937
9938 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9941 {
9942 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9943 }
9945 {
9946 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9947 }
9948
9949 }
9950
9951 player.RemoveQuickBarEntityShortcut(this);
9952 }
9953 }
9954 }
9955
9957 {
9958 super.EEKilled(killer);
9959
9962 {
9963 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9964 {
9965 if (IsMagazine())
9966 {
9967 if (Magazine.Cast(this).GetAmmoCount() > 0)
9968 {
9970 }
9971 }
9972 else
9973 {
9975 }
9976 }
9977 }
9978 }
9979
9981 {
9982 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9983
9984 super.OnWasAttached(parent, slot_id);
9985
9988
9991 }
9992
9994 {
9995 super.OnWasDetached(parent, slot_id);
9996
9999
10002 }
10003
10005 {
10006 int idx;
10009
10010 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10011 if (inventory_slots.Count() < 1)
10012 {
10013 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10014 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10015 }
10016 else
10017 {
10018 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10019 }
10020
10021 idx = inventory_slots.Find(slot);
10022 if (idx < 0)
10023 return "";
10024
10025 return attach_types.Get(idx);
10026 }
10027
10029 {
10030 int idx = -1;
10031 string slot;
10032
10035
10036 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10037 if (inventory_slots.Count() < 1)
10038 {
10039 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10040 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10041 }
10042 else
10043 {
10044 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10045 if (detach_types.Count() < 1)
10046 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10047 }
10048
10049 for (int i = 0; i < inventory_slots.Count(); i++)
10050 {
10051 slot = inventory_slots.Get(i);
10052 }
10053
10054 if (slot != "")
10055 {
10056 if (detach_types.Count() == 1)
10057 idx = 0;
10058 else
10059 idx = inventory_slots.Find(slot);
10060 }
10061 if (idx < 0)
10062 return "";
10063
10064 return detach_types.Get(idx);
10065 }
10066
10068 {
10069
10071
10072
10073 float min_time = 1;
10074 float max_time = 3;
10075 float delay = Math.RandomFloat(min_time, max_time);
10076
10077 explode_timer.Run(delay, this, "DoAmmoExplosion");
10078 }
10079
10081 {
10082 Magazine magazine = Magazine.Cast(this);
10083 int pop_sounds_count = 6;
10084 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10085
10086
10087 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10088 string sound_name = pop_sounds[ sound_idx ];
10089 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10090
10091
10092 magazine.ServerAddAmmoCount(-1);
10093
10094
10095 float min_temp_to_explode = 100;
10096
10097 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10098 {
10100 }
10101 }
10102
10103
10104 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10105 {
10106 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10107
10108 const int CHANCE_DAMAGE_CARGO = 4;
10109 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10110 const int CHANCE_DAMAGE_NOTHING = 2;
10111
10113 {
10114 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10115 int chances;
10116 int rnd;
10117
10118 if (GetInventory().GetCargo())
10119 {
10120 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10121 rnd = Math.RandomInt(0,chances);
10122
10123 if (rnd < CHANCE_DAMAGE_CARGO)
10124 {
10126 }
10127 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10128 {
10130 }
10131 }
10132 else
10133 {
10134 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10135 rnd = Math.RandomInt(0,chances);
10136
10137 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10138 {
10140 }
10141 }
10142 }
10143 }
10144
10146 {
10147 CargoBase cargo = GetInventory().GetCargo();
10148 if (cargo)
10149 {
10151 if (item_count > 0)
10152 {
10153 int random_pick = Math.RandomInt(0, item_count);
10155 if (!item.IsExplosive())
10156 {
10157 item.AddHealth("","",damage);
10158 return true;
10159 }
10160 }
10161 }
10162 return false;
10163 }
10164
10166 {
10167 GameInventory inventory = GetInventory();
10169 if (attachment_count > 0)
10170 {
10171 int random_pick = Math.RandomInt(0, attachment_count);
10173 if (!attachment.IsExplosive())
10174 {
10175 attachment.AddHealth("","",damage);
10176 return true;
10177 }
10178 }
10179 return false;
10180 }
10181
10183 {
10185 }
10186
10188 {
10190 return GetInventory().CanRemoveEntity();
10191
10192 return false;
10193 }
10194
10196 {
10197
10199 return false;
10200
10201
10203 return false;
10204
10205
10206
10208 if (delta == 0)
10209 return false;
10210
10211
10212 return true;
10213 }
10214
10216 {
10218 {
10219 if (ScriptInputUserData.CanStoreInputUserData())
10220 {
10221 ScriptInputUserData ctx = new ScriptInputUserData;
10226 ctx.
Write(destination_entity);
10228 ctx.
Write(slot_id);
10230 }
10231 }
10232 else if (!
g_Game.IsMultiplayer())
10233 {
10235 }
10236 }
10237
10239 {
10240 float split_quantity_new;
10244 InventoryLocation loc = new InventoryLocation;
10245
10246 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10247 {
10249 split_quantity_new = stack_max;
10250 else
10252
10254 {
10255 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10256 if (new_item)
10257 {
10258 new_item.SetResultOfSplit(true);
10259 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10261 new_item.
SetQuantity(split_quantity_new,
false,
true);
10262 }
10263 }
10264 }
10265 else if (destination_entity && slot_id == -1)
10266 {
10267 if (quantity > stack_max)
10268 split_quantity_new = stack_max;
10269 else
10270 split_quantity_new = quantity;
10271
10273 {
10274 GameInventory destinationInventory = destination_entity.GetInventory();
10276 {
10279 }
10280
10281 if (new_item)
10282 {
10283 new_item.SetResultOfSplit(true);
10284 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10286 new_item.
SetQuantity(split_quantity_new,
false,
true);
10287 }
10288 }
10289 }
10290 else
10291 {
10292 if (stack_max != 0)
10293 {
10295 {
10297 }
10298
10299 if (split_quantity_new == 0)
10300 {
10301 if (!
g_Game.IsMultiplayer())
10302 player.PhysicalPredictiveDropItem(this);
10303 else
10304 player.ServerDropEntity(this);
10305 return;
10306 }
10307
10309 {
10311
10312 if (new_item)
10313 {
10314 new_item.SetResultOfSplit(true);
10315 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10318 new_item.PlaceOnSurface();
10319 }
10320 }
10321 }
10322 }
10323 }
10324
10326 {
10327 float split_quantity_new;
10331 InventoryLocation loc = new InventoryLocation;
10332
10333 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10334 {
10336 split_quantity_new = stack_max;
10337 else
10339
10341 {
10342 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10343 if (new_item)
10344 {
10345 new_item.SetResultOfSplit(true);
10346 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10348 new_item.
SetQuantity(split_quantity_new,
false,
true);
10349 }
10350 }
10351 }
10352 else if (destination_entity && slot_id == -1)
10353 {
10354 if (quantity > stack_max)
10355 split_quantity_new = stack_max;
10356 else
10357 split_quantity_new = quantity;
10358
10360 {
10361 GameInventory destinationInventory = destination_entity.GetInventory();
10363 {
10366 }
10367
10368 if (new_item)
10369 {
10370 new_item.SetResultOfSplit(true);
10371 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10373 new_item.
SetQuantity(split_quantity_new,
false,
true);
10374 }
10375 }
10376 }
10377 else
10378 {
10379 if (stack_max != 0)
10380 {
10382 {
10384 }
10385
10387 {
10389
10390 if (new_item)
10391 {
10392 new_item.SetResultOfSplit(true);
10393 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10396 new_item.PlaceOnSurface();
10397 }
10398 }
10399 }
10400 }
10401 }
10402
10404 {
10406 {
10407 if (ScriptInputUserData.CanStoreInputUserData())
10408 {
10409 ScriptInputUserData ctx = new ScriptInputUserData;
10414 dst.WriteToContext(ctx);
10416 }
10417 }
10418 else if (!
g_Game.IsMultiplayer())
10419 {
10421 }
10422 }
10423
10425 {
10427 {
10428 if (ScriptInputUserData.CanStoreInputUserData())
10429 {
10430 ScriptInputUserData ctx = new ScriptInputUserData;
10435 ctx.
Write(destination_entity);
10441 }
10442 }
10443 else if (!
g_Game.IsMultiplayer())
10444 {
10446 }
10447 }
10448
10450 {
10452 }
10453
10455 {
10457 float split_quantity_new;
10459 if (dst.IsValid())
10460 {
10461 int slot_id = dst.GetSlot();
10463
10464 if (quantity > stack_max)
10465 split_quantity_new = stack_max;
10466 else
10467 split_quantity_new = quantity;
10468
10470 {
10472
10473 if (new_item)
10474 {
10475 new_item.SetResultOfSplit(true);
10476 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10478 new_item.
SetQuantity(split_quantity_new,
false,
true);
10479 }
10480
10481 return new_item;
10482 }
10483 }
10484
10485 return null;
10486 }
10487
10489 {
10491 float split_quantity_new;
10493 if (destination_entity)
10494 {
10496 if (quantity > stackable)
10497 split_quantity_new = stackable;
10498 else
10499 split_quantity_new = quantity;
10500
10502 {
10503 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10504 if (new_item)
10505 {
10506 new_item.SetResultOfSplit(true);
10507 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10509 new_item.
SetQuantity(split_quantity_new,
false,
true);
10510 }
10511 }
10512 }
10513 }
10514
10516 {
10518 {
10519 if (ScriptInputUserData.CanStoreInputUserData())
10520 {
10521 ScriptInputUserData ctx = new ScriptInputUserData;
10526 ItemBase destination_entity =
this;
10527 ctx.
Write(destination_entity);
10531 }
10532 }
10533 else if (!
g_Game.IsMultiplayer())
10534 {
10536 }
10537 }
10538
10540 {
10542 float split_quantity_new;
10544 if (player)
10545 {
10547 if (quantity > stackable)
10548 split_quantity_new = stackable;
10549 else
10550 split_quantity_new = quantity;
10551
10553 {
10554 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10555 new_item =
ItemBase.Cast(in_hands);
10556 if (new_item)
10557 {
10558 new_item.SetResultOfSplit(true);
10559 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10561 new_item.SetQuantity(split_quantity_new, false, true);
10562 }
10563 }
10564 }
10565 }
10566
10568 {
10570 float split_quantity_new = Math.Floor(quantity * 0.5);
10571
10573 return;
10574
10576
10577 if (new_item)
10578 {
10579 if (new_item.GetQuantityMax() < split_quantity_new)
10580 {
10581 split_quantity_new = new_item.GetQuantityMax();
10582 }
10583
10584 new_item.SetResultOfSplit(true);
10585 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10586
10588 {
10591 }
10592 else
10593 {
10595 new_item.
SetQuantity(split_quantity_new,
false,
true);
10596 }
10597 }
10598 }
10599
10601 {
10603 float split_quantity_new = Math.Floor(quantity / 2);
10604
10606 return;
10607
10608 InventoryLocation invloc = new InventoryLocation;
10610
10612 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10613
10614 if (new_item)
10615 {
10616 if (new_item.GetQuantityMax() < split_quantity_new)
10617 {
10618 split_quantity_new = new_item.GetQuantityMax();
10619 }
10621 {
10624 }
10625 else if (split_quantity_new > 1)
10626 {
10628 new_item.
SetQuantity(split_quantity_new,
false,
true);
10629 }
10630 }
10631 }
10632
10635 {
10636 SetWeightDirty();
10638
10639 if (parent)
10640 parent.OnAttachmentQuantityChangedEx(this, delta);
10641
10643 {
10645 {
10647 }
10649 {
10650 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10652 }
10653 }
10654 }
10655
10658 {
10659
10660 }
10661
10664 {
10666 }
10667
10669 {
10670 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10671
10673 {
10674 if (newLevel == GameConstants.STATE_RUINED)
10675 {
10677 EntityAI parent = GetHierarchyParent();
10678 if (parent && parent.IsFireplace())
10679 {
10680 CargoBase cargo = GetInventory().GetCargo();
10681 if (cargo)
10682 {
10684 {
10686 }
10687 }
10688 }
10689 }
10690
10692 {
10693
10695 return;
10696 }
10697
10698 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10699 {
10701 }
10702 }
10703 }
10704
10705
10707 {
10708 super.OnRightClick();
10709
10711 {
10713 {
10714 if (ScriptInputUserData.CanStoreInputUserData())
10715 {
10716 EntityAI root = GetHierarchyRoot();
10717 Man playerOwner = GetHierarchyRootPlayer();
10718 InventoryLocation dst = new InventoryLocation;
10719
10720
10721 if (!playerOwner && root && root == this)
10722 {
10724 }
10725 else
10726 {
10727
10728 GetInventory().GetCurrentInventoryLocation(dst);
10730 {
10731 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10733 {
10735 }
10736 else
10737 {
10739
10740
10741 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10742 {
10744 }
10745 else
10746 {
10747 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10748 }
10749 }
10750 }
10751 }
10752
10753 ScriptInputUserData ctx = new ScriptInputUserData;
10761 }
10762 }
10763 else if (!
g_Game.IsMultiplayer())
10764 {
10766 }
10767 }
10768 }
10769
10771 {
10772 if (root)
10773 {
10774 vector m4[4];
10775 root.GetTransform(m4);
10776 dst.SetGround(this, m4);
10777 }
10778 else
10779 {
10780 GetInventory().GetCurrentInventoryLocation(dst);
10781 }
10782 }
10783
10784 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
10785 {
10786
10787 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
10788 return false;
10789
10790 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10791 return false;
10792
10793
10795 return false;
10796
10797
10798 Magazine mag = Magazine.Cast(this);
10799 if (mag)
10800 {
10801 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10802 return false;
10803
10804 if (stack_max_limit)
10805 {
10806 Magazine other_mag = Magazine.Cast(other_item);
10807 if (other_item)
10808 {
10809 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10810 return false;
10811 }
10812
10813 }
10814 }
10815 else
10816 {
10817
10819 return false;
10820
10822 return false;
10823 }
10824
10825 PlayerBase player = null;
10826 if (CastTo(player, GetHierarchyRootPlayer()))
10827 {
10828 if (player.GetInventory().HasAttachment(this))
10829 return false;
10830
10831 if (player.IsItemsToDelete())
10832 return false;
10833 }
10834
10835 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10836 return false;
10837
10838 int slotID;
10840 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10841 return false;
10842
10843 return true;
10844 }
10845
10847 {
10849 }
10850
10852 {
10853 return m_IsResultOfSplit;
10854 }
10855
10857 {
10858 m_IsResultOfSplit = value;
10859 }
10860
10862 {
10864 }
10865
10867 {
10868 float other_item_quantity = other_item.GetQuantity();
10869 float this_free_space;
10870
10872
10874
10875 if (other_item_quantity > this_free_space)
10876 {
10877 return this_free_space;
10878 }
10879 else
10880 {
10881 return other_item_quantity;
10882 }
10883 }
10884
10886 {
10888 }
10889
10891 {
10893 return;
10894
10895 if (!IsMagazine() && other_item)
10896 {
10898 if (quantity_used != 0)
10899 {
10900 float hp1 = GetHealth01("","");
10901 float hp2 = other_item.GetHealth01("","");
10902 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10903 hpResult = hpResult / (
GetQuantity() + quantity_used);
10904
10905 hpResult *= GetMaxHealth();
10906 Math.Round(hpResult);
10907 SetHealth("", "Health", hpResult);
10908
10910 other_item.AddQuantity(-quantity_used);
10911 }
10912 }
10914 }
10915
10917 {
10918 #ifdef SERVER
10919 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10920 GetHierarchyParent().IncreaseLifetimeUp();
10921 #endif
10922 };
10923
10925 {
10926 PlayerBase p = PlayerBase.Cast(player);
10927
10928 array<int> recipesIds = p.m_Recipes;
10929 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10930 if (moduleRecipesManager)
10931 {
10932 EntityAI itemInHands = player.GetEntityInHands();
10933 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10934 }
10935
10936 for (int i = 0;i < recipesIds.Count(); i++)
10937 {
10938 int key = recipesIds.Get(i);
10939 string recipeName = moduleRecipesManager.GetRecipeName(key);
10941 }
10942 }
10943
10944
10945 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10946 {
10947 super.GetDebugActions(outputList);
10948
10949
10955
10956
10961
10966
10967
10971
10972
10974 {
10978 }
10979
10982
10983
10987
10989
10990 InventoryLocation loc = new InventoryLocation();
10991 GetInventory().GetCurrentInventoryLocation(loc);
10993 {
10994 if (Gizmo_IsSupported())
10997 }
10998
11000 }
11001
11002
11003
11004
11006 {
11007 super.OnAction(action_id, player, ctx);
11008
11010 {
11011 switch (action_id)
11012 {
11016 return true;
11020 return true;
11021 }
11022 }
11023
11025 {
11026 switch (action_id)
11027 {
11029 Delete();
11030 return true;
11031 }
11032 }
11033
11034 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11035 {
11036 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11037 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11038 PlayerBase p = PlayerBase.Cast(player);
11039 if (
EActions.RECIPES_RANGE_START < 1000)
11040 {
11041 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11042 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11043 }
11044 }
11045 #ifndef SERVER
11046 else if (action_id ==
EActions.WATCH_PLAYER)
11047 {
11048 PluginDeveloper.SetDeveloperItemClientEx(player);
11049 }
11050 #endif
11052 {
11053 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11054 {
11055 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11056 OnDebugButtonPressServer(id + 1);
11057 }
11058
11059 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11060 {
11061 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11063 }
11064
11065 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11066 {
11067 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11069 }
11070
11071 else if (action_id ==
EActions.ADD_QUANTITY)
11072 {
11073 if (IsMagazine())
11074 {
11075 Magazine mag = Magazine.Cast(this);
11076 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11077 }
11078 else
11079 {
11081 }
11082
11083 if (m_EM)
11084 {
11085 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11086 }
11087
11088 }
11089
11090 else if (action_id ==
EActions.REMOVE_QUANTITY)
11091 {
11092 if (IsMagazine())
11093 {
11094 Magazine mag2 = Magazine.Cast(this);
11095 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11096 }
11097 else
11098 {
11100 }
11101 if (m_EM)
11102 {
11103 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11104 }
11105
11106 }
11107
11108 else if (action_id ==
EActions.SET_QUANTITY_0)
11109 {
11111
11112 if (m_EM)
11113 {
11114 m_EM.SetEnergy(0);
11115 }
11116 }
11117
11118 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11119 {
11121
11122 if (m_EM)
11123 {
11124 m_EM.SetEnergy(m_EM.GetEnergyMax());
11125 }
11126 }
11127
11128 else if (action_id ==
EActions.ADD_HEALTH)
11129 {
11130 AddHealth("","",GetMaxHealth("","Health")/5);
11131 }
11132 else if (action_id ==
EActions.REMOVE_HEALTH)
11133 {
11134 AddHealth("","",-GetMaxHealth("","Health")/5);
11135 }
11136 else if (action_id ==
EActions.DESTROY_HEALTH)
11137 {
11138 SetHealth01("","",0);
11139 }
11140 else if (action_id ==
EActions.WATCH_ITEM)
11141 {
11143 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11144 #ifdef DEVELOPER
11145 SetDebugDeveloper_item(this);
11146 #endif
11147 }
11148
11149 else if (action_id ==
EActions.ADD_TEMPERATURE)
11150 {
11151 AddTemperature(20);
11152
11153 }
11154
11155 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11156 {
11157 AddTemperature(-20);
11158
11159 }
11160
11161 else if (action_id ==
EActions.FLIP_FROZEN)
11162 {
11163 SetFrozen(!GetIsFrozen());
11164
11165 }
11166
11167 else if (action_id ==
EActions.ADD_WETNESS)
11168 {
11170
11171 }
11172
11173 else if (action_id ==
EActions.REMOVE_WETNESS)
11174 {
11176
11177 }
11178
11179 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11180 {
11183
11184
11185 }
11186
11187 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11188 {
11191 }
11192
11193 else if (action_id ==
EActions.MAKE_SPECIAL)
11194 {
11195 auto debugParams = DebugSpawnParams.WithPlayer(player);
11196 OnDebugSpawnEx(debugParams);
11197 }
11198
11199 }
11200
11201
11202 return false;
11203 }
11204
11205
11206
11207
11211
11214
11215
11216
11218 {
11219 return false;
11220 }
11221
11222
11224 {
11225 return true;
11226 }
11227
11228
11230 {
11231 return true;
11232 }
11233
11234
11235
11237 {
11238 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11239 return g_Game.ConfigIsExisting(config_path);
11240 }
11241
11244 {
11245 return null;
11246 }
11247
11249 {
11250 return false;
11251 }
11252
11254 {
11255 return false;
11256 }
11257
11261
11262
11264 {
11265 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11266 return module_repairing.CanRepair(this, item_repair_kit);
11267 }
11268
11269
11270 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11271 {
11272 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11273 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11274 }
11275
11276
11278 {
11279
11280
11281
11282
11283
11284
11285
11286
11287 return 1;
11288 }
11289
11290
11291
11293 {
11295 }
11296
11297
11298
11300 {
11302 }
11303
11304
11313 {
11314 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11315
11316 if (player)
11317 {
11318 player.MessageStatus(text);
11319 }
11320 }
11321
11322
11331 {
11332 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11333
11334 if (player)
11335 {
11336 player.MessageAction(text);
11337 }
11338 }
11339
11340
11349 {
11350 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11351
11352 if (player)
11353 {
11354 player.MessageFriendly(text);
11355 }
11356 }
11357
11358
11367 {
11368 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11369
11370 if (player)
11371 {
11372 player.MessageImportant(text);
11373 }
11374 }
11375
11377 {
11378 return true;
11379 }
11380
11381
11382 override bool KindOf(
string tag)
11383 {
11384 bool found = false;
11385 string item_name = this.
GetType();
11387 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11388
11389 int array_size = item_tag_array.Count();
11390 for (int i = 0; i < array_size; i++)
11391 {
11392 if (item_tag_array.Get(i) == tag)
11393 {
11394 found = true;
11395 break;
11396 }
11397 }
11398 return found;
11399 }
11400
11401
11403 {
11404
11405 super.OnRPC(sender, rpc_type,ctx);
11406
11407
11408 switch (rpc_type)
11409 {
11410 #ifndef SERVER
11411 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11412 Param2<bool, string> p = new Param2<bool, string>(false, "");
11413
11415 return;
11416
11417 bool play = p.param1;
11418 string soundSet = p.param2;
11419
11420 if (play)
11421 {
11423 {
11425 {
11427 }
11428 }
11429 else
11430 {
11432 }
11433 }
11434 else
11435 {
11437 }
11438
11439 break;
11440 #endif
11441
11442 }
11443
11445 {
11447 }
11448 }
11449
11450
11451
11452
11454 {
11455 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11456 return plugin.GetID(
name);
11457 }
11458
11460 {
11461 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11462 return plugin.GetName(id);
11463 }
11464
11467 {
11468
11469
11470 int varFlags;
11471 if (!ctx.
Read(varFlags))
11472 return;
11473
11474 if (varFlags & ItemVariableFlags.FLOAT)
11475 {
11477 }
11478 }
11479
11481 {
11482
11483 super.SerializeNumericalVars(floats_out);
11484
11485
11486
11488 {
11490 }
11491
11493 {
11495 }
11496
11498 {
11500 }
11501
11503 {
11508 }
11509
11511 {
11513 }
11514 }
11515
11517 {
11518
11519 super.DeSerializeNumericalVars(floats);
11520
11521
11522 int index = 0;
11523 int mask = Math.Round(floats.Get(index));
11524
11525 index++;
11526
11528 {
11530 {
11532 }
11533 else
11534 {
11535 float quantity = floats.Get(index);
11536 SetQuantity(quantity,
true,
false,
false,
false);
11537 }
11538 index++;
11539 }
11540
11542 {
11543 float wet = floats.Get(index);
11545 index++;
11546 }
11547
11549 {
11550 int liquidtype = Math.Round(floats.Get(index));
11552 index++;
11553 }
11554
11556 {
11558 index++;
11560 index++;
11562 index++;
11564 index++;
11565 }
11566
11568 {
11569 int cleanness = Math.Round(floats.Get(index));
11571 index++;
11572 }
11573 }
11574
11576 {
11577 super.WriteVarsToCTX(ctx);
11578
11579
11581 {
11583 }
11584
11586 {
11588 }
11589
11591 {
11593 }
11594
11596 {
11597 int r,g,b,a;
11603 }
11604
11606 {
11608 }
11609 }
11610
11612 {
11613 if (!super.ReadVarsFromCTX(ctx,version))
11614 return false;
11615
11616 int intValue;
11617 float value;
11618
11619 if (version < 140)
11620 {
11621 if (!ctx.
Read(intValue))
11622 return false;
11623
11624 m_VariablesMask = intValue;
11625 }
11626
11628 {
11629 if (!ctx.
Read(value))
11630 return false;
11631
11633 {
11635 }
11636 else
11637 {
11639 }
11640 }
11641
11642 if (version < 140)
11643 {
11645 {
11646 if (!ctx.
Read(value))
11647 return false;
11648 SetTemperatureDirect(value);
11649 }
11650 }
11651
11653 {
11654 if (!ctx.
Read(value))
11655 return false;
11657 }
11658
11660 {
11661 if (!ctx.
Read(intValue))
11662 return false;
11664 }
11665
11667 {
11668 int r,g,b,a;
11670 return false;
11672 return false;
11674 return false;
11676 return false;
11677
11679 }
11680
11682 {
11683 if (!ctx.
Read(intValue))
11684 return false;
11686 }
11687
11688 if (version >= 138 && version < 140)
11689 {
11691 {
11692 if (!ctx.
Read(intValue))
11693 return false;
11694 SetFrozen(intValue);
11695 }
11696 }
11697
11698 return true;
11699 }
11700
11701
11703 {
11706 {
11708 }
11709
11710 if (!super.OnStoreLoad(ctx, version))
11711 {
11713 return false;
11714 }
11715
11716 if (version >= 114)
11717 {
11718 bool hasQuickBarIndexSaved;
11719
11720 if (!ctx.
Read(hasQuickBarIndexSaved))
11721 {
11723 return false;
11724 }
11725
11726 if (hasQuickBarIndexSaved)
11727 {
11728 int itmQBIndex;
11729
11730
11731 if (!ctx.
Read(itmQBIndex))
11732 {
11734 return false;
11735 }
11736
11737 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11738 if (itmQBIndex != -1 && parentPlayer)
11739 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11740 }
11741 }
11742 else
11743 {
11744
11745 PlayerBase player;
11746 int itemQBIndex;
11747 if (version ==
int.
MAX)
11748 {
11749 if (!ctx.
Read(itemQBIndex))
11750 {
11752 return false;
11753 }
11754 }
11755 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11756 {
11757
11758 if (!ctx.
Read(itemQBIndex))
11759 {
11761 return false;
11762 }
11763 if (itemQBIndex != -1 && player)
11764 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11765 }
11766 }
11767
11768 if (version < 140)
11769 {
11770
11771 if (!LoadVariables(ctx, version))
11772 {
11774 return false;
11775 }
11776 }
11777
11778
11780 {
11782 return false;
11783 }
11784 if (version >= 132)
11785 {
11787 if (raib)
11788 {
11790 {
11792 return false;
11793 }
11794 }
11795 }
11796
11798 return true;
11799 }
11800
11801
11802
11804 {
11805 super.OnStoreSave(ctx);
11806
11807 PlayerBase player;
11808 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11809 {
11811
11812 int itemQBIndex = -1;
11813 itemQBIndex = player.FindQuickBarEntityIndex(this);
11814 ctx.
Write(itemQBIndex);
11815 }
11816 else
11817 {
11819 }
11820
11822
11824 if (raib)
11825 {
11827 }
11828 }
11829
11830
11832 {
11833 super.AfterStoreLoad();
11834
11836 {
11838 }
11839
11841 {
11844 }
11845 }
11846
11848 {
11849 super.EEOnAfterLoad();
11850
11852 {
11854 }
11855
11858 }
11859
11861 {
11862 return false;
11863 }
11864
11865
11866
11868 {
11870 {
11871 #ifdef PLATFORM_CONSOLE
11872
11874 {
11876 if (menu)
11877 {
11879 }
11880 }
11881 #endif
11882 }
11883
11885 {
11888 }
11889
11891 {
11892 SetWeightDirty();
11894 }
11896 {
11899 }
11900
11902 {
11905
11908 }
11910 {
11914 }
11915
11916 super.OnVariablesSynchronized();
11917 }
11918
11919
11920
11922 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11923 {
11924 if (!IsServerCheck(allow_client))
11925 return false;
11926
11928 return false;
11929
11932
11933 if (value <= (min + 0.001))
11934 value = min;
11935
11936 if (value == min)
11937 {
11938 if (destroy_config)
11939 {
11940 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11941 if (dstr)
11942 {
11944 this.Delete();
11945 return true;
11946 }
11947 }
11948 else if (destroy_forced)
11949 {
11951 this.Delete();
11952 return true;
11953 }
11954
11956 }
11957
11960
11962 {
11963 EntityAI parent = GetHierarchyRoot();
11964 InventoryLocation iLoc = new InventoryLocation();
11965 GetInventory().GetCurrentInventoryLocation(iLoc);
11967 {
11968 int iLocSlot = iLoc.
GetSlot();
11970 {
11972 }
11974 {
11976 }
11977 }
11978 }
11979
11981 {
11983
11984 if (delta)
11986 }
11987
11989
11990 return false;
11991 }
11992
11993
11995 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11996 {
11998 }
11999
12001 {
12004 }
12005
12007 {
12010 }
12011
12013 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12014 {
12015 float value_clamped = Math.Clamp(value, 0, 1);
12017 SetQuantity(result, destroy_config, destroy_forced);
12018 }
12019
12020
12023 {
12025 }
12026
12028 {
12030 }
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12042 {
12043 int slot = -1;
12044 GameInventory inventory = GetInventory();
12045 if (inventory)
12046 {
12047 InventoryLocation il = new InventoryLocation;
12050 }
12051
12053 }
12054
12056 {
12057 float quantity_max = 0;
12058
12060 {
12061 if (attSlotID != -1)
12062 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12063
12064 if (quantity_max <= 0)
12066 }
12067
12068 if (quantity_max <= 0)
12070
12071 return quantity_max;
12072 }
12073
12075 {
12077 }
12078
12080 {
12082 }
12083
12084
12086 {
12088 }
12089
12091 {
12093 }
12094
12096 {
12098 }
12099
12100
12102 {
12103
12104 float weightEx = GetWeightEx();
12105 float special = GetInventoryAndCargoWeight();
12106 return weightEx - special;
12107 }
12108
12109
12111 {
12113 }
12114
12116 {
12118 {
12119 #ifdef DEVELOPER
12120 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12121 {
12122 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12124 }
12125 #endif
12126
12127 return GetQuantity() * GetConfigWeightModified();
12128 }
12129 else if (HasEnergyManager())
12130 {
12131 #ifdef DEVELOPER
12132 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12133 {
12134 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12135 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12136 }
12137 #endif
12138 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12139 }
12140 else
12141 {
12142 #ifdef DEVELOPER
12143 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12144 {
12145 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12146 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12147 }
12148 #endif
12149 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12150 }
12151 }
12152
12155 {
12156 int item_count = 0;
12158
12159 GameInventory inventory = GetInventory();
12160 CargoBase cargo = inventory.
GetCargo();
12161 if (cargo != NULL)
12162 {
12164 }
12165
12167 for (int i = 0; i < nAttachments; ++i)
12168 {
12170 if (item)
12171 item_count += item.GetNumberOfItems();
12172 }
12173 return item_count;
12174 }
12175
12178 {
12179 float weight = 0;
12180 float wetness = 1;
12181 if (include_wetness)
12184 {
12185 weight = wetness * m_ConfigWeight;
12186 }
12188 {
12189 weight = 1;
12190 }
12191 return weight;
12192 }
12193
12194
12195
12197 {
12198 GameInventory inventory = GetInventory();
12199 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12200 {
12201 array<EntityAI> items = new array<EntityAI>;
12203 for (int i = 0; i < items.Count(); ++i)
12204 {
12206 if (item)
12207 {
12208 g_Game.ObjectDelete(item);
12209 }
12210 }
12211 }
12212 }
12213
12214
12215
12216
12218 {
12219 float energy = 0;
12220 if (HasEnergyManager())
12221 {
12222 energy = GetCompEM().GetEnergy();
12223 }
12224 return energy;
12225 }
12226
12227
12229 {
12230 super.OnEnergyConsumed();
12231
12233 }
12234
12236 {
12237 super.OnEnergyAdded();
12238
12240 }
12241
12242
12244 {
12245 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12246 {
12248 {
12249 float energy_0to1 = GetCompEM().GetEnergy0To1();
12251 }
12252 }
12253 }
12254
12255
12257 {
12258 return ConfigGetFloat("heatIsolation");
12259 }
12260
12262 {
12264 }
12265
12267 {
12268 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12269 if (
g_Game.ConfigIsExisting(paramPath))
12270 return g_Game.ConfigGetFloat(paramPath);
12271
12272 return 0.0;
12273 }
12274
12276 {
12277 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12278 if (
g_Game.ConfigIsExisting(paramPath))
12279 return g_Game.ConfigGetFloat(paramPath);
12280
12281 return 0.0;
12282 }
12283
12284 override void SetWet(
float value,
bool allow_client =
false)
12285 {
12286 if (!IsServerCheck(allow_client))
12287 return;
12288
12291
12293
12294 m_VarWet = Math.Clamp(value, min, max);
12295
12297 {
12300 }
12301 }
12302
12303 override void AddWet(
float value)
12304 {
12306 }
12307
12309 {
12311 }
12312
12314 {
12316 }
12317
12319 {
12321 }
12322
12324 {
12326 }
12327
12329 {
12331 }
12332
12333 override void OnWetChanged(
float newVal,
float oldVal)
12334 {
12337 if (newLevel != oldLevel)
12338 {
12340 }
12341 }
12342
12344 {
12345 SetWeightDirty();
12346 }
12347
12349 {
12350 return GetWetLevelInternal(
m_VarWet);
12351 }
12352
12353
12354
12356 {
12358 }
12359
12361 {
12363 }
12364
12366 {
12368 }
12369
12371 {
12373 }
12374
12375
12376
12378 {
12379 if (ConfigIsExisting("itemModelLength"))
12380 {
12381 return ConfigGetFloat("itemModelLength");
12382 }
12383 return 0;
12384 }
12385
12387 {
12388 if (ConfigIsExisting("itemAttachOffset"))
12389 {
12390 return ConfigGetFloat("itemAttachOffset");
12391 }
12392 return 0;
12393 }
12394
12395 override void SetCleanness(
int value,
bool allow_client =
false)
12396 {
12397 if (!IsServerCheck(allow_client))
12398 return;
12399
12401
12403
12406 }
12407
12409 {
12411 }
12412
12414 {
12415 return true;
12416 }
12417
12418
12419
12420
12422 {
12424 }
12425
12427 {
12429 }
12430
12431
12432
12433
12434 override void SetColor(
int r,
int g,
int b,
int a)
12435 {
12441 }
12443 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12444 {
12449 }
12450
12452 {
12454 }
12455
12458 {
12459 int r,g,b,a;
12461 r = r/255;
12462 g = g/255;
12463 b = b/255;
12464 a = a/255;
12465 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12466 }
12467
12468
12469
12470 override void SetLiquidType(
int value,
bool allow_client =
false)
12471 {
12472 if (!IsServerCheck(allow_client))
12473 return;
12474
12479 }
12480
12482 {
12483 return ConfigGetInt("varLiquidTypeInit");
12484 }
12485
12487 {
12489 }
12490
12492 {
12494 SetFrozen(false);
12495 }
12496
12499 {
12500 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12501 }
12502
12503
12506 {
12507 PlayerBase nplayer;
12508 if (PlayerBase.CastTo(nplayer, player))
12509 {
12511 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12512 }
12513 }
12514
12515
12518 {
12519 PlayerBase nplayer;
12520 if (PlayerBase.CastTo(nplayer,player))
12521 {
12522 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12523 }
12524
12525 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12526
12527 if (HasEnergyManager())
12528 {
12529 GetCompEM().UpdatePlugState();
12530 }
12531 }
12532
12533
12535 {
12536 super.OnPlacementStarted(player);
12537
12539 }
12540
12541 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12542 {
12544 {
12545 m_AdminLog.OnPlacementComplete(player,
this);
12546 }
12547
12548 super.OnPlacementComplete(player, position, orientation);
12549 }
12550
12551
12552
12553
12554
12556 {
12558 {
12559 return true;
12560 }
12561 else
12562 {
12563 return false;
12564 }
12565 }
12566
12567
12569 {
12571 {
12573 }
12574 }
12575
12576
12578 {
12580 }
12581
12583 {
12585 }
12586
12587 override void InsertAgent(
int agent,
float count = 1)
12588 {
12589 if (count < 1)
12590 return;
12591
12593 }
12594
12597 {
12599 }
12600
12601
12603 {
12605 }
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12649 {
12651 return false;
12652 return true;
12653 }
12654
12656 {
12657
12659 }
12660
12661
12664 {
12665 super.CheckForRoofLimited(timeTresholdMS);
12666
12667 float time =
g_Game.GetTime();
12668 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12669 {
12670 m_PreviousRoofTestTime = time;
12671 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12672 }
12673 }
12674
12675
12677 {
12679 {
12680 return 0;
12681 }
12682
12683 if (GetInventory().GetAttachmentSlotsCount() != 0)
12684 {
12685 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12686 if (filter)
12687 return filter.GetProtectionLevel(type, false, system);
12688 else
12689 return 0;
12690 }
12691
12692 string subclassPath, entryName;
12693
12694 switch (type)
12695 {
12697 entryName = "biological";
12698 break;
12700 entryName = "chemical";
12701 break;
12702 default:
12703 entryName = "biological";
12704 break;
12705 }
12706
12707 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12708
12709 return g_Game.ConfigGetFloat(subclassPath + entryName);
12710 }
12711
12712
12713
12716 {
12717 if (!IsMagazine())
12719
12721 }
12722
12723
12724
12725
12726
12731 {
12732 return true;
12733 }
12734
12736 {
12738 }
12739
12740
12741
12742
12743
12745 {
12746 if (parent)
12747 {
12748 if (parent.IsInherited(DayZInfected))
12749 return true;
12750
12751 if (!parent.IsRuined())
12752 return true;
12753 }
12754
12755 return true;
12756 }
12757
12759 {
12760 if (!super.CanPutAsAttachment(parent))
12761 {
12762 return false;
12763 }
12764
12765 if (!IsRuined() && !parent.IsRuined())
12766 {
12767 return true;
12768 }
12769
12770 return false;
12771 }
12772
12774 {
12775
12776
12777
12778
12779 return super.CanReceiveItemIntoCargo(item);
12780 }
12781
12783 {
12784
12785
12786
12787
12788 GameInventory attachmentInv = attachment.GetInventory();
12790 {
12791 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12792 return false;
12793 }
12794
12795 InventoryLocation loc = new InventoryLocation();
12796 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12797 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
12798 return false;
12799
12800 return super.CanReceiveAttachment(attachment, slotId);
12801 }
12802
12804 {
12805 if (!super.CanReleaseAttachment(attachment))
12806 return false;
12807
12808 return GetInventory().AreChildrenAccessible();
12809 }
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12832 {
12833 int id = muzzle_owner.GetMuzzleID();
12834 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12835
12836 if (WPOF_array)
12837 {
12838 for (int i = 0; i < WPOF_array.Count(); i++)
12839 {
12840 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12841
12842 if (WPOF)
12843 {
12844 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12845 }
12846 }
12847 }
12848 }
12849
12850
12852 {
12853 int id = muzzle_owner.GetMuzzleID();
12855
12856 if (WPOBE_array)
12857 {
12858 for (int i = 0; i < WPOBE_array.Count(); i++)
12859 {
12860 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12861
12862 if (WPOBE)
12863 {
12864 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12865 }
12866 }
12867 }
12868 }
12869
12870
12872 {
12873 int id = muzzle_owner.GetMuzzleID();
12874 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12875
12876 if (WPOOH_array)
12877 {
12878 for (int i = 0; i < WPOOH_array.Count(); i++)
12879 {
12880 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12881
12882 if (WPOOH)
12883 {
12884 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12885 }
12886 }
12887 }
12888 }
12889
12890
12892 {
12893 int id = muzzle_owner.GetMuzzleID();
12894 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12895
12896 if (WPOOH_array)
12897 {
12898 for (int i = 0; i < WPOOH_array.Count(); i++)
12899 {
12900 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12901
12902 if (WPOOH)
12903 {
12904 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12905 }
12906 }
12907 }
12908 }
12909
12910
12912 {
12913 int id = muzzle_owner.GetMuzzleID();
12914 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12915
12916 if (WPOOH_array)
12917 {
12918 for (int i = 0; i < WPOOH_array.Count(); i++)
12919 {
12920 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12921
12922 if (WPOOH)
12923 {
12924 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12925 }
12926 }
12927 }
12928 }
12929
12930
12931
12933 {
12935 {
12936 return true;
12937 }
12938
12939 return false;
12940 }
12941
12943 {
12945 {
12946 return true;
12947 }
12948
12949 return false;
12950 }
12951
12953 {
12955 {
12956 return true;
12957 }
12958
12959 return false;
12960 }
12961
12963 {
12964 return false;
12965 }
12966
12969 {
12970 return UATimeSpent.DEFAULT_DEPLOY;
12971 }
12972
12973
12974
12975
12977 {
12979 SetSynchDirty();
12980 }
12981
12983 {
12985 }
12986
12987
12989 {
12990 return false;
12991 }
12992
12995 {
12996 string att_type = "None";
12997
12998 if (ConfigIsExisting("soundAttType"))
12999 {
13000 att_type = ConfigGetString("soundAttType");
13001 }
13002
13004 }
13005
13007 {
13009 }
13010
13011
13012
13013
13014
13020
13022 {
13025
13027 }
13028
13029
13031 {
13033 return;
13034
13036
13039
13042
13043 SoundParameters params = new SoundParameters();
13047 }
13048
13049
13051 {
13053 {
13056
13057 SetSynchDirty();
13058
13061 }
13062 }
13063
13065 {
13067 }
13068
13069
13071 {
13073 return;
13074
13076 SetSynchDirty();
13077
13080 }
13081
13083 {
13086 }
13087
13089 {
13091 }
13092
13093 void OnApply(PlayerBase player);
13094
13096 {
13097 return 1.0;
13098 };
13099
13101 {
13103 }
13104
13106 {
13108 }
13109
13111
13113 {
13114 SetDynamicPhysicsLifeTime(0.01);
13116 }
13117
13119 {
13120 array<string> zone_names = new array<string>;
13121 GetDamageZones(zone_names);
13122 for (int i = 0; i < zone_names.Count(); i++)
13123 {
13124 SetHealthMax(zone_names.Get(i),"Health");
13125 }
13126 SetHealthMax("","Health");
13127 }
13128
13131 {
13132 float global_health = GetHealth01("","Health");
13133 array<string> zones = new array<string>;
13134 GetDamageZones(zones);
13135
13136 for (int i = 0; i < zones.Count(); i++)
13137 {
13138 SetHealth01(zones.Get(i),"Health",global_health);
13139 }
13140 }
13141
13144 {
13145 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13146 }
13147
13149 {
13150 if (!hasRootAsPlayer)
13151 {
13152 if (refParentIB)
13153 {
13154
13155 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13156 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13157
13158 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13159 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13160
13163 }
13164 else
13165 {
13166
13169 }
13170 }
13171 }
13172
13174 {
13176 {
13177 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13178 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13179 {
13180 float heatPermCoef = 1.0;
13182 while (ent)
13183 {
13184 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13185 ent = ent.GetHierarchyParent();
13186 }
13187
13188 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13189 }
13190 }
13191 }
13192
13194 {
13195
13196 EntityAI parent = GetHierarchyParent();
13197 if (!parent)
13198 {
13199 hasParent = false;
13200 hasRootAsPlayer = false;
13201 }
13202 else
13203 {
13204 hasParent = true;
13205 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13206 refParentIB =
ItemBase.Cast(parent);
13207 }
13208 }
13209
13210 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13211 {
13212
13213 }
13214
13216 {
13217
13218 return false;
13219 }
13220
13222 {
13223
13224
13225 return false;
13226 }
13227
13229 {
13230
13231 return false;
13232 }
13233
13236 {
13237 return !GetIsFrozen() &&
IsOpen();
13238 }
13239
13241 {
13242 bool hasParent = false, hasRootAsPlayer = false;
13244
13245 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13246 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13247
13248 if (wwtu || foodDecay)
13249 {
13253
13254 if (processWetness || processTemperature || processDecay)
13255 {
13257
13258 if (processWetness)
13259 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13260
13261 if (processTemperature)
13263
13264 if (processDecay)
13265 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13266 }
13267 }
13268 }
13269
13272 {
13274 }
13275
13277 {
13280
13281 return super.GetTemperatureFreezeThreshold();
13282 }
13283
13285 {
13288
13289 return super.GetTemperatureThawThreshold();
13290 }
13291
13293 {
13296
13297 return super.GetItemOverheatThreshold();
13298 }
13299
13301 {
13303 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13304
13305 return super.GetTemperatureFreezeTime();
13306 }
13307
13309 {
13311 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13312
13313 return super.GetTemperatureThawTime();
13314 }
13315
13320
13322 {
13323 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13324 }
13325
13327 {
13328 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13329 }
13330
13333 {
13335 }
13336
13338 {
13340 }
13341
13343 {
13345 }
13346
13349 {
13350 return null;
13351 }
13352
13355 {
13356 return false;
13357 }
13358
13360 {
13362 {
13365 if (!trg)
13366 {
13368 explosive = this;
13369 }
13370
13371 explosive.PairRemote(trg);
13373
13374 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13375 trg.SetPersistentPairID(persistentID);
13376 explosive.SetPersistentPairID(persistentID);
13377
13378 return true;
13379 }
13380 return false;
13381 }
13382
13385 {
13386 float ret = 1.0;
13389 ret *= GetHealth01();
13390
13391 return ret;
13392 }
13393
13394 #ifdef DEVELOPER
13395 override void SetDebugItem()
13396 {
13397 super.SetDebugItem();
13398 _itemBase = this;
13399 }
13400
13402 {
13403 string text = super.GetDebugText();
13404
13406 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13407
13408 return text;
13409 }
13410 #endif
13411
13413 {
13414 return true;
13415 }
13416
13418
13420
13422 {
13425 }
13426
13427
13435
13451
13452 [
Obsolete(
"Use ItemSoundHandler instead")]
13455 {
13456 if (!
g_Game.IsDedicatedServer())
13457 {
13458 if (ConfigIsExisting("attachSoundSet"))
13459 {
13460 string cfg_path = "";
13461 string soundset = "";
13462 string type_name =
GetType();
13463
13466 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13467 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13468
13469 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13470 {
13471 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13472 {
13473 if (cfg_slot_array[i] == slot_type)
13474 {
13475 soundset = cfg_soundset_array[i];
13476 break;
13477 }
13478 }
13479 }
13480
13481 if (soundset != "")
13482 {
13483 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13485 }
13486 }
13487 }
13488 }
13489
13491}
13492
13494{
13496 if (entity)
13497 {
13498 bool is_item = entity.IsInherited(
ItemBase);
13499 if (is_item && full_quantity)
13500 {
13503 }
13504 }
13505 else
13506 {
13508 return NULL;
13509 }
13510 return entity;
13511}
13512
13514{
13515 if (item)
13516 {
13517 if (health > 0)
13518 item.SetHealth("", "", health);
13519
13520 if (item.CanHaveTemperature())
13521 {
13523 if (item.CanFreeze())
13524 item.SetFrozen(false);
13525 }
13526
13527 if (item.HasEnergyManager())
13528 {
13529 if (quantity >= 0)
13530 {
13531 item.GetCompEM().SetEnergy0To1(quantity);
13532 }
13533 else
13534 {
13536 }
13537 }
13538 else if (item.IsMagazine())
13539 {
13540 Magazine mag = Magazine.Cast(item);
13541 if (quantity >= 0)
13542 {
13543 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13544 }
13545 else
13546 {
13548 }
13549
13550 }
13551 else
13552 {
13553 if (quantity >= 0)
13554 {
13555 item.SetQuantityNormalized(quantity, false);
13556 }
13557 else
13558 {
13560 }
13561
13562 }
13563 }
13564}
13565
13566#ifdef DEVELOPER
13568#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.