To be called on moving item within character's inventory; 'player' should never be null.
8811{
8813 {
8814 return true;
8815 }
8816};
8817
8819{
8820
8821};
8822
8823
8824
8826{
8830
8832
8835
8836
8837
8838
8839
8848
8854
8859
8864
8885 protected bool m_IsResultOfSplit
8886
8888
8893
8894
8895
8897
8901
8902
8903
8905
8908
8909
8910
8916
8917
8925
8928
8929
8931
8932
8934
8935
8940
8941
8946
8948
8949
8951
8952
8954 {
8959
8960 if (!
g_Game.IsDedicatedServer())
8961 {
8963 {
8965
8967 {
8969 }
8970 }
8971
8974 }
8975
8976 m_OldLocation = null;
8977
8979 {
8981 }
8982
8983 if (ConfigIsExisting("headSelectionsToHide"))
8984 {
8987 }
8988
8990 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8991 {
8993 }
8994
8996
8997 m_IsResultOfSplit = false;
8998
9000 }
9001
9003 {
9004 super.InitItemVariables();
9005
9011 m_Count = ConfigGetInt(
"count");
9012
9015
9020
9023
9028
9040
9044
9045
9048 if (ConfigIsExisting("canBeSplit"))
9049 {
9052 }
9053
9055 if (ConfigIsExisting("itemBehaviour"))
9057
9058
9061 RegisterNetSyncVariableInt("m_VarLiquidType");
9062 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9063
9064 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9065 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9066 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9067
9068 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9069 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9070 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9071 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9072
9073 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9074 RegisterNetSyncVariableBool("m_IsTakeable");
9075 RegisterNetSyncVariableBool("m_IsHologram");
9076
9079 {
9082 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9083 }
9084
9086
9088 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9090
9092 }
9093
9095 {
9097 }
9098
9100 {
9103 {
9108 }
9109 }
9110
9111 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9112 {
9114 {
9117 }
9118
9120 }
9121
9123 {
9129 }
9130
9132
9134 {
9136
9137 if (!action)
9138 {
9139 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9140 return;
9141 }
9142
9144 if (!ai)
9145 {
9147 return;
9148 }
9149
9151 if (!action_array)
9152 {
9153 action_array = new array<ActionBase_Basic>;
9155 }
9156 if (LogManager.IsActionLogEnable())
9157 {
9158 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9159 }
9160
9161 if (action_array.Find(action) != -1)
9162 {
9163 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9164 }
9165 else
9166 {
9167 action_array.Insert(action);
9168 }
9169 }
9170
9172 {
9173 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9174 ActionBase action = player.GetActionManager().GetAction(actionName);
9177
9178 if (action_array)
9179 {
9180 action_array.RemoveItem(action);
9181 }
9182 }
9183
9184
9185
9187 {
9188 ActionOverrideData overrideData = new ActionOverrideData();
9192
9194 if (!actionMap)
9195 {
9198 }
9199
9200 actionMap.Insert(this.
Type(), overrideData);
9201
9202 }
9203
9205
9207
9208
9210 {
9213
9216
9217 string config_to_search = "CfgVehicles";
9218 string muzzle_owner_config;
9219
9221 {
9222 if (IsInherited(Weapon))
9223 config_to_search = "CfgWeapons";
9224
9225 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9226
9227 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9228
9229 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9230
9231 if (config_OnFire_subclass_count > 0)
9232 {
9233 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9234
9235 for (int i = 0; i < config_OnFire_subclass_count; i++)
9236 {
9237 string particle_class = "";
9238 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9239 string config_OnFire_entry = config_OnFire_class + particle_class;
9240 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9241 WPOF_array.Insert(WPOF);
9242 }
9243
9244
9246 }
9247 }
9248
9250 {
9251 config_to_search = "CfgWeapons";
9252 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9253
9254 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9255
9256 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9257
9258 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9259 {
9260 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9261
9262 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9263 {
9264 string particle_class2 = "";
9265 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9266 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9267 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9268 WPOBE_array.Insert(WPOBE);
9269 }
9270
9271
9273 }
9274 }
9275 }
9276
9277
9279 {
9282
9284 {
9285 string config_to_search = "CfgVehicles";
9286
9287 if (IsInherited(Weapon))
9288 config_to_search = "CfgWeapons";
9289
9290 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9291 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9292
9293 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9294 {
9295
9297
9299 {
9301 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9303 return;
9304 }
9305
9308
9309
9310
9311 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9312 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9313
9314 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9315 {
9316 string particle_class = "";
9317 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9318 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9319 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9320
9321 if (entry_type == CT_CLASS)
9322 {
9323 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9324 WPOOH_array.Insert(WPOF);
9325 }
9326 }
9327
9328
9330 }
9331 }
9332 }
9333
9335 {
9337 }
9338
9340 {
9342 {
9344
9347
9350
9351 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9352 }
9353 }
9354
9356 {
9358 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9359
9361 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9362
9364 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9365
9367 {
9369 }
9370 }
9371
9373 {
9375 }
9376
9378 {
9381 else
9383
9385 {
9388 }
9389 else
9390 {
9393
9396 }
9397
9399 }
9400
9402 {
9404 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9405 }
9406
9408 {
9410 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9412 }
9413
9415 {
9417 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9418 }
9419
9421 {
9424
9425 OverheatingParticle OP = new OverheatingParticle();
9430
9432 }
9433
9435 {
9438
9439 return -1;
9440 }
9441
9443 {
9445 {
9448
9449 for (int i = count; i > 0; --i)
9450 {
9451 int id = i - 1;
9454
9457
9458 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9459 {
9460 if (p)
9461 {
9464 }
9465 }
9466 }
9467 }
9468 }
9469
9471 {
9473 {
9475 {
9476 int id = i - 1;
9478
9479 if (OP)
9480 {
9482
9483 if (p)
9484 {
9486 }
9487
9488 delete OP;
9489 }
9490 }
9491
9494 }
9495 }
9496
9499 {
9500 return 0.0;
9501 }
9502
9503
9505 {
9506 return 250;
9507 }
9508
9510 {
9511 return 0;
9512 }
9513
9516 {
9518 return true;
9519
9520 return false;
9521 }
9522
9525 {
9528
9530 {
9532 }
9533 else
9534 {
9535
9537 }
9538
9540 }
9541
9548 {
9549 return -1;
9550 }
9551
9552
9553
9554
9556 {
9558 {
9559 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9560 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9561
9562 if (r_index >= 0)
9563 {
9564 InventoryLocation r_il = new InventoryLocation;
9565 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9566
9567 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9570 {
9571 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9572 }
9574 {
9575 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9576 }
9577
9578 }
9579
9580 player.GetHumanInventory().ClearUserReservedLocation(this);
9581 }
9582
9585 }
9586
9587
9588
9589
9591 {
9592 return ItemBase.m_DebugActionsMask;
9593 }
9594
9596 {
9597 return ItemBase.m_DebugActionsMask & mask;
9598 }
9599
9601 {
9602 ItemBase.m_DebugActionsMask = mask;
9603 }
9604
9606 {
9607 ItemBase.m_DebugActionsMask |= mask;
9608 }
9609
9611 {
9612 ItemBase.m_DebugActionsMask &= ~mask;
9613 }
9614
9616 {
9618 {
9620 }
9621 else
9622 {
9624 }
9625 }
9626
9627
9629 {
9630 if (GetEconomyProfile())
9631 {
9632 float q_max = GetEconomyProfile().GetQuantityMax();
9633 if (q_max > 0)
9634 {
9635 float q_min = GetEconomyProfile().GetQuantityMin();
9636 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9637
9639 {
9640 ComponentEnergyManager comp = GetCompEM();
9642 {
9644 }
9645 }
9647 {
9649
9650 }
9651
9652 }
9653 }
9654 }
9655
9658 {
9659 EntityAI parent = GetHierarchyParent();
9660
9661 if (parent)
9662 {
9663 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9664 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9665 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9666 }
9667 }
9668
9671 {
9672 EntityAI parent = GetHierarchyParent();
9673
9674 if (parent)
9675 {
9676 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9677 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9678 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9679 }
9680 }
9681
9683 {
9684
9685
9686
9687
9689
9691 {
9692 if (ScriptInputUserData.CanStoreInputUserData())
9693 {
9694 ScriptInputUserData ctx = new ScriptInputUserData;
9700 ctx.
Write(use_stack_max);
9703
9705 {
9706 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9707 }
9708 }
9709 }
9710 else if (!
g_Game.IsMultiplayer())
9711 {
9713 }
9714 }
9715
9717 {
9719 }
9720
9722 {
9724 }
9725
9727 {
9729 }
9730
9732 {
9733
9734 return false;
9735 }
9736
9738 {
9739 return false;
9740 }
9741
9745 {
9746 return false;
9747 }
9748
9750 {
9751 return "";
9752 }
9753
9755
9757 {
9758 return false;
9759 }
9760
9762 {
9763 return true;
9764 }
9765
9766
9767
9769 {
9770 return true;
9771 }
9772
9774 {
9775 return true;
9776 }
9777
9779 {
9780 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9782 }
9783
9785 {
9787 }
9788
9790 {
9792 if (!is_being_placed)
9794 SetSynchDirty();
9795 }
9796
9797
9799
9801 {
9803 }
9804
9806 {
9808 }
9809
9811 {
9812 return 1;
9813 }
9814
9816 {
9817 return false;
9818 }
9819
9821 {
9823 SetSynchDirty();
9824 }
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9861 {
9862 super.OnMovedInsideCargo(container);
9863
9864 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9865 }
9866
9867 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9868 {
9869 super.EEItemLocationChanged(oldLoc, newLoc);
9870
9871 PlayerBase newPlayer = null;
9872 PlayerBase oldPlayer = null;
9873
9874 if (newLoc.GetParent())
9875 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9876
9877 if (oldLoc.GetParent())
9878 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9879
9881 {
9882 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9883
9884 if (rIndex >= 0)
9885 {
9886 InventoryLocation rIl = new InventoryLocation;
9887 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9888
9889 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9892 {
9893 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9894 }
9896 {
9898 }
9899
9900 }
9901 }
9902
9904 {
9905 if (newPlayer)
9906 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9907
9908 if (newPlayer == oldPlayer)
9909 {
9910 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9911 {
9913 {
9914 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9915 {
9916 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9917 }
9918 }
9919 else
9920 {
9921 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9922 }
9923 }
9924
9925 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9926 {
9927 int type = oldLoc.GetType();
9929 {
9930 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9931 }
9933 {
9934 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9935 }
9936 }
9937 if (!m_OldLocation)
9938 {
9939 m_OldLocation = new InventoryLocation;
9940 }
9941 m_OldLocation.Copy(oldLoc);
9942 }
9943 else
9944 {
9945 if (m_OldLocation)
9946 {
9947 m_OldLocation.Reset();
9948 }
9949 }
9950
9951 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
9952 }
9953 else
9954 {
9955 if (newPlayer)
9956 {
9957 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9958 if (resIndex >= 0)
9959 {
9960 InventoryLocation il = new InventoryLocation;
9961 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
9963 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
9966 {
9967 il.
GetParent().GetOnReleaseLock().Invoke(it);
9968 }
9970 {
9972 }
9973
9974 }
9975 }
9977 {
9978
9980 }
9981
9982 if (m_OldLocation)
9983 {
9984 m_OldLocation.Reset();
9985 }
9986 }
9987
9989 {
9990 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
9991 }
9992
9994 {
9995 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
9996 }
9997 }
9998
9999 override void EOnContact(IEntity other, Contact extra)
10000 {
10002 {
10003 int liquidType = -1;
10005 if (impactSpeed > 0.0)
10006 {
10008 #ifndef SERVER
10010 #else
10012 SetSynchDirty();
10013 #endif
10015 }
10016 }
10017
10018 #ifdef SERVER
10019 if (GetCompEM() && GetCompEM().IsPlugged())
10020 {
10021 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10022 GetCompEM().UnplugThis();
10023 }
10024 #endif
10025 }
10026
10028
10030 {
10032 }
10033
10035 {
10036
10037 }
10038
10040 {
10041 super.OnItemLocationChanged(old_owner, new_owner);
10042
10043 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10044 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10045
10046 if (!relatedPlayer && playerNew)
10047 relatedPlayer = playerNew;
10048
10049 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10050 {
10052 if (actionMgr)
10053 {
10054 ActionBase currentAction = actionMgr.GetRunningAction();
10055 if (currentAction)
10057 }
10058 }
10059
10060 Man ownerPlayerOld = null;
10061 Man ownerPlayerNew = null;
10062
10063 if (old_owner)
10064 {
10065 if (old_owner.
IsMan())
10066 {
10067 ownerPlayerOld = Man.Cast(old_owner);
10068 }
10069 else
10070 {
10071 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10072 }
10073 }
10074 else
10075 {
10077 {
10079
10080 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10081 {
10082 GetCompEM().UnplugThis();
10083 }
10084 }
10085 }
10086
10087 if (new_owner)
10088 {
10089 if (new_owner.
IsMan())
10090 {
10091 ownerPlayerNew = Man.Cast(new_owner);
10092 }
10093 else
10094 {
10095 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10096 }
10097 }
10098
10099 if (ownerPlayerOld != ownerPlayerNew)
10100 {
10101 if (ownerPlayerOld)
10102 {
10103 array<EntityAI> subItemsExit = new array<EntityAI>;
10105 for (int i = 0; i < subItemsExit.Count(); i++)
10106 {
10109 }
10110 }
10111
10112 if (ownerPlayerNew)
10113 {
10114 array<EntityAI> subItemsEnter = new array<EntityAI>;
10116 for (int j = 0; j < subItemsEnter.Count(); j++)
10117 {
10120 }
10121 }
10122 }
10123 else if (ownerPlayerNew != null)
10124 {
10125 PlayerBase nplayer;
10126 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10127 {
10128 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10130 for (int k = 0; k < subItemsUpdate.Count(); k++)
10131 {
10133 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10134 }
10135 }
10136 }
10137
10138 if (old_owner)
10139 old_owner.OnChildItemRemoved(this);
10140 if (new_owner)
10141 new_owner.OnChildItemReceived(this);
10142 }
10143
10144
10146 {
10147 super.EEDelete(parent);
10148 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10149 if (player)
10150 {
10152
10153 if (player.IsAlive())
10154 {
10155 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10156 if (r_index >= 0)
10157 {
10158 InventoryLocation r_il = new InventoryLocation;
10159 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10160
10161 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10164 {
10165 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10166 }
10168 {
10169 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10170 }
10171
10172 }
10173
10174 player.RemoveQuickBarEntityShortcut(this);
10175 }
10176 }
10177 }
10178
10180 {
10181 super.EEKilled(killer);
10182
10185 {
10186 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10187 {
10188 if (IsMagazine())
10189 {
10190 if (Magazine.Cast(this).GetAmmoCount() > 0)
10191 {
10193 }
10194 }
10195 else
10196 {
10198 }
10199 }
10200 }
10201 }
10202
10204 {
10205 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10206
10207 super.OnWasAttached(parent, slot_id);
10208
10211
10214 }
10215
10217 {
10218 super.OnWasDetached(parent, slot_id);
10219
10222
10225 }
10226
10228 {
10229 int idx;
10232
10233 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10234 if (inventory_slots.Count() < 1)
10235 {
10236 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10237 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10238 }
10239 else
10240 {
10241 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10242 }
10243
10244 idx = inventory_slots.Find(slot);
10245 if (idx < 0)
10246 return "";
10247
10248 return attach_types.Get(idx);
10249 }
10250
10252 {
10253 int idx = -1;
10254 string slot;
10255
10258
10259 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10260 if (inventory_slots.Count() < 1)
10261 {
10262 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10263 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10264 }
10265 else
10266 {
10267 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10268 if (detach_types.Count() < 1)
10269 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10270 }
10271
10272 for (int i = 0; i < inventory_slots.Count(); i++)
10273 {
10274 slot = inventory_slots.Get(i);
10275 }
10276
10277 if (slot != "")
10278 {
10279 if (detach_types.Count() == 1)
10280 idx = 0;
10281 else
10282 idx = inventory_slots.Find(slot);
10283 }
10284 if (idx < 0)
10285 return "";
10286
10287 return detach_types.Get(idx);
10288 }
10289
10291 {
10292
10294
10295
10296 float min_time = 1;
10297 float max_time = 3;
10298 float delay = Math.RandomFloat(min_time, max_time);
10299
10300 explode_timer.Run(delay, this, "DoAmmoExplosion");
10301 }
10302
10304 {
10305 Magazine magazine = Magazine.Cast(this);
10306 int pop_sounds_count = 6;
10307 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10308
10309
10310 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10311 string sound_name = pop_sounds[ sound_idx ];
10312 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10313
10314
10315 magazine.ServerAddAmmoCount(-1);
10316
10317
10318 float min_temp_to_explode = 100;
10319
10320 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10321 {
10323 }
10324 }
10325
10326
10327 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10328 {
10329 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10330
10331 const int CHANCE_DAMAGE_CARGO = 4;
10332 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10333 const int CHANCE_DAMAGE_NOTHING = 2;
10334
10336 {
10337 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10338 int chances;
10339 int rnd;
10340
10341 if (GetInventory().GetCargo())
10342 {
10343 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10344 rnd = Math.RandomInt(0,chances);
10345
10346 if (rnd < CHANCE_DAMAGE_CARGO)
10347 {
10349 }
10350 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10351 {
10353 }
10354 }
10355 else
10356 {
10357 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10358 rnd = Math.RandomInt(0,chances);
10359
10360 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10361 {
10363 }
10364 }
10365 }
10366 }
10367
10369 {
10370 CargoBase cargo = GetInventory().GetCargo();
10371 if (cargo)
10372 {
10374 if (item_count > 0)
10375 {
10376 int random_pick = Math.RandomInt(0, item_count);
10378 if (!item.IsExplosive())
10379 {
10380 item.AddHealth("","",damage);
10381 return true;
10382 }
10383 }
10384 }
10385 return false;
10386 }
10387
10389 {
10390 GameInventory inventory = GetInventory();
10392 if (attachment_count > 0)
10393 {
10394 int random_pick = Math.RandomInt(0, attachment_count);
10396 if (!attachment.IsExplosive())
10397 {
10398 attachment.AddHealth("","",damage);
10399 return true;
10400 }
10401 }
10402 return false;
10403 }
10404
10406 {
10408 }
10409
10411 {
10413 return GetInventory().CanRemoveEntity();
10414
10415 return false;
10416 }
10417
10419 {
10420
10422 return false;
10423
10424
10426 return false;
10427
10428
10429
10431 if (delta == 0)
10432 return false;
10433
10434
10435 return true;
10436 }
10437
10439 {
10441 {
10442 if (ScriptInputUserData.CanStoreInputUserData())
10443 {
10444 ScriptInputUserData ctx = new ScriptInputUserData;
10449 ctx.
Write(destination_entity);
10451 ctx.
Write(slot_id);
10453 }
10454 }
10455 else if (!
g_Game.IsMultiplayer())
10456 {
10458 }
10459 }
10460
10462 {
10463 float split_quantity_new;
10467 InventoryLocation loc = new InventoryLocation;
10468
10469 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10470 {
10472 split_quantity_new = stack_max;
10473 else
10475
10477 {
10478 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10479 if (new_item)
10480 {
10481 new_item.SetResultOfSplit(true);
10482 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10484 new_item.
SetQuantity(split_quantity_new,
false,
true);
10485 }
10486 }
10487 }
10488 else if (destination_entity && slot_id == -1)
10489 {
10490 if (quantity > stack_max)
10491 split_quantity_new = stack_max;
10492 else
10493 split_quantity_new = quantity;
10494
10496 {
10497 GameInventory destinationInventory = destination_entity.GetInventory();
10499 {
10502 }
10503
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 else
10514 {
10515 if (stack_max != 0)
10516 {
10518 {
10520 }
10521
10522 if (split_quantity_new == 0)
10523 {
10524 if (!
g_Game.IsMultiplayer())
10525 player.PhysicalPredictiveDropItem(this);
10526 else
10527 player.ServerDropEntity(this);
10528 return;
10529 }
10530
10532 {
10534
10535 if (new_item)
10536 {
10537 new_item.SetResultOfSplit(true);
10538 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10541 new_item.PlaceOnSurface();
10542 }
10543 }
10544 }
10545 }
10546 }
10547
10549 {
10550 float split_quantity_new;
10554 InventoryLocation loc = new InventoryLocation;
10555
10556 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10557 {
10559 split_quantity_new = stack_max;
10560 else
10562
10564 {
10565 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10566 if (new_item)
10567 {
10568 new_item.SetResultOfSplit(true);
10569 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10571 new_item.
SetQuantity(split_quantity_new,
false,
true);
10572 }
10573 }
10574 }
10575 else if (destination_entity && slot_id == -1)
10576 {
10577 if (quantity > stack_max)
10578 split_quantity_new = stack_max;
10579 else
10580 split_quantity_new = quantity;
10581
10583 {
10584 GameInventory destinationInventory = destination_entity.GetInventory();
10586 {
10589 }
10590
10591 if (new_item)
10592 {
10593 new_item.SetResultOfSplit(true);
10594 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10596 new_item.
SetQuantity(split_quantity_new,
false,
true);
10597 }
10598 }
10599 }
10600 else
10601 {
10602 if (stack_max != 0)
10603 {
10605 {
10607 }
10608
10610 {
10612
10613 if (new_item)
10614 {
10615 new_item.SetResultOfSplit(true);
10616 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10619 new_item.PlaceOnSurface();
10620 }
10621 }
10622 }
10623 }
10624 }
10625
10627 {
10629 {
10630 if (ScriptInputUserData.CanStoreInputUserData())
10631 {
10632 ScriptInputUserData ctx = new ScriptInputUserData;
10637 dst.WriteToContext(ctx);
10639 }
10640 }
10641 else if (!
g_Game.IsMultiplayer())
10642 {
10644 }
10645 }
10646
10648 {
10650 {
10651 if (ScriptInputUserData.CanStoreInputUserData())
10652 {
10653 ScriptInputUserData ctx = new ScriptInputUserData;
10658 ctx.
Write(destination_entity);
10664 }
10665 }
10666 else if (!
g_Game.IsMultiplayer())
10667 {
10669 }
10670 }
10671
10673 {
10675 }
10676
10678 {
10680 float split_quantity_new;
10682 if (dst.IsValid())
10683 {
10684 int slot_id = dst.GetSlot();
10686
10687 if (quantity > stack_max)
10688 split_quantity_new = stack_max;
10689 else
10690 split_quantity_new = quantity;
10691
10693 {
10695
10696 if (new_item)
10697 {
10698 new_item.SetResultOfSplit(true);
10699 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10701 new_item.
SetQuantity(split_quantity_new,
false,
true);
10702 }
10703
10704 return new_item;
10705 }
10706 }
10707
10708 return null;
10709 }
10710
10712 {
10714 float split_quantity_new;
10716 if (destination_entity)
10717 {
10719 if (quantity > stackable)
10720 split_quantity_new = stackable;
10721 else
10722 split_quantity_new = quantity;
10723
10725 {
10726 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10727 if (new_item)
10728 {
10729 new_item.SetResultOfSplit(true);
10730 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10732 new_item.
SetQuantity(split_quantity_new,
false,
true);
10733 }
10734 }
10735 }
10736 }
10737
10739 {
10741 {
10742 if (ScriptInputUserData.CanStoreInputUserData())
10743 {
10744 ScriptInputUserData ctx = new ScriptInputUserData;
10749 ItemBase destination_entity =
this;
10750 ctx.
Write(destination_entity);
10754 }
10755 }
10756 else if (!
g_Game.IsMultiplayer())
10757 {
10759 }
10760 }
10761
10763 {
10765 float split_quantity_new;
10767 if (player)
10768 {
10770 if (quantity > stackable)
10771 split_quantity_new = stackable;
10772 else
10773 split_quantity_new = quantity;
10774
10776 {
10777 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10778 new_item =
ItemBase.Cast(in_hands);
10779 if (new_item)
10780 {
10781 new_item.SetResultOfSplit(true);
10782 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10784 new_item.SetQuantity(split_quantity_new, false, true);
10785 }
10786 }
10787 }
10788 }
10789
10791 {
10793 float split_quantity_new = Math.Floor(quantity * 0.5);
10794
10796 return;
10797
10799
10800 if (new_item)
10801 {
10802 if (new_item.GetQuantityMax() < split_quantity_new)
10803 {
10804 split_quantity_new = new_item.GetQuantityMax();
10805 }
10806
10807 new_item.SetResultOfSplit(true);
10808 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10809
10811 {
10814 }
10815 else
10816 {
10818 new_item.
SetQuantity(split_quantity_new,
false,
true);
10819 }
10820 }
10821 }
10822
10824 {
10826 float split_quantity_new = Math.Floor(quantity / 2);
10827
10829 return;
10830
10831 InventoryLocation invloc = new InventoryLocation;
10833
10835 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10836
10837 if (new_item)
10838 {
10839 if (new_item.GetQuantityMax() < split_quantity_new)
10840 {
10841 split_quantity_new = new_item.GetQuantityMax();
10842 }
10844 {
10847 }
10848 else if (split_quantity_new > 1)
10849 {
10851 new_item.
SetQuantity(split_quantity_new,
false,
true);
10852 }
10853 }
10854 }
10855
10858 {
10859 SetWeightDirty();
10861
10862 if (parent)
10863 parent.OnAttachmentQuantityChangedEx(this, delta);
10864
10866 {
10868 {
10870 }
10872 {
10873 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10875 }
10876 }
10877 }
10878
10881 {
10882
10883 }
10884
10887 {
10889 }
10890
10892 {
10893 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10894
10896 {
10897 if (newLevel == GameConstants.STATE_RUINED)
10898 {
10900 EntityAI parent = GetHierarchyParent();
10901 if (parent && parent.IsFireplace())
10902 {
10903 CargoBase cargo = GetInventory().GetCargo();
10904 if (cargo)
10905 {
10907 {
10909 }
10910 }
10911 }
10912 }
10913
10915 {
10916
10918 return;
10919 }
10920
10921 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10922 {
10924 }
10925 }
10926 }
10927
10928
10930 {
10931 super.OnRightClick();
10932
10934 {
10936 {
10937 if (ScriptInputUserData.CanStoreInputUserData())
10938 {
10939 EntityAI root = GetHierarchyRoot();
10940 Man playerOwner = GetHierarchyRootPlayer();
10941 InventoryLocation dst = new InventoryLocation;
10942
10943
10944 if (!playerOwner && root && root == this)
10945 {
10947 }
10948 else
10949 {
10950
10951 GetInventory().GetCurrentInventoryLocation(dst);
10953 {
10954 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10956 {
10958 }
10959 else
10960 {
10962
10963
10964 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
10965 {
10967 }
10968 else
10969 {
10970 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10971 }
10972 }
10973 }
10974 }
10975
10976 ScriptInputUserData ctx = new ScriptInputUserData;
10984 }
10985 }
10986 else if (!
g_Game.IsMultiplayer())
10987 {
10989 }
10990 }
10991 }
10992
10994 {
10995 if (root)
10996 {
10997 vector m4[4];
10998 root.GetTransform(m4);
10999 dst.SetGround(this, m4);
11000 }
11001 else
11002 {
11003 GetInventory().GetCurrentInventoryLocation(dst);
11004 }
11005 }
11006
11007 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11008 {
11009
11010 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11011 return false;
11012
11013 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11014 return false;
11015
11016
11018 return false;
11019
11020
11021 Magazine mag = Magazine.Cast(this);
11022 if (mag)
11023 {
11024 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11025 return false;
11026
11027 if (stack_max_limit)
11028 {
11029 Magazine other_mag = Magazine.Cast(other_item);
11030 if (other_item)
11031 {
11032 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11033 return false;
11034 }
11035
11036 }
11037 }
11038 else
11039 {
11040
11042 return false;
11043
11045 return false;
11046 }
11047
11048 PlayerBase player = null;
11049 if (CastTo(player, GetHierarchyRootPlayer()))
11050 {
11051 if (player.GetInventory().HasAttachment(this))
11052 return false;
11053
11054 if (player.IsItemsToDelete())
11055 return false;
11056 }
11057
11058 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11059 return false;
11060
11061 int slotID;
11063 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11064 return false;
11065
11066 return true;
11067 }
11068
11070 {
11072 }
11073
11075 {
11076 return m_IsResultOfSplit;
11077 }
11078
11080 {
11081 m_IsResultOfSplit = value;
11082 }
11083
11085 {
11087 }
11088
11090 {
11091 float other_item_quantity = other_item.GetQuantity();
11092 float this_free_space;
11093
11095
11097
11098 if (other_item_quantity > this_free_space)
11099 {
11100 return this_free_space;
11101 }
11102 else
11103 {
11104 return other_item_quantity;
11105 }
11106 }
11107
11109 {
11111 }
11112
11114 {
11116 return;
11117
11118 if (!IsMagazine() && other_item)
11119 {
11121 if (quantity_used != 0)
11122 {
11123 float hp1 = GetHealth01("","");
11124 float hp2 = other_item.GetHealth01("","");
11125 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11126 hpResult = hpResult / (
GetQuantity() + quantity_used);
11127
11128 hpResult *= GetMaxHealth();
11129 Math.Round(hpResult);
11130 SetHealth("", "Health", hpResult);
11131
11133 other_item.AddQuantity(-quantity_used);
11134 }
11135 }
11137 }
11138
11140 {
11141 #ifdef SERVER
11142 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11143 GetHierarchyParent().IncreaseLifetimeUp();
11144 #endif
11145 };
11146
11148 {
11149 PlayerBase p = PlayerBase.Cast(player);
11150
11151 array<int> recipesIds = p.m_Recipes;
11152 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11153 if (moduleRecipesManager)
11154 {
11155 EntityAI itemInHands = player.GetEntityInHands();
11156 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11157 }
11158
11159 for (int i = 0;i < recipesIds.Count(); i++)
11160 {
11161 int key = recipesIds.Get(i);
11162 string recipeName = moduleRecipesManager.GetRecipeName(key);
11164 }
11165 }
11166
11167
11168 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11169 {
11170 super.GetDebugActions(outputList);
11171
11172
11178
11179
11184
11189
11190
11194
11195
11197 {
11201 }
11202
11205
11206
11210
11212
11213 InventoryLocation loc = new InventoryLocation();
11214 GetInventory().GetCurrentInventoryLocation(loc);
11216 {
11217 if (Gizmo_IsSupported())
11220 }
11221
11223 }
11224
11225
11226
11227
11229 {
11230 super.OnAction(action_id, player, ctx);
11231
11233 {
11234 switch (action_id)
11235 {
11239 return true;
11243 return true;
11244 }
11245 }
11246
11248 {
11249 switch (action_id)
11250 {
11252 Delete();
11253 return true;
11254 }
11255 }
11256
11257 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11258 {
11259 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11260 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11261 PlayerBase p = PlayerBase.Cast(player);
11262 if (
EActions.RECIPES_RANGE_START < 1000)
11263 {
11264 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11265 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11266 }
11267 }
11268 #ifndef SERVER
11269 else if (action_id ==
EActions.WATCH_PLAYER)
11270 {
11271 PluginDeveloper.SetDeveloperItemClientEx(player);
11272 }
11273 #endif
11275 {
11276 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11277 {
11278 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11279 OnDebugButtonPressServer(id + 1);
11280 }
11281
11282 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11283 {
11284 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11286 }
11287
11288 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11289 {
11290 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11292 }
11293
11294 else if (action_id ==
EActions.ADD_QUANTITY)
11295 {
11296 if (IsMagazine())
11297 {
11298 Magazine mag = Magazine.Cast(this);
11299 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11300 }
11301 else
11302 {
11304 }
11305
11306 if (m_EM)
11307 {
11308 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11309 }
11310
11311 }
11312
11313 else if (action_id ==
EActions.REMOVE_QUANTITY)
11314 {
11315 if (IsMagazine())
11316 {
11317 Magazine mag2 = Magazine.Cast(this);
11318 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11319 }
11320 else
11321 {
11323 }
11324 if (m_EM)
11325 {
11326 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11327 }
11328
11329 }
11330
11331 else if (action_id ==
EActions.SET_QUANTITY_0)
11332 {
11334
11335 if (m_EM)
11336 {
11337 m_EM.SetEnergy(0);
11338 }
11339 }
11340
11341 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11342 {
11344
11345 if (m_EM)
11346 {
11347 m_EM.SetEnergy(m_EM.GetEnergyMax());
11348 }
11349 }
11350
11351 else if (action_id ==
EActions.ADD_HEALTH)
11352 {
11353 AddHealth("","",GetMaxHealth("","Health")/5);
11354 }
11355 else if (action_id ==
EActions.REMOVE_HEALTH)
11356 {
11357 AddHealth("","",-GetMaxHealth("","Health")/5);
11358 }
11359 else if (action_id ==
EActions.DESTROY_HEALTH)
11360 {
11361 SetHealth01("","",0);
11362 }
11363 else if (action_id ==
EActions.WATCH_ITEM)
11364 {
11366 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11367 #ifdef DEVELOPER
11368 SetDebugDeveloper_item(this);
11369 #endif
11370 }
11371
11372 else if (action_id ==
EActions.ADD_TEMPERATURE)
11373 {
11374 AddTemperature(20);
11375
11376 }
11377
11378 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11379 {
11380 AddTemperature(-20);
11381
11382 }
11383
11384 else if (action_id ==
EActions.FLIP_FROZEN)
11385 {
11386 SetFrozen(!GetIsFrozen());
11387
11388 }
11389
11390 else if (action_id ==
EActions.ADD_WETNESS)
11391 {
11393
11394 }
11395
11396 else if (action_id ==
EActions.REMOVE_WETNESS)
11397 {
11399
11400 }
11401
11402 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11403 {
11406
11407
11408 }
11409
11410 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11411 {
11414 }
11415
11416 else if (action_id ==
EActions.MAKE_SPECIAL)
11417 {
11418 auto debugParams = DebugSpawnParams.WithPlayer(player);
11419 OnDebugSpawnEx(debugParams);
11420 }
11421
11422 }
11423
11424
11425 return false;
11426 }
11427
11428
11429
11430
11434
11437
11438
11439
11441 {
11442 return false;
11443 }
11444
11445
11447 {
11448 return true;
11449 }
11450
11451
11453 {
11454 return true;
11455 }
11456
11457
11458
11460 {
11461 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11462 return g_Game.ConfigIsExisting(config_path);
11463 }
11464
11467 {
11468 return null;
11469 }
11470
11472 {
11473 return false;
11474 }
11475
11477 {
11478 return false;
11479 }
11480
11484
11485
11487 {
11488 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11489 return module_repairing.CanRepair(this, item_repair_kit);
11490 }
11491
11492
11493 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11494 {
11495 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11496 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11497 }
11498
11499
11501 {
11502
11503
11504
11505
11506
11507
11508
11509
11510 return 1;
11511 }
11512
11513
11514
11516 {
11518 }
11519
11520
11521
11523 {
11525 }
11526
11527
11536 {
11537 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11538
11539 if (player)
11540 {
11541 player.MessageStatus(text);
11542 }
11543 }
11544
11545
11554 {
11555 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11556
11557 if (player)
11558 {
11559 player.MessageAction(text);
11560 }
11561 }
11562
11563
11572 {
11573 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11574
11575 if (player)
11576 {
11577 player.MessageFriendly(text);
11578 }
11579 }
11580
11581
11590 {
11591 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11592
11593 if (player)
11594 {
11595 player.MessageImportant(text);
11596 }
11597 }
11598
11600 {
11601 return true;
11602 }
11603
11604
11605 override bool KindOf(
string tag)
11606 {
11607 bool found = false;
11608 string item_name = this.
GetType();
11610 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11611
11612 int array_size = item_tag_array.Count();
11613 for (int i = 0; i < array_size; i++)
11614 {
11615 if (item_tag_array.Get(i) == tag)
11616 {
11617 found = true;
11618 break;
11619 }
11620 }
11621 return found;
11622 }
11623
11624
11626 {
11627
11628 super.OnRPC(sender, rpc_type,ctx);
11629
11630
11631 switch (rpc_type)
11632 {
11633 #ifndef SERVER
11634 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11635 Param2<bool, string> p = new Param2<bool, string>(false, "");
11636
11638 return;
11639
11640 bool play = p.param1;
11641 string soundSet = p.param2;
11642
11643 if (play)
11644 {
11646 {
11648 {
11650 }
11651 }
11652 else
11653 {
11655 }
11656 }
11657 else
11658 {
11660 }
11661
11662 break;
11663 #endif
11664
11665 }
11666
11668 {
11670 }
11671 }
11672
11673
11674
11675
11677 {
11678 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11679 return plugin.GetID(
name);
11680 }
11681
11683 {
11684 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11685 return plugin.GetName(id);
11686 }
11687
11690 {
11691
11692
11693 int varFlags;
11694 if (!ctx.
Read(varFlags))
11695 return;
11696
11697 if (varFlags & ItemVariableFlags.FLOAT)
11698 {
11700 }
11701 }
11702
11704 {
11705
11706 super.SerializeNumericalVars(floats_out);
11707
11708
11709
11711 {
11713 }
11714
11716 {
11718 }
11719
11721 {
11723 }
11724
11726 {
11731 }
11732
11734 {
11736 }
11737 }
11738
11740 {
11741
11742 super.DeSerializeNumericalVars(floats);
11743
11744
11745 int index = 0;
11746 int mask = Math.Round(floats.Get(index));
11747
11748 index++;
11749
11751 {
11753 {
11755 }
11756 else
11757 {
11758 float quantity = floats.Get(index);
11759 SetQuantity(quantity,
true,
false,
false,
false);
11760 }
11761 index++;
11762 }
11763
11765 {
11766 float wet = floats.Get(index);
11768 index++;
11769 }
11770
11772 {
11773 int liquidtype = Math.Round(floats.Get(index));
11775 index++;
11776 }
11777
11779 {
11781 index++;
11783 index++;
11785 index++;
11787 index++;
11788 }
11789
11791 {
11792 int cleanness = Math.Round(floats.Get(index));
11794 index++;
11795 }
11796 }
11797
11799 {
11800 super.WriteVarsToCTX(ctx);
11801
11802
11804 {
11806 }
11807
11809 {
11811 }
11812
11814 {
11816 }
11817
11819 {
11820 int r,g,b,a;
11826 }
11827
11829 {
11831 }
11832 }
11833
11835 {
11836 if (!super.ReadVarsFromCTX(ctx,version))
11837 return false;
11838
11839 int intValue;
11840 float value;
11841
11842 if (version < 140)
11843 {
11844 if (!ctx.
Read(intValue))
11845 return false;
11846
11847 m_VariablesMask = intValue;
11848 }
11849
11851 {
11852 if (!ctx.
Read(value))
11853 return false;
11854
11856 {
11858 }
11859 else
11860 {
11862 }
11863 }
11864
11865 if (version < 140)
11866 {
11868 {
11869 if (!ctx.
Read(value))
11870 return false;
11871 SetTemperatureDirect(value);
11872 }
11873 }
11874
11876 {
11877 if (!ctx.
Read(value))
11878 return false;
11880 }
11881
11883 {
11884 if (!ctx.
Read(intValue))
11885 return false;
11887 }
11888
11890 {
11891 int r,g,b,a;
11893 return false;
11895 return false;
11897 return false;
11899 return false;
11900
11902 }
11903
11905 {
11906 if (!ctx.
Read(intValue))
11907 return false;
11909 }
11910
11911 if (version >= 138 && version < 140)
11912 {
11914 {
11915 if (!ctx.
Read(intValue))
11916 return false;
11917 SetFrozen(intValue);
11918 }
11919 }
11920
11921 return true;
11922 }
11923
11924
11926 {
11929 {
11931 }
11932
11933 if (!super.OnStoreLoad(ctx, version))
11934 {
11936 return false;
11937 }
11938
11939 if (version >= 114)
11940 {
11941 bool hasQuickBarIndexSaved;
11942
11943 if (!ctx.
Read(hasQuickBarIndexSaved))
11944 {
11946 return false;
11947 }
11948
11949 if (hasQuickBarIndexSaved)
11950 {
11951 int itmQBIndex;
11952
11953
11954 if (!ctx.
Read(itmQBIndex))
11955 {
11957 return false;
11958 }
11959
11960 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11961 if (itmQBIndex != -1 && parentPlayer)
11962 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11963 }
11964 }
11965 else
11966 {
11967
11968 PlayerBase player;
11969 int itemQBIndex;
11970 if (version ==
int.
MAX)
11971 {
11972 if (!ctx.
Read(itemQBIndex))
11973 {
11975 return false;
11976 }
11977 }
11978 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11979 {
11980
11981 if (!ctx.
Read(itemQBIndex))
11982 {
11984 return false;
11985 }
11986 if (itemQBIndex != -1 && player)
11987 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11988 }
11989 }
11990
11991 if (version < 140)
11992 {
11993
11994 if (!LoadVariables(ctx, version))
11995 {
11997 return false;
11998 }
11999 }
12000
12001
12003 {
12005 return false;
12006 }
12007 if (version >= 132)
12008 {
12010 if (raib)
12011 {
12013 {
12015 return false;
12016 }
12017 }
12018 }
12019
12021 return true;
12022 }
12023
12024
12025
12027 {
12028 super.OnStoreSave(ctx);
12029
12030 PlayerBase player;
12031 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12032 {
12034
12035 int itemQBIndex = -1;
12036 itemQBIndex = player.FindQuickBarEntityIndex(this);
12037 ctx.
Write(itemQBIndex);
12038 }
12039 else
12040 {
12042 }
12043
12045
12047 if (raib)
12048 {
12050 }
12051 }
12052
12053
12055 {
12056 super.AfterStoreLoad();
12057
12059 {
12061 }
12062
12064 {
12067 }
12068 }
12069
12071 {
12072 super.EEOnAfterLoad();
12073
12075 {
12077 }
12078
12081 }
12082
12084 {
12085 return false;
12086 }
12087
12088
12089
12091 {
12093 {
12094 #ifdef PLATFORM_CONSOLE
12095
12097 {
12099 if (menu)
12100 {
12102 }
12103 }
12104 #endif
12105 }
12106
12108 {
12111 }
12112
12114 {
12115 SetWeightDirty();
12117 }
12119 {
12122 }
12123
12125 {
12128
12131 }
12133 {
12137 }
12138
12139 super.OnVariablesSynchronized();
12140 }
12141
12142
12143
12145 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12146 {
12147 if (!IsServerCheck(allow_client))
12148 return false;
12149
12151 return false;
12152
12155
12156 if (value <= (min + 0.001))
12157 value = min;
12158
12159 if (value == min)
12160 {
12161 if (destroy_config)
12162 {
12163 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12164 if (dstr)
12165 {
12167 this.Delete();
12168 return true;
12169 }
12170 }
12171 else if (destroy_forced)
12172 {
12174 this.Delete();
12175 return true;
12176 }
12177
12179 }
12180
12183
12185 {
12186 EntityAI parent = GetHierarchyRoot();
12187 InventoryLocation iLoc = new InventoryLocation();
12188 GetInventory().GetCurrentInventoryLocation(iLoc);
12190 {
12191 int iLocSlot = iLoc.
GetSlot();
12193 {
12195 }
12197 {
12199 }
12200 }
12201 }
12202
12204 {
12206
12207 if (delta)
12209 }
12210
12212
12213 return false;
12214 }
12215
12216
12218 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12219 {
12221 }
12222
12224 {
12227 }
12228
12230 {
12233 }
12234
12236 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12237 {
12238 float value_clamped = Math.Clamp(value, 0, 1);
12240 SetQuantity(result, destroy_config, destroy_forced);
12241 }
12242
12243
12246 {
12248 }
12249
12251 {
12253 }
12254
12255
12256
12257
12258
12259
12260
12261
12262
12263
12265 {
12266 int slot = -1;
12267 GameInventory inventory = GetInventory();
12268 if (inventory)
12269 {
12270 InventoryLocation il = new InventoryLocation;
12273 }
12274
12276 }
12277
12279 {
12280 float quantity_max = 0;
12281
12283 {
12284 if (attSlotID != -1)
12285 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12286
12287 if (quantity_max <= 0)
12289 }
12290
12291 if (quantity_max <= 0)
12293
12294 return quantity_max;
12295 }
12296
12298 {
12300 }
12301
12303 {
12305 }
12306
12307
12309 {
12311 }
12312
12314 {
12316 }
12317
12319 {
12321 }
12322
12323
12325 {
12326
12327 float weightEx = GetWeightEx();
12328 float special = GetInventoryAndCargoWeight();
12329 return weightEx - special;
12330 }
12331
12332
12334 {
12336 }
12337
12339 {
12341 {
12342 #ifdef DEVELOPER
12343 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12344 {
12345 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12347 }
12348 #endif
12349
12350 return GetQuantity() * GetConfigWeightModified();
12351 }
12352 else if (HasEnergyManager())
12353 {
12354 #ifdef DEVELOPER
12355 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12356 {
12357 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12358 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12359 }
12360 #endif
12361 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12362 }
12363 else
12364 {
12365 #ifdef DEVELOPER
12366 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12367 {
12368 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12369 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12370 }
12371 #endif
12372 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12373 }
12374 }
12375
12378 {
12379 int item_count = 0;
12381
12382 GameInventory inventory = GetInventory();
12383 CargoBase cargo = inventory.
GetCargo();
12384 if (cargo != NULL)
12385 {
12387 }
12388
12390 for (int i = 0; i < nAttachments; ++i)
12391 {
12393 if (item)
12394 item_count += item.GetNumberOfItems();
12395 }
12396 return item_count;
12397 }
12398
12401 {
12402 float weight = 0;
12403 float wetness = 1;
12404 if (include_wetness)
12407 {
12408 weight = wetness * m_ConfigWeight;
12409 }
12411 {
12412 weight = 1;
12413 }
12414 return weight;
12415 }
12416
12417
12418
12420 {
12421 GameInventory inventory = GetInventory();
12422 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12423 {
12424 array<EntityAI> items = new array<EntityAI>;
12426 for (int i = 0; i < items.Count(); ++i)
12427 {
12429 if (item)
12430 {
12431 g_Game.ObjectDelete(item);
12432 }
12433 }
12434 }
12435 }
12436
12437
12438
12439
12441 {
12442 float energy = 0;
12443 if (HasEnergyManager())
12444 {
12445 energy = GetCompEM().GetEnergy();
12446 }
12447 return energy;
12448 }
12449
12450
12452 {
12453 super.OnEnergyConsumed();
12454
12456 }
12457
12459 {
12460 super.OnEnergyAdded();
12461
12463 }
12464
12465
12467 {
12468 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12469 {
12471 {
12472 float energy_0to1 = GetCompEM().GetEnergy0To1();
12474 }
12475 }
12476 }
12477
12478
12480 {
12481 return ConfigGetFloat("heatIsolation");
12482 }
12483
12485 {
12487 }
12488
12490 {
12491 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12492 if (
g_Game.ConfigIsExisting(paramPath))
12493 return g_Game.ConfigGetFloat(paramPath);
12494
12495 return 0.0;
12496 }
12497
12499 {
12500 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12501 if (
g_Game.ConfigIsExisting(paramPath))
12502 return g_Game.ConfigGetFloat(paramPath);
12503
12504 return 0.0;
12505 }
12506
12507 override void SetWet(
float value,
bool allow_client =
false)
12508 {
12509 if (!IsServerCheck(allow_client))
12510 return;
12511
12514
12516
12517 m_VarWet = Math.Clamp(value, min, max);
12518
12520 {
12523 }
12524 }
12525
12526 override void AddWet(
float value)
12527 {
12529 }
12530
12532 {
12534 }
12535
12537 {
12539 }
12540
12542 {
12544 }
12545
12547 {
12549 }
12550
12552 {
12554 }
12555
12556 override void OnWetChanged(
float newVal,
float oldVal)
12557 {
12560 if (newLevel != oldLevel)
12561 {
12563 }
12564 }
12565
12567 {
12568 SetWeightDirty();
12569 }
12570
12572 {
12573 return GetWetLevelInternal(
m_VarWet);
12574 }
12575
12576
12577
12579 {
12581 }
12582
12584 {
12586 }
12587
12589 {
12591 }
12592
12594 {
12596 }
12597
12598
12599
12601 {
12602 if (ConfigIsExisting("itemModelLength"))
12603 {
12604 return ConfigGetFloat("itemModelLength");
12605 }
12606 return 0;
12607 }
12608
12610 {
12611 if (ConfigIsExisting("itemAttachOffset"))
12612 {
12613 return ConfigGetFloat("itemAttachOffset");
12614 }
12615 return 0;
12616 }
12617
12618 override void SetCleanness(
int value,
bool allow_client =
false)
12619 {
12620 if (!IsServerCheck(allow_client))
12621 return;
12622
12624
12626
12629 }
12630
12632 {
12634 }
12635
12637 {
12638 return true;
12639 }
12640
12641
12642
12643
12645 {
12647 }
12648
12650 {
12652 }
12653
12654
12655
12656
12657 override void SetColor(
int r,
int g,
int b,
int a)
12658 {
12664 }
12666 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12667 {
12672 }
12673
12675 {
12677 }
12678
12681 {
12682 int r,g,b,a;
12684 r = r/255;
12685 g = g/255;
12686 b = b/255;
12687 a = a/255;
12688 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12689 }
12690
12691
12692
12693 override void SetLiquidType(
int value,
bool allow_client =
false)
12694 {
12695 if (!IsServerCheck(allow_client))
12696 return;
12697
12702 }
12703
12705 {
12706 return ConfigGetInt("varLiquidTypeInit");
12707 }
12708
12710 {
12712 }
12713
12715 {
12717 SetFrozen(false);
12718 }
12719
12722 {
12723 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12724 }
12725
12726
12729 {
12730 PlayerBase nplayer;
12731 if (PlayerBase.CastTo(nplayer, player))
12732 {
12734 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12735 }
12736 }
12737
12738
12741 {
12742 PlayerBase nplayer;
12743 if (PlayerBase.CastTo(nplayer,player))
12744 {
12745 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12746 }
12747
12748 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12749
12750 if (HasEnergyManager())
12751 {
12752 GetCompEM().UpdatePlugState();
12753 }
12754 }
12755
12756
12758 {
12759 super.OnPlacementStarted(player);
12760
12762 }
12763
12764 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12765 {
12767 {
12768 m_AdminLog.OnPlacementComplete(player,
this);
12769 }
12770
12771 super.OnPlacementComplete(player, position, orientation);
12772 }
12773
12774
12775
12776
12777
12779 {
12781 {
12782 return true;
12783 }
12784 else
12785 {
12786 return false;
12787 }
12788 }
12789
12790
12792 {
12794 {
12796 }
12797 }
12798
12799
12801 {
12803 }
12804
12806 {
12808 }
12809
12810 override void InsertAgent(
int agent,
float count = 1)
12811 {
12812 if (count < 1)
12813 return;
12814
12816 }
12817
12820 {
12822 }
12823
12824
12826 {
12828 }
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12872 {
12874 return false;
12875 return true;
12876 }
12877
12879 {
12880
12882 }
12883
12884
12887 {
12888 super.CheckForRoofLimited(timeTresholdMS);
12889
12890 float time =
g_Game.GetTime();
12891 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12892 {
12893 m_PreviousRoofTestTime = time;
12894 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12895 }
12896 }
12897
12898
12900 {
12902 {
12903 return 0;
12904 }
12905
12906 if (GetInventory().GetAttachmentSlotsCount() != 0)
12907 {
12908 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12909 if (filter)
12910 return filter.GetProtectionLevel(type, false, system);
12911 else
12912 return 0;
12913 }
12914
12915 string subclassPath, entryName;
12916
12917 switch (type)
12918 {
12920 entryName = "biological";
12921 break;
12923 entryName = "chemical";
12924 break;
12925 default:
12926 entryName = "biological";
12927 break;
12928 }
12929
12930 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
12931
12932 return g_Game.ConfigGetFloat(subclassPath + entryName);
12933 }
12934
12935
12936
12939 {
12940 if (!IsMagazine())
12942
12944 }
12945
12946
12947
12948
12949
12954 {
12955 return true;
12956 }
12957
12959 {
12961 }
12962
12963
12964
12965
12966
12968 {
12969 if (parent)
12970 {
12971 if (parent.IsInherited(DayZInfected))
12972 return true;
12973
12974 if (!parent.IsRuined())
12975 return true;
12976 }
12977
12978 return true;
12979 }
12980
12982 {
12983 if (!super.CanPutAsAttachment(parent))
12984 {
12985 return false;
12986 }
12987
12988 if (!IsRuined() && !parent.IsRuined())
12989 {
12990 return true;
12991 }
12992
12993 return false;
12994 }
12995
12997 {
12998
12999
13000
13001
13002 return super.CanReceiveItemIntoCargo(item);
13003 }
13004
13006 {
13007
13008
13009
13010
13011 GameInventory attachmentInv = attachment.GetInventory();
13013 {
13014 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13015 return false;
13016 }
13017
13018 InventoryLocation loc = new InventoryLocation();
13019 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13020 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13021 return false;
13022
13023 return super.CanReceiveAttachment(attachment, slotId);
13024 }
13025
13027 {
13028 if (!super.CanReleaseAttachment(attachment))
13029 return false;
13030
13031 return GetInventory().AreChildrenAccessible();
13032 }
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
13052
13053
13055 {
13056 int id = muzzle_owner.GetMuzzleID();
13057 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13058
13059 if (WPOF_array)
13060 {
13061 for (int i = 0; i < WPOF_array.Count(); i++)
13062 {
13063 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13064
13065 if (WPOF)
13066 {
13067 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13068 }
13069 }
13070 }
13071 }
13072
13073
13075 {
13076 int id = muzzle_owner.GetMuzzleID();
13078
13079 if (WPOBE_array)
13080 {
13081 for (int i = 0; i < WPOBE_array.Count(); i++)
13082 {
13083 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13084
13085 if (WPOBE)
13086 {
13087 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13088 }
13089 }
13090 }
13091 }
13092
13093
13095 {
13096 int id = muzzle_owner.GetMuzzleID();
13097 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13098
13099 if (WPOOH_array)
13100 {
13101 for (int i = 0; i < WPOOH_array.Count(); i++)
13102 {
13103 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13104
13105 if (WPOOH)
13106 {
13107 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13108 }
13109 }
13110 }
13111 }
13112
13113
13115 {
13116 int id = muzzle_owner.GetMuzzleID();
13117 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13118
13119 if (WPOOH_array)
13120 {
13121 for (int i = 0; i < WPOOH_array.Count(); i++)
13122 {
13123 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13124
13125 if (WPOOH)
13126 {
13127 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13128 }
13129 }
13130 }
13131 }
13132
13133
13135 {
13136 int id = muzzle_owner.GetMuzzleID();
13137 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13138
13139 if (WPOOH_array)
13140 {
13141 for (int i = 0; i < WPOOH_array.Count(); i++)
13142 {
13143 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13144
13145 if (WPOOH)
13146 {
13147 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13148 }
13149 }
13150 }
13151 }
13152
13153
13154
13156 {
13158 {
13159 return true;
13160 }
13161
13162 return false;
13163 }
13164
13166 {
13168 {
13169 return true;
13170 }
13171
13172 return false;
13173 }
13174
13176 {
13178 {
13179 return true;
13180 }
13181
13182 return false;
13183 }
13184
13186 {
13187 return false;
13188 }
13189
13192 {
13193 return UATimeSpent.DEFAULT_DEPLOY;
13194 }
13195
13196
13197
13198
13200 {
13202 SetSynchDirty();
13203 }
13204
13206 {
13208 }
13209
13210
13212 {
13213 return false;
13214 }
13215
13218 {
13219 string att_type = "None";
13220
13221 if (ConfigIsExisting("soundAttType"))
13222 {
13223 att_type = ConfigGetString("soundAttType");
13224 }
13225
13227 }
13228
13230 {
13232 }
13233
13234
13235
13236
13237
13243
13245 {
13248
13250 }
13251
13252
13254 {
13256 return;
13257
13259
13262
13265
13266 SoundParameters params = new SoundParameters();
13270 }
13271
13272
13274 {
13276 {
13279
13280 SetSynchDirty();
13281
13284 }
13285 }
13286
13288 {
13290 }
13291
13292
13294 {
13296 return;
13297
13299 SetSynchDirty();
13300
13303 }
13304
13306 {
13309 }
13310
13312 {
13314 }
13315
13316 void OnApply(PlayerBase player);
13317
13319 {
13320 return 1.0;
13321 };
13322
13324 {
13326 }
13327
13329 {
13331 }
13332
13334
13336 {
13337 SetDynamicPhysicsLifeTime(0.01);
13339 }
13340
13342 {
13343 array<string> zone_names = new array<string>;
13344 GetDamageZones(zone_names);
13345 for (int i = 0; i < zone_names.Count(); i++)
13346 {
13347 SetHealthMax(zone_names.Get(i),"Health");
13348 }
13349 SetHealthMax("","Health");
13350 }
13351
13354 {
13355 float global_health = GetHealth01("","Health");
13356 array<string> zones = new array<string>;
13357 GetDamageZones(zones);
13358
13359 for (int i = 0; i < zones.Count(); i++)
13360 {
13361 SetHealth01(zones.Get(i),"Health",global_health);
13362 }
13363 }
13364
13367 {
13368 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13369 }
13370
13372 {
13373 if (!hasRootAsPlayer)
13374 {
13375 if (refParentIB)
13376 {
13377
13378 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13379 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13380
13381 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13382 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13383
13386 }
13387 else
13388 {
13389
13392 }
13393 }
13394 }
13395
13397 {
13399 {
13400 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13401 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13402 {
13403 float heatPermCoef = 1.0;
13405 while (ent)
13406 {
13407 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13408 ent = ent.GetHierarchyParent();
13409 }
13410
13411 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13412 }
13413 }
13414 }
13415
13417 {
13418
13419 EntityAI parent = GetHierarchyParent();
13420 if (!parent)
13421 {
13422 hasParent = false;
13423 hasRootAsPlayer = false;
13424 }
13425 else
13426 {
13427 hasParent = true;
13428 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13429 refParentIB =
ItemBase.Cast(parent);
13430 }
13431 }
13432
13433 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13434 {
13435
13436 }
13437
13439 {
13440
13441 return false;
13442 }
13443
13445 {
13446
13447
13448 return false;
13449 }
13450
13452 {
13453
13454 return false;
13455 }
13456
13459 {
13460 return !GetIsFrozen() &&
IsOpen();
13461 }
13462
13464 {
13465 bool hasParent = false, hasRootAsPlayer = false;
13467
13468 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13469 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13470
13471 if (wwtu || foodDecay)
13472 {
13476
13477 if (processWetness || processTemperature || processDecay)
13478 {
13480
13481 if (processWetness)
13482 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13483
13484 if (processTemperature)
13486
13487 if (processDecay)
13488 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13489 }
13490 }
13491 }
13492
13495 {
13497 }
13498
13500 {
13503
13504 return super.GetTemperatureFreezeThreshold();
13505 }
13506
13508 {
13511
13512 return super.GetTemperatureThawThreshold();
13513 }
13514
13516 {
13519
13520 return super.GetItemOverheatThreshold();
13521 }
13522
13524 {
13526 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13527
13528 return super.GetTemperatureFreezeTime();
13529 }
13530
13532 {
13534 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13535
13536 return super.GetTemperatureThawTime();
13537 }
13538
13543
13545 {
13546 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13547 }
13548
13550 {
13551 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13552 }
13553
13556 {
13558 }
13559
13561 {
13563 }
13564
13566 {
13568 }
13569
13572 {
13573 return null;
13574 }
13575
13578 {
13579 return false;
13580 }
13581
13583 {
13585 {
13588 if (!trg)
13589 {
13591 explosive = this;
13592 }
13593
13594 explosive.PairRemote(trg);
13596
13597 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13598 trg.SetPersistentPairID(persistentID);
13599 explosive.SetPersistentPairID(persistentID);
13600
13601 return true;
13602 }
13603 return false;
13604 }
13605
13608 {
13609 float ret = 1.0;
13612 ret *= GetHealth01();
13613
13614 return ret;
13615 }
13616
13617 #ifdef DEVELOPER
13618 override void SetDebugItem()
13619 {
13620 super.SetDebugItem();
13621 _itemBase = this;
13622 }
13623
13625 {
13626 string text = super.GetDebugText();
13627
13629 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13630
13631 return text;
13632 }
13633 #endif
13634
13636 {
13637 return true;
13638 }
13639
13641
13643
13645 {
13648 }
13649
13650
13658
13674
13675 [
Obsolete(
"Use ItemSoundHandler instead")]
13678 {
13679 if (!
g_Game.IsDedicatedServer())
13680 {
13681 if (ConfigIsExisting("attachSoundSet"))
13682 {
13683 string cfg_path = "";
13684 string soundset = "";
13685 string type_name =
GetType();
13686
13689 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13690 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13691
13692 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13693 {
13694 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13695 {
13696 if (cfg_slot_array[i] == slot_type)
13697 {
13698 soundset = cfg_soundset_array[i];
13699 break;
13700 }
13701 }
13702 }
13703
13704 if (soundset != "")
13705 {
13706 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13708 }
13709 }
13710 }
13711 }
13712
13714}
13715
13717{
13719 if (entity)
13720 {
13721 bool is_item = entity.IsInherited(
ItemBase);
13722 if (is_item && full_quantity)
13723 {
13726 }
13727 }
13728 else
13729 {
13731 return NULL;
13732 }
13733 return entity;
13734}
13735
13737{
13738 if (item)
13739 {
13740 if (health > 0)
13741 item.SetHealth("", "", health);
13742
13743 if (item.CanHaveTemperature())
13744 {
13746 if (item.CanFreeze())
13747 item.SetFrozen(false);
13748 }
13749
13750 if (item.HasEnergyManager())
13751 {
13752 if (quantity >= 0)
13753 {
13754 item.GetCompEM().SetEnergy0To1(quantity);
13755 }
13756 else
13757 {
13759 }
13760 }
13761 else if (item.IsMagazine())
13762 {
13763 Magazine mag = Magazine.Cast(item);
13764 if (quantity >= 0)
13765 {
13766 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13767 }
13768 else
13769 {
13771 }
13772
13773 }
13774 else
13775 {
13776 if (quantity >= 0)
13777 {
13778 item.SetQuantityNormalized(quantity, false);
13779 }
13780 else
13781 {
13783 }
13784
13785 }
13786 }
13787}
13788
13789#ifdef DEVELOPER
13791#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.