8895{
8897 {
8898 return true;
8899 }
8900};
8901
8903{
8904
8905};
8906
8907
8908
8910{
8914
8916
8919
8920
8921
8922
8923
8932
8938
8943
8948
8969 protected bool m_IsResultOfSplit
8970
8972
8977
8978
8979
8981
8985
8986
8987
8989
8992
8993
8994
9000
9001
9009
9012
9013
9015
9016
9018
9019
9024
9025
9030
9032
9033
9035
9036
9038 {
9043
9044 if (!
g_Game.IsDedicatedServer())
9045 {
9047 {
9049
9051 {
9053 }
9054 }
9055
9058 }
9059
9060 m_OldLocation = null;
9061
9063 {
9065 }
9066
9067 if (ConfigIsExisting("headSelectionsToHide"))
9068 {
9071 }
9072
9074 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9075 {
9077 }
9078
9080
9081 m_IsResultOfSplit = false;
9082
9084 }
9085
9087 {
9088 super.InitItemVariables();
9089
9095 m_Count = ConfigGetInt(
"count");
9096
9099
9104
9107
9112
9124
9128
9129
9132 if (ConfigIsExisting("canBeSplit"))
9133 {
9136 }
9137
9139 if (ConfigIsExisting("itemBehaviour"))
9141
9142
9145 RegisterNetSyncVariableInt("m_VarLiquidType");
9146 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9147
9148 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9149 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9150 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9151
9152 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9153 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9154 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9155 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9156
9157 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9158 RegisterNetSyncVariableBool("m_IsTakeable");
9159 RegisterNetSyncVariableBool("m_IsHologram");
9160
9163 {
9166 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9167 }
9168
9170
9172 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9174
9176 }
9177
9179 {
9181 }
9182
9184 {
9187 {
9192 }
9193 }
9194
9195 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9196 {
9198 {
9201 }
9202
9204 }
9205
9207 {
9213 }
9214
9216
9218 {
9220
9221 if (!action)
9222 {
9223 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9224 return;
9225 }
9226
9228 if (!ai)
9229 {
9231 return;
9232 }
9233
9235 if (!action_array)
9236 {
9237 action_array = new array<ActionBase_Basic>;
9239 }
9240 if (LogManager.IsActionLogEnable())
9241 {
9242 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9243 }
9244
9245 if (action_array.Find(action) != -1)
9246 {
9247 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9248 }
9249 else
9250 {
9251 action_array.Insert(action);
9252 }
9253 }
9254
9256 {
9257 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9258 ActionBase action = player.GetActionManager().GetAction(actionName);
9261
9262 if (action_array)
9263 {
9264 action_array.RemoveItem(action);
9265 }
9266 }
9267
9268
9269
9271 {
9272 ActionOverrideData overrideData = new ActionOverrideData();
9276
9278 if (!actionMap)
9279 {
9282 }
9283
9284 actionMap.Insert(this.
Type(), overrideData);
9285
9286 }
9287
9289
9291
9292
9294 {
9297
9300
9301 string config_to_search = "CfgVehicles";
9302 string muzzle_owner_config;
9303
9305 {
9306 if (IsInherited(Weapon))
9307 config_to_search = "CfgWeapons";
9308
9309 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9310
9311 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9312
9313 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9314
9315 if (config_OnFire_subclass_count > 0)
9316 {
9317 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9318
9319 for (int i = 0; i < config_OnFire_subclass_count; i++)
9320 {
9321 string particle_class = "";
9322 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9323 string config_OnFire_entry = config_OnFire_class + particle_class;
9324 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9325 WPOF_array.Insert(WPOF);
9326 }
9327
9328
9330 }
9331 }
9332
9334 {
9335 config_to_search = "CfgWeapons";
9336 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9337
9338 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9339
9340 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9341
9342 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9343 {
9344 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9345
9346 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9347 {
9348 string particle_class2 = "";
9349 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9350 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9351 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9352 WPOBE_array.Insert(WPOBE);
9353 }
9354
9355
9357 }
9358 }
9359 }
9360
9361
9363 {
9366
9368 {
9369 string config_to_search = "CfgVehicles";
9370
9371 if (IsInherited(Weapon))
9372 config_to_search = "CfgWeapons";
9373
9374 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9375 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9376
9377 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9378 {
9379
9381
9383 {
9385 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9387 return;
9388 }
9389
9392
9393
9394
9395 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9396 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9397
9398 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9399 {
9400 string particle_class = "";
9401 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9402 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9403 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9404
9405 if (entry_type == CT_CLASS)
9406 {
9407 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9408 WPOOH_array.Insert(WPOF);
9409 }
9410 }
9411
9412
9414 }
9415 }
9416 }
9417
9419 {
9421 }
9422
9424 {
9426 {
9428
9431
9434
9435 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9436 }
9437 }
9438
9440 {
9442 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9443
9445 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9446
9448 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9449
9451 {
9453 }
9454 }
9455
9457 {
9459 }
9460
9462 {
9465 else
9467
9469 {
9472 }
9473 else
9474 {
9477
9480 }
9481
9483 }
9484
9486 {
9488 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9489 }
9490
9492 {
9494 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9496 }
9497
9499 {
9501 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9502 }
9503
9505 {
9508
9509 OverheatingParticle OP = new OverheatingParticle();
9514
9516 }
9517
9519 {
9522
9523 return -1;
9524 }
9525
9527 {
9529 {
9532
9533 for (int i = count; i > 0; --i)
9534 {
9535 int id = i - 1;
9538
9541
9542 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9543 {
9544 if (p)
9545 {
9548 }
9549 }
9550 }
9551 }
9552 }
9553
9555 {
9557 {
9559 {
9560 int id = i - 1;
9562
9563 if (OP)
9564 {
9566
9567 if (p)
9568 {
9570 }
9571
9572 delete OP;
9573 }
9574 }
9575
9578 }
9579 }
9580
9583 {
9584 return 0.0;
9585 }
9586
9587
9589 {
9590 return 250;
9591 }
9592
9594 {
9595 return 0;
9596 }
9597
9600 {
9602 return true;
9603
9604 return false;
9605 }
9606
9609 {
9612
9614 {
9616 }
9617 else
9618 {
9619
9621 }
9622
9624 }
9625
9632 {
9633 return -1;
9634 }
9635
9636
9637
9638
9640 {
9642 {
9643 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9644 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9645
9646 if (r_index >= 0)
9647 {
9648 InventoryLocation r_il = new InventoryLocation;
9649 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9650
9651 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9654 {
9655 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9656 }
9658 {
9659 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9660 }
9661
9662 }
9663
9664 player.GetHumanInventory().ClearUserReservedLocation(this);
9665 }
9666
9669 }
9670
9671
9672
9673
9675 {
9676 return ItemBase.m_DebugActionsMask;
9677 }
9678
9680 {
9681 return ItemBase.m_DebugActionsMask & mask;
9682 }
9683
9685 {
9686 ItemBase.m_DebugActionsMask = mask;
9687 }
9688
9690 {
9691 ItemBase.m_DebugActionsMask |= mask;
9692 }
9693
9695 {
9696 ItemBase.m_DebugActionsMask &= ~mask;
9697 }
9698
9700 {
9702 {
9704 }
9705 else
9706 {
9708 }
9709 }
9710
9711
9713 {
9714 if (GetEconomyProfile())
9715 {
9716 float q_max = GetEconomyProfile().GetQuantityMax();
9717 if (q_max > 0)
9718 {
9719 float q_min = GetEconomyProfile().GetQuantityMin();
9720 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9721
9723 {
9724 ComponentEnergyManager comp = GetCompEM();
9726 {
9728 }
9729 }
9731 {
9733
9734 }
9735
9736 }
9737 }
9738 }
9739
9742 {
9743 EntityAI parent = GetHierarchyParent();
9744
9745 if (parent)
9746 {
9747 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9748 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9749 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9750 }
9751 }
9752
9755 {
9756 EntityAI parent = GetHierarchyParent();
9757
9758 if (parent)
9759 {
9760 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9761 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9762 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9763 }
9764 }
9765
9767 {
9768
9769
9770
9771
9773
9775 {
9776 if (ScriptInputUserData.CanStoreInputUserData())
9777 {
9778 ScriptInputUserData ctx = new ScriptInputUserData;
9784 ctx.
Write(use_stack_max);
9787
9789 {
9790 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9791 }
9792 }
9793 }
9794 else if (!
g_Game.IsMultiplayer())
9795 {
9797 }
9798 }
9799
9801 {
9803 }
9804
9806 {
9808 }
9809
9811 {
9813 }
9814
9816 {
9817
9818 return false;
9819 }
9820
9822 {
9823 return false;
9824 }
9825
9829 {
9830 return false;
9831 }
9832
9834 {
9835 return "";
9836 }
9837
9839
9841 {
9842 return false;
9843 }
9844
9846 {
9847 return true;
9848 }
9849
9850
9851
9853 {
9854 return true;
9855 }
9856
9858 {
9859 return true;
9860 }
9861
9863 {
9864 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9866 }
9867
9869 {
9871 }
9872
9874 {
9876 if (!is_being_placed)
9878 SetSynchDirty();
9879 }
9880
9881
9883
9885 {
9887 }
9888
9890 {
9892 }
9893
9895 {
9896 return 1;
9897 }
9898
9900 {
9901 return false;
9902 }
9903
9905 {
9907 SetSynchDirty();
9908 }
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9945 {
9946 super.OnMovedInsideCargo(container);
9947
9948 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9949 }
9950
9951 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9952 {
9953 super.EEItemLocationChanged(oldLoc, newLoc);
9954
9955 PlayerBase newPlayer = null;
9956 PlayerBase oldPlayer = null;
9957
9958 if (newLoc.GetParent())
9959 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9960
9961 if (oldLoc.GetParent())
9962 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9963
9965 {
9966 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
9967
9968 if (rIndex >= 0)
9969 {
9970 InventoryLocation rIl = new InventoryLocation;
9971 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
9972
9973 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
9976 {
9977 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
9978 }
9980 {
9982 }
9983
9984 }
9985 }
9986
9988 {
9989 if (newPlayer)
9990 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
9991
9992 if (newPlayer == oldPlayer)
9993 {
9994 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9995 {
9997 {
9998 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9999 {
10000 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10001 }
10002 }
10003 else
10004 {
10005 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10006 }
10007 }
10008
10009 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10010 {
10011 int type = oldLoc.GetType();
10013 {
10014 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10015 }
10017 {
10018 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10019 }
10020 }
10021 if (!m_OldLocation)
10022 {
10023 m_OldLocation = new InventoryLocation;
10024 }
10025 m_OldLocation.Copy(oldLoc);
10026 }
10027 else
10028 {
10029 if (m_OldLocation)
10030 {
10031 m_OldLocation.Reset();
10032 }
10033 }
10034
10035 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10036 }
10037 else
10038 {
10039 if (newPlayer)
10040 {
10041 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10042 if (resIndex >= 0)
10043 {
10044 InventoryLocation il = new InventoryLocation;
10045 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10047 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10050 {
10051 il.
GetParent().GetOnReleaseLock().Invoke(it);
10052 }
10054 {
10056 }
10057
10058 }
10059 }
10061 {
10062
10064 }
10065
10066 if (m_OldLocation)
10067 {
10068 m_OldLocation.Reset();
10069 }
10070 }
10071
10073 {
10074 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10075 }
10076
10078 {
10079 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10080 }
10081 }
10082
10083 override void EOnContact(IEntity other, Contact extra)
10084 {
10086 {
10087 int liquidType = -1;
10089 if (impactSpeed > 0.0)
10090 {
10092 #ifndef SERVER
10094 #else
10096 SetSynchDirty();
10097 #endif
10099 }
10100 }
10101
10102 #ifdef SERVER
10103 if (GetCompEM() && GetCompEM().IsPlugged())
10104 {
10105 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10106 GetCompEM().UnplugThis();
10107 }
10108 #endif
10109 }
10110
10112
10114 {
10116 }
10117
10119 {
10120
10121 }
10122
10124 {
10125 super.OnItemLocationChanged(old_owner, new_owner);
10126
10127 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10128 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10129
10130 if (!relatedPlayer && playerNew)
10131 relatedPlayer = playerNew;
10132
10133 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10134 {
10136 if (actionMgr)
10137 {
10138 ActionBase currentAction = actionMgr.GetRunningAction();
10139 if (currentAction)
10141 }
10142 }
10143
10144 Man ownerPlayerOld = null;
10145 Man ownerPlayerNew = null;
10146
10147 if (old_owner)
10148 {
10149 if (old_owner.
IsMan())
10150 {
10151 ownerPlayerOld = Man.Cast(old_owner);
10152 }
10153 else
10154 {
10155 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10156 }
10157 }
10158 else
10159 {
10161 {
10163
10164 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10165 {
10166 GetCompEM().UnplugThis();
10167 }
10168 }
10169 }
10170
10171 if (new_owner)
10172 {
10173 if (new_owner.
IsMan())
10174 {
10175 ownerPlayerNew = Man.Cast(new_owner);
10176 }
10177 else
10178 {
10179 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10180 }
10181 }
10182
10183 if (ownerPlayerOld != ownerPlayerNew)
10184 {
10185 if (ownerPlayerOld)
10186 {
10187 array<EntityAI> subItemsExit = new array<EntityAI>;
10189 for (int i = 0; i < subItemsExit.Count(); i++)
10190 {
10193 }
10194 }
10195
10196 if (ownerPlayerNew)
10197 {
10198 array<EntityAI> subItemsEnter = new array<EntityAI>;
10200 for (int j = 0; j < subItemsEnter.Count(); j++)
10201 {
10204 }
10205 }
10206 }
10207 else if (ownerPlayerNew != null)
10208 {
10209 PlayerBase nplayer;
10210 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10211 {
10212 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10214 for (int k = 0; k < subItemsUpdate.Count(); k++)
10215 {
10217 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10218 }
10219 }
10220 }
10221
10222 if (old_owner)
10223 old_owner.OnChildItemRemoved(this);
10224 if (new_owner)
10225 new_owner.OnChildItemReceived(this);
10226 }
10227
10228
10230 {
10231 super.EEDelete(parent);
10232 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10233 if (player)
10234 {
10236
10237 if (player.IsAlive())
10238 {
10239 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10240 if (r_index >= 0)
10241 {
10242 InventoryLocation r_il = new InventoryLocation;
10243 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10244
10245 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10248 {
10249 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10250 }
10252 {
10253 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10254 }
10255
10256 }
10257
10258 player.RemoveQuickBarEntityShortcut(this);
10259 }
10260 }
10261 }
10262
10264 {
10265 super.EEKilled(killer);
10266
10269 {
10270 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10271 {
10272 if (IsMagazine())
10273 {
10274 if (Magazine.Cast(this).GetAmmoCount() > 0)
10275 {
10277 }
10278 }
10279 else
10280 {
10282 }
10283 }
10284 }
10285 }
10286
10288 {
10289 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10290
10291 super.OnWasAttached(parent, slot_id);
10292
10295
10298 }
10299
10301 {
10302 super.OnWasDetached(parent, slot_id);
10303
10306
10309 }
10310
10312 {
10313 int idx;
10316
10317 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10318 if (inventory_slots.Count() < 1)
10319 {
10320 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10321 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10322 }
10323 else
10324 {
10325 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10326 }
10327
10328 idx = inventory_slots.Find(slot);
10329 if (idx < 0)
10330 return "";
10331
10332 return attach_types.Get(idx);
10333 }
10334
10336 {
10337 int idx = -1;
10338 string slot;
10339
10342
10343 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10344 if (inventory_slots.Count() < 1)
10345 {
10346 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10347 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10348 }
10349 else
10350 {
10351 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10352 if (detach_types.Count() < 1)
10353 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10354 }
10355
10356 for (int i = 0; i < inventory_slots.Count(); i++)
10357 {
10358 slot = inventory_slots.Get(i);
10359 }
10360
10361 if (slot != "")
10362 {
10363 if (detach_types.Count() == 1)
10364 idx = 0;
10365 else
10366 idx = inventory_slots.Find(slot);
10367 }
10368 if (idx < 0)
10369 return "";
10370
10371 return detach_types.Get(idx);
10372 }
10373
10375 {
10376
10378
10379
10380 float min_time = 1;
10381 float max_time = 3;
10382 float delay = Math.RandomFloat(min_time, max_time);
10383
10384 explode_timer.Run(delay, this, "DoAmmoExplosion");
10385 }
10386
10388 {
10389 Magazine magazine = Magazine.Cast(this);
10390 int pop_sounds_count = 6;
10391 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10392
10393
10394 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10395 string sound_name = pop_sounds[ sound_idx ];
10396 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10397
10398
10399 magazine.ServerAddAmmoCount(-1);
10400
10401
10402 float min_temp_to_explode = 100;
10403
10404 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10405 {
10407 }
10408 }
10409
10410
10411 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10412 {
10413 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10414
10415 const int CHANCE_DAMAGE_CARGO = 4;
10416 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10417 const int CHANCE_DAMAGE_NOTHING = 2;
10418
10420 {
10421 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10422 int chances;
10423 int rnd;
10424
10425 if (GetInventory().GetCargo())
10426 {
10427 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10428 rnd = Math.RandomInt(0,chances);
10429
10430 if (rnd < CHANCE_DAMAGE_CARGO)
10431 {
10433 }
10434 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10435 {
10437 }
10438 }
10439 else
10440 {
10441 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10442 rnd = Math.RandomInt(0,chances);
10443
10444 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10445 {
10447 }
10448 }
10449 }
10450 }
10451
10453 {
10454 CargoBase cargo = GetInventory().GetCargo();
10455 if (cargo)
10456 {
10458 if (item_count > 0)
10459 {
10460 int random_pick = Math.RandomInt(0, item_count);
10462 if (!item.IsExplosive())
10463 {
10464 item.AddHealth("","",damage);
10465 return true;
10466 }
10467 }
10468 }
10469 return false;
10470 }
10471
10473 {
10474 GameInventory inventory = GetInventory();
10476 if (attachment_count > 0)
10477 {
10478 int random_pick = Math.RandomInt(0, attachment_count);
10480 if (!attachment.IsExplosive())
10481 {
10482 attachment.AddHealth("","",damage);
10483 return true;
10484 }
10485 }
10486 return false;
10487 }
10488
10490 {
10492 }
10493
10495 {
10497 return GetInventory().CanRemoveEntity();
10498
10499 return false;
10500 }
10501
10503 {
10504
10506 return false;
10507
10508
10510 return false;
10511
10512
10513
10515 if (delta == 0)
10516 return false;
10517
10518
10519 return true;
10520 }
10521
10523 {
10525 {
10526 if (ScriptInputUserData.CanStoreInputUserData())
10527 {
10528 ScriptInputUserData ctx = new ScriptInputUserData;
10533 ctx.
Write(destination_entity);
10535 ctx.
Write(slot_id);
10537 }
10538 }
10539 else if (!
g_Game.IsMultiplayer())
10540 {
10542 }
10543 }
10544
10546 {
10547 float split_quantity_new;
10551 InventoryLocation loc = new InventoryLocation;
10552
10553 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10554 {
10556 split_quantity_new = stack_max;
10557 else
10559
10561 {
10562 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10563 if (new_item)
10564 {
10565 new_item.SetResultOfSplit(true);
10566 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10568 new_item.
SetQuantity(split_quantity_new,
false,
true);
10569 }
10570 }
10571 }
10572 else if (destination_entity && slot_id == -1)
10573 {
10574 if (quantity > stack_max)
10575 split_quantity_new = stack_max;
10576 else
10577 split_quantity_new = quantity;
10578
10580 {
10581 GameInventory destinationInventory = destination_entity.GetInventory();
10583 {
10586 }
10587
10588 if (new_item)
10589 {
10590 new_item.SetResultOfSplit(true);
10591 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10593 new_item.
SetQuantity(split_quantity_new,
false,
true);
10594 }
10595 }
10596 }
10597 else
10598 {
10599 if (stack_max != 0)
10600 {
10602 {
10604 }
10605
10606 if (split_quantity_new == 0)
10607 {
10608 if (!
g_Game.IsMultiplayer())
10609 player.PhysicalPredictiveDropItem(this);
10610 else
10611 player.ServerDropEntity(this);
10612 return;
10613 }
10614
10616 {
10618
10619 if (new_item)
10620 {
10621 new_item.SetResultOfSplit(true);
10622 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10625 new_item.PlaceOnSurface();
10626 }
10627 }
10628 }
10629 }
10630 }
10631
10633 {
10634 float split_quantity_new;
10638 InventoryLocation loc = new InventoryLocation;
10639
10640 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10641 {
10643 split_quantity_new = stack_max;
10644 else
10646
10648 {
10649 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10650 if (new_item)
10651 {
10652 new_item.SetResultOfSplit(true);
10653 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10655 new_item.
SetQuantity(split_quantity_new,
false,
true);
10656 }
10657 }
10658 }
10659 else if (destination_entity && slot_id == -1)
10660 {
10661 if (quantity > stack_max)
10662 split_quantity_new = stack_max;
10663 else
10664 split_quantity_new = quantity;
10665
10667 {
10668 GameInventory destinationInventory = destination_entity.GetInventory();
10670 {
10673 }
10674
10675 if (new_item)
10676 {
10677 new_item.SetResultOfSplit(true);
10678 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10680 new_item.
SetQuantity(split_quantity_new,
false,
true);
10681 }
10682 }
10683 }
10684 else
10685 {
10686 if (stack_max != 0)
10687 {
10689 {
10691 }
10692
10694 {
10696
10697 if (new_item)
10698 {
10699 new_item.SetResultOfSplit(true);
10700 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10703 new_item.PlaceOnSurface();
10704 }
10705 }
10706 }
10707 }
10708 }
10709
10711 {
10713 {
10714 if (ScriptInputUserData.CanStoreInputUserData())
10715 {
10716 ScriptInputUserData ctx = new ScriptInputUserData;
10721 dst.WriteToContext(ctx);
10723 }
10724 }
10725 else if (!
g_Game.IsMultiplayer())
10726 {
10728 }
10729 }
10730
10732 {
10734 {
10735 if (ScriptInputUserData.CanStoreInputUserData())
10736 {
10737 ScriptInputUserData ctx = new ScriptInputUserData;
10742 ctx.
Write(destination_entity);
10748 }
10749 }
10750 else if (!
g_Game.IsMultiplayer())
10751 {
10753 }
10754 }
10755
10757 {
10759 }
10760
10762 {
10764 float split_quantity_new;
10766 if (dst.IsValid())
10767 {
10768 int slot_id = dst.GetSlot();
10770
10771 if (quantity > stack_max)
10772 split_quantity_new = stack_max;
10773 else
10774 split_quantity_new = quantity;
10775
10777 {
10779
10780 if (new_item)
10781 {
10782 new_item.SetResultOfSplit(true);
10783 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10785 new_item.
SetQuantity(split_quantity_new,
false,
true);
10786 }
10787
10788 return new_item;
10789 }
10790 }
10791
10792 return null;
10793 }
10794
10796 {
10798 float split_quantity_new;
10800 if (destination_entity)
10801 {
10803 if (quantity > stackable)
10804 split_quantity_new = stackable;
10805 else
10806 split_quantity_new = quantity;
10807
10809 {
10810 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10811 if (new_item)
10812 {
10813 new_item.SetResultOfSplit(true);
10814 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10816 new_item.
SetQuantity(split_quantity_new,
false,
true);
10817 }
10818 }
10819 }
10820 }
10821
10823 {
10825 {
10826 if (ScriptInputUserData.CanStoreInputUserData())
10827 {
10828 ScriptInputUserData ctx = new ScriptInputUserData;
10833 ItemBase destination_entity =
this;
10834 ctx.
Write(destination_entity);
10838 }
10839 }
10840 else if (!
g_Game.IsMultiplayer())
10841 {
10843 }
10844 }
10845
10847 {
10849 float split_quantity_new;
10851 if (player)
10852 {
10854 if (quantity > stackable)
10855 split_quantity_new = stackable;
10856 else
10857 split_quantity_new = quantity;
10858
10860 {
10861 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10862 new_item =
ItemBase.Cast(in_hands);
10863 if (new_item)
10864 {
10865 new_item.SetResultOfSplit(true);
10866 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10868 new_item.SetQuantity(split_quantity_new, false, true);
10869 }
10870 }
10871 }
10872 }
10873
10875 {
10877 float split_quantity_new = Math.Floor(quantity * 0.5);
10878
10880 return;
10881
10883
10884 if (new_item)
10885 {
10886 if (new_item.GetQuantityMax() < split_quantity_new)
10887 {
10888 split_quantity_new = new_item.GetQuantityMax();
10889 }
10890
10891 new_item.SetResultOfSplit(true);
10892 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10893
10895 {
10898 }
10899 else
10900 {
10902 new_item.
SetQuantity(split_quantity_new,
false,
true);
10903 }
10904 }
10905 }
10906
10908 {
10910 float split_quantity_new = Math.Floor(quantity / 2);
10911
10913 return;
10914
10915 InventoryLocation invloc = new InventoryLocation;
10917
10919 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10920
10921 if (new_item)
10922 {
10923 if (new_item.GetQuantityMax() < split_quantity_new)
10924 {
10925 split_quantity_new = new_item.GetQuantityMax();
10926 }
10928 {
10931 }
10932 else if (split_quantity_new > 1)
10933 {
10935 new_item.
SetQuantity(split_quantity_new,
false,
true);
10936 }
10937 }
10938 }
10939
10942 {
10943 SetWeightDirty();
10945
10946 if (parent)
10947 parent.OnAttachmentQuantityChangedEx(this, delta);
10948
10950 {
10952 {
10954 }
10956 {
10957 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
10959 }
10960 }
10961 }
10962
10965 {
10966
10967 }
10968
10971 {
10973 }
10974
10976 {
10977 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10978
10980 {
10981 if (newLevel == GameConstants.STATE_RUINED)
10982 {
10984 EntityAI parent = GetHierarchyParent();
10985 if (parent && parent.IsFireplace())
10986 {
10987 CargoBase cargo = GetInventory().GetCargo();
10988 if (cargo)
10989 {
10991 {
10993 }
10994 }
10995 }
10996 }
10997
10999 {
11000
11002 return;
11003 }
11004
11005 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11006 {
11008 }
11009 }
11010 }
11011
11012
11014 {
11015 super.OnRightClick();
11016
11018 {
11020 {
11021 if (ScriptInputUserData.CanStoreInputUserData())
11022 {
11023 EntityAI root = GetHierarchyRoot();
11024 Man playerOwner = GetHierarchyRootPlayer();
11025 InventoryLocation dst = new InventoryLocation;
11026
11027
11028 if (!playerOwner && root && root == this)
11029 {
11031 }
11032 else
11033 {
11034
11035 GetInventory().GetCurrentInventoryLocation(dst);
11037 {
11038 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11040 {
11042 }
11043 else
11044 {
11046
11047
11048 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11049 {
11051 }
11052 else
11053 {
11054 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11055 }
11056 }
11057 }
11058 }
11059
11060 ScriptInputUserData ctx = new ScriptInputUserData;
11068 }
11069 }
11070 else if (!
g_Game.IsMultiplayer())
11071 {
11073 }
11074 }
11075 }
11076
11078 {
11079 if (root)
11080 {
11081 vector m4[4];
11082 root.GetTransform(m4);
11083 dst.SetGround(this, m4);
11084 }
11085 else
11086 {
11087 GetInventory().GetCurrentInventoryLocation(dst);
11088 }
11089 }
11090
11091 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11092 {
11093
11094 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11095 return false;
11096
11097 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11098 return false;
11099
11100
11102 return false;
11103
11104
11105 Magazine mag = Magazine.Cast(this);
11106 if (mag)
11107 {
11108 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11109 return false;
11110
11111 if (stack_max_limit)
11112 {
11113 Magazine other_mag = Magazine.Cast(other_item);
11114 if (other_item)
11115 {
11116 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11117 return false;
11118 }
11119
11120 }
11121 }
11122 else
11123 {
11124
11126 return false;
11127
11129 return false;
11130 }
11131
11132 PlayerBase player = null;
11133 if (CastTo(player, GetHierarchyRootPlayer()))
11134 {
11135 if (player.GetInventory().HasAttachment(this))
11136 return false;
11137
11138 if (player.IsItemsToDelete())
11139 return false;
11140 }
11141
11142 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11143 return false;
11144
11145 int slotID;
11147 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11148 return false;
11149
11150 return true;
11151 }
11152
11154 {
11156 }
11157
11159 {
11160 return m_IsResultOfSplit;
11161 }
11162
11164 {
11165 m_IsResultOfSplit = value;
11166 }
11167
11169 {
11171 }
11172
11174 {
11175 float other_item_quantity = other_item.GetQuantity();
11176 float this_free_space;
11177
11179
11181
11182 if (other_item_quantity > this_free_space)
11183 {
11184 return this_free_space;
11185 }
11186 else
11187 {
11188 return other_item_quantity;
11189 }
11190 }
11191
11193 {
11195 }
11196
11198 {
11200 return;
11201
11202 if (!IsMagazine() && other_item)
11203 {
11205 if (quantity_used != 0)
11206 {
11207 float hp1 = GetHealth01("","");
11208 float hp2 = other_item.GetHealth01("","");
11209 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11210 hpResult = hpResult / (
GetQuantity() + quantity_used);
11211
11212 hpResult *= GetMaxHealth();
11213 Math.Round(hpResult);
11214 SetHealth("", "Health", hpResult);
11215
11217 other_item.AddQuantity(-quantity_used);
11218 }
11219 }
11221 }
11222
11224 {
11225 #ifdef SERVER
11226 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11227 GetHierarchyParent().IncreaseLifetimeUp();
11228 #endif
11229 };
11230
11232 {
11233 PlayerBase p = PlayerBase.Cast(player);
11234
11235 array<int> recipesIds = p.m_Recipes;
11236 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11237 if (moduleRecipesManager)
11238 {
11239 EntityAI itemInHands = player.GetEntityInHands();
11240 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11241 }
11242
11243 for (int i = 0;i < recipesIds.Count(); i++)
11244 {
11245 int key = recipesIds.Get(i);
11246 string recipeName = moduleRecipesManager.GetRecipeName(key);
11248 }
11249 }
11250
11251
11252 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11253 {
11254 super.GetDebugActions(outputList);
11255
11256
11262
11263
11268
11273
11274
11278
11279
11281 {
11285 }
11286
11289
11290
11294
11296
11297 InventoryLocation loc = new InventoryLocation();
11298 GetInventory().GetCurrentInventoryLocation(loc);
11300 {
11301 if (Gizmo_IsSupported())
11304 }
11305
11307 }
11308
11309
11310
11311
11313 {
11314 super.OnAction(action_id, player, ctx);
11315
11317 {
11318 switch (action_id)
11319 {
11323 return true;
11327 return true;
11328 }
11329 }
11330
11332 {
11333 switch (action_id)
11334 {
11336 Delete();
11337 return true;
11338 }
11339 }
11340
11341 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11342 {
11343 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11344 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11345 PlayerBase p = PlayerBase.Cast(player);
11346 if (
EActions.RECIPES_RANGE_START < 1000)
11347 {
11348 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11349 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11350 }
11351 }
11352 #ifndef SERVER
11353 else if (action_id ==
EActions.WATCH_PLAYER)
11354 {
11355 PluginDeveloper.SetDeveloperItemClientEx(player);
11356 }
11357 #endif
11359 {
11360 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11361 {
11362 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11363 OnDebugButtonPressServer(id + 1);
11364 }
11365
11366 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11367 {
11368 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11370 }
11371
11372 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11373 {
11374 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11376 }
11377
11378 else if (action_id ==
EActions.ADD_QUANTITY)
11379 {
11380 if (IsMagazine())
11381 {
11382 Magazine mag = Magazine.Cast(this);
11383 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11384 }
11385 else
11386 {
11388 }
11389
11390 if (m_EM)
11391 {
11392 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11393 }
11394
11395 }
11396
11397 else if (action_id ==
EActions.REMOVE_QUANTITY)
11398 {
11399 if (IsMagazine())
11400 {
11401 Magazine mag2 = Magazine.Cast(this);
11402 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11403 }
11404 else
11405 {
11407 }
11408 if (m_EM)
11409 {
11410 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11411 }
11412
11413 }
11414
11415 else if (action_id ==
EActions.SET_QUANTITY_0)
11416 {
11418
11419 if (m_EM)
11420 {
11421 m_EM.SetEnergy(0);
11422 }
11423 }
11424
11425 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11426 {
11428
11429 if (m_EM)
11430 {
11431 m_EM.SetEnergy(m_EM.GetEnergyMax());
11432 }
11433 }
11434
11435 else if (action_id ==
EActions.ADD_HEALTH)
11436 {
11437 AddHealth("","",GetMaxHealth("","Health")/5);
11438 }
11439 else if (action_id ==
EActions.REMOVE_HEALTH)
11440 {
11441 AddHealth("","",-GetMaxHealth("","Health")/5);
11442 }
11443 else if (action_id ==
EActions.DESTROY_HEALTH)
11444 {
11445 SetHealth01("","",0);
11446 }
11447 else if (action_id ==
EActions.WATCH_ITEM)
11448 {
11450 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11451 #ifdef DEVELOPER
11452 SetDebugDeveloper_item(this);
11453 #endif
11454 }
11455
11456 else if (action_id ==
EActions.ADD_TEMPERATURE)
11457 {
11458 AddTemperature(20);
11459
11460 }
11461
11462 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11463 {
11464 AddTemperature(-20);
11465
11466 }
11467
11468 else if (action_id ==
EActions.FLIP_FROZEN)
11469 {
11470 SetFrozen(!GetIsFrozen());
11471
11472 }
11473
11474 else if (action_id ==
EActions.ADD_WETNESS)
11475 {
11477
11478 }
11479
11480 else if (action_id ==
EActions.REMOVE_WETNESS)
11481 {
11483
11484 }
11485
11486 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11487 {
11490
11491
11492 }
11493
11494 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11495 {
11498 }
11499
11500 else if (action_id ==
EActions.MAKE_SPECIAL)
11501 {
11502 auto debugParams = DebugSpawnParams.WithPlayer(player);
11503 OnDebugSpawnEx(debugParams);
11504 }
11505
11506 }
11507
11508
11509 return false;
11510 }
11511
11512
11513
11514
11518
11521
11522
11523
11525 {
11526 return false;
11527 }
11528
11529
11531 {
11532 return true;
11533 }
11534
11535
11537 {
11538 return true;
11539 }
11540
11541
11542
11544 {
11545 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11546 return g_Game.ConfigIsExisting(config_path);
11547 }
11548
11551 {
11552 return null;
11553 }
11554
11556 {
11557 return false;
11558 }
11559
11561 {
11562 return false;
11563 }
11564
11568
11569
11571 {
11572 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11573 return module_repairing.CanRepair(this, item_repair_kit);
11574 }
11575
11576
11577 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11578 {
11579 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11580 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11581 }
11582
11583
11585 {
11586
11587
11588
11589
11590
11591
11592
11593
11594 return 1;
11595 }
11596
11597
11598
11600 {
11602 }
11603
11604
11605
11607 {
11609 }
11610
11611
11620 {
11621 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11622
11623 if (player)
11624 {
11625 player.MessageStatus(text);
11626 }
11627 }
11628
11629
11638 {
11639 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11640
11641 if (player)
11642 {
11643 player.MessageAction(text);
11644 }
11645 }
11646
11647
11656 {
11657 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11658
11659 if (player)
11660 {
11661 player.MessageFriendly(text);
11662 }
11663 }
11664
11665
11674 {
11675 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11676
11677 if (player)
11678 {
11679 player.MessageImportant(text);
11680 }
11681 }
11682
11684 {
11685 return true;
11686 }
11687
11688
11689 override bool KindOf(
string tag)
11690 {
11691 bool found = false;
11692 string item_name = this.
GetType();
11694 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11695
11696 int array_size = item_tag_array.Count();
11697 for (int i = 0; i < array_size; i++)
11698 {
11699 if (item_tag_array.Get(i) == tag)
11700 {
11701 found = true;
11702 break;
11703 }
11704 }
11705 return found;
11706 }
11707
11708
11710 {
11711
11712 super.OnRPC(sender, rpc_type,ctx);
11713
11714
11715 switch (rpc_type)
11716 {
11717 #ifndef SERVER
11718 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11719 Param2<bool, string> p = new Param2<bool, string>(false, "");
11720
11722 return;
11723
11724 bool play = p.param1;
11725 string soundSet = p.param2;
11726
11727 if (play)
11728 {
11730 {
11732 {
11734 }
11735 }
11736 else
11737 {
11739 }
11740 }
11741 else
11742 {
11744 }
11745
11746 break;
11747 #endif
11748
11749 }
11750
11752 {
11754 }
11755 }
11756
11757
11758
11759
11761 {
11762 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11763 return plugin.GetID(
name);
11764 }
11765
11767 {
11768 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11769 return plugin.GetName(id);
11770 }
11771
11774 {
11775
11776
11777 int varFlags;
11778 if (!ctx.
Read(varFlags))
11779 return;
11780
11781 if (varFlags & ItemVariableFlags.FLOAT)
11782 {
11784 }
11785 }
11786
11788 {
11789
11790 super.SerializeNumericalVars(floats_out);
11791
11792
11793
11795 {
11797 }
11798
11800 {
11802 }
11803
11805 {
11807 }
11808
11810 {
11815 }
11816
11818 {
11820 }
11821 }
11822
11824 {
11825
11826 super.DeSerializeNumericalVars(floats);
11827
11828
11829 int index = 0;
11830 int mask = Math.Round(floats.Get(index));
11831
11832 index++;
11833
11835 {
11837 {
11839 }
11840 else
11841 {
11842 float quantity = floats.Get(index);
11843 SetQuantity(quantity,
true,
false,
false,
false);
11844 }
11845 index++;
11846 }
11847
11849 {
11850 float wet = floats.Get(index);
11852 index++;
11853 }
11854
11856 {
11857 int liquidtype = Math.Round(floats.Get(index));
11859 index++;
11860 }
11861
11863 {
11865 index++;
11867 index++;
11869 index++;
11871 index++;
11872 }
11873
11875 {
11876 int cleanness = Math.Round(floats.Get(index));
11878 index++;
11879 }
11880 }
11881
11883 {
11884 super.WriteVarsToCTX(ctx);
11885
11886
11888 {
11890 }
11891
11893 {
11895 }
11896
11898 {
11900 }
11901
11903 {
11904 int r,g,b,a;
11910 }
11911
11913 {
11915 }
11916 }
11917
11919 {
11920 if (!super.ReadVarsFromCTX(ctx,version))
11921 return false;
11922
11923 int intValue;
11924 float value;
11925
11926 if (version < 140)
11927 {
11928 if (!ctx.
Read(intValue))
11929 return false;
11930
11931 m_VariablesMask = intValue;
11932 }
11933
11935 {
11936 if (!ctx.
Read(value))
11937 return false;
11938
11940 {
11942 }
11943 else
11944 {
11946 }
11947 }
11948
11949 if (version < 140)
11950 {
11952 {
11953 if (!ctx.
Read(value))
11954 return false;
11955 SetTemperatureDirect(value);
11956 }
11957 }
11958
11960 {
11961 if (!ctx.
Read(value))
11962 return false;
11964 }
11965
11967 {
11968 if (!ctx.
Read(intValue))
11969 return false;
11971 }
11972
11974 {
11975 int r,g,b,a;
11977 return false;
11979 return false;
11981 return false;
11983 return false;
11984
11986 }
11987
11989 {
11990 if (!ctx.
Read(intValue))
11991 return false;
11993 }
11994
11995 if (version >= 138 && version < 140)
11996 {
11998 {
11999 if (!ctx.
Read(intValue))
12000 return false;
12001 SetFrozen(intValue);
12002 }
12003 }
12004
12005 return true;
12006 }
12007
12008
12010 {
12013 {
12015 }
12016
12017 if (!super.OnStoreLoad(ctx, version))
12018 {
12020 return false;
12021 }
12022
12023 if (version >= 114)
12024 {
12025 bool hasQuickBarIndexSaved;
12026
12027 if (!ctx.
Read(hasQuickBarIndexSaved))
12028 {
12030 return false;
12031 }
12032
12033 if (hasQuickBarIndexSaved)
12034 {
12035 int itmQBIndex;
12036
12037
12038 if (!ctx.
Read(itmQBIndex))
12039 {
12041 return false;
12042 }
12043
12044 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12045 if (itmQBIndex != -1 && parentPlayer)
12046 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12047 }
12048 }
12049 else
12050 {
12051
12052 PlayerBase player;
12053 int itemQBIndex;
12054 if (version ==
int.
MAX)
12055 {
12056 if (!ctx.
Read(itemQBIndex))
12057 {
12059 return false;
12060 }
12061 }
12062 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12063 {
12064
12065 if (!ctx.
Read(itemQBIndex))
12066 {
12068 return false;
12069 }
12070 if (itemQBIndex != -1 && player)
12071 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12072 }
12073 }
12074
12075 if (version < 140)
12076 {
12077
12078 if (!LoadVariables(ctx, version))
12079 {
12081 return false;
12082 }
12083 }
12084
12085
12087 {
12089 return false;
12090 }
12091 if (version >= 132)
12092 {
12094 if (raib)
12095 {
12097 {
12099 return false;
12100 }
12101 }
12102 }
12103
12105 return true;
12106 }
12107
12108
12109
12111 {
12112 super.OnStoreSave(ctx);
12113
12114 PlayerBase player;
12115 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12116 {
12118
12119 int itemQBIndex = -1;
12120 itemQBIndex = player.FindQuickBarEntityIndex(this);
12121 ctx.
Write(itemQBIndex);
12122 }
12123 else
12124 {
12126 }
12127
12129
12131 if (raib)
12132 {
12134 }
12135 }
12136
12137
12139 {
12140 super.AfterStoreLoad();
12141
12143 {
12145 }
12146
12148 {
12151 }
12152 }
12153
12155 {
12156 super.EEOnAfterLoad();
12157
12159 {
12161 }
12162
12165 }
12166
12168 {
12169 return false;
12170 }
12171
12172
12173
12175 {
12177 {
12178 #ifdef PLATFORM_CONSOLE
12179
12181 {
12183 if (menu)
12184 {
12186 }
12187 }
12188 #endif
12189 }
12190
12192 {
12195 }
12196
12198 {
12199 SetWeightDirty();
12201 }
12203 {
12206 }
12207
12209 {
12212
12215 }
12217 {
12221 }
12222
12223 super.OnVariablesSynchronized();
12224 }
12225
12226
12227
12229 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12230 {
12231 if (!IsServerCheck(allow_client))
12232 return false;
12233
12235 return false;
12236
12239
12240 if (value <= (min + 0.001))
12241 value = min;
12242
12243 if (value == min)
12244 {
12245 if (destroy_config)
12246 {
12247 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12248 if (dstr)
12249 {
12251 this.Delete();
12252 return true;
12253 }
12254 }
12255 else if (destroy_forced)
12256 {
12258 this.Delete();
12259 return true;
12260 }
12261
12263 }
12264
12267
12269 {
12270 EntityAI parent = GetHierarchyRoot();
12271 InventoryLocation iLoc = new InventoryLocation();
12272 GetInventory().GetCurrentInventoryLocation(iLoc);
12274 {
12275 int iLocSlot = iLoc.
GetSlot();
12277 {
12279 }
12281 {
12283 }
12284 }
12285 }
12286
12288 {
12290
12291 if (delta)
12293 }
12294
12296
12297 return false;
12298 }
12299
12300
12302 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12303 {
12305 }
12306
12308 {
12311 }
12312
12314 {
12317 }
12318
12320 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12321 {
12322 float value_clamped = Math.Clamp(value, 0, 1);
12324 SetQuantity(result, destroy_config, destroy_forced);
12325 }
12326
12327
12330 {
12332 }
12333
12335 {
12337 }
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12349 {
12350 int slot = -1;
12351 GameInventory inventory = GetInventory();
12352 if (inventory)
12353 {
12354 InventoryLocation il = new InventoryLocation;
12357 }
12358
12360 }
12361
12363 {
12364 float quantity_max = 0;
12365
12367 {
12368 if (attSlotID != -1)
12369 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12370
12371 if (quantity_max <= 0)
12373 }
12374
12375 if (quantity_max <= 0)
12377
12378 return quantity_max;
12379 }
12380
12382 {
12384 }
12385
12387 {
12389 }
12390
12391
12393 {
12395 }
12396
12398 {
12400 }
12401
12403 {
12405 }
12406
12407
12409 {
12410
12411 float weightEx = GetWeightEx();
12412 float special = GetInventoryAndCargoWeight();
12413 return weightEx - special;
12414 }
12415
12416
12418 {
12420 }
12421
12423 {
12425 {
12426 #ifdef DEVELOPER
12427 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12428 {
12429 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12431 }
12432 #endif
12433
12434 return GetQuantity() * GetConfigWeightModified();
12435 }
12436 else if (HasEnergyManager())
12437 {
12438 #ifdef DEVELOPER
12439 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12440 {
12441 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12442 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12443 }
12444 #endif
12445 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12446 }
12447 else
12448 {
12449 #ifdef DEVELOPER
12450 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12451 {
12452 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12453 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12454 }
12455 #endif
12456 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12457 }
12458 }
12459
12462 {
12463 int item_count = 0;
12465
12466 GameInventory inventory = GetInventory();
12467 CargoBase cargo = inventory.
GetCargo();
12468 if (cargo != NULL)
12469 {
12471 }
12472
12474 for (int i = 0; i < nAttachments; ++i)
12475 {
12477 if (item)
12478 item_count += item.GetNumberOfItems();
12479 }
12480 return item_count;
12481 }
12482
12485 {
12486 float weight = 0;
12487 float wetness = 1;
12488 if (include_wetness)
12491 {
12492 weight = wetness * m_ConfigWeight;
12493 }
12495 {
12496 weight = 1;
12497 }
12498 return weight;
12499 }
12500
12501
12502
12504 {
12505 GameInventory inventory = GetInventory();
12506 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12507 {
12508 array<EntityAI> items = new array<EntityAI>;
12510 for (int i = 0; i < items.Count(); ++i)
12511 {
12513 if (item)
12514 {
12515 g_Game.ObjectDelete(item);
12516 }
12517 }
12518 }
12519 }
12520
12521
12522
12523
12525 {
12526 float energy = 0;
12527 if (HasEnergyManager())
12528 {
12529 energy = GetCompEM().GetEnergy();
12530 }
12531 return energy;
12532 }
12533
12534
12536 {
12537 super.OnEnergyConsumed();
12538
12540 }
12541
12543 {
12544 super.OnEnergyAdded();
12545
12547 }
12548
12549
12551 {
12552 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12553 {
12555 {
12556 float energy_0to1 = GetCompEM().GetEnergy0To1();
12558 }
12559 }
12560 }
12561
12562
12564 {
12565 return ConfigGetFloat("heatIsolation");
12566 }
12567
12569 {
12571 }
12572
12574 {
12575 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12576 if (
g_Game.ConfigIsExisting(paramPath))
12577 return g_Game.ConfigGetFloat(paramPath);
12578
12579 return 0.0;
12580 }
12581
12583 {
12584 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12585 if (
g_Game.ConfigIsExisting(paramPath))
12586 return g_Game.ConfigGetFloat(paramPath);
12587
12588 return 0.0;
12589 }
12590
12591 override void SetWet(
float value,
bool allow_client =
false)
12592 {
12593 if (!IsServerCheck(allow_client))
12594 return;
12595
12598
12600
12601 m_VarWet = Math.Clamp(value, min, max);
12602
12604 {
12607 }
12608 }
12609
12610 override void AddWet(
float value)
12611 {
12613 }
12614
12616 {
12618 }
12619
12621 {
12623 }
12624
12626 {
12628 }
12629
12631 {
12633 }
12634
12636 {
12638 }
12639
12640 override void OnWetChanged(
float newVal,
float oldVal)
12641 {
12644 if (newLevel != oldLevel)
12645 {
12647 }
12648 }
12649
12651 {
12652 SetWeightDirty();
12653 }
12654
12656 {
12657 return GetWetLevelInternal(
m_VarWet);
12658 }
12659
12660
12661
12663 {
12665 }
12666
12668 {
12670 }
12671
12673 {
12675 }
12676
12678 {
12680 }
12681
12682
12683
12685 {
12686 if (ConfigIsExisting("itemModelLength"))
12687 {
12688 return ConfigGetFloat("itemModelLength");
12689 }
12690 return 0;
12691 }
12692
12694 {
12695 if (ConfigIsExisting("itemAttachOffset"))
12696 {
12697 return ConfigGetFloat("itemAttachOffset");
12698 }
12699 return 0;
12700 }
12701
12702 override void SetCleanness(
int value,
bool allow_client =
false)
12703 {
12704 if (!IsServerCheck(allow_client))
12705 return;
12706
12708
12710
12713 }
12714
12716 {
12718 }
12719
12721 {
12722 return true;
12723 }
12724
12725
12726
12727
12729 {
12731 }
12732
12734 {
12736 }
12737
12738
12739
12740
12741 override void SetColor(
int r,
int g,
int b,
int a)
12742 {
12748 }
12750 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12751 {
12756 }
12757
12759 {
12761 }
12762
12765 {
12766 int r,g,b,a;
12768 r = r/255;
12769 g = g/255;
12770 b = b/255;
12771 a = a/255;
12772 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12773 }
12774
12775
12776
12777 override void SetLiquidType(
int value,
bool allow_client =
false)
12778 {
12779 if (!IsServerCheck(allow_client))
12780 return;
12781
12786 }
12787
12789 {
12790 return ConfigGetInt("varLiquidTypeInit");
12791 }
12792
12794 {
12796 }
12797
12799 {
12801 SetFrozen(false);
12802 }
12803
12806 {
12807 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12808 }
12809
12810
12813 {
12814 PlayerBase nplayer;
12815 if (PlayerBase.CastTo(nplayer, player))
12816 {
12818 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12819 }
12820 }
12821
12822
12825 {
12826 PlayerBase nplayer;
12827 if (PlayerBase.CastTo(nplayer,player))
12828 {
12829 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12830 }
12831
12832 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12833
12834 if (HasEnergyManager())
12835 {
12836 GetCompEM().UpdatePlugState();
12837 }
12838 }
12839
12840
12842 {
12843 super.OnPlacementStarted(player);
12844
12846 }
12847
12848 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12849 {
12851 {
12852 m_AdminLog.OnPlacementComplete(player,
this);
12853 }
12854
12855 super.OnPlacementComplete(player, position, orientation);
12856 }
12857
12858
12859
12860
12861
12863 {
12865 {
12866 return true;
12867 }
12868 else
12869 {
12870 return false;
12871 }
12872 }
12873
12874
12876 {
12878 {
12880 }
12881 }
12882
12883
12885 {
12887 }
12888
12890 {
12892 }
12893
12894 override void InsertAgent(
int agent,
float count = 1)
12895 {
12896 if (count < 1)
12897 return;
12898
12900 }
12901
12904 {
12906 }
12907
12908
12910 {
12912 }
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
12945
12946
12947
12948
12949
12950
12951
12952
12953
12954
12956 {
12958 return false;
12959 return true;
12960 }
12961
12963 {
12964
12966 }
12967
12968
12971 {
12972 super.CheckForRoofLimited(timeTresholdMS);
12973
12974 float time =
g_Game.GetTime();
12975 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12976 {
12977 m_PreviousRoofTestTime = time;
12978 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12979 }
12980 }
12981
12982
12984 {
12986 {
12987 return 0;
12988 }
12989
12990 if (GetInventory().GetAttachmentSlotsCount() != 0)
12991 {
12992 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
12993 if (filter)
12994 return filter.GetProtectionLevel(type, false, system);
12995 else
12996 return 0;
12997 }
12998
12999 string subclassPath, entryName;
13000
13001 switch (type)
13002 {
13004 entryName = "biological";
13005 break;
13007 entryName = "chemical";
13008 break;
13009 default:
13010 entryName = "biological";
13011 break;
13012 }
13013
13014 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13015
13016 return g_Game.ConfigGetFloat(subclassPath + entryName);
13017 }
13018
13019
13020
13023 {
13024 if (!IsMagazine())
13026
13028 }
13029
13030
13031
13032
13033
13038 {
13039 return true;
13040 }
13041
13043 {
13045 }
13046
13047
13048
13049
13050
13052 {
13053 if (parent)
13054 {
13055 if (parent.IsInherited(DayZInfected))
13056 return true;
13057
13058 if (!parent.IsRuined())
13059 return true;
13060 }
13061
13062 return true;
13063 }
13064
13066 {
13067 if (!super.CanPutAsAttachment(parent))
13068 {
13069 return false;
13070 }
13071
13072 if (!IsRuined() && !parent.IsRuined())
13073 {
13074 return true;
13075 }
13076
13077 return false;
13078 }
13079
13081 {
13082
13083
13084
13085
13086 return super.CanReceiveItemIntoCargo(item);
13087 }
13088
13090 {
13091
13092
13093
13094
13095 GameInventory attachmentInv = attachment.GetInventory();
13097 {
13098 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13099 return false;
13100 }
13101
13102 InventoryLocation loc = new InventoryLocation();
13103 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13104 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13105 return false;
13106
13107 return super.CanReceiveAttachment(attachment, slotId);
13108 }
13109
13111 {
13112 if (!super.CanReleaseAttachment(attachment))
13113 return false;
13114
13115 return GetInventory().AreChildrenAccessible();
13116 }
13117
13118
13119
13120
13121
13122
13123
13124
13125
13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13139 {
13140 int id = muzzle_owner.GetMuzzleID();
13141 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13142
13143 if (WPOF_array)
13144 {
13145 for (int i = 0; i < WPOF_array.Count(); i++)
13146 {
13147 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13148
13149 if (WPOF)
13150 {
13151 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13152 }
13153 }
13154 }
13155 }
13156
13157
13159 {
13160 int id = muzzle_owner.GetMuzzleID();
13162
13163 if (WPOBE_array)
13164 {
13165 for (int i = 0; i < WPOBE_array.Count(); i++)
13166 {
13167 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13168
13169 if (WPOBE)
13170 {
13171 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13172 }
13173 }
13174 }
13175 }
13176
13177
13179 {
13180 int id = muzzle_owner.GetMuzzleID();
13181 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13182
13183 if (WPOOH_array)
13184 {
13185 for (int i = 0; i < WPOOH_array.Count(); i++)
13186 {
13187 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13188
13189 if (WPOOH)
13190 {
13191 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13192 }
13193 }
13194 }
13195 }
13196
13197
13199 {
13200 int id = muzzle_owner.GetMuzzleID();
13201 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13202
13203 if (WPOOH_array)
13204 {
13205 for (int i = 0; i < WPOOH_array.Count(); i++)
13206 {
13207 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13208
13209 if (WPOOH)
13210 {
13211 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13212 }
13213 }
13214 }
13215 }
13216
13217
13219 {
13220 int id = muzzle_owner.GetMuzzleID();
13221 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13222
13223 if (WPOOH_array)
13224 {
13225 for (int i = 0; i < WPOOH_array.Count(); i++)
13226 {
13227 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13228
13229 if (WPOOH)
13230 {
13231 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13232 }
13233 }
13234 }
13235 }
13236
13237
13238
13240 {
13242 {
13243 return true;
13244 }
13245
13246 return false;
13247 }
13248
13250 {
13252 {
13253 return true;
13254 }
13255
13256 return false;
13257 }
13258
13260 {
13262 {
13263 return true;
13264 }
13265
13266 return false;
13267 }
13268
13270 {
13271 return false;
13272 }
13273
13276 {
13277 return UATimeSpent.DEFAULT_DEPLOY;
13278 }
13279
13280
13281
13282
13284 {
13286 SetSynchDirty();
13287 }
13288
13290 {
13292 }
13293
13294
13296 {
13297 return false;
13298 }
13299
13302 {
13303 string att_type = "None";
13304
13305 if (ConfigIsExisting("soundAttType"))
13306 {
13307 att_type = ConfigGetString("soundAttType");
13308 }
13309
13311 }
13312
13314 {
13316 }
13317
13318
13319
13320
13321
13327
13329 {
13332
13334 }
13335
13336
13338 {
13340 return;
13341
13343
13346
13349
13350 SoundParameters params = new SoundParameters();
13354 }
13355
13356
13358 {
13360 {
13363
13364 SetSynchDirty();
13365
13368 }
13369 }
13370
13372 {
13374 }
13375
13376
13378 {
13380 return;
13381
13383 SetSynchDirty();
13384
13387 }
13388
13390 {
13393 }
13394
13396 {
13398 }
13399
13400 void OnApply(PlayerBase player);
13401
13403 {
13404 return 1.0;
13405 };
13406
13408 {
13410 }
13411
13413 {
13415 }
13416
13418
13420 {
13421 SetDynamicPhysicsLifeTime(0.01);
13423 }
13424
13426 {
13427 array<string> zone_names = new array<string>;
13428 GetDamageZones(zone_names);
13429 for (int i = 0; i < zone_names.Count(); i++)
13430 {
13431 SetHealthMax(zone_names.Get(i),"Health");
13432 }
13433 SetHealthMax("","Health");
13434 }
13435
13438 {
13439 float global_health = GetHealth01("","Health");
13440 array<string> zones = new array<string>;
13441 GetDamageZones(zones);
13442
13443 for (int i = 0; i < zones.Count(); i++)
13444 {
13445 SetHealth01(zones.Get(i),"Health",global_health);
13446 }
13447 }
13448
13451 {
13452 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13453 }
13454
13456 {
13457 if (!hasRootAsPlayer)
13458 {
13459 if (refParentIB)
13460 {
13461
13462 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13463 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13464
13465 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13466 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13467
13470 }
13471 else
13472 {
13473
13476 }
13477 }
13478 }
13479
13481 {
13483 {
13484 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13485 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13486 {
13487 float heatPermCoef = 1.0;
13489 while (ent)
13490 {
13491 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13492 ent = ent.GetHierarchyParent();
13493 }
13494
13495 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13496 }
13497 }
13498 }
13499
13501 {
13502
13503 EntityAI parent = GetHierarchyParent();
13504 if (!parent)
13505 {
13506 hasParent = false;
13507 hasRootAsPlayer = false;
13508 }
13509 else
13510 {
13511 hasParent = true;
13512 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13513 refParentIB =
ItemBase.Cast(parent);
13514 }
13515 }
13516
13517 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13518 {
13519
13520 }
13521
13523 {
13524
13525 return false;
13526 }
13527
13529 {
13530
13531
13532 return false;
13533 }
13534
13536 {
13537
13538 return false;
13539 }
13540
13543 {
13544 return !GetIsFrozen() &&
IsOpen();
13545 }
13546
13548 {
13549 bool hasParent = false, hasRootAsPlayer = false;
13551
13552 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13553 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13554
13555 if (wwtu || foodDecay)
13556 {
13560
13561 if (processWetness || processTemperature || processDecay)
13562 {
13564
13565 if (processWetness)
13566 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13567
13568 if (processTemperature)
13570
13571 if (processDecay)
13572 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13573 }
13574 }
13575 }
13576
13579 {
13581 }
13582
13584 {
13587
13588 return super.GetTemperatureFreezeThreshold();
13589 }
13590
13592 {
13595
13596 return super.GetTemperatureThawThreshold();
13597 }
13598
13600 {
13603
13604 return super.GetItemOverheatThreshold();
13605 }
13606
13608 {
13610 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13611
13612 return super.GetTemperatureFreezeTime();
13613 }
13614
13616 {
13618 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13619
13620 return super.GetTemperatureThawTime();
13621 }
13622
13627
13629 {
13630 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13631 }
13632
13634 {
13635 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13636 }
13637
13640 {
13642 }
13643
13645 {
13647 }
13648
13650 {
13652 }
13653
13656 {
13657 return null;
13658 }
13659
13662 {
13663 return false;
13664 }
13665
13667 {
13669 {
13672 if (!trg)
13673 {
13675 explosive = this;
13676 }
13677
13678 explosive.PairRemote(trg);
13680
13681 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13682 trg.SetPersistentPairID(persistentID);
13683 explosive.SetPersistentPairID(persistentID);
13684
13685 return true;
13686 }
13687 return false;
13688 }
13689
13692 {
13693 float ret = 1.0;
13696 ret *= GetHealth01();
13697
13698 return ret;
13699 }
13700
13701 #ifdef DEVELOPER
13702 override void SetDebugItem()
13703 {
13704 super.SetDebugItem();
13705 _itemBase = this;
13706 }
13707
13709 {
13710 string text = super.GetDebugText();
13711
13713 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13714
13715 return text;
13716 }
13717 #endif
13718
13720 {
13721 return true;
13722 }
13723
13725
13727
13729 {
13732 }
13733
13734
13742
13758
13759 [
Obsolete(
"Use ItemSoundHandler instead")]
13762 {
13763 if (!
g_Game.IsDedicatedServer())
13764 {
13765 if (ConfigIsExisting("attachSoundSet"))
13766 {
13767 string cfg_path = "";
13768 string soundset = "";
13769 string type_name =
GetType();
13770
13773 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13774 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13775
13776 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13777 {
13778 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13779 {
13780 if (cfg_slot_array[i] == slot_type)
13781 {
13782 soundset = cfg_soundset_array[i];
13783 break;
13784 }
13785 }
13786 }
13787
13788 if (soundset != "")
13789 {
13790 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13792 }
13793 }
13794 }
13795 }
13796
13798}
13799
13801{
13803 if (entity)
13804 {
13805 bool is_item = entity.IsInherited(
ItemBase);
13806 if (is_item && full_quantity)
13807 {
13810 }
13811 }
13812 else
13813 {
13815 return NULL;
13816 }
13817 return entity;
13818}
13819
13821{
13822 if (item)
13823 {
13824 if (health > 0)
13825 item.SetHealth("", "", health);
13826
13827 if (item.CanHaveTemperature())
13828 {
13830 if (item.CanFreeze())
13831 item.SetFrozen(false);
13832 }
13833
13834 if (item.HasEnergyManager())
13835 {
13836 if (quantity >= 0)
13837 {
13838 item.GetCompEM().SetEnergy0To1(quantity);
13839 }
13840 else
13841 {
13843 }
13844 }
13845 else if (item.IsMagazine())
13846 {
13847 Magazine mag = Magazine.Cast(item);
13848 if (quantity >= 0)
13849 {
13850 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13851 }
13852 else
13853 {
13855 }
13856
13857 }
13858 else
13859 {
13860 if (quantity >= 0)
13861 {
13862 item.SetQuantityNormalized(quantity, false);
13863 }
13864 else
13865 {
13867 }
13868
13869 }
13870 }
13871}
13872
13873#ifdef DEVELOPER
13875#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.