8968{
8970 {
8971 return true;
8972 }
8973};
8974
8976{
8977
8978};
8979
8980
8981
8983{
8987
8989
8992
8993
8994
8995
8996
9005
9011
9016
9021
9042 protected bool m_IsResultOfSplit
9043
9045
9050
9051
9052
9054
9058
9059
9060
9062
9065
9066
9067
9073
9074
9082
9085
9086
9088
9089
9091
9092
9097
9098
9103
9105
9106
9108
9109
9111 {
9116
9117 if (!
g_Game.IsDedicatedServer())
9118 {
9120 {
9122
9124 {
9126 }
9127 }
9128
9131 }
9132
9133 m_OldLocation = null;
9134
9136 {
9138 }
9139
9140 if (ConfigIsExisting("headSelectionsToHide"))
9141 {
9144 }
9145
9147 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9148 {
9150 }
9151
9153
9154 m_IsResultOfSplit = false;
9155
9157 }
9158
9160 {
9161 super.InitItemVariables();
9162
9168 m_Count = ConfigGetInt(
"count");
9169
9172
9177
9180
9185
9197
9201
9202
9205 if (ConfigIsExisting("canBeSplit"))
9206 {
9209 }
9210
9212 if (ConfigIsExisting("itemBehaviour"))
9214
9215
9218 RegisterNetSyncVariableInt("m_VarLiquidType");
9219 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9220
9221 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9222 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9223 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9224
9225 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9226 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9227 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9228 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9229
9230 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9231 RegisterNetSyncVariableBool("m_IsTakeable");
9232 RegisterNetSyncVariableBool("m_IsHologram");
9233
9236 {
9239 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9240 }
9241
9243
9245 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9247
9249 }
9250
9252 {
9254 }
9255
9257 {
9260 {
9265 }
9266 }
9267
9268 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9269 {
9271 {
9274 }
9275
9277 }
9278
9280 {
9286 }
9287
9289
9291 {
9293
9294 if (!action)
9295 {
9296 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9297 return;
9298 }
9299
9301 if (!ai)
9302 {
9304 return;
9305 }
9306
9308 if (!action_array)
9309 {
9310 action_array = new array<ActionBase_Basic>;
9312 }
9313 if (LogManager.IsActionLogEnable())
9314 {
9315 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9316 }
9317
9318 if (action_array.Find(action) != -1)
9319 {
9320 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9321 }
9322 else
9323 {
9324 action_array.Insert(action);
9325 }
9326 }
9327
9329 {
9330 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9331 ActionBase action = player.GetActionManager().GetAction(actionName);
9334
9335 if (action_array)
9336 {
9337 action_array.RemoveItem(action);
9338 }
9339 }
9340
9341
9342
9344 {
9345 ActionOverrideData overrideData = new ActionOverrideData();
9349
9351 if (!actionMap)
9352 {
9355 }
9356
9357 actionMap.Insert(this.
Type(), overrideData);
9358
9359 }
9360
9362
9364
9365
9367 {
9370
9373
9374 string config_to_search = "CfgVehicles";
9375 string muzzle_owner_config;
9376
9378 {
9379 if (IsInherited(Weapon))
9380 config_to_search = "CfgWeapons";
9381
9382 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9383
9384 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9385
9386 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9387
9388 if (config_OnFire_subclass_count > 0)
9389 {
9390 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9391
9392 for (int i = 0; i < config_OnFire_subclass_count; i++)
9393 {
9394 string particle_class = "";
9395 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9396 string config_OnFire_entry = config_OnFire_class + particle_class;
9397 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9398 WPOF_array.Insert(WPOF);
9399 }
9400
9401
9403 }
9404 }
9405
9407 {
9408 config_to_search = "CfgWeapons";
9409 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9410
9411 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9412
9413 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9414
9415 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9416 {
9417 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9418
9419 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9420 {
9421 string particle_class2 = "";
9422 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9423 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9424 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9425 WPOBE_array.Insert(WPOBE);
9426 }
9427
9428
9430 }
9431 }
9432 }
9433
9434
9436 {
9439
9441 {
9442 string config_to_search = "CfgVehicles";
9443
9444 if (IsInherited(Weapon))
9445 config_to_search = "CfgWeapons";
9446
9447 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9448 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9449
9450 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9451 {
9452
9454
9456 {
9458 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9460 return;
9461 }
9462
9465
9466
9467
9468 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9469 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9470
9471 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9472 {
9473 string particle_class = "";
9474 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9475 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9476 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9477
9478 if (entry_type == CT_CLASS)
9479 {
9480 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9481 WPOOH_array.Insert(WPOF);
9482 }
9483 }
9484
9485
9487 }
9488 }
9489 }
9490
9492 {
9494 }
9495
9497 {
9499 {
9501
9504
9507
9508 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9509 }
9510 }
9511
9513 {
9515 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9516
9518 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9519
9521 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9522
9524 {
9526 }
9527 }
9528
9530 {
9532 }
9533
9535 {
9538 else
9540
9542 {
9545 }
9546 else
9547 {
9550
9553 }
9554
9556 }
9557
9559 {
9561 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9562 }
9563
9565 {
9567 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9569 }
9570
9572 {
9574 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9575 }
9576
9578 {
9581
9582 OverheatingParticle OP = new OverheatingParticle();
9587
9589 }
9590
9592 {
9595
9596 return -1;
9597 }
9598
9600 {
9602 {
9605
9606 for (int i = count; i > 0; --i)
9607 {
9608 int id = i - 1;
9611
9614
9615 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9616 {
9617 if (p)
9618 {
9621 }
9622 }
9623 }
9624 }
9625 }
9626
9628 {
9630 {
9632 {
9633 int id = i - 1;
9635
9636 if (OP)
9637 {
9639
9640 if (p)
9641 {
9643 }
9644
9645 delete OP;
9646 }
9647 }
9648
9651 }
9652 }
9653
9656 {
9657 return 0.0;
9658 }
9659
9660
9662 {
9663 return 250;
9664 }
9665
9667 {
9668 return 0;
9669 }
9670
9673 {
9675 return true;
9676
9677 return false;
9678 }
9679
9682 {
9685
9687 {
9689 }
9690 else
9691 {
9692
9694 }
9695
9697 }
9698
9705 {
9706 return -1;
9707 }
9708
9709
9710
9711
9713 {
9715 {
9716 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9717 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9718
9719 if (r_index >= 0)
9720 {
9721 InventoryLocation r_il = new InventoryLocation;
9722 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9723
9724 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9727 {
9728 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9729 }
9731 {
9732 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9733 }
9734
9735 }
9736
9737 player.GetHumanInventory().ClearUserReservedLocation(this);
9738 }
9739
9742 }
9743
9744
9745
9746
9748 {
9749 return ItemBase.m_DebugActionsMask;
9750 }
9751
9753 {
9754 return ItemBase.m_DebugActionsMask & mask;
9755 }
9756
9758 {
9759 ItemBase.m_DebugActionsMask = mask;
9760 }
9761
9763 {
9764 ItemBase.m_DebugActionsMask |= mask;
9765 }
9766
9768 {
9769 ItemBase.m_DebugActionsMask &= ~mask;
9770 }
9771
9773 {
9775 {
9777 }
9778 else
9779 {
9781 }
9782 }
9783
9784
9786 {
9787 if (GetEconomyProfile())
9788 {
9789 float q_max = GetEconomyProfile().GetQuantityMax();
9790 if (q_max > 0)
9791 {
9792 float q_min = GetEconomyProfile().GetQuantityMin();
9793 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9794
9796 {
9797 ComponentEnergyManager comp = GetCompEM();
9799 {
9801 }
9802 }
9804 {
9806
9807 }
9808
9809 }
9810 }
9811 }
9812
9815 {
9816 EntityAI parent = GetHierarchyParent();
9817
9818 if (parent)
9819 {
9820 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9821 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9822 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9823 }
9824 }
9825
9828 {
9829 EntityAI parent = GetHierarchyParent();
9830
9831 if (parent)
9832 {
9833 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9834 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9835 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9836 }
9837 }
9838
9840 {
9841
9842
9843
9844
9846
9848 {
9849 if (ScriptInputUserData.CanStoreInputUserData())
9850 {
9851 ScriptInputUserData ctx = new ScriptInputUserData;
9857 ctx.
Write(use_stack_max);
9860
9862 {
9863 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9864 }
9865 }
9866 }
9867 else if (!
g_Game.IsMultiplayer())
9868 {
9870 }
9871 }
9872
9874 {
9876 }
9877
9879 {
9881 }
9882
9884 {
9886 }
9887
9889 {
9890
9891 return false;
9892 }
9893
9895 {
9896 return false;
9897 }
9898
9902 {
9903 return false;
9904 }
9905
9907 {
9908 return "";
9909 }
9910
9912
9914 {
9915 return false;
9916 }
9917
9919 {
9920 return true;
9921 }
9922
9923
9924
9926 {
9927 return true;
9928 }
9929
9931 {
9932 return true;
9933 }
9934
9936 {
9937 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9939 }
9940
9942 {
9944 }
9945
9947 {
9949 if (!is_being_placed)
9951 SetSynchDirty();
9952 }
9953
9954
9956
9958 {
9960 }
9961
9963 {
9965 }
9966
9968 {
9969 return 1;
9970 }
9971
9973 {
9974 return false;
9975 }
9976
9978 {
9980 SetSynchDirty();
9981 }
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10018 {
10019 super.OnMovedInsideCargo(container);
10020
10021 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10022 }
10023
10024 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10025 {
10026 super.EEItemLocationChanged(oldLoc, newLoc);
10027
10028 PlayerBase newPlayer = null;
10029 PlayerBase oldPlayer = null;
10030
10031 if (newLoc.GetParent())
10032 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10033
10034 if (oldLoc.GetParent())
10035 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10036
10038 {
10039 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10040
10041 if (rIndex >= 0)
10042 {
10043 InventoryLocation rIl = new InventoryLocation;
10044 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10045
10046 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10049 {
10050 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10051 }
10053 {
10055 }
10056
10057 }
10058 }
10059
10061 {
10062 if (newPlayer)
10063 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10064
10065 if (newPlayer == oldPlayer)
10066 {
10067 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10068 {
10070 {
10071 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10072 {
10073 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10074 }
10075 }
10076 else
10077 {
10078 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10079 }
10080 }
10081
10082 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10083 {
10084 int type = oldLoc.GetType();
10086 {
10087 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10088 }
10090 {
10091 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10092 }
10093 }
10094 if (!m_OldLocation)
10095 {
10096 m_OldLocation = new InventoryLocation;
10097 }
10098 m_OldLocation.Copy(oldLoc);
10099 }
10100 else
10101 {
10102 if (m_OldLocation)
10103 {
10104 m_OldLocation.Reset();
10105 }
10106 }
10107
10108 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10109 }
10110 else
10111 {
10112 if (newPlayer)
10113 {
10114 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10115 if (resIndex >= 0)
10116 {
10117 InventoryLocation il = new InventoryLocation;
10118 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10120 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10123 {
10124 il.
GetParent().GetOnReleaseLock().Invoke(it);
10125 }
10127 {
10129 }
10130
10131 }
10132 }
10134 {
10135
10137 }
10138
10139 if (m_OldLocation)
10140 {
10141 m_OldLocation.Reset();
10142 }
10143 }
10144
10146 {
10147 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10148 }
10149
10151 {
10152 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10153 }
10154 }
10155
10156 override void EOnContact(IEntity other, Contact extra)
10157 {
10159 {
10160 int liquidType = -1;
10162 if (impactSpeed > 0.0)
10163 {
10165 #ifndef SERVER
10167 #else
10169 SetSynchDirty();
10170 #endif
10172 }
10173 }
10174
10175 #ifdef SERVER
10176 if (GetCompEM() && GetCompEM().IsPlugged())
10177 {
10178 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10179 GetCompEM().UnplugThis();
10180 }
10181 #endif
10182 }
10183
10185
10187 {
10189 }
10190
10192 {
10193
10194 }
10195
10197 {
10198 super.OnItemLocationChanged(old_owner, new_owner);
10199
10200 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10201 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10202
10203 if (!relatedPlayer && playerNew)
10204 relatedPlayer = playerNew;
10205
10206 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10207 {
10209 if (actionMgr)
10210 {
10211 ActionBase currentAction = actionMgr.GetRunningAction();
10212 if (currentAction)
10214 }
10215 }
10216
10217 Man ownerPlayerOld = null;
10218 Man ownerPlayerNew = null;
10219
10220 if (old_owner)
10221 {
10222 if (old_owner.
IsMan())
10223 {
10224 ownerPlayerOld = Man.Cast(old_owner);
10225 }
10226 else
10227 {
10228 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10229 }
10230 }
10231 else
10232 {
10234 {
10236
10237 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10238 {
10239 GetCompEM().UnplugThis();
10240 }
10241 }
10242 }
10243
10244 if (new_owner)
10245 {
10246 if (new_owner.
IsMan())
10247 {
10248 ownerPlayerNew = Man.Cast(new_owner);
10249 }
10250 else
10251 {
10252 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10253 }
10254 }
10255
10256 if (ownerPlayerOld != ownerPlayerNew)
10257 {
10258 if (ownerPlayerOld)
10259 {
10260 array<EntityAI> subItemsExit = new array<EntityAI>;
10262 for (int i = 0; i < subItemsExit.Count(); i++)
10263 {
10266 }
10267 }
10268
10269 if (ownerPlayerNew)
10270 {
10271 array<EntityAI> subItemsEnter = new array<EntityAI>;
10273 for (int j = 0; j < subItemsEnter.Count(); j++)
10274 {
10277 }
10278 }
10279 }
10280 else if (ownerPlayerNew != null)
10281 {
10282 PlayerBase nplayer;
10283 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10284 {
10285 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10287 for (int k = 0; k < subItemsUpdate.Count(); k++)
10288 {
10290 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10291 }
10292 }
10293 }
10294
10295 if (old_owner)
10296 old_owner.OnChildItemRemoved(this);
10297 if (new_owner)
10298 new_owner.OnChildItemReceived(this);
10299 }
10300
10301
10303 {
10304 super.EEDelete(parent);
10305 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10306 if (player)
10307 {
10309
10310 if (player.IsAlive())
10311 {
10312 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10313 if (r_index >= 0)
10314 {
10315 InventoryLocation r_il = new InventoryLocation;
10316 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10317
10318 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10321 {
10322 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10323 }
10325 {
10326 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10327 }
10328
10329 }
10330
10331 player.RemoveQuickBarEntityShortcut(this);
10332 }
10333 }
10334 }
10335
10337 {
10338 super.EEKilled(killer);
10339
10342 {
10343 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10344 {
10345 if (IsMagazine())
10346 {
10347 if (Magazine.Cast(this).GetAmmoCount() > 0)
10348 {
10350 }
10351 }
10352 else
10353 {
10355 }
10356 }
10357 }
10358 }
10359
10361 {
10362 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10363
10364 super.OnWasAttached(parent, slot_id);
10365
10368
10371 }
10372
10374 {
10375 super.OnWasDetached(parent, slot_id);
10376
10379
10382 }
10383
10385 {
10386 int idx;
10389
10390 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10391 if (inventory_slots.Count() < 1)
10392 {
10393 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10394 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10395 }
10396 else
10397 {
10398 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10399 }
10400
10401 idx = inventory_slots.Find(slot);
10402 if (idx < 0)
10403 return "";
10404
10405 return attach_types.Get(idx);
10406 }
10407
10409 {
10410 int idx = -1;
10411 string slot;
10412
10415
10416 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10417 if (inventory_slots.Count() < 1)
10418 {
10419 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10420 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10421 }
10422 else
10423 {
10424 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10425 if (detach_types.Count() < 1)
10426 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10427 }
10428
10429 for (int i = 0; i < inventory_slots.Count(); i++)
10430 {
10431 slot = inventory_slots.Get(i);
10432 }
10433
10434 if (slot != "")
10435 {
10436 if (detach_types.Count() == 1)
10437 idx = 0;
10438 else
10439 idx = inventory_slots.Find(slot);
10440 }
10441 if (idx < 0)
10442 return "";
10443
10444 return detach_types.Get(idx);
10445 }
10446
10448 {
10449
10451
10452
10453 float min_time = 1;
10454 float max_time = 3;
10455 float delay = Math.RandomFloat(min_time, max_time);
10456
10457 explode_timer.Run(delay, this, "DoAmmoExplosion");
10458 }
10459
10461 {
10462 Magazine magazine = Magazine.Cast(this);
10463 int pop_sounds_count = 6;
10464 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10465
10466
10467 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10468 string sound_name = pop_sounds[ sound_idx ];
10469 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10470
10471
10472 magazine.ServerAddAmmoCount(-1);
10473
10474
10475 float min_temp_to_explode = 100;
10476
10477 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10478 {
10480 }
10481 }
10482
10483
10484 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10485 {
10486 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10487
10488 const int CHANCE_DAMAGE_CARGO = 4;
10489 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10490 const int CHANCE_DAMAGE_NOTHING = 2;
10491
10493 {
10494 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10495 int chances;
10496 int rnd;
10497
10498 if (GetInventory().GetCargo())
10499 {
10500 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10501 rnd = Math.RandomInt(0,chances);
10502
10503 if (rnd < CHANCE_DAMAGE_CARGO)
10504 {
10506 }
10507 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10508 {
10510 }
10511 }
10512 else
10513 {
10514 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10515 rnd = Math.RandomInt(0,chances);
10516
10517 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10518 {
10520 }
10521 }
10522 }
10523 }
10524
10526 {
10527 CargoBase cargo = GetInventory().GetCargo();
10528 if (cargo)
10529 {
10531 if (item_count > 0)
10532 {
10533 int random_pick = Math.RandomInt(0, item_count);
10535 if (!item.IsExplosive())
10536 {
10537 item.AddHealth("","",damage);
10538 return true;
10539 }
10540 }
10541 }
10542 return false;
10543 }
10544
10546 {
10547 GameInventory inventory = GetInventory();
10549 if (attachment_count > 0)
10550 {
10551 int random_pick = Math.RandomInt(0, attachment_count);
10553 if (!attachment.IsExplosive())
10554 {
10555 attachment.AddHealth("","",damage);
10556 return true;
10557 }
10558 }
10559 return false;
10560 }
10561
10563 {
10565 }
10566
10568 {
10570 return GetInventory().CanRemoveEntity();
10571
10572 return false;
10573 }
10574
10576 {
10577
10579 return false;
10580
10581
10583 return false;
10584
10585
10586
10588 if (delta == 0)
10589 return false;
10590
10591
10592 return true;
10593 }
10594
10596 {
10598 {
10599 if (ScriptInputUserData.CanStoreInputUserData())
10600 {
10601 ScriptInputUserData ctx = new ScriptInputUserData;
10606 ctx.
Write(destination_entity);
10608 ctx.
Write(slot_id);
10610 }
10611 }
10612 else if (!
g_Game.IsMultiplayer())
10613 {
10615 }
10616 }
10617
10619 {
10620 float split_quantity_new;
10624 InventoryLocation loc = new InventoryLocation;
10625
10626 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10627 {
10629 split_quantity_new = stack_max;
10630 else
10632
10634 {
10635 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10636 if (new_item)
10637 {
10638 new_item.SetResultOfSplit(true);
10639 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10641 new_item.
SetQuantity(split_quantity_new,
false,
true);
10642 }
10643 }
10644 }
10645 else if (destination_entity && slot_id == -1)
10646 {
10647 if (quantity > stack_max)
10648 split_quantity_new = stack_max;
10649 else
10650 split_quantity_new = quantity;
10651
10653 {
10654 GameInventory destinationInventory = destination_entity.GetInventory();
10656 {
10659 }
10660
10661 if (new_item)
10662 {
10663 new_item.SetResultOfSplit(true);
10664 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10666 new_item.
SetQuantity(split_quantity_new,
false,
true);
10667 }
10668 }
10669 }
10670 else
10671 {
10672 if (stack_max != 0)
10673 {
10675 {
10677 }
10678
10679 if (split_quantity_new == 0)
10680 {
10681 if (!
g_Game.IsMultiplayer())
10682 player.PhysicalPredictiveDropItem(this);
10683 else
10684 player.ServerDropEntity(this);
10685 return;
10686 }
10687
10689 {
10691
10692 if (new_item)
10693 {
10694 new_item.SetResultOfSplit(true);
10695 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10698 new_item.PlaceOnSurface();
10699 }
10700 }
10701 }
10702 }
10703 }
10704
10706 {
10707 float split_quantity_new;
10711 InventoryLocation loc = new InventoryLocation;
10712
10713 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10714 {
10716 split_quantity_new = stack_max;
10717 else
10719
10721 {
10722 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10723 if (new_item)
10724 {
10725 new_item.SetResultOfSplit(true);
10726 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10728 new_item.
SetQuantity(split_quantity_new,
false,
true);
10729 }
10730 }
10731 }
10732 else if (destination_entity && slot_id == -1)
10733 {
10734 if (quantity > stack_max)
10735 split_quantity_new = stack_max;
10736 else
10737 split_quantity_new = quantity;
10738
10740 {
10741 GameInventory destinationInventory = destination_entity.GetInventory();
10743 {
10746 }
10747
10748 if (new_item)
10749 {
10750 new_item.SetResultOfSplit(true);
10751 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10753 new_item.
SetQuantity(split_quantity_new,
false,
true);
10754 }
10755 }
10756 }
10757 else
10758 {
10759 if (stack_max != 0)
10760 {
10762 {
10764 }
10765
10767 {
10769
10770 if (new_item)
10771 {
10772 new_item.SetResultOfSplit(true);
10773 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10776 new_item.PlaceOnSurface();
10777 }
10778 }
10779 }
10780 }
10781 }
10782
10784 {
10786 {
10787 if (ScriptInputUserData.CanStoreInputUserData())
10788 {
10789 ScriptInputUserData ctx = new ScriptInputUserData;
10794 dst.WriteToContext(ctx);
10796 }
10797 }
10798 else if (!
g_Game.IsMultiplayer())
10799 {
10801 }
10802 }
10803
10805 {
10807 {
10808 if (ScriptInputUserData.CanStoreInputUserData())
10809 {
10810 ScriptInputUserData ctx = new ScriptInputUserData;
10815 ctx.
Write(destination_entity);
10821 }
10822 }
10823 else if (!
g_Game.IsMultiplayer())
10824 {
10826 }
10827 }
10828
10830 {
10832 }
10833
10835 {
10837 float split_quantity_new;
10839 if (dst.IsValid())
10840 {
10841 int slot_id = dst.GetSlot();
10843
10844 if (quantity > stack_max)
10845 split_quantity_new = stack_max;
10846 else
10847 split_quantity_new = quantity;
10848
10850 {
10852
10853 if (new_item)
10854 {
10855 new_item.SetResultOfSplit(true);
10856 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10858 new_item.
SetQuantity(split_quantity_new,
false,
true);
10859 }
10860
10861 return new_item;
10862 }
10863 }
10864
10865 return null;
10866 }
10867
10869 {
10871 float split_quantity_new;
10873 if (destination_entity)
10874 {
10876 if (quantity > stackable)
10877 split_quantity_new = stackable;
10878 else
10879 split_quantity_new = quantity;
10880
10882 {
10883 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10884 if (new_item)
10885 {
10886 new_item.SetResultOfSplit(true);
10887 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10889 new_item.
SetQuantity(split_quantity_new,
false,
true);
10890 }
10891 }
10892 }
10893 }
10894
10896 {
10898 {
10899 if (ScriptInputUserData.CanStoreInputUserData())
10900 {
10901 ScriptInputUserData ctx = new ScriptInputUserData;
10906 ItemBase destination_entity =
this;
10907 ctx.
Write(destination_entity);
10911 }
10912 }
10913 else if (!
g_Game.IsMultiplayer())
10914 {
10916 }
10917 }
10918
10920 {
10922 float split_quantity_new;
10924 if (player)
10925 {
10927 if (quantity > stackable)
10928 split_quantity_new = stackable;
10929 else
10930 split_quantity_new = quantity;
10931
10933 {
10934 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
10935 new_item =
ItemBase.Cast(in_hands);
10936 if (new_item)
10937 {
10938 new_item.SetResultOfSplit(true);
10939 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10941 new_item.SetQuantity(split_quantity_new, false, true);
10942 }
10943 }
10944 }
10945 }
10946
10948 {
10950 float split_quantity_new = Math.Floor(quantity * 0.5);
10951
10953 return;
10954
10956
10957 if (new_item)
10958 {
10959 if (new_item.GetQuantityMax() < split_quantity_new)
10960 {
10961 split_quantity_new = new_item.GetQuantityMax();
10962 }
10963
10964 new_item.SetResultOfSplit(true);
10965 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10966
10968 {
10971 }
10972 else
10973 {
10975 new_item.
SetQuantity(split_quantity_new,
false,
true);
10976 }
10977 }
10978 }
10979
10981 {
10983 float split_quantity_new = Math.Floor(quantity / 2);
10984
10986 return;
10987
10988 InventoryLocation invloc = new InventoryLocation;
10990
10992 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10993
10994 if (new_item)
10995 {
10996 if (new_item.GetQuantityMax() < split_quantity_new)
10997 {
10998 split_quantity_new = new_item.GetQuantityMax();
10999 }
11001 {
11004 }
11005 else if (split_quantity_new > 1)
11006 {
11008 new_item.
SetQuantity(split_quantity_new,
false,
true);
11009 }
11010 }
11011 }
11012
11015 {
11016 SetWeightDirty();
11018
11019 if (parent)
11020 parent.OnAttachmentQuantityChangedEx(this, delta);
11021
11023 {
11025 {
11027 }
11029 {
11030 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11032 }
11033 }
11034 }
11035
11038 {
11039
11040 }
11041
11044 {
11046 }
11047
11049 {
11050 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11051
11053 {
11054 if (newLevel == GameConstants.STATE_RUINED)
11055 {
11057 EntityAI parent = GetHierarchyParent();
11058 if (parent && parent.IsFireplace())
11059 {
11060 CargoBase cargo = GetInventory().GetCargo();
11061 if (cargo)
11062 {
11064 {
11066 }
11067 }
11068 }
11069 }
11070
11072 {
11073
11075 return;
11076 }
11077
11078 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11079 {
11081 }
11082 }
11083 }
11084
11085
11087 {
11088 super.OnRightClick();
11089
11091 {
11093 {
11094 if (ScriptInputUserData.CanStoreInputUserData())
11095 {
11096 EntityAI root = GetHierarchyRoot();
11097 Man playerOwner = GetHierarchyRootPlayer();
11098 InventoryLocation dst = new InventoryLocation;
11099
11100
11101 if (!playerOwner && root && root == this)
11102 {
11104 }
11105 else
11106 {
11107
11108 GetInventory().GetCurrentInventoryLocation(dst);
11110 {
11111 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11113 {
11115 }
11116 else
11117 {
11119
11120
11121 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11122 {
11124 }
11125 else
11126 {
11127 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11128 }
11129 }
11130 }
11131 }
11132
11133 ScriptInputUserData ctx = new ScriptInputUserData;
11141 }
11142 }
11143 else if (!
g_Game.IsMultiplayer())
11144 {
11146 }
11147 }
11148 }
11149
11151 {
11152 if (root)
11153 {
11154 vector m4[4];
11155 root.GetTransform(m4);
11156 dst.SetGround(this, m4);
11157 }
11158 else
11159 {
11160 GetInventory().GetCurrentInventoryLocation(dst);
11161 }
11162 }
11163
11164 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11165 {
11166
11167 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11168 return false;
11169
11170 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11171 return false;
11172
11173
11175 return false;
11176
11177
11178 Magazine mag = Magazine.Cast(this);
11179 if (mag)
11180 {
11181 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11182 return false;
11183
11184 if (stack_max_limit)
11185 {
11186 Magazine other_mag = Magazine.Cast(other_item);
11187 if (other_item)
11188 {
11189 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11190 return false;
11191 }
11192
11193 }
11194 }
11195 else
11196 {
11197
11199 return false;
11200
11202 return false;
11203 }
11204
11205 PlayerBase player = null;
11206 if (CastTo(player, GetHierarchyRootPlayer()))
11207 {
11208 if (player.GetInventory().HasAttachment(this))
11209 return false;
11210
11211 if (player.IsItemsToDelete())
11212 return false;
11213 }
11214
11215 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11216 return false;
11217
11218 int slotID;
11220 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11221 return false;
11222
11223 return true;
11224 }
11225
11227 {
11229 }
11230
11232 {
11233 return m_IsResultOfSplit;
11234 }
11235
11237 {
11238 m_IsResultOfSplit = value;
11239 }
11240
11242 {
11244 }
11245
11247 {
11248 float other_item_quantity = other_item.GetQuantity();
11249 float this_free_space;
11250
11252
11254
11255 if (other_item_quantity > this_free_space)
11256 {
11257 return this_free_space;
11258 }
11259 else
11260 {
11261 return other_item_quantity;
11262 }
11263 }
11264
11266 {
11268 }
11269
11271 {
11273 return;
11274
11275 if (!IsMagazine() && other_item)
11276 {
11278 if (quantity_used != 0)
11279 {
11280 float hp1 = GetHealth01("","");
11281 float hp2 = other_item.GetHealth01("","");
11282 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11283 hpResult = hpResult / (
GetQuantity() + quantity_used);
11284
11285 hpResult *= GetMaxHealth();
11286 Math.Round(hpResult);
11287 SetHealth("", "Health", hpResult);
11288
11290 other_item.AddQuantity(-quantity_used);
11291 }
11292 }
11294 }
11295
11297 {
11298 #ifdef SERVER
11299 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11300 GetHierarchyParent().IncreaseLifetimeUp();
11301 #endif
11302 };
11303
11305 {
11306 PlayerBase p = PlayerBase.Cast(player);
11307
11308 array<int> recipesIds = p.m_Recipes;
11309 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11310 if (moduleRecipesManager)
11311 {
11312 EntityAI itemInHands = player.GetEntityInHands();
11313 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11314 }
11315
11316 for (int i = 0;i < recipesIds.Count(); i++)
11317 {
11318 int key = recipesIds.Get(i);
11319 string recipeName = moduleRecipesManager.GetRecipeName(key);
11321 }
11322 }
11323
11324
11325 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11326 {
11327 super.GetDebugActions(outputList);
11328
11329
11335
11336
11341
11346
11347
11351
11352
11354 {
11358 }
11359
11362
11363
11367
11369
11370 InventoryLocation loc = new InventoryLocation();
11371 GetInventory().GetCurrentInventoryLocation(loc);
11373 {
11374 if (Gizmo_IsSupported())
11377 }
11378
11380 }
11381
11382
11383
11384
11386 {
11387 super.OnAction(action_id, player, ctx);
11388
11390 {
11391 switch (action_id)
11392 {
11396 return true;
11400 return true;
11401 }
11402 }
11403
11405 {
11406 switch (action_id)
11407 {
11409 Delete();
11410 return true;
11411 }
11412 }
11413
11414 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11415 {
11416 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11417 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11418 PlayerBase p = PlayerBase.Cast(player);
11419 if (
EActions.RECIPES_RANGE_START < 1000)
11420 {
11421 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11422 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11423 }
11424 }
11425 #ifndef SERVER
11426 else if (action_id ==
EActions.WATCH_PLAYER)
11427 {
11428 PluginDeveloper.SetDeveloperItemClientEx(player);
11429 }
11430 #endif
11432 {
11433 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11434 {
11435 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11436 OnDebugButtonPressServer(id + 1);
11437 }
11438
11439 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11440 {
11441 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11443 }
11444
11445 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11446 {
11447 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11449 }
11450
11451 else if (action_id ==
EActions.ADD_QUANTITY)
11452 {
11453 if (IsMagazine())
11454 {
11455 Magazine mag = Magazine.Cast(this);
11456 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11457 }
11458 else
11459 {
11461 }
11462
11463 if (m_EM)
11464 {
11465 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11466 }
11467
11468 }
11469
11470 else if (action_id ==
EActions.REMOVE_QUANTITY)
11471 {
11472 if (IsMagazine())
11473 {
11474 Magazine mag2 = Magazine.Cast(this);
11475 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11476 }
11477 else
11478 {
11480 }
11481 if (m_EM)
11482 {
11483 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11484 }
11485
11486 }
11487
11488 else if (action_id ==
EActions.SET_QUANTITY_0)
11489 {
11491
11492 if (m_EM)
11493 {
11494 m_EM.SetEnergy(0);
11495 }
11496 }
11497
11498 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11499 {
11501
11502 if (m_EM)
11503 {
11504 m_EM.SetEnergy(m_EM.GetEnergyMax());
11505 }
11506 }
11507
11508 else if (action_id ==
EActions.ADD_HEALTH)
11509 {
11510 AddHealth("","",GetMaxHealth("","Health")/5);
11511 }
11512 else if (action_id ==
EActions.REMOVE_HEALTH)
11513 {
11514 AddHealth("","",-GetMaxHealth("","Health")/5);
11515 }
11516 else if (action_id ==
EActions.DESTROY_HEALTH)
11517 {
11518 SetHealth01("","",0);
11519 }
11520 else if (action_id ==
EActions.WATCH_ITEM)
11521 {
11523 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11524 #ifdef DEVELOPER
11525 SetDebugDeveloper_item(this);
11526 #endif
11527 }
11528
11529 else if (action_id ==
EActions.ADD_TEMPERATURE)
11530 {
11531 AddTemperature(20);
11532
11533 }
11534
11535 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11536 {
11537 AddTemperature(-20);
11538
11539 }
11540
11541 else if (action_id ==
EActions.FLIP_FROZEN)
11542 {
11543 SetFrozen(!GetIsFrozen());
11544
11545 }
11546
11547 else if (action_id ==
EActions.ADD_WETNESS)
11548 {
11550
11551 }
11552
11553 else if (action_id ==
EActions.REMOVE_WETNESS)
11554 {
11556
11557 }
11558
11559 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11560 {
11563
11564
11565 }
11566
11567 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11568 {
11571 }
11572
11573 else if (action_id ==
EActions.MAKE_SPECIAL)
11574 {
11575 auto debugParams = DebugSpawnParams.WithPlayer(player);
11576 OnDebugSpawnEx(debugParams);
11577 }
11578
11579 }
11580
11581
11582 return false;
11583 }
11584
11585
11586
11587
11591
11594
11595
11596
11598 {
11599 return false;
11600 }
11601
11602
11604 {
11605 return true;
11606 }
11607
11608
11610 {
11611 return true;
11612 }
11613
11614
11615
11617 {
11618 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11619 return g_Game.ConfigIsExisting(config_path);
11620 }
11621
11624 {
11625 return null;
11626 }
11627
11629 {
11630 return false;
11631 }
11632
11634 {
11635 return false;
11636 }
11637
11641
11642
11644 {
11645 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11646 return module_repairing.CanRepair(this, item_repair_kit);
11647 }
11648
11649
11650 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11651 {
11652 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11653 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11654 }
11655
11656
11658 {
11659
11660
11661
11662
11663
11664
11665
11666
11667 return 1;
11668 }
11669
11670
11671
11673 {
11675 }
11676
11677
11678
11680 {
11682 }
11683
11684
11693 {
11694 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11695
11696 if (player)
11697 {
11698 player.MessageStatus(text);
11699 }
11700 }
11701
11702
11711 {
11712 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11713
11714 if (player)
11715 {
11716 player.MessageAction(text);
11717 }
11718 }
11719
11720
11729 {
11730 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11731
11732 if (player)
11733 {
11734 player.MessageFriendly(text);
11735 }
11736 }
11737
11738
11747 {
11748 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11749
11750 if (player)
11751 {
11752 player.MessageImportant(text);
11753 }
11754 }
11755
11757 {
11758 return true;
11759 }
11760
11761
11762 override bool KindOf(
string tag)
11763 {
11764 bool found = false;
11765 string item_name = this.
GetType();
11767 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11768
11769 int array_size = item_tag_array.Count();
11770 for (int i = 0; i < array_size; i++)
11771 {
11772 if (item_tag_array.Get(i) == tag)
11773 {
11774 found = true;
11775 break;
11776 }
11777 }
11778 return found;
11779 }
11780
11781
11783 {
11784
11785 super.OnRPC(sender, rpc_type,ctx);
11786
11787
11788 switch (rpc_type)
11789 {
11790 #ifndef SERVER
11791 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11792 Param2<bool, string> p = new Param2<bool, string>(false, "");
11793
11795 return;
11796
11797 bool play = p.param1;
11798 string soundSet = p.param2;
11799
11800 if (play)
11801 {
11803 {
11805 {
11807 }
11808 }
11809 else
11810 {
11812 }
11813 }
11814 else
11815 {
11817 }
11818
11819 break;
11820 #endif
11821
11822 }
11823
11825 {
11827 }
11828 }
11829
11830
11831
11832
11834 {
11835 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11836 return plugin.GetID(
name);
11837 }
11838
11840 {
11841 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11842 return plugin.GetName(id);
11843 }
11844
11847 {
11848
11849
11850 int varFlags;
11851 if (!ctx.
Read(varFlags))
11852 return;
11853
11854 if (varFlags & ItemVariableFlags.FLOAT)
11855 {
11857 }
11858 }
11859
11861 {
11862
11863 super.SerializeNumericalVars(floats_out);
11864
11865
11866
11868 {
11870 }
11871
11873 {
11875 }
11876
11878 {
11880 }
11881
11883 {
11888 }
11889
11891 {
11893 }
11894 }
11895
11897 {
11898
11899 super.DeSerializeNumericalVars(floats);
11900
11901
11902 int index = 0;
11903 int mask = Math.Round(floats.Get(index));
11904
11905 index++;
11906
11908 {
11910 {
11912 }
11913 else
11914 {
11915 float quantity = floats.Get(index);
11916 SetQuantity(quantity,
true,
false,
false,
false);
11917 }
11918 index++;
11919 }
11920
11922 {
11923 float wet = floats.Get(index);
11925 index++;
11926 }
11927
11929 {
11930 int liquidtype = Math.Round(floats.Get(index));
11932 index++;
11933 }
11934
11936 {
11938 index++;
11940 index++;
11942 index++;
11944 index++;
11945 }
11946
11948 {
11949 int cleanness = Math.Round(floats.Get(index));
11951 index++;
11952 }
11953 }
11954
11956 {
11957 super.WriteVarsToCTX(ctx);
11958
11959
11961 {
11963 }
11964
11966 {
11968 }
11969
11971 {
11973 }
11974
11976 {
11977 int r,g,b,a;
11983 }
11984
11986 {
11988 }
11989 }
11990
11992 {
11993 if (!super.ReadVarsFromCTX(ctx,version))
11994 return false;
11995
11996 int intValue;
11997 float value;
11998
11999 if (version < 140)
12000 {
12001 if (!ctx.
Read(intValue))
12002 return false;
12003
12004 m_VariablesMask = intValue;
12005 }
12006
12008 {
12009 if (!ctx.
Read(value))
12010 return false;
12011
12013 {
12015 }
12016 else
12017 {
12019 }
12020 }
12021
12022 if (version < 140)
12023 {
12025 {
12026 if (!ctx.
Read(value))
12027 return false;
12028 SetTemperatureDirect(value);
12029 }
12030 }
12031
12033 {
12034 if (!ctx.
Read(value))
12035 return false;
12037 }
12038
12040 {
12041 if (!ctx.
Read(intValue))
12042 return false;
12044 }
12045
12047 {
12048 int r,g,b,a;
12050 return false;
12052 return false;
12054 return false;
12056 return false;
12057
12059 }
12060
12062 {
12063 if (!ctx.
Read(intValue))
12064 return false;
12066 }
12067
12068 if (version >= 138 && version < 140)
12069 {
12071 {
12072 if (!ctx.
Read(intValue))
12073 return false;
12074 SetFrozen(intValue);
12075 }
12076 }
12077
12078 return true;
12079 }
12080
12081
12083 {
12086 {
12088 }
12089
12090 if (!super.OnStoreLoad(ctx, version))
12091 {
12093 return false;
12094 }
12095
12096 if (version >= 114)
12097 {
12098 bool hasQuickBarIndexSaved;
12099
12100 if (!ctx.
Read(hasQuickBarIndexSaved))
12101 {
12103 return false;
12104 }
12105
12106 if (hasQuickBarIndexSaved)
12107 {
12108 int itmQBIndex;
12109
12110
12111 if (!ctx.
Read(itmQBIndex))
12112 {
12114 return false;
12115 }
12116
12117 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12118 if (itmQBIndex != -1 && parentPlayer)
12119 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12120 }
12121 }
12122 else
12123 {
12124
12125 PlayerBase player;
12126 int itemQBIndex;
12127 if (version ==
int.
MAX)
12128 {
12129 if (!ctx.
Read(itemQBIndex))
12130 {
12132 return false;
12133 }
12134 }
12135 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12136 {
12137
12138 if (!ctx.
Read(itemQBIndex))
12139 {
12141 return false;
12142 }
12143 if (itemQBIndex != -1 && player)
12144 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12145 }
12146 }
12147
12148 if (version < 140)
12149 {
12150
12151 if (!LoadVariables(ctx, version))
12152 {
12154 return false;
12155 }
12156 }
12157
12158
12160 {
12162 return false;
12163 }
12164 if (version >= 132)
12165 {
12167 if (raib)
12168 {
12170 {
12172 return false;
12173 }
12174 }
12175 }
12176
12178 return true;
12179 }
12180
12181
12182
12184 {
12185 super.OnStoreSave(ctx);
12186
12187 PlayerBase player;
12188 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12189 {
12191
12192 int itemQBIndex = -1;
12193 itemQBIndex = player.FindQuickBarEntityIndex(this);
12194 ctx.
Write(itemQBIndex);
12195 }
12196 else
12197 {
12199 }
12200
12202
12204 if (raib)
12205 {
12207 }
12208 }
12209
12210
12212 {
12213 super.AfterStoreLoad();
12214
12216 {
12218 }
12219
12221 {
12224 }
12225 }
12226
12228 {
12229 super.EEOnAfterLoad();
12230
12232 {
12234 }
12235
12238 }
12239
12241 {
12242 return false;
12243 }
12244
12245
12246
12248 {
12250 {
12251 #ifdef PLATFORM_CONSOLE
12252
12254 {
12256 if (menu)
12257 {
12259 }
12260 }
12261 #endif
12262 }
12263
12265 {
12268 }
12269
12271 {
12272 SetWeightDirty();
12274 }
12276 {
12279 }
12280
12282 {
12285
12288 }
12290 {
12294 }
12295
12296 super.OnVariablesSynchronized();
12297 }
12298
12299
12300
12302 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12303 {
12304 if (!IsServerCheck(allow_client))
12305 return false;
12306
12308 return false;
12309
12312
12313 if (value <= (min + 0.001))
12314 value = min;
12315
12316 if (value == min)
12317 {
12318 if (destroy_config)
12319 {
12320 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12321 if (dstr)
12322 {
12324 this.Delete();
12325 return true;
12326 }
12327 }
12328 else if (destroy_forced)
12329 {
12331 this.Delete();
12332 return true;
12333 }
12334
12336 }
12337
12340
12342 {
12343 EntityAI parent = GetHierarchyRoot();
12344 InventoryLocation iLoc = new InventoryLocation();
12345 GetInventory().GetCurrentInventoryLocation(iLoc);
12347 {
12348 int iLocSlot = iLoc.
GetSlot();
12350 {
12352 }
12354 {
12356 }
12357 }
12358 }
12359
12361 {
12363
12364 if (delta)
12366 }
12367
12369
12370 return false;
12371 }
12372
12373
12375 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12376 {
12378 }
12379
12381 {
12384 }
12385
12387 {
12390 }
12391
12393 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12394 {
12395 float value_clamped = Math.Clamp(value, 0, 1);
12397 SetQuantity(result, destroy_config, destroy_forced);
12398 }
12399
12400
12403 {
12405 }
12406
12408 {
12410 }
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12422 {
12423 int slot = -1;
12424 GameInventory inventory = GetInventory();
12425 if (inventory)
12426 {
12427 InventoryLocation il = new InventoryLocation;
12430 }
12431
12433 }
12434
12436 {
12437 float quantity_max = 0;
12438
12440 {
12441 if (attSlotID != -1)
12442 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12443
12444 if (quantity_max <= 0)
12446 }
12447
12448 if (quantity_max <= 0)
12450
12451 return quantity_max;
12452 }
12453
12455 {
12457 }
12458
12460 {
12462 }
12463
12464
12466 {
12468 }
12469
12471 {
12473 }
12474
12476 {
12478 }
12479
12480
12482 {
12483
12484 float weightEx = GetWeightEx();
12485 float special = GetInventoryAndCargoWeight();
12486 return weightEx - special;
12487 }
12488
12489
12491 {
12493 }
12494
12496 {
12498 {
12499 #ifdef DEVELOPER
12500 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12501 {
12502 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12504 }
12505 #endif
12506
12507 return GetQuantity() * GetConfigWeightModified();
12508 }
12509 else if (HasEnergyManager())
12510 {
12511 #ifdef DEVELOPER
12512 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12513 {
12514 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12515 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12516 }
12517 #endif
12518 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12519 }
12520 else
12521 {
12522 #ifdef DEVELOPER
12523 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12524 {
12525 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12526 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12527 }
12528 #endif
12529 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12530 }
12531 }
12532
12535 {
12536 int item_count = 0;
12538
12539 GameInventory inventory = GetInventory();
12540 CargoBase cargo = inventory.
GetCargo();
12541 if (cargo != NULL)
12542 {
12544 }
12545
12547 for (int i = 0; i < nAttachments; ++i)
12548 {
12550 if (item)
12551 item_count += item.GetNumberOfItems();
12552 }
12553 return item_count;
12554 }
12555
12558 {
12559 float weight = 0;
12560 float wetness = 1;
12561 if (include_wetness)
12564 {
12565 weight = wetness * m_ConfigWeight;
12566 }
12568 {
12569 weight = 1;
12570 }
12571 return weight;
12572 }
12573
12574
12575
12577 {
12578 GameInventory inventory = GetInventory();
12579 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12580 {
12581 array<EntityAI> items = new array<EntityAI>;
12583 for (int i = 0; i < items.Count(); ++i)
12584 {
12586 if (item)
12587 {
12588 g_Game.ObjectDelete(item);
12589 }
12590 }
12591 }
12592 }
12593
12594
12595
12596
12598 {
12599 float energy = 0;
12600 if (HasEnergyManager())
12601 {
12602 energy = GetCompEM().GetEnergy();
12603 }
12604 return energy;
12605 }
12606
12607
12609 {
12610 super.OnEnergyConsumed();
12611
12613 }
12614
12616 {
12617 super.OnEnergyAdded();
12618
12620 }
12621
12622
12624 {
12625 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12626 {
12628 {
12629 float energy_0to1 = GetCompEM().GetEnergy0To1();
12631 }
12632 }
12633 }
12634
12635
12637 {
12638 return ConfigGetFloat("heatIsolation");
12639 }
12640
12642 {
12644 }
12645
12647 {
12648 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12649 if (
g_Game.ConfigIsExisting(paramPath))
12650 return g_Game.ConfigGetFloat(paramPath);
12651
12652 return 0.0;
12653 }
12654
12656 {
12657 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12658 if (
g_Game.ConfigIsExisting(paramPath))
12659 return g_Game.ConfigGetFloat(paramPath);
12660
12661 return 0.0;
12662 }
12663
12664 override void SetWet(
float value,
bool allow_client =
false)
12665 {
12666 if (!IsServerCheck(allow_client))
12667 return;
12668
12671
12673
12674 m_VarWet = Math.Clamp(value, min, max);
12675
12677 {
12680 }
12681 }
12682
12683 override void AddWet(
float value)
12684 {
12686 }
12687
12689 {
12691 }
12692
12694 {
12696 }
12697
12699 {
12701 }
12702
12704 {
12706 }
12707
12709 {
12711 }
12712
12713 override void OnWetChanged(
float newVal,
float oldVal)
12714 {
12717 if (newLevel != oldLevel)
12718 {
12720 }
12721 }
12722
12724 {
12725 SetWeightDirty();
12726 }
12727
12729 {
12730 return GetWetLevelInternal(
m_VarWet);
12731 }
12732
12733
12734
12736 {
12738 }
12739
12741 {
12743 }
12744
12746 {
12748 }
12749
12751 {
12753 }
12754
12755
12756
12758 {
12759 if (ConfigIsExisting("itemModelLength"))
12760 {
12761 return ConfigGetFloat("itemModelLength");
12762 }
12763 return 0;
12764 }
12765
12767 {
12768 if (ConfigIsExisting("itemAttachOffset"))
12769 {
12770 return ConfigGetFloat("itemAttachOffset");
12771 }
12772 return 0;
12773 }
12774
12775 override void SetCleanness(
int value,
bool allow_client =
false)
12776 {
12777 if (!IsServerCheck(allow_client))
12778 return;
12779
12781
12783
12786 }
12787
12789 {
12791 }
12792
12794 {
12795 return true;
12796 }
12797
12798
12799
12800
12802 {
12804 }
12805
12807 {
12809 }
12810
12811
12812
12813
12814 override void SetColor(
int r,
int g,
int b,
int a)
12815 {
12821 }
12823 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12824 {
12829 }
12830
12832 {
12834 }
12835
12838 {
12839 int r,g,b,a;
12841 r = r/255;
12842 g = g/255;
12843 b = b/255;
12844 a = a/255;
12845 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12846 }
12847
12848
12849
12850 override void SetLiquidType(
int value,
bool allow_client =
false)
12851 {
12852 if (!IsServerCheck(allow_client))
12853 return;
12854
12859 }
12860
12862 {
12863 return ConfigGetInt("varLiquidTypeInit");
12864 }
12865
12867 {
12869 }
12870
12872 {
12874 SetFrozen(false);
12875 }
12876
12879 {
12880 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12881 }
12882
12883
12886 {
12887 PlayerBase nplayer;
12888 if (PlayerBase.CastTo(nplayer, player))
12889 {
12891 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12892 }
12893 }
12894
12895
12898 {
12899 PlayerBase nplayer;
12900 if (PlayerBase.CastTo(nplayer,player))
12901 {
12902 nplayer.SetEnableQuickBarEntityShortcut(this, false);
12903 }
12904
12905 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12906
12907 if (HasEnergyManager())
12908 {
12909 GetCompEM().UpdatePlugState();
12910 }
12911 }
12912
12913
12915 {
12916 super.OnPlacementStarted(player);
12917
12919 }
12920
12921 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
12922 {
12924 {
12925 m_AdminLog.OnPlacementComplete(player,
this);
12926 }
12927
12928 super.OnPlacementComplete(player, position, orientation);
12929 }
12930
12931
12932
12933
12934
12936 {
12938 {
12939 return true;
12940 }
12941 else
12942 {
12943 return false;
12944 }
12945 }
12946
12947
12949 {
12951 {
12953 }
12954 }
12955
12956
12958 {
12960 }
12961
12963 {
12965 }
12966
12967 override void InsertAgent(
int agent,
float count = 1)
12968 {
12969 if (count < 1)
12970 return;
12971
12973 }
12974
12977 {
12979 }
12980
12981
12983 {
12985 }
12986
12987
12988
12989
12990
12991
12992
12993
12994
12995
12996
12997
12998
12999
13000
13001
13002
13003
13004
13005
13006
13007
13008
13009
13010
13011
13012
13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13026
13027
13029 {
13031 return false;
13032 return true;
13033 }
13034
13036 {
13037
13039 }
13040
13041
13044 {
13045 super.CheckForRoofLimited(timeTresholdMS);
13046
13047 float time =
g_Game.GetTime();
13048 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13049 {
13050 m_PreviousRoofTestTime = time;
13051 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13052 }
13053 }
13054
13055
13057 {
13059 {
13060 return 0;
13061 }
13062
13063 if (GetInventory().GetAttachmentSlotsCount() != 0)
13064 {
13065 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13066 if (filter)
13067 return filter.GetProtectionLevel(type, false, system);
13068 else
13069 return 0;
13070 }
13071
13072 string subclassPath, entryName;
13073
13074 switch (type)
13075 {
13077 entryName = "biological";
13078 break;
13080 entryName = "chemical";
13081 break;
13082 default:
13083 entryName = "biological";
13084 break;
13085 }
13086
13087 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13088
13089 return g_Game.ConfigGetFloat(subclassPath + entryName);
13090 }
13091
13092
13093
13096 {
13097 if (!IsMagazine())
13099
13101 }
13102
13103
13104
13105
13106
13111 {
13112 return true;
13113 }
13114
13116 {
13118 }
13119
13120
13121
13122
13123
13125 {
13126 if (parent)
13127 {
13128 if (parent.IsInherited(DayZInfected))
13129 return true;
13130
13131 if (!parent.IsRuined())
13132 return true;
13133 }
13134
13135 return true;
13136 }
13137
13139 {
13140 if (!super.CanPutAsAttachment(parent))
13141 {
13142 return false;
13143 }
13144
13145 if (!IsRuined() && !parent.IsRuined())
13146 {
13147 return true;
13148 }
13149
13150 return false;
13151 }
13152
13154 {
13155
13156
13157
13158
13159 return super.CanReceiveItemIntoCargo(item);
13160 }
13161
13163 {
13164
13165
13166
13167
13168 GameInventory attachmentInv = attachment.GetInventory();
13170 {
13171 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13172 return false;
13173 }
13174
13175 InventoryLocation loc = new InventoryLocation();
13176 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13177 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13178 return false;
13179
13180 return super.CanReceiveAttachment(attachment, slotId);
13181 }
13182
13184 {
13185 if (!super.CanReleaseAttachment(attachment))
13186 return false;
13187
13188 return GetInventory().AreChildrenAccessible();
13189 }
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13212 {
13213 int id = muzzle_owner.GetMuzzleID();
13214 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13215
13216 if (WPOF_array)
13217 {
13218 for (int i = 0; i < WPOF_array.Count(); i++)
13219 {
13220 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13221
13222 if (WPOF)
13223 {
13224 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13225 }
13226 }
13227 }
13228 }
13229
13230
13232 {
13233 int id = muzzle_owner.GetMuzzleID();
13235
13236 if (WPOBE_array)
13237 {
13238 for (int i = 0; i < WPOBE_array.Count(); i++)
13239 {
13240 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13241
13242 if (WPOBE)
13243 {
13244 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13245 }
13246 }
13247 }
13248 }
13249
13250
13252 {
13253 int id = muzzle_owner.GetMuzzleID();
13254 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13255
13256 if (WPOOH_array)
13257 {
13258 for (int i = 0; i < WPOOH_array.Count(); i++)
13259 {
13260 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13261
13262 if (WPOOH)
13263 {
13264 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13265 }
13266 }
13267 }
13268 }
13269
13270
13272 {
13273 int id = muzzle_owner.GetMuzzleID();
13274 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13275
13276 if (WPOOH_array)
13277 {
13278 for (int i = 0; i < WPOOH_array.Count(); i++)
13279 {
13280 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13281
13282 if (WPOOH)
13283 {
13284 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13285 }
13286 }
13287 }
13288 }
13289
13290
13292 {
13293 int id = muzzle_owner.GetMuzzleID();
13294 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13295
13296 if (WPOOH_array)
13297 {
13298 for (int i = 0; i < WPOOH_array.Count(); i++)
13299 {
13300 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13301
13302 if (WPOOH)
13303 {
13304 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13305 }
13306 }
13307 }
13308 }
13309
13310
13311
13313 {
13315 {
13316 return true;
13317 }
13318
13319 return false;
13320 }
13321
13323 {
13325 {
13326 return true;
13327 }
13328
13329 return false;
13330 }
13331
13333 {
13335 {
13336 return true;
13337 }
13338
13339 return false;
13340 }
13341
13343 {
13344 return false;
13345 }
13346
13349 {
13350 return UATimeSpent.DEFAULT_DEPLOY;
13351 }
13352
13353
13354
13355
13357 {
13359 SetSynchDirty();
13360 }
13361
13363 {
13365 }
13366
13367
13369 {
13370 return false;
13371 }
13372
13375 {
13376 string att_type = "None";
13377
13378 if (ConfigIsExisting("soundAttType"))
13379 {
13380 att_type = ConfigGetString("soundAttType");
13381 }
13382
13384 }
13385
13387 {
13389 }
13390
13391
13392
13393
13394
13400
13402 {
13405
13407 }
13408
13409
13411 {
13413 return;
13414
13416
13419
13422
13423 SoundParameters params = new SoundParameters();
13427 }
13428
13429
13431 {
13433 {
13436
13437 SetSynchDirty();
13438
13441 }
13442 }
13443
13445 {
13447 }
13448
13449
13451 {
13453 return;
13454
13456 SetSynchDirty();
13457
13460 }
13461
13463 {
13466 }
13467
13469 {
13471 }
13472
13473 void OnApply(PlayerBase player);
13474
13476 {
13477 return 1.0;
13478 };
13479
13481 {
13483 }
13484
13486 {
13488 }
13489
13491
13493 {
13494 SetDynamicPhysicsLifeTime(0.01);
13496 }
13497
13499 {
13500 array<string> zone_names = new array<string>;
13501 GetDamageZones(zone_names);
13502 for (int i = 0; i < zone_names.Count(); i++)
13503 {
13504 SetHealthMax(zone_names.Get(i),"Health");
13505 }
13506 SetHealthMax("","Health");
13507 }
13508
13511 {
13512 float global_health = GetHealth01("","Health");
13513 array<string> zones = new array<string>;
13514 GetDamageZones(zones);
13515
13516 for (int i = 0; i < zones.Count(); i++)
13517 {
13518 SetHealth01(zones.Get(i),"Health",global_health);
13519 }
13520 }
13521
13524 {
13525 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13526 }
13527
13529 {
13530 if (!hasRootAsPlayer)
13531 {
13532 if (refParentIB)
13533 {
13534
13535 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13536 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13537
13538 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13539 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13540
13543 }
13544 else
13545 {
13546
13549 }
13550 }
13551 }
13552
13554 {
13556 {
13557 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13558 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13559 {
13560 float heatPermCoef = 1.0;
13562 while (ent)
13563 {
13564 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13565 ent = ent.GetHierarchyParent();
13566 }
13567
13568 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13569 }
13570 }
13571 }
13572
13574 {
13575
13576 EntityAI parent = GetHierarchyParent();
13577 if (!parent)
13578 {
13579 hasParent = false;
13580 hasRootAsPlayer = false;
13581 }
13582 else
13583 {
13584 hasParent = true;
13585 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13586 refParentIB =
ItemBase.Cast(parent);
13587 }
13588 }
13589
13590 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13591 {
13592
13593 }
13594
13596 {
13597
13598 return false;
13599 }
13600
13602 {
13603
13604
13605 return false;
13606 }
13607
13609 {
13610
13611 return false;
13612 }
13613
13616 {
13617 return !GetIsFrozen() &&
IsOpen();
13618 }
13619
13621 {
13622 bool hasParent = false, hasRootAsPlayer = false;
13624
13625 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13626 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13627
13628 if (wwtu || foodDecay)
13629 {
13633
13634 if (processWetness || processTemperature || processDecay)
13635 {
13637
13638 if (processWetness)
13639 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13640
13641 if (processTemperature)
13643
13644 if (processDecay)
13645 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13646 }
13647 }
13648 }
13649
13652 {
13654 }
13655
13657 {
13660
13661 return super.GetTemperatureFreezeThreshold();
13662 }
13663
13665 {
13668
13669 return super.GetTemperatureThawThreshold();
13670 }
13671
13673 {
13676
13677 return super.GetItemOverheatThreshold();
13678 }
13679
13681 {
13683 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13684
13685 return super.GetTemperatureFreezeTime();
13686 }
13687
13689 {
13691 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13692
13693 return super.GetTemperatureThawTime();
13694 }
13695
13700
13702 {
13703 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13704 }
13705
13707 {
13708 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13709 }
13710
13713 {
13715 }
13716
13718 {
13720 }
13721
13723 {
13725 }
13726
13729 {
13730 return null;
13731 }
13732
13735 {
13736 return false;
13737 }
13738
13740 {
13742 {
13745 if (!trg)
13746 {
13748 explosive = this;
13749 }
13750
13751 explosive.PairRemote(trg);
13753
13754 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13755 trg.SetPersistentPairID(persistentID);
13756 explosive.SetPersistentPairID(persistentID);
13757
13758 return true;
13759 }
13760 return false;
13761 }
13762
13765 {
13766 float ret = 1.0;
13769 ret *= GetHealth01();
13770
13771 return ret;
13772 }
13773
13774 #ifdef DEVELOPER
13775 override void SetDebugItem()
13776 {
13777 super.SetDebugItem();
13778 _itemBase = this;
13779 }
13780
13782 {
13783 string text = super.GetDebugText();
13784
13786 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13787
13788 return text;
13789 }
13790 #endif
13791
13793 {
13794 return true;
13795 }
13796
13798
13800
13802 {
13805 }
13806
13807
13815
13831
13832 [
Obsolete(
"Use ItemSoundHandler instead")]
13835 {
13836 if (!
g_Game.IsDedicatedServer())
13837 {
13838 if (ConfigIsExisting("attachSoundSet"))
13839 {
13840 string cfg_path = "";
13841 string soundset = "";
13842 string type_name =
GetType();
13843
13846 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13847 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13848
13849 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13850 {
13851 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13852 {
13853 if (cfg_slot_array[i] == slot_type)
13854 {
13855 soundset = cfg_soundset_array[i];
13856 break;
13857 }
13858 }
13859 }
13860
13861 if (soundset != "")
13862 {
13863 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13865 }
13866 }
13867 }
13868 }
13869
13871}
13872
13874{
13876 if (entity)
13877 {
13878 bool is_item = entity.IsInherited(
ItemBase);
13879 if (is_item && full_quantity)
13880 {
13883 }
13884 }
13885 else
13886 {
13888 return NULL;
13889 }
13890 return entity;
13891}
13892
13894{
13895 if (item)
13896 {
13897 if (health > 0)
13898 item.SetHealth("", "", health);
13899
13900 if (item.CanHaveTemperature())
13901 {
13903 if (item.CanFreeze())
13904 item.SetFrozen(false);
13905 }
13906
13907 if (item.HasEnergyManager())
13908 {
13909 if (quantity >= 0)
13910 {
13911 item.GetCompEM().SetEnergy0To1(quantity);
13912 }
13913 else
13914 {
13916 }
13917 }
13918 else if (item.IsMagazine())
13919 {
13920 Magazine mag = Magazine.Cast(item);
13921 if (quantity >= 0)
13922 {
13923 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13924 }
13925 else
13926 {
13928 }
13929
13930 }
13931 else
13932 {
13933 if (quantity >= 0)
13934 {
13935 item.SetQuantityNormalized(quantity, false);
13936 }
13937 else
13938 {
13940 }
13941
13942 }
13943 }
13944}
13945
13946#ifdef DEVELOPER
13948#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.