9071{
9073 {
9074 return true;
9075 }
9076};
9077
9079{
9080
9081};
9082
9083
9084
9086{
9090
9092
9095
9096
9097
9098
9099
9108
9114
9119
9124
9145 protected bool m_IsResultOfSplit
9146
9148
9153
9154
9155
9157
9161
9162
9163
9165
9168
9169
9170
9176
9177
9185
9188
9189
9191
9192
9194
9195
9200
9201
9206
9208
9209
9211
9212
9214 {
9219
9220 if (!
g_Game.IsDedicatedServer())
9221 {
9223 {
9225
9227 {
9229 }
9230 }
9231
9234 }
9235
9236 m_OldLocation = null;
9237
9239 {
9241 }
9242
9243 if (ConfigIsExisting("headSelectionsToHide"))
9244 {
9247 }
9248
9250 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9251 {
9253 }
9254
9256
9257 m_IsResultOfSplit = false;
9258
9260 }
9261
9263 {
9264 super.InitItemVariables();
9265
9271 m_Count = ConfigGetInt(
"count");
9272
9275
9280
9283
9288
9300
9304
9305
9308 if (ConfigIsExisting("canBeSplit"))
9309 {
9312 }
9313
9315 if (ConfigIsExisting("itemBehaviour"))
9317
9318
9321 RegisterNetSyncVariableInt("m_VarLiquidType");
9322 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9323
9324 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9325 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9326 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9327
9328 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9329 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9330 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9331 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9332
9333 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9334 RegisterNetSyncVariableBool("m_IsTakeable");
9335 RegisterNetSyncVariableBool("m_IsHologram");
9336
9339 {
9342 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9343 }
9344
9346
9348 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9350
9352 }
9353
9355 {
9357 }
9358
9360 {
9363 {
9368 }
9369 }
9370
9371 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9372 {
9374 {
9377 }
9378
9380 }
9381
9383 {
9389 }
9390
9392
9394 {
9396
9397 if (!action)
9398 {
9399 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9400 return;
9401 }
9402
9404 if (!ai)
9405 {
9407 return;
9408 }
9409
9411 if (!action_array)
9412 {
9413 action_array = new array<ActionBase_Basic>;
9415 }
9416 if (LogManager.IsActionLogEnable())
9417 {
9418 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9419 }
9420
9421 if (action_array.Find(action) != -1)
9422 {
9423 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9424 }
9425 else
9426 {
9427 action_array.Insert(action);
9428 }
9429 }
9430
9432 {
9433 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9434 ActionBase action = player.GetActionManager().GetAction(actionName);
9437
9438 if (action_array)
9439 {
9440 action_array.RemoveItem(action);
9441 }
9442 }
9443
9444
9445
9447 {
9448 ActionOverrideData overrideData = new ActionOverrideData();
9452
9454 if (!actionMap)
9455 {
9458 }
9459
9460 actionMap.Insert(this.
Type(), overrideData);
9461
9462 }
9463
9465
9467
9468
9470 {
9473
9476
9477 string config_to_search = "CfgVehicles";
9478 string muzzle_owner_config;
9479
9481 {
9482 if (IsInherited(Weapon))
9483 config_to_search = "CfgWeapons";
9484
9485 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9486
9487 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9488
9489 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9490
9491 if (config_OnFire_subclass_count > 0)
9492 {
9493 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9494
9495 for (int i = 0; i < config_OnFire_subclass_count; i++)
9496 {
9497 string particle_class = "";
9498 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9499 string config_OnFire_entry = config_OnFire_class + particle_class;
9500 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9501 WPOF_array.Insert(WPOF);
9502 }
9503
9504
9506 }
9507 }
9508
9510 {
9511 config_to_search = "CfgWeapons";
9512 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9513
9514 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9515
9516 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9517
9518 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9519 {
9520 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9521
9522 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9523 {
9524 string particle_class2 = "";
9525 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9526 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9527 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9528 WPOBE_array.Insert(WPOBE);
9529 }
9530
9531
9533 }
9534 }
9535 }
9536
9537
9539 {
9542
9544 {
9545 string config_to_search = "CfgVehicles";
9546
9547 if (IsInherited(Weapon))
9548 config_to_search = "CfgWeapons";
9549
9550 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9551 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9552
9553 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9554 {
9555
9557
9559 {
9561 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9563 return;
9564 }
9565
9568
9569
9570
9571 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9572 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9573
9574 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9575 {
9576 string particle_class = "";
9577 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9578 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9579 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9580
9581 if (entry_type == CT_CLASS)
9582 {
9583 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9584 WPOOH_array.Insert(WPOF);
9585 }
9586 }
9587
9588
9590 }
9591 }
9592 }
9593
9595 {
9597 }
9598
9600 {
9602 {
9604
9607
9610
9611 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9612 }
9613 }
9614
9616 {
9618 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9619
9621 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9622
9624 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9625
9627 {
9629 }
9630 }
9631
9633 {
9635 }
9636
9638 {
9641 else
9643
9645 {
9648 }
9649 else
9650 {
9653
9656 }
9657
9659 }
9660
9662 {
9664 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9665 }
9666
9668 {
9670 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9672 }
9673
9675 {
9677 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9678 }
9679
9681 {
9684
9685 OverheatingParticle OP = new OverheatingParticle();
9690
9692 }
9693
9695 {
9698
9699 return -1;
9700 }
9701
9703 {
9705 {
9708
9709 for (int i = count; i > 0; --i)
9710 {
9711 int id = i - 1;
9714
9717
9718 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9719 {
9720 if (p)
9721 {
9724 }
9725 }
9726 }
9727 }
9728 }
9729
9731 {
9733 {
9735 {
9736 int id = i - 1;
9738
9739 if (OP)
9740 {
9742
9743 if (p)
9744 {
9746 }
9747
9748 delete OP;
9749 }
9750 }
9751
9754 }
9755 }
9756
9759 {
9760 return 0.0;
9761 }
9762
9763
9765 {
9766 return 250;
9767 }
9768
9770 {
9771 return 0;
9772 }
9773
9776 {
9778 return true;
9779
9780 return false;
9781 }
9782
9785 {
9788
9790 {
9792 }
9793 else
9794 {
9795
9797 }
9798
9800 }
9801
9808 {
9809 return -1;
9810 }
9811
9812
9813
9814
9816 {
9818 {
9819 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9820 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9821
9822 if (r_index >= 0)
9823 {
9824 InventoryLocation r_il = new InventoryLocation;
9825 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9826
9827 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9830 {
9831 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9832 }
9834 {
9835 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9836 }
9837
9838 }
9839
9840 player.GetHumanInventory().ClearUserReservedLocation(this);
9841 }
9842
9845 }
9846
9847
9848
9849
9851 {
9852 return ItemBase.m_DebugActionsMask;
9853 }
9854
9856 {
9857 return ItemBase.m_DebugActionsMask & mask;
9858 }
9859
9861 {
9862 ItemBase.m_DebugActionsMask = mask;
9863 }
9864
9866 {
9867 ItemBase.m_DebugActionsMask |= mask;
9868 }
9869
9871 {
9872 ItemBase.m_DebugActionsMask &= ~mask;
9873 }
9874
9876 {
9878 {
9880 }
9881 else
9882 {
9884 }
9885 }
9886
9887
9889 {
9890 if (GetEconomyProfile())
9891 {
9892 float q_max = GetEconomyProfile().GetQuantityMax();
9893 if (q_max > 0)
9894 {
9895 float q_min = GetEconomyProfile().GetQuantityMin();
9896 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9897
9899 {
9900 ComponentEnergyManager comp = GetCompEM();
9902 {
9904 }
9905 }
9907 {
9909
9910 }
9911
9912 }
9913 }
9914 }
9915
9918 {
9919 EntityAI parent = GetHierarchyParent();
9920
9921 if (parent)
9922 {
9923 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9924 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9925 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
9926 }
9927 }
9928
9931 {
9932 EntityAI parent = GetHierarchyParent();
9933
9934 if (parent)
9935 {
9936 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9937 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9938 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
9939 }
9940 }
9941
9943 {
9944
9945
9946
9947
9949
9951 {
9952 if (ScriptInputUserData.CanStoreInputUserData())
9953 {
9954 ScriptInputUserData ctx = new ScriptInputUserData;
9960 ctx.
Write(use_stack_max);
9963
9965 {
9966 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9967 }
9968 }
9969 }
9970 else if (!
g_Game.IsMultiplayer())
9971 {
9973 }
9974 }
9975
9977 {
9979 }
9980
9982 {
9984 }
9985
9987 {
9989 }
9990
9992 {
9993
9994 return false;
9995 }
9996
9998 {
9999 return false;
10000 }
10001
10005 {
10006 return false;
10007 }
10008
10010 {
10011 return "";
10012 }
10013
10015
10017 {
10018 return false;
10019 }
10020
10022 {
10023 return true;
10024 }
10025
10026
10027
10029 {
10030 return true;
10031 }
10032
10034 {
10035 return true;
10036 }
10037
10039 {
10040 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10042 }
10043
10045 {
10047 }
10048
10050 {
10052 if (!is_being_placed)
10054 SetSynchDirty();
10055 }
10056
10057
10059
10061 {
10063 }
10064
10066 {
10068 }
10069
10071 {
10072 return 1;
10073 }
10074
10076 {
10077 return false;
10078 }
10079
10081 {
10083 SetSynchDirty();
10084 }
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10121 {
10122 super.OnMovedInsideCargo(container);
10123
10124 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10125 }
10126
10127 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10128 {
10129 super.EEItemLocationChanged(oldLoc, newLoc);
10130
10131 PlayerBase newPlayer = null;
10132 PlayerBase oldPlayer = null;
10133
10134 if (newLoc.GetParent())
10135 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10136
10137 if (oldLoc.GetParent())
10138 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10139
10141 {
10142 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10143
10144 if (rIndex >= 0)
10145 {
10146 InventoryLocation rIl = new InventoryLocation;
10147 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10148
10149 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10152 {
10153 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10154 }
10156 {
10158 }
10159
10160 }
10161 }
10162
10164 {
10165 if (newPlayer)
10166 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10167
10168 if (newPlayer == oldPlayer)
10169 {
10170 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10171 {
10173 {
10174 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10175 {
10176 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10177 }
10178 }
10179 else
10180 {
10181 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10182 }
10183 }
10184
10185 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10186 {
10187 int type = oldLoc.GetType();
10189 {
10190 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10191 }
10193 {
10194 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10195 }
10196 }
10197 if (!m_OldLocation)
10198 {
10199 m_OldLocation = new InventoryLocation;
10200 }
10201 m_OldLocation.Copy(oldLoc);
10202 }
10203 else
10204 {
10205 if (m_OldLocation)
10206 {
10207 m_OldLocation.Reset();
10208 }
10209 }
10210
10211 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10212 }
10213 else
10214 {
10215 if (newPlayer)
10216 {
10217 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10218 if (resIndex >= 0)
10219 {
10220 InventoryLocation il = new InventoryLocation;
10221 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10223 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10226 {
10227 il.
GetParent().GetOnReleaseLock().Invoke(it);
10228 }
10230 {
10232 }
10233
10234 }
10235 }
10237 {
10238
10240 }
10241
10242 if (m_OldLocation)
10243 {
10244 m_OldLocation.Reset();
10245 }
10246 }
10247
10249 {
10250 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10251 }
10252
10254 {
10255 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10256 }
10257 }
10258
10259 override void EOnContact(IEntity other, Contact extra)
10260 {
10262 {
10263 int liquidType = -1;
10265 if (impactSpeed > 0.0)
10266 {
10268 #ifndef SERVER
10270 #else
10272 SetSynchDirty();
10273 #endif
10275 }
10276 }
10277
10278 #ifdef SERVER
10279 if (GetCompEM() && GetCompEM().IsPlugged())
10280 {
10281 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10282 GetCompEM().UnplugThis();
10283 }
10284 #endif
10285 }
10286
10288
10290 {
10292 }
10293
10295 {
10296
10297 }
10298
10300 {
10301 super.OnItemLocationChanged(old_owner, new_owner);
10302
10303 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10304 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10305
10306 if (!relatedPlayer && playerNew)
10307 relatedPlayer = playerNew;
10308
10309 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10310 {
10312 if (actionMgr)
10313 {
10314 ActionBase currentAction = actionMgr.GetRunningAction();
10315 if (currentAction)
10317 }
10318 }
10319
10320 Man ownerPlayerOld = null;
10321 Man ownerPlayerNew = null;
10322
10323 if (old_owner)
10324 {
10325 if (old_owner.
IsMan())
10326 {
10327 ownerPlayerOld = Man.Cast(old_owner);
10328 }
10329 else
10330 {
10331 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10332 }
10333 }
10334 else
10335 {
10337 {
10339
10340 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10341 {
10342 GetCompEM().UnplugThis();
10343 }
10344 }
10345 }
10346
10347 if (new_owner)
10348 {
10349 if (new_owner.
IsMan())
10350 {
10351 ownerPlayerNew = Man.Cast(new_owner);
10352 }
10353 else
10354 {
10355 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10356 }
10357 }
10358
10359 if (ownerPlayerOld != ownerPlayerNew)
10360 {
10361 if (ownerPlayerOld)
10362 {
10363 array<EntityAI> subItemsExit = new array<EntityAI>;
10365 for (int i = 0; i < subItemsExit.Count(); i++)
10366 {
10369 }
10370 }
10371
10372 if (ownerPlayerNew)
10373 {
10374 array<EntityAI> subItemsEnter = new array<EntityAI>;
10376 for (int j = 0; j < subItemsEnter.Count(); j++)
10377 {
10380 }
10381 }
10382 }
10383 else if (ownerPlayerNew != null)
10384 {
10385 PlayerBase nplayer;
10386 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10387 {
10388 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10390 for (int k = 0; k < subItemsUpdate.Count(); k++)
10391 {
10393 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10394 }
10395 }
10396 }
10397
10398 if (old_owner)
10399 old_owner.OnChildItemRemoved(this);
10400 if (new_owner)
10401 new_owner.OnChildItemReceived(this);
10402 }
10403
10404
10406 {
10407 super.EEDelete(parent);
10408 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10409 if (player)
10410 {
10412
10413 if (player.IsAlive())
10414 {
10415 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10416 if (r_index >= 0)
10417 {
10418 InventoryLocation r_il = new InventoryLocation;
10419 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10420
10421 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10424 {
10425 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10426 }
10428 {
10429 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10430 }
10431
10432 }
10433
10434 player.RemoveQuickBarEntityShortcut(this);
10435 }
10436 }
10437 }
10438
10440 {
10441 super.EEKilled(killer);
10442
10445 {
10446 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10447 {
10448 if (IsMagazine())
10449 {
10450 if (Magazine.Cast(this).GetAmmoCount() > 0)
10451 {
10453 }
10454 }
10455 else
10456 {
10458 }
10459 }
10460 }
10461 }
10462
10464 {
10465 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10466
10467 super.OnWasAttached(parent, slot_id);
10468
10471
10474 }
10475
10477 {
10478 super.OnWasDetached(parent, slot_id);
10479
10482
10485 }
10486
10488 {
10489 int idx;
10492
10493 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10494 if (inventory_slots.Count() < 1)
10495 {
10496 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10497 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10498 }
10499 else
10500 {
10501 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10502 }
10503
10504 idx = inventory_slots.Find(slot);
10505 if (idx < 0)
10506 return "";
10507
10508 return attach_types.Get(idx);
10509 }
10510
10512 {
10513 int idx = -1;
10514 string slot;
10515
10518
10519 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10520 if (inventory_slots.Count() < 1)
10521 {
10522 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10523 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10524 }
10525 else
10526 {
10527 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10528 if (detach_types.Count() < 1)
10529 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10530 }
10531
10532 for (int i = 0; i < inventory_slots.Count(); i++)
10533 {
10534 slot = inventory_slots.Get(i);
10535 }
10536
10537 if (slot != "")
10538 {
10539 if (detach_types.Count() == 1)
10540 idx = 0;
10541 else
10542 idx = inventory_slots.Find(slot);
10543 }
10544 if (idx < 0)
10545 return "";
10546
10547 return detach_types.Get(idx);
10548 }
10549
10551 {
10552
10554
10555
10556 float min_time = 1;
10557 float max_time = 3;
10558 float delay = Math.RandomFloat(min_time, max_time);
10559
10560 explode_timer.Run(delay, this, "DoAmmoExplosion");
10561 }
10562
10564 {
10565 Magazine magazine = Magazine.Cast(this);
10566 int pop_sounds_count = 6;
10567 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10568
10569
10570 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10571 string sound_name = pop_sounds[ sound_idx ];
10572 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10573
10574
10575 magazine.ServerAddAmmoCount(-1);
10576
10577
10578 float min_temp_to_explode = 100;
10579
10580 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10581 {
10583 }
10584 }
10585
10586
10587 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10588 {
10589 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10590
10591 const int CHANCE_DAMAGE_CARGO = 4;
10592 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10593 const int CHANCE_DAMAGE_NOTHING = 2;
10594
10596 {
10597 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10598 int chances;
10599 int rnd;
10600
10601 if (GetInventory().GetCargo())
10602 {
10603 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10604 rnd = Math.RandomInt(0,chances);
10605
10606 if (rnd < CHANCE_DAMAGE_CARGO)
10607 {
10609 }
10610 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10611 {
10613 }
10614 }
10615 else
10616 {
10617 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10618 rnd = Math.RandomInt(0,chances);
10619
10620 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10621 {
10623 }
10624 }
10625 }
10626 }
10627
10629 {
10630 CargoBase cargo = GetInventory().GetCargo();
10631 if (cargo)
10632 {
10634 if (item_count > 0)
10635 {
10636 int random_pick = Math.RandomInt(0, item_count);
10638 if (!item.IsExplosive())
10639 {
10640 item.AddHealth("","",damage);
10641 return true;
10642 }
10643 }
10644 }
10645 return false;
10646 }
10647
10649 {
10650 GameInventory inventory = GetInventory();
10652 if (attachment_count > 0)
10653 {
10654 int random_pick = Math.RandomInt(0, attachment_count);
10656 if (!attachment.IsExplosive())
10657 {
10658 attachment.AddHealth("","",damage);
10659 return true;
10660 }
10661 }
10662 return false;
10663 }
10664
10666 {
10668 }
10669
10671 {
10673 return GetInventory().CanRemoveEntity();
10674
10675 return false;
10676 }
10677
10679 {
10680
10682 return false;
10683
10684
10686 return false;
10687
10688
10689
10691 if (delta == 0)
10692 return false;
10693
10694
10695 return true;
10696 }
10697
10699 {
10701 {
10702 if (ScriptInputUserData.CanStoreInputUserData())
10703 {
10704 ScriptInputUserData ctx = new ScriptInputUserData;
10709 ctx.
Write(destination_entity);
10711 ctx.
Write(slot_id);
10713 }
10714 }
10715 else if (!
g_Game.IsMultiplayer())
10716 {
10718 }
10719 }
10720
10722 {
10723 float split_quantity_new;
10727 InventoryLocation loc = new InventoryLocation;
10728
10729 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10730 {
10732 split_quantity_new = stack_max;
10733 else
10735
10737 {
10738 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10739 if (new_item)
10740 {
10741 new_item.SetResultOfSplit(true);
10742 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10744 new_item.
SetQuantity(split_quantity_new,
false,
true);
10745 }
10746 }
10747 }
10748 else if (destination_entity && slot_id == -1)
10749 {
10750 if (quantity > stack_max)
10751 split_quantity_new = stack_max;
10752 else
10753 split_quantity_new = quantity;
10754
10756 {
10757 GameInventory destinationInventory = destination_entity.GetInventory();
10759 {
10762 }
10763
10764 if (new_item)
10765 {
10766 new_item.SetResultOfSplit(true);
10767 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10769 new_item.
SetQuantity(split_quantity_new,
false,
true);
10770 }
10771 }
10772 }
10773 else
10774 {
10775 if (stack_max != 0)
10776 {
10778 {
10780 }
10781
10782 if (split_quantity_new == 0)
10783 {
10784 if (!
g_Game.IsMultiplayer())
10785 player.PhysicalPredictiveDropItem(this);
10786 else
10787 player.ServerDropEntity(this);
10788 return;
10789 }
10790
10792 {
10794
10795 if (new_item)
10796 {
10797 new_item.SetResultOfSplit(true);
10798 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10801 new_item.PlaceOnSurface();
10802 }
10803 }
10804 }
10805 }
10806 }
10807
10809 {
10810 float split_quantity_new;
10814 InventoryLocation loc = new InventoryLocation;
10815
10816 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10817 {
10819 split_quantity_new = stack_max;
10820 else
10822
10824 {
10825 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10826 if (new_item)
10827 {
10828 new_item.SetResultOfSplit(true);
10829 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10831 new_item.
SetQuantity(split_quantity_new,
false,
true);
10832 }
10833 }
10834 }
10835 else if (destination_entity && slot_id == -1)
10836 {
10837 if (quantity > stack_max)
10838 split_quantity_new = stack_max;
10839 else
10840 split_quantity_new = quantity;
10841
10843 {
10844 GameInventory destinationInventory = destination_entity.GetInventory();
10846 {
10849 }
10850
10851 if (new_item)
10852 {
10853 new_item.SetResultOfSplit(true);
10854 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10856 new_item.
SetQuantity(split_quantity_new,
false,
true);
10857 }
10858 }
10859 }
10860 else
10861 {
10862 if (stack_max != 0)
10863 {
10865 {
10867 }
10868
10870 {
10872
10873 if (new_item)
10874 {
10875 new_item.SetResultOfSplit(true);
10876 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10879 new_item.PlaceOnSurface();
10880 }
10881 }
10882 }
10883 }
10884 }
10885
10887 {
10889 {
10890 if (ScriptInputUserData.CanStoreInputUserData())
10891 {
10892 ScriptInputUserData ctx = new ScriptInputUserData;
10897 dst.WriteToContext(ctx);
10899 }
10900 }
10901 else if (!
g_Game.IsMultiplayer())
10902 {
10904 }
10905 }
10906
10908 {
10910 {
10911 if (ScriptInputUserData.CanStoreInputUserData())
10912 {
10913 ScriptInputUserData ctx = new ScriptInputUserData;
10918 ctx.
Write(destination_entity);
10924 }
10925 }
10926 else if (!
g_Game.IsMultiplayer())
10927 {
10929 }
10930 }
10931
10933 {
10935 }
10936
10938 {
10940 float split_quantity_new;
10942 if (dst.IsValid())
10943 {
10944 int slot_id = dst.GetSlot();
10946
10947 if (quantity > stack_max)
10948 split_quantity_new = stack_max;
10949 else
10950 split_quantity_new = quantity;
10951
10953 {
10955
10956 if (new_item)
10957 {
10958 new_item.SetResultOfSplit(true);
10959 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10961 new_item.
SetQuantity(split_quantity_new,
false,
true);
10962 }
10963
10964 return new_item;
10965 }
10966 }
10967
10968 return null;
10969 }
10970
10972 {
10974 float split_quantity_new;
10976 if (destination_entity)
10977 {
10979 if (quantity > stackable)
10980 split_quantity_new = stackable;
10981 else
10982 split_quantity_new = quantity;
10983
10985 {
10986 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
10987 if (new_item)
10988 {
10989 new_item.SetResultOfSplit(true);
10990 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10992 new_item.
SetQuantity(split_quantity_new,
false,
true);
10993 }
10994 }
10995 }
10996 }
10997
10999 {
11001 {
11002 if (ScriptInputUserData.CanStoreInputUserData())
11003 {
11004 ScriptInputUserData ctx = new ScriptInputUserData;
11009 ItemBase destination_entity =
this;
11010 ctx.
Write(destination_entity);
11014 }
11015 }
11016 else if (!
g_Game.IsMultiplayer())
11017 {
11019 }
11020 }
11021
11023 {
11025 float split_quantity_new;
11027 if (player)
11028 {
11030 if (quantity > stackable)
11031 split_quantity_new = stackable;
11032 else
11033 split_quantity_new = quantity;
11034
11036 {
11037 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11038 new_item =
ItemBase.Cast(in_hands);
11039 if (new_item)
11040 {
11041 new_item.SetResultOfSplit(true);
11042 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11044 new_item.SetQuantity(split_quantity_new, false, true);
11045 }
11046 }
11047 }
11048 }
11049
11051 {
11053 float split_quantity_new = Math.Floor(quantity * 0.5);
11054
11056 return;
11057
11059
11060 if (new_item)
11061 {
11062 if (new_item.GetQuantityMax() < split_quantity_new)
11063 {
11064 split_quantity_new = new_item.GetQuantityMax();
11065 }
11066
11067 new_item.SetResultOfSplit(true);
11068 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11069
11071 {
11074 }
11075 else
11076 {
11078 new_item.
SetQuantity(split_quantity_new,
false,
true);
11079 }
11080 }
11081 }
11082
11084 {
11086 float split_quantity_new = Math.Floor(quantity / 2);
11087
11089 return;
11090
11091 InventoryLocation invloc = new InventoryLocation;
11093
11095 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11096
11097 if (new_item)
11098 {
11099 if (new_item.GetQuantityMax() < split_quantity_new)
11100 {
11101 split_quantity_new = new_item.GetQuantityMax();
11102 }
11104 {
11107 }
11108 else if (split_quantity_new > 1)
11109 {
11111 new_item.
SetQuantity(split_quantity_new,
false,
true);
11112 }
11113 }
11114 }
11115
11118 {
11119 SetWeightDirty();
11121
11122 if (parent)
11123 parent.OnAttachmentQuantityChangedEx(this, delta);
11124
11126 {
11128 {
11130 }
11132 {
11133 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11135 }
11136 }
11137 }
11138
11141 {
11142
11143 }
11144
11147 {
11149 }
11150
11152 {
11153 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11154
11156 {
11157 if (newLevel == GameConstants.STATE_RUINED)
11158 {
11160 EntityAI parent = GetHierarchyParent();
11161 if (parent && parent.IsFireplace())
11162 {
11163 CargoBase cargo = GetInventory().GetCargo();
11164 if (cargo)
11165 {
11167 {
11169 }
11170 }
11171 }
11172 }
11173
11175 {
11176
11178 return;
11179 }
11180
11181 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11182 {
11184 }
11185 }
11186 }
11187
11188
11190 {
11191 super.OnRightClick();
11192
11194 {
11196 {
11197 if (ScriptInputUserData.CanStoreInputUserData())
11198 {
11199 EntityAI root = GetHierarchyRoot();
11200 Man playerOwner = GetHierarchyRootPlayer();
11201 InventoryLocation dst = new InventoryLocation;
11202
11203
11204 if (!playerOwner && root && root == this)
11205 {
11207 }
11208 else
11209 {
11210
11211 GetInventory().GetCurrentInventoryLocation(dst);
11213 {
11214 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11216 {
11218 }
11219 else
11220 {
11222
11223
11224 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11225 {
11227 }
11228 else
11229 {
11230 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11231 }
11232 }
11233 }
11234 }
11235
11236 ScriptInputUserData ctx = new ScriptInputUserData;
11244 }
11245 }
11246 else if (!
g_Game.IsMultiplayer())
11247 {
11249 }
11250 }
11251 }
11252
11254 {
11255 if (root)
11256 {
11257 vector m4[4];
11258 root.GetTransform(m4);
11259 dst.SetGround(this, m4);
11260 }
11261 else
11262 {
11263 GetInventory().GetCurrentInventoryLocation(dst);
11264 }
11265 }
11266
11267 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11268 {
11269
11270 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11271 return false;
11272
11273 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11274 return false;
11275
11276
11278 return false;
11279
11280
11281 Magazine mag = Magazine.Cast(this);
11282 if (mag)
11283 {
11284 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11285 return false;
11286
11287 if (stack_max_limit)
11288 {
11289 Magazine other_mag = Magazine.Cast(other_item);
11290 if (other_item)
11291 {
11292 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11293 return false;
11294 }
11295
11296 }
11297 }
11298 else
11299 {
11300
11302 return false;
11303
11305 return false;
11306 }
11307
11308 PlayerBase player = null;
11309 if (CastTo(player, GetHierarchyRootPlayer()))
11310 {
11311 if (player.GetInventory().HasAttachment(this))
11312 return false;
11313
11314 if (player.IsItemsToDelete())
11315 return false;
11316 }
11317
11318 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11319 return false;
11320
11321 int slotID;
11323 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11324 return false;
11325
11326 return true;
11327 }
11328
11330 {
11332 }
11333
11335 {
11336 return m_IsResultOfSplit;
11337 }
11338
11340 {
11341 m_IsResultOfSplit = value;
11342 }
11343
11345 {
11347 }
11348
11350 {
11351 float other_item_quantity = other_item.GetQuantity();
11352 float this_free_space;
11353
11355
11357
11358 if (other_item_quantity > this_free_space)
11359 {
11360 return this_free_space;
11361 }
11362 else
11363 {
11364 return other_item_quantity;
11365 }
11366 }
11367
11369 {
11371 }
11372
11374 {
11376 return;
11377
11378 if (!IsMagazine() && other_item)
11379 {
11381 if (quantity_used != 0)
11382 {
11383 float hp1 = GetHealth01("","");
11384 float hp2 = other_item.GetHealth01("","");
11385 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11386 hpResult = hpResult / (
GetQuantity() + quantity_used);
11387
11388 hpResult *= GetMaxHealth();
11389 Math.Round(hpResult);
11390 SetHealth("", "Health", hpResult);
11391
11393 other_item.AddQuantity(-quantity_used);
11394 }
11395 }
11397 }
11398
11400 {
11401 #ifdef SERVER
11402 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11403 GetHierarchyParent().IncreaseLifetimeUp();
11404 #endif
11405 };
11406
11408 {
11409 PlayerBase p = PlayerBase.Cast(player);
11410
11411 array<int> recipesIds = p.m_Recipes;
11412 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11413 if (moduleRecipesManager)
11414 {
11415 EntityAI itemInHands = player.GetEntityInHands();
11416 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11417 }
11418
11419 for (int i = 0;i < recipesIds.Count(); i++)
11420 {
11421 int key = recipesIds.Get(i);
11422 string recipeName = moduleRecipesManager.GetRecipeName(key);
11424 }
11425 }
11426
11427
11428 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11429 {
11430 super.GetDebugActions(outputList);
11431
11432
11438
11439
11444
11449
11450
11454
11455
11457 {
11461 }
11462
11465
11466
11470
11472
11473 InventoryLocation loc = new InventoryLocation();
11474 GetInventory().GetCurrentInventoryLocation(loc);
11476 {
11477 if (Gizmo_IsSupported())
11480 }
11481
11483 }
11484
11485
11486
11487
11489 {
11490 super.OnAction(action_id, player, ctx);
11491
11493 {
11494 switch (action_id)
11495 {
11499 return true;
11503 return true;
11504 }
11505 }
11506
11508 {
11509 switch (action_id)
11510 {
11512 Delete();
11513 return true;
11514 }
11515 }
11516
11517 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11518 {
11519 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11520 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11521 PlayerBase p = PlayerBase.Cast(player);
11522 if (
EActions.RECIPES_RANGE_START < 1000)
11523 {
11524 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11525 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11526 }
11527 }
11528 #ifndef SERVER
11529 else if (action_id ==
EActions.WATCH_PLAYER)
11530 {
11531 PluginDeveloper.SetDeveloperItemClientEx(player);
11532 }
11533 #endif
11535 {
11536 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11537 {
11538 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11539 OnDebugButtonPressServer(id + 1);
11540 }
11541
11542 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11543 {
11544 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11546 }
11547
11548 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11549 {
11550 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11552 }
11553
11554 else if (action_id ==
EActions.ADD_QUANTITY)
11555 {
11556 if (IsMagazine())
11557 {
11558 Magazine mag = Magazine.Cast(this);
11559 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11560 }
11561 else
11562 {
11564 }
11565
11566 if (m_EM)
11567 {
11568 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11569 }
11570
11571 }
11572
11573 else if (action_id ==
EActions.REMOVE_QUANTITY)
11574 {
11575 if (IsMagazine())
11576 {
11577 Magazine mag2 = Magazine.Cast(this);
11578 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11579 }
11580 else
11581 {
11583 }
11584 if (m_EM)
11585 {
11586 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11587 }
11588
11589 }
11590
11591 else if (action_id ==
EActions.SET_QUANTITY_0)
11592 {
11594
11595 if (m_EM)
11596 {
11597 m_EM.SetEnergy(0);
11598 }
11599 }
11600
11601 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11602 {
11604
11605 if (m_EM)
11606 {
11607 m_EM.SetEnergy(m_EM.GetEnergyMax());
11608 }
11609 }
11610
11611 else if (action_id ==
EActions.ADD_HEALTH)
11612 {
11613 AddHealth("","",GetMaxHealth("","Health")/5);
11614 }
11615 else if (action_id ==
EActions.REMOVE_HEALTH)
11616 {
11617 AddHealth("","",-GetMaxHealth("","Health")/5);
11618 }
11619 else if (action_id ==
EActions.DESTROY_HEALTH)
11620 {
11621 SetHealth01("","",0);
11622 }
11623 else if (action_id ==
EActions.WATCH_ITEM)
11624 {
11626 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11627 #ifdef DEVELOPER
11628 SetDebugDeveloper_item(this);
11629 #endif
11630 }
11631
11632 else if (action_id ==
EActions.ADD_TEMPERATURE)
11633 {
11634 AddTemperature(20);
11635
11636 }
11637
11638 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11639 {
11640 AddTemperature(-20);
11641
11642 }
11643
11644 else if (action_id ==
EActions.FLIP_FROZEN)
11645 {
11646 SetFrozen(!GetIsFrozen());
11647
11648 }
11649
11650 else if (action_id ==
EActions.ADD_WETNESS)
11651 {
11653
11654 }
11655
11656 else if (action_id ==
EActions.REMOVE_WETNESS)
11657 {
11659
11660 }
11661
11662 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11663 {
11666
11667
11668 }
11669
11670 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11671 {
11674 }
11675
11676 else if (action_id ==
EActions.MAKE_SPECIAL)
11677 {
11678 auto debugParams = DebugSpawnParams.WithPlayer(player);
11679 OnDebugSpawnEx(debugParams);
11680 }
11681
11682 }
11683
11684
11685 return false;
11686 }
11687
11688
11689
11690
11694
11697
11698
11699
11701 {
11702 return false;
11703 }
11704
11705
11707 {
11708 return true;
11709 }
11710
11711
11713 {
11714 return true;
11715 }
11716
11717
11718
11720 {
11721 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11722 return g_Game.ConfigIsExisting(config_path);
11723 }
11724
11727 {
11728 return null;
11729 }
11730
11732 {
11733 return false;
11734 }
11735
11737 {
11738 return false;
11739 }
11740
11744
11745
11747 {
11748 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11749 return module_repairing.CanRepair(this, item_repair_kit);
11750 }
11751
11752
11753 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11754 {
11755 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11756 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11757 }
11758
11759
11761 {
11762
11763
11764
11765
11766
11767
11768
11769
11770 return 1;
11771 }
11772
11773
11774
11776 {
11778 }
11779
11780
11781
11783 {
11785 }
11786
11787
11796 {
11797 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11798
11799 if (player)
11800 {
11801 player.MessageStatus(text);
11802 }
11803 }
11804
11805
11814 {
11815 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11816
11817 if (player)
11818 {
11819 player.MessageAction(text);
11820 }
11821 }
11822
11823
11832 {
11833 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11834
11835 if (player)
11836 {
11837 player.MessageFriendly(text);
11838 }
11839 }
11840
11841
11850 {
11851 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11852
11853 if (player)
11854 {
11855 player.MessageImportant(text);
11856 }
11857 }
11858
11860 {
11861 return true;
11862 }
11863
11864
11865 override bool KindOf(
string tag)
11866 {
11867 bool found = false;
11868 string item_name = this.
GetType();
11870 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11871
11872 int array_size = item_tag_array.Count();
11873 for (int i = 0; i < array_size; i++)
11874 {
11875 if (item_tag_array.Get(i) == tag)
11876 {
11877 found = true;
11878 break;
11879 }
11880 }
11881 return found;
11882 }
11883
11884
11886 {
11887
11888 super.OnRPC(sender, rpc_type,ctx);
11889
11890
11891 switch (rpc_type)
11892 {
11893 #ifndef SERVER
11894 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11895 Param2<bool, string> p = new Param2<bool, string>(false, "");
11896
11898 return;
11899
11900 bool play = p.param1;
11901 string soundSet = p.param2;
11902
11903 if (play)
11904 {
11906 {
11908 {
11910 }
11911 }
11912 else
11913 {
11915 }
11916 }
11917 else
11918 {
11920 }
11921
11922 break;
11923 #endif
11924
11925 }
11926
11928 {
11930 }
11931 }
11932
11933
11934
11935
11937 {
11938 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11939 return plugin.GetID(
name);
11940 }
11941
11943 {
11944 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
11945 return plugin.GetName(id);
11946 }
11947
11950 {
11951
11952
11953 int varFlags;
11954 if (!ctx.
Read(varFlags))
11955 return;
11956
11957 if (varFlags & ItemVariableFlags.FLOAT)
11958 {
11960 }
11961 }
11962
11964 {
11965
11966 super.SerializeNumericalVars(floats_out);
11967
11968
11969
11971 {
11973 }
11974
11976 {
11978 }
11979
11981 {
11983 }
11984
11986 {
11991 }
11992
11994 {
11996 }
11997 }
11998
12000 {
12001
12002 super.DeSerializeNumericalVars(floats);
12003
12004
12005 int index = 0;
12006 int mask = Math.Round(floats.Get(index));
12007
12008 index++;
12009
12011 {
12013 {
12015 }
12016 else
12017 {
12018 float quantity = floats.Get(index);
12019 SetQuantity(quantity,
true,
false,
false,
false);
12020 }
12021 index++;
12022 }
12023
12025 {
12026 float wet = floats.Get(index);
12028 index++;
12029 }
12030
12032 {
12033 int liquidtype = Math.Round(floats.Get(index));
12035 index++;
12036 }
12037
12039 {
12041 index++;
12043 index++;
12045 index++;
12047 index++;
12048 }
12049
12051 {
12052 int cleanness = Math.Round(floats.Get(index));
12054 index++;
12055 }
12056 }
12057
12059 {
12060 super.WriteVarsToCTX(ctx);
12061
12062
12064 {
12066 }
12067
12069 {
12071 }
12072
12074 {
12076 }
12077
12079 {
12080 int r,g,b,a;
12086 }
12087
12089 {
12091 }
12092 }
12093
12095 {
12096 if (!super.ReadVarsFromCTX(ctx,version))
12097 return false;
12098
12099 int intValue;
12100 float value;
12101
12102 if (version < 140)
12103 {
12104 if (!ctx.
Read(intValue))
12105 return false;
12106
12107 m_VariablesMask = intValue;
12108 }
12109
12111 {
12112 if (!ctx.
Read(value))
12113 return false;
12114
12116 {
12118 }
12119 else
12120 {
12122 }
12123 }
12124
12125 if (version < 140)
12126 {
12128 {
12129 if (!ctx.
Read(value))
12130 return false;
12131 SetTemperatureDirect(value);
12132 }
12133 }
12134
12136 {
12137 if (!ctx.
Read(value))
12138 return false;
12140 }
12141
12143 {
12144 if (!ctx.
Read(intValue))
12145 return false;
12147 }
12148
12150 {
12151 int r,g,b,a;
12153 return false;
12155 return false;
12157 return false;
12159 return false;
12160
12162 }
12163
12165 {
12166 if (!ctx.
Read(intValue))
12167 return false;
12169 }
12170
12171 if (version >= 138 && version < 140)
12172 {
12174 {
12175 if (!ctx.
Read(intValue))
12176 return false;
12177 SetFrozen(intValue);
12178 }
12179 }
12180
12181 return true;
12182 }
12183
12184
12186 {
12189 {
12191 }
12192
12193 if (!super.OnStoreLoad(ctx, version))
12194 {
12196 return false;
12197 }
12198
12199 if (version >= 114)
12200 {
12201 bool hasQuickBarIndexSaved;
12202
12203 if (!ctx.
Read(hasQuickBarIndexSaved))
12204 {
12206 return false;
12207 }
12208
12209 if (hasQuickBarIndexSaved)
12210 {
12211 int itmQBIndex;
12212
12213
12214 if (!ctx.
Read(itmQBIndex))
12215 {
12217 return false;
12218 }
12219
12220 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12221 if (itmQBIndex != -1 && parentPlayer)
12222 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12223 }
12224 }
12225 else
12226 {
12227
12228 PlayerBase player;
12229 int itemQBIndex;
12230 if (version ==
int.
MAX)
12231 {
12232 if (!ctx.
Read(itemQBIndex))
12233 {
12235 return false;
12236 }
12237 }
12238 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12239 {
12240
12241 if (!ctx.
Read(itemQBIndex))
12242 {
12244 return false;
12245 }
12246 if (itemQBIndex != -1 && player)
12247 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12248 }
12249 }
12250
12251 if (version < 140)
12252 {
12253
12254 if (!LoadVariables(ctx, version))
12255 {
12257 return false;
12258 }
12259 }
12260
12261
12263 {
12265 return false;
12266 }
12267 if (version >= 132)
12268 {
12270 if (raib)
12271 {
12273 {
12275 return false;
12276 }
12277 }
12278 }
12279
12281 return true;
12282 }
12283
12284
12285
12287 {
12288 super.OnStoreSave(ctx);
12289
12290 PlayerBase player;
12291 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12292 {
12294
12295 int itemQBIndex = -1;
12296 itemQBIndex = player.FindQuickBarEntityIndex(this);
12297 ctx.
Write(itemQBIndex);
12298 }
12299 else
12300 {
12302 }
12303
12305
12307 if (raib)
12308 {
12310 }
12311 }
12312
12313
12315 {
12316 super.AfterStoreLoad();
12317
12319 {
12321 }
12322
12324 {
12327 }
12328 }
12329
12331 {
12332 super.EEOnAfterLoad();
12333
12335 {
12337 }
12338
12341 }
12342
12344 {
12345 return false;
12346 }
12347
12348
12349
12351 {
12353 {
12354 #ifdef PLATFORM_CONSOLE
12355
12357 {
12359 if (menu)
12360 {
12362 }
12363 }
12364 #endif
12365 }
12366
12368 {
12371 }
12372
12374 {
12375 SetWeightDirty();
12377 }
12379 {
12382 }
12383
12385 {
12388
12391 }
12393 {
12397 }
12398
12399 super.OnVariablesSynchronized();
12400 }
12401
12402
12403
12405 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12406 {
12407 if (!IsServerCheck(allow_client))
12408 return false;
12409
12411 return false;
12412
12415
12416 if (value <= (min + 0.001))
12417 value = min;
12418
12419 if (value == min)
12420 {
12421 if (destroy_config)
12422 {
12423 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12424 if (dstr)
12425 {
12427 this.Delete();
12428 return true;
12429 }
12430 }
12431 else if (destroy_forced)
12432 {
12434 this.Delete();
12435 return true;
12436 }
12437
12439 }
12440
12443
12445 {
12446 EntityAI parent = GetHierarchyRoot();
12447 InventoryLocation iLoc = new InventoryLocation();
12448 GetInventory().GetCurrentInventoryLocation(iLoc);
12450 {
12451 int iLocSlot = iLoc.
GetSlot();
12453 {
12455 }
12457 {
12459 }
12460 }
12461 }
12462
12464 {
12466
12467 if (delta)
12469 }
12470
12472
12473 return false;
12474 }
12475
12476
12478 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12479 {
12481 }
12482
12484 {
12487 }
12488
12490 {
12493 }
12494
12496 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12497 {
12498 float value_clamped = Math.Clamp(value, 0, 1);
12500 SetQuantity(result, destroy_config, destroy_forced);
12501 }
12502
12503
12506 {
12508 }
12509
12511 {
12513 }
12514
12515
12516
12517
12518
12519
12520
12521
12522
12523
12525 {
12526 int slot = -1;
12527 GameInventory inventory = GetInventory();
12528 if (inventory)
12529 {
12530 InventoryLocation il = new InventoryLocation;
12533 }
12534
12536 }
12537
12539 {
12540 float quantity_max = 0;
12541
12543 {
12544 if (attSlotID != -1)
12545 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12546
12547 if (quantity_max <= 0)
12549 }
12550
12551 if (quantity_max <= 0)
12553
12554 return quantity_max;
12555 }
12556
12558 {
12560 }
12561
12563 {
12565 }
12566
12567
12569 {
12571 }
12572
12574 {
12576 }
12577
12579 {
12581 }
12582
12583
12585 {
12586
12587 float weightEx = GetWeightEx();
12588 float special = GetInventoryAndCargoWeight();
12589 return weightEx - special;
12590 }
12591
12592
12594 {
12596 }
12597
12599 {
12601 {
12602 #ifdef DEVELOPER
12603 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12604 {
12605 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12607 }
12608 #endif
12609
12610 return GetQuantity() * GetConfigWeightModified();
12611 }
12612 else if (HasEnergyManager())
12613 {
12614 #ifdef DEVELOPER
12615 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12616 {
12617 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12618 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12619 }
12620 #endif
12621 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12622 }
12623 else
12624 {
12625 #ifdef DEVELOPER
12626 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12627 {
12628 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12629 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12630 }
12631 #endif
12632 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12633 }
12634 }
12635
12638 {
12639 int item_count = 0;
12641
12642 GameInventory inventory = GetInventory();
12643 CargoBase cargo = inventory.
GetCargo();
12644 if (cargo != NULL)
12645 {
12647 }
12648
12650 for (int i = 0; i < nAttachments; ++i)
12651 {
12653 if (item)
12654 item_count += item.GetNumberOfItems();
12655 }
12656 return item_count;
12657 }
12658
12661 {
12662 float weight = 0;
12663 float wetness = 1;
12664 if (include_wetness)
12667 {
12668 weight = wetness * m_ConfigWeight;
12669 }
12671 {
12672 weight = 1;
12673 }
12674 return weight;
12675 }
12676
12677
12678
12680 {
12681 GameInventory inventory = GetInventory();
12682 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12683 {
12684 array<EntityAI> items = new array<EntityAI>;
12686 for (int i = 0; i < items.Count(); ++i)
12687 {
12689 if (item)
12690 {
12691 g_Game.ObjectDelete(item);
12692 }
12693 }
12694 }
12695 }
12696
12697
12698
12699
12701 {
12702 float energy = 0;
12703 if (HasEnergyManager())
12704 {
12705 energy = GetCompEM().GetEnergy();
12706 }
12707 return energy;
12708 }
12709
12710
12712 {
12713 super.OnEnergyConsumed();
12714
12716 }
12717
12719 {
12720 super.OnEnergyAdded();
12721
12723 }
12724
12725
12727 {
12728 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12729 {
12731 {
12732 float energy_0to1 = GetCompEM().GetEnergy0To1();
12734 }
12735 }
12736 }
12737
12738
12740 {
12741 return ConfigGetFloat("heatIsolation");
12742 }
12743
12745 {
12747 }
12748
12750 {
12751 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12752 if (
g_Game.ConfigIsExisting(paramPath))
12753 return g_Game.ConfigGetFloat(paramPath);
12754
12755 return 0.0;
12756 }
12757
12759 {
12760 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12761 if (
g_Game.ConfigIsExisting(paramPath))
12762 return g_Game.ConfigGetFloat(paramPath);
12763
12764 return 0.0;
12765 }
12766
12767 override void SetWet(
float value,
bool allow_client =
false)
12768 {
12769 if (!IsServerCheck(allow_client))
12770 return;
12771
12774
12776
12777 m_VarWet = Math.Clamp(value, min, max);
12778
12780 {
12783 }
12784 }
12785
12786 override void AddWet(
float value)
12787 {
12789 }
12790
12792 {
12794 }
12795
12797 {
12799 }
12800
12802 {
12804 }
12805
12807 {
12809 }
12810
12812 {
12814 }
12815
12816 override void OnWetChanged(
float newVal,
float oldVal)
12817 {
12820 if (newLevel != oldLevel)
12821 {
12823 }
12824 }
12825
12827 {
12828 SetWeightDirty();
12829 }
12830
12832 {
12833 return GetWetLevelInternal(
m_VarWet);
12834 }
12835
12836
12837
12839 {
12841 }
12842
12844 {
12846 }
12847
12849 {
12851 }
12852
12854 {
12856 }
12857
12858
12859
12861 {
12862 if (ConfigIsExisting("itemModelLength"))
12863 {
12864 return ConfigGetFloat("itemModelLength");
12865 }
12866 return 0;
12867 }
12868
12870 {
12871 if (ConfigIsExisting("itemAttachOffset"))
12872 {
12873 return ConfigGetFloat("itemAttachOffset");
12874 }
12875 return 0;
12876 }
12877
12878 override void SetCleanness(
int value,
bool allow_client =
false)
12879 {
12880 if (!IsServerCheck(allow_client))
12881 return;
12882
12884
12886
12889 }
12890
12892 {
12894 }
12895
12897 {
12898 return true;
12899 }
12900
12901
12902
12903
12905 {
12907 }
12908
12910 {
12912 }
12913
12914
12915
12916
12917 override void SetColor(
int r,
int g,
int b,
int a)
12918 {
12924 }
12926 override void GetColor(out
int r,out
int g,out
int b,out
int a)
12927 {
12932 }
12933
12935 {
12937 }
12938
12941 {
12942 int r,g,b,a;
12944 r = r/255;
12945 g = g/255;
12946 b = b/255;
12947 a = a/255;
12948 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12949 }
12950
12951
12952
12953 override void SetLiquidType(
int value,
bool allow_client =
false)
12954 {
12955 if (!IsServerCheck(allow_client))
12956 return;
12957
12962 }
12963
12965 {
12966 return ConfigGetInt("varLiquidTypeInit");
12967 }
12968
12970 {
12972 }
12973
12975 {
12977 SetFrozen(false);
12978 }
12979
12982 {
12983 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12984 }
12985
12986
12989 {
12990 PlayerBase nplayer;
12991 if (PlayerBase.CastTo(nplayer, player))
12992 {
12994 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12995 }
12996 }
12997
12998
13001 {
13002 PlayerBase nplayer;
13003 if (PlayerBase.CastTo(nplayer,player))
13004 {
13005 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13006 }
13007
13008 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13009
13010 if (HasEnergyManager())
13011 {
13012 GetCompEM().UpdatePlugState();
13013 }
13014 }
13015
13016
13018 {
13019 super.OnPlacementStarted(player);
13020
13022 }
13023
13024 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13025 {
13027 {
13028 m_AdminLog.OnPlacementComplete(player,
this);
13029 }
13030
13031 super.OnPlacementComplete(player, position, orientation);
13032 }
13033
13034
13035
13036
13037
13039 {
13041 {
13042 return true;
13043 }
13044 else
13045 {
13046 return false;
13047 }
13048 }
13049
13050
13052 {
13054 {
13056 }
13057 }
13058
13059
13061 {
13063 }
13064
13066 {
13068 }
13069
13070 override void InsertAgent(
int agent,
float count = 1)
13071 {
13072 if (count < 1)
13073 return;
13074
13076 }
13077
13080 {
13082 }
13083
13084
13086 {
13088 }
13089
13090
13091
13092
13093
13094
13095
13096
13097
13098
13099
13100
13101
13102
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
13121
13122
13123
13124
13125
13126
13127
13128
13129
13130
13132 {
13134 return false;
13135 return true;
13136 }
13137
13139 {
13140
13142 }
13143
13144
13147 {
13148 super.CheckForRoofLimited(timeTresholdMS);
13149
13150 float time =
g_Game.GetTime();
13151 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13152 {
13153 m_PreviousRoofTestTime = time;
13154 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13155 }
13156 }
13157
13158
13160 {
13162 {
13163 return 0;
13164 }
13165
13166 if (GetInventory().GetAttachmentSlotsCount() != 0)
13167 {
13168 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13169 if (filter)
13170 return filter.GetProtectionLevel(type, false, system);
13171 else
13172 return 0;
13173 }
13174
13175 string subclassPath, entryName;
13176
13177 switch (type)
13178 {
13180 entryName = "biological";
13181 break;
13183 entryName = "chemical";
13184 break;
13185 default:
13186 entryName = "biological";
13187 break;
13188 }
13189
13190 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13191
13192 return g_Game.ConfigGetFloat(subclassPath + entryName);
13193 }
13194
13195
13196
13199 {
13200 if (!IsMagazine())
13202
13204 }
13205
13206
13207
13208
13209
13214 {
13215 return true;
13216 }
13217
13219 {
13221 }
13222
13223
13224
13225
13226
13228 {
13229 if (parent)
13230 {
13231 if (parent.IsInherited(DayZInfected))
13232 return true;
13233
13234 if (!parent.IsRuined())
13235 return true;
13236 }
13237
13238 return true;
13239 }
13240
13242 {
13243 if (!super.CanPutAsAttachment(parent))
13244 {
13245 return false;
13246 }
13247
13248 if (!IsRuined() && !parent.IsRuined())
13249 {
13250 return true;
13251 }
13252
13253 return false;
13254 }
13255
13257 {
13258
13259
13260
13261
13262 return super.CanReceiveItemIntoCargo(item);
13263 }
13264
13266 {
13267
13268
13269
13270
13271 GameInventory attachmentInv = attachment.GetInventory();
13273 {
13274 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13275 return false;
13276 }
13277
13278 InventoryLocation loc = new InventoryLocation();
13279 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13280 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13281 return false;
13282
13283 return super.CanReceiveAttachment(attachment, slotId);
13284 }
13285
13287 {
13288 if (!super.CanReleaseAttachment(attachment))
13289 return false;
13290
13291 return GetInventory().AreChildrenAccessible();
13292 }
13293
13294
13295
13296
13297
13298
13299
13300
13301
13302
13303
13304
13305
13306
13307
13308
13309
13310
13311
13312
13313
13315 {
13316 int id = muzzle_owner.GetMuzzleID();
13317 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13318
13319 if (WPOF_array)
13320 {
13321 for (int i = 0; i < WPOF_array.Count(); i++)
13322 {
13323 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13324
13325 if (WPOF)
13326 {
13327 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13328 }
13329 }
13330 }
13331 }
13332
13333
13335 {
13336 int id = muzzle_owner.GetMuzzleID();
13338
13339 if (WPOBE_array)
13340 {
13341 for (int i = 0; i < WPOBE_array.Count(); i++)
13342 {
13343 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13344
13345 if (WPOBE)
13346 {
13347 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13348 }
13349 }
13350 }
13351 }
13352
13353
13355 {
13356 int id = muzzle_owner.GetMuzzleID();
13357 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13358
13359 if (WPOOH_array)
13360 {
13361 for (int i = 0; i < WPOOH_array.Count(); i++)
13362 {
13363 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13364
13365 if (WPOOH)
13366 {
13367 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13368 }
13369 }
13370 }
13371 }
13372
13373
13375 {
13376 int id = muzzle_owner.GetMuzzleID();
13377 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13378
13379 if (WPOOH_array)
13380 {
13381 for (int i = 0; i < WPOOH_array.Count(); i++)
13382 {
13383 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13384
13385 if (WPOOH)
13386 {
13387 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13388 }
13389 }
13390 }
13391 }
13392
13393
13395 {
13396 int id = muzzle_owner.GetMuzzleID();
13397 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13398
13399 if (WPOOH_array)
13400 {
13401 for (int i = 0; i < WPOOH_array.Count(); i++)
13402 {
13403 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13404
13405 if (WPOOH)
13406 {
13407 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13408 }
13409 }
13410 }
13411 }
13412
13413
13414
13416 {
13418 {
13419 return true;
13420 }
13421
13422 return false;
13423 }
13424
13426 {
13428 {
13429 return true;
13430 }
13431
13432 return false;
13433 }
13434
13436 {
13438 {
13439 return true;
13440 }
13441
13442 return false;
13443 }
13444
13446 {
13447 return false;
13448 }
13449
13452 {
13453 return UATimeSpent.DEFAULT_DEPLOY;
13454 }
13455
13456
13457
13458
13460 {
13462 SetSynchDirty();
13463 }
13464
13466 {
13468 }
13469
13470
13472 {
13473 return false;
13474 }
13475
13478 {
13479 string att_type = "None";
13480
13481 if (ConfigIsExisting("soundAttType"))
13482 {
13483 att_type = ConfigGetString("soundAttType");
13484 }
13485
13487 }
13488
13490 {
13492 }
13493
13494
13495
13496
13497
13503
13505 {
13508
13510 }
13511
13512
13514 {
13516 return;
13517
13519
13522
13525
13526 SoundParameters params = new SoundParameters();
13530 }
13531
13532
13534 {
13536 {
13539
13540 SetSynchDirty();
13541
13544 }
13545 }
13546
13548 {
13550 }
13551
13552
13554 {
13556 return;
13557
13559 SetSynchDirty();
13560
13563 }
13564
13566 {
13569 }
13570
13572 {
13574 }
13575
13576 void OnApply(PlayerBase player);
13577
13579 {
13580 return 1.0;
13581 };
13582
13584 {
13586 }
13587
13589 {
13591 }
13592
13594
13596 {
13597 SetDynamicPhysicsLifeTime(0.01);
13599 }
13600
13602 {
13603 array<string> zone_names = new array<string>;
13604 GetDamageZones(zone_names);
13605 for (int i = 0; i < zone_names.Count(); i++)
13606 {
13607 SetHealthMax(zone_names.Get(i),"Health");
13608 }
13609 SetHealthMax("","Health");
13610 }
13611
13614 {
13615 float global_health = GetHealth01("","Health");
13616 array<string> zones = new array<string>;
13617 GetDamageZones(zones);
13618
13619 for (int i = 0; i < zones.Count(); i++)
13620 {
13621 SetHealth01(zones.Get(i),"Health",global_health);
13622 }
13623 }
13624
13627 {
13628 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13629 }
13630
13632 {
13633 if (!hasRootAsPlayer)
13634 {
13635 if (refParentIB)
13636 {
13637
13638 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13639 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13640
13641 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13642 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13643
13646 }
13647 else
13648 {
13649
13652 }
13653 }
13654 }
13655
13657 {
13659 {
13660 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13661 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13662 {
13663 float heatPermCoef = 1.0;
13665 while (ent)
13666 {
13667 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13668 ent = ent.GetHierarchyParent();
13669 }
13670
13671 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13672 }
13673 }
13674 }
13675
13677 {
13678
13679 EntityAI parent = GetHierarchyParent();
13680 if (!parent)
13681 {
13682 hasParent = false;
13683 hasRootAsPlayer = false;
13684 }
13685 else
13686 {
13687 hasParent = true;
13688 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13689 refParentIB =
ItemBase.Cast(parent);
13690 }
13691 }
13692
13693 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13694 {
13695
13696 }
13697
13699 {
13700
13701 return false;
13702 }
13703
13705 {
13706
13707
13708 return false;
13709 }
13710
13712 {
13713
13714 return false;
13715 }
13716
13719 {
13720 return !GetIsFrozen() &&
IsOpen();
13721 }
13722
13724 {
13725 bool hasParent = false, hasRootAsPlayer = false;
13727
13728 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13729 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13730
13731 if (wwtu || foodDecay)
13732 {
13736
13737 if (processWetness || processTemperature || processDecay)
13738 {
13740
13741 if (processWetness)
13742 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13743
13744 if (processTemperature)
13746
13747 if (processDecay)
13748 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13749 }
13750 }
13751 }
13752
13755 {
13757 }
13758
13760 {
13763
13764 return super.GetTemperatureFreezeThreshold();
13765 }
13766
13768 {
13771
13772 return super.GetTemperatureThawThreshold();
13773 }
13774
13776 {
13779
13780 return super.GetItemOverheatThreshold();
13781 }
13782
13784 {
13786 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13787
13788 return super.GetTemperatureFreezeTime();
13789 }
13790
13792 {
13794 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13795
13796 return super.GetTemperatureThawTime();
13797 }
13798
13803
13805 {
13806 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13807 }
13808
13810 {
13811 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13812 }
13813
13816 {
13818 }
13819
13821 {
13823 }
13824
13826 {
13828 }
13829
13832 {
13833 return null;
13834 }
13835
13838 {
13839 return false;
13840 }
13841
13843 {
13845 {
13848 if (!trg)
13849 {
13851 explosive = this;
13852 }
13853
13854 explosive.PairRemote(trg);
13856
13857 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13858 trg.SetPersistentPairID(persistentID);
13859 explosive.SetPersistentPairID(persistentID);
13860
13861 return true;
13862 }
13863 return false;
13864 }
13865
13868 {
13869 float ret = 1.0;
13872 ret *= GetHealth01();
13873
13874 return ret;
13875 }
13876
13877 #ifdef DEVELOPER
13878 override void SetDebugItem()
13879 {
13880 super.SetDebugItem();
13881 _itemBase = this;
13882 }
13883
13885 {
13886 string text = super.GetDebugText();
13887
13889 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
13890
13891 return text;
13892 }
13893 #endif
13894
13896 {
13897 return true;
13898 }
13899
13901
13903
13905 {
13908 }
13909
13910
13918
13934
13935 [
Obsolete(
"Use ItemSoundHandler instead")]
13938 {
13939 if (!
g_Game.IsDedicatedServer())
13940 {
13941 if (ConfigIsExisting("attachSoundSet"))
13942 {
13943 string cfg_path = "";
13944 string soundset = "";
13945 string type_name =
GetType();
13946
13949 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13950 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13951
13952 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13953 {
13954 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13955 {
13956 if (cfg_slot_array[i] == slot_type)
13957 {
13958 soundset = cfg_soundset_array[i];
13959 break;
13960 }
13961 }
13962 }
13963
13964 if (soundset != "")
13965 {
13966 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13968 }
13969 }
13970 }
13971 }
13972
13974}
13975
13977{
13979 if (entity)
13980 {
13981 bool is_item = entity.IsInherited(
ItemBase);
13982 if (is_item && full_quantity)
13983 {
13986 }
13987 }
13988 else
13989 {
13991 return NULL;
13992 }
13993 return entity;
13994}
13995
13997{
13998 if (item)
13999 {
14000 if (health > 0)
14001 item.SetHealth("", "", health);
14002
14003 if (item.CanHaveTemperature())
14004 {
14006 if (item.CanFreeze())
14007 item.SetFrozen(false);
14008 }
14009
14010 if (item.HasEnergyManager())
14011 {
14012 if (quantity >= 0)
14013 {
14014 item.GetCompEM().SetEnergy0To1(quantity);
14015 }
14016 else
14017 {
14019 }
14020 }
14021 else if (item.IsMagazine())
14022 {
14023 Magazine mag = Magazine.Cast(item);
14024 if (quantity >= 0)
14025 {
14026 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14027 }
14028 else
14029 {
14031 }
14032
14033 }
14034 else
14035 {
14036 if (quantity >= 0)
14037 {
14038 item.SetQuantityNormalized(quantity, false);
14039 }
14040 else
14041 {
14043 }
14044
14045 }
14046 }
14047}
14048
14049#ifdef DEVELOPER
14051#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.