9184{
9186 {
9187 return true;
9188 }
9189};
9190
9192{
9193
9194};
9195
9196
9197
9199{
9203
9205
9208
9209
9210
9211
9212
9221
9227
9232
9237
9258 protected bool m_IsResultOfSplit
9259
9261
9266
9267
9268
9270
9274
9275
9276
9278
9281
9282
9283
9289
9290
9298
9301
9302
9304
9305
9307
9308
9313
9314
9319
9321
9322
9324
9325
9327 {
9332
9333 if (!
g_Game.IsDedicatedServer())
9334 {
9336 {
9338
9340 {
9342 }
9343 }
9344
9347 }
9348
9349 m_OldLocation = null;
9350
9352 {
9354 }
9355
9356 if (ConfigIsExisting("headSelectionsToHide"))
9357 {
9360 }
9361
9363 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9364 {
9366 }
9367
9369
9370 m_IsResultOfSplit = false;
9371
9373 }
9374
9376 {
9377 super.InitItemVariables();
9378
9384 m_Count = ConfigGetInt(
"count");
9385
9388
9393
9396
9401
9413
9417
9418
9421 if (ConfigIsExisting("canBeSplit"))
9422 {
9425 }
9426
9428 if (ConfigIsExisting("itemBehaviour"))
9430
9431
9434 RegisterNetSyncVariableInt("m_VarLiquidType");
9435 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9436
9437 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9438 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9439 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9440
9441 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9442 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9443 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9444 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9445
9446 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9447 RegisterNetSyncVariableBool("m_IsTakeable");
9448 RegisterNetSyncVariableBool("m_IsHologram");
9449
9452 {
9455 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9456 }
9457
9459
9461 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9463
9465 }
9466
9468 {
9470 }
9471
9473 {
9476 {
9481 }
9482 }
9483
9484 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9485 {
9487 {
9490 }
9491
9493 }
9494
9496 {
9502 }
9503
9505
9507 {
9509
9510 if (!action)
9511 {
9512 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9513 return;
9514 }
9515
9517 if (!ai)
9518 {
9520 return;
9521 }
9522
9524 if (!action_array)
9525 {
9526 action_array = new array<ActionBase_Basic>;
9528 }
9529 if (LogManager.IsActionLogEnable())
9530 {
9531 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9532 }
9533
9534 if (action_array.Find(action) != -1)
9535 {
9536 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9537 }
9538 else
9539 {
9540 action_array.Insert(action);
9541 }
9542 }
9543
9545 {
9546 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9547 ActionBase action = player.GetActionManager().GetAction(actionName);
9550
9551 if (action_array)
9552 {
9553 action_array.RemoveItem(action);
9554 }
9555 }
9556
9557
9558
9560 {
9561 ActionOverrideData overrideData = new ActionOverrideData();
9565
9567 if (!actionMap)
9568 {
9571 }
9572
9573 actionMap.Insert(this.
Type(), overrideData);
9574
9575 }
9576
9578
9580
9581
9583 {
9586
9589
9590 string config_to_search = "CfgVehicles";
9591 string muzzle_owner_config;
9592
9594 {
9595 if (IsInherited(Weapon))
9596 config_to_search = "CfgWeapons";
9597
9598 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9599
9600 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9601
9602 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9603
9604 if (config_OnFire_subclass_count > 0)
9605 {
9606 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9607
9608 for (int i = 0; i < config_OnFire_subclass_count; i++)
9609 {
9610 string particle_class = "";
9611 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9612 string config_OnFire_entry = config_OnFire_class + particle_class;
9613 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9614 WPOF_array.Insert(WPOF);
9615 }
9616
9617
9619 }
9620 }
9621
9623 {
9624 config_to_search = "CfgWeapons";
9625 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9626
9627 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9628
9629 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9630
9631 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9632 {
9633 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9634
9635 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9636 {
9637 string particle_class2 = "";
9638 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9639 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9640 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9641 WPOBE_array.Insert(WPOBE);
9642 }
9643
9644
9646 }
9647 }
9648 }
9649
9650
9652 {
9655
9657 {
9658 string config_to_search = "CfgVehicles";
9659
9660 if (IsInherited(Weapon))
9661 config_to_search = "CfgWeapons";
9662
9663 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9664 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9665
9666 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9667 {
9668
9670
9672 {
9674 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9676 return;
9677 }
9678
9681
9682
9683
9684 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9685 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9686
9687 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9688 {
9689 string particle_class = "";
9690 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9691 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9692 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9693
9694 if (entry_type == CT_CLASS)
9695 {
9696 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9697 WPOOH_array.Insert(WPOF);
9698 }
9699 }
9700
9701
9703 }
9704 }
9705 }
9706
9708 {
9710 }
9711
9713 {
9715 {
9717
9720
9723
9724 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9725 }
9726 }
9727
9729 {
9731 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9732
9734 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9735
9737 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9738
9740 {
9742 }
9743 }
9744
9746 {
9748 }
9749
9751 {
9754 else
9756
9758 {
9761 }
9762 else
9763 {
9766
9769 }
9770
9772 }
9773
9775 {
9777 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9778 }
9779
9781 {
9783 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9785 }
9786
9788 {
9790 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9791 }
9792
9794 {
9797
9798 OverheatingParticle OP = new OverheatingParticle();
9803
9805 }
9806
9808 {
9811
9812 return -1;
9813 }
9814
9816 {
9818 {
9821
9822 for (int i = count; i > 0; --i)
9823 {
9824 int id = i - 1;
9827
9830
9831 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9832 {
9833 if (p)
9834 {
9837 }
9838 }
9839 }
9840 }
9841 }
9842
9844 {
9846 {
9848 {
9849 int id = i - 1;
9851
9852 if (OP)
9853 {
9855
9856 if (p)
9857 {
9859 }
9860
9861 delete OP;
9862 }
9863 }
9864
9867 }
9868 }
9869
9872 {
9873 return 0.0;
9874 }
9875
9876
9878 {
9879 return 250;
9880 }
9881
9883 {
9884 return 0;
9885 }
9886
9889 {
9891 return true;
9892
9893 return false;
9894 }
9895
9898 {
9901
9903 {
9905 }
9906 else
9907 {
9908
9910 }
9911
9913 }
9914
9921 {
9922 return -1;
9923 }
9924
9925
9926
9927
9929 {
9931 {
9932 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9933 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9934
9935 if (r_index >= 0)
9936 {
9937 InventoryLocation r_il = new InventoryLocation;
9938 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9939
9940 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9943 {
9944 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9945 }
9947 {
9948 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9949 }
9950
9951 }
9952
9953 player.GetHumanInventory().ClearUserReservedLocation(this);
9954 }
9955
9958 }
9959
9960
9961
9962
9964 {
9965 return ItemBase.m_DebugActionsMask;
9966 }
9967
9969 {
9970 return ItemBase.m_DebugActionsMask & mask;
9971 }
9972
9974 {
9975 ItemBase.m_DebugActionsMask = mask;
9976 }
9977
9979 {
9980 ItemBase.m_DebugActionsMask |= mask;
9981 }
9982
9984 {
9985 ItemBase.m_DebugActionsMask &= ~mask;
9986 }
9987
9989 {
9991 {
9993 }
9994 else
9995 {
9997 }
9998 }
9999
10000
10002 {
10003 if (GetEconomyProfile())
10004 {
10005 float q_max = GetEconomyProfile().GetQuantityMax();
10006 if (q_max > 0)
10007 {
10008 float q_min = GetEconomyProfile().GetQuantityMin();
10009 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10010
10012 {
10013 ComponentEnergyManager comp = GetCompEM();
10015 {
10017 }
10018 }
10020 {
10022
10023 }
10024
10025 }
10026 }
10027 }
10028
10031 {
10032 EntityAI parent = GetHierarchyParent();
10033
10034 if (parent)
10035 {
10036 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10037 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10038 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10039 }
10040 }
10041
10044 {
10045 EntityAI parent = GetHierarchyParent();
10046
10047 if (parent)
10048 {
10049 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10050 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10051 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10052 }
10053 }
10054
10056 {
10057
10058
10059
10060
10062
10064 {
10065 if (ScriptInputUserData.CanStoreInputUserData())
10066 {
10067 ScriptInputUserData ctx = new ScriptInputUserData;
10073 ctx.
Write(use_stack_max);
10076
10078 {
10079 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10080 }
10081 }
10082 }
10083 else if (!
g_Game.IsMultiplayer())
10084 {
10086 }
10087 }
10088
10090 {
10092 }
10093
10095 {
10097 }
10098
10100 {
10102 }
10103
10105 {
10106
10107 return false;
10108 }
10109
10111 {
10112 return false;
10113 }
10114
10118 {
10119 return false;
10120 }
10121
10123 {
10124 return "";
10125 }
10126
10128
10130 {
10131 return false;
10132 }
10133
10135 {
10136 return true;
10137 }
10138
10139
10140
10142 {
10143 return true;
10144 }
10145
10147 {
10148 return true;
10149 }
10150
10152 {
10153 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10155 }
10156
10158 {
10160 }
10161
10163 {
10165 if (!is_being_placed)
10167 SetSynchDirty();
10168 }
10169
10170
10172
10174 {
10176 }
10177
10179 {
10181 }
10182
10184 {
10185 return 1;
10186 }
10187
10189 {
10190 return false;
10191 }
10192
10194 {
10196 SetSynchDirty();
10197 }
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10234 {
10235 super.OnMovedInsideCargo(container);
10236
10237 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10238 }
10239
10240 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10241 {
10242 super.EEItemLocationChanged(oldLoc, newLoc);
10243
10244 PlayerBase newPlayer = null;
10245 PlayerBase oldPlayer = null;
10246
10247 if (newLoc.GetParent())
10248 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10249
10250 if (oldLoc.GetParent())
10251 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10252
10254 {
10255 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10256
10257 if (rIndex >= 0)
10258 {
10259 InventoryLocation rIl = new InventoryLocation;
10260 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10261
10262 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10265 {
10266 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10267 }
10269 {
10271 }
10272
10273 }
10274 }
10275
10277 {
10278 if (newPlayer)
10279 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10280
10281 if (newPlayer == oldPlayer)
10282 {
10283 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10284 {
10286 {
10287 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10288 {
10289 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10290 }
10291 }
10292 else
10293 {
10294 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10295 }
10296 }
10297
10298 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10299 {
10300 int type = oldLoc.GetType();
10302 {
10303 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10304 }
10306 {
10307 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10308 }
10309 }
10310 if (!m_OldLocation)
10311 {
10312 m_OldLocation = new InventoryLocation;
10313 }
10314 m_OldLocation.Copy(oldLoc);
10315 }
10316 else
10317 {
10318 if (m_OldLocation)
10319 {
10320 m_OldLocation.Reset();
10321 }
10322 }
10323
10324 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10325 }
10326 else
10327 {
10328 if (newPlayer)
10329 {
10330 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10331 if (resIndex >= 0)
10332 {
10333 InventoryLocation il = new InventoryLocation;
10334 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10336 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10339 {
10340 il.
GetParent().GetOnReleaseLock().Invoke(it);
10341 }
10343 {
10345 }
10346
10347 }
10348 }
10350 {
10351
10353 }
10354
10355 if (m_OldLocation)
10356 {
10357 m_OldLocation.Reset();
10358 }
10359 }
10360
10362 {
10363 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10364 }
10365
10367 {
10368 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10369 }
10370 }
10371
10372 override void EOnContact(IEntity other, Contact extra)
10373 {
10375 {
10376 int liquidType = -1;
10378 if (impactSpeed > 0.0)
10379 {
10381 #ifndef SERVER
10383 #else
10385 SetSynchDirty();
10386 #endif
10388 }
10389 }
10390
10391 #ifdef SERVER
10392 if (GetCompEM() && GetCompEM().IsPlugged())
10393 {
10394 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10395 GetCompEM().UnplugThis();
10396 }
10397 #endif
10398 }
10399
10401
10403 {
10405 }
10406
10408 {
10409
10410 }
10411
10413 {
10414 super.OnItemLocationChanged(old_owner, new_owner);
10415
10416 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10417 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10418
10419 if (!relatedPlayer && playerNew)
10420 relatedPlayer = playerNew;
10421
10422 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10423 {
10425 if (actionMgr)
10426 {
10427 ActionBase currentAction = actionMgr.GetRunningAction();
10428 if (currentAction)
10430 }
10431 }
10432
10433 Man ownerPlayerOld = null;
10434 Man ownerPlayerNew = null;
10435
10436 if (old_owner)
10437 {
10438 if (old_owner.
IsMan())
10439 {
10440 ownerPlayerOld = Man.Cast(old_owner);
10441 }
10442 else
10443 {
10444 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10445 }
10446 }
10447 else
10448 {
10450 {
10452
10453 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10454 {
10455 GetCompEM().UnplugThis();
10456 }
10457 }
10458 }
10459
10460 if (new_owner)
10461 {
10462 if (new_owner.
IsMan())
10463 {
10464 ownerPlayerNew = Man.Cast(new_owner);
10465 }
10466 else
10467 {
10468 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10469 }
10470 }
10471
10472 if (ownerPlayerOld != ownerPlayerNew)
10473 {
10474 if (ownerPlayerOld)
10475 {
10476 array<EntityAI> subItemsExit = new array<EntityAI>;
10478 for (int i = 0; i < subItemsExit.Count(); i++)
10479 {
10482 }
10483 }
10484
10485 if (ownerPlayerNew)
10486 {
10487 array<EntityAI> subItemsEnter = new array<EntityAI>;
10489 for (int j = 0; j < subItemsEnter.Count(); j++)
10490 {
10493 }
10494 }
10495 }
10496 else if (ownerPlayerNew != null)
10497 {
10498 PlayerBase nplayer;
10499 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10500 {
10501 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10503 for (int k = 0; k < subItemsUpdate.Count(); k++)
10504 {
10506 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10507 }
10508 }
10509 }
10510
10511 if (old_owner)
10512 old_owner.OnChildItemRemoved(this);
10513 if (new_owner)
10514 new_owner.OnChildItemReceived(this);
10515 }
10516
10517
10519 {
10520 super.EEDelete(parent);
10521 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10522 if (player)
10523 {
10525
10526 if (player.IsAlive())
10527 {
10528 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10529 if (r_index >= 0)
10530 {
10531 InventoryLocation r_il = new InventoryLocation;
10532 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10533
10534 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10537 {
10538 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10539 }
10541 {
10542 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10543 }
10544
10545 }
10546
10547 player.RemoveQuickBarEntityShortcut(this);
10548 }
10549 }
10550 }
10551
10553 {
10554 super.EEKilled(killer);
10555
10558 {
10559 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10560 {
10561 if (IsMagazine())
10562 {
10563 if (Magazine.Cast(this).GetAmmoCount() > 0)
10564 {
10566 }
10567 }
10568 else
10569 {
10571 }
10572 }
10573 }
10574 }
10575
10577 {
10578 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10579
10580 super.OnWasAttached(parent, slot_id);
10581
10584
10587 }
10588
10590 {
10591 super.OnWasDetached(parent, slot_id);
10592
10595
10598 }
10599
10601 {
10602 int idx;
10605
10606 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10607 if (inventory_slots.Count() < 1)
10608 {
10609 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10610 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10611 }
10612 else
10613 {
10614 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10615 }
10616
10617 idx = inventory_slots.Find(slot);
10618 if (idx < 0)
10619 return "";
10620
10621 return attach_types.Get(idx);
10622 }
10623
10625 {
10626 int idx = -1;
10627 string slot;
10628
10631
10632 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10633 if (inventory_slots.Count() < 1)
10634 {
10635 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10636 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10637 }
10638 else
10639 {
10640 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10641 if (detach_types.Count() < 1)
10642 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10643 }
10644
10645 for (int i = 0; i < inventory_slots.Count(); i++)
10646 {
10647 slot = inventory_slots.Get(i);
10648 }
10649
10650 if (slot != "")
10651 {
10652 if (detach_types.Count() == 1)
10653 idx = 0;
10654 else
10655 idx = inventory_slots.Find(slot);
10656 }
10657 if (idx < 0)
10658 return "";
10659
10660 return detach_types.Get(idx);
10661 }
10662
10664 {
10665
10667
10668
10669 float min_time = 1;
10670 float max_time = 3;
10671 float delay = Math.RandomFloat(min_time, max_time);
10672
10673 explode_timer.Run(delay, this, "DoAmmoExplosion");
10674 }
10675
10677 {
10678 Magazine magazine = Magazine.Cast(this);
10679 int pop_sounds_count = 6;
10680 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10681
10682
10683 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10684 string sound_name = pop_sounds[ sound_idx ];
10685 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10686
10687
10688 magazine.ServerAddAmmoCount(-1);
10689
10690
10691 float min_temp_to_explode = 100;
10692
10693 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10694 {
10696 }
10697 }
10698
10699
10700 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10701 {
10702 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10703
10704 const int CHANCE_DAMAGE_CARGO = 4;
10705 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10706 const int CHANCE_DAMAGE_NOTHING = 2;
10707
10709 {
10710 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10711 int chances;
10712 int rnd;
10713
10714 if (GetInventory().GetCargo())
10715 {
10716 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10717 rnd = Math.RandomInt(0,chances);
10718
10719 if (rnd < CHANCE_DAMAGE_CARGO)
10720 {
10722 }
10723 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10724 {
10726 }
10727 }
10728 else
10729 {
10730 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10731 rnd = Math.RandomInt(0,chances);
10732
10733 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10734 {
10736 }
10737 }
10738 }
10739 }
10740
10742 {
10743 CargoBase cargo = GetInventory().GetCargo();
10744 if (cargo)
10745 {
10747 if (item_count > 0)
10748 {
10749 int random_pick = Math.RandomInt(0, item_count);
10751 if (!item.IsExplosive())
10752 {
10753 item.AddHealth("","",damage);
10754 return true;
10755 }
10756 }
10757 }
10758 return false;
10759 }
10760
10762 {
10763 GameInventory inventory = GetInventory();
10765 if (attachment_count > 0)
10766 {
10767 int random_pick = Math.RandomInt(0, attachment_count);
10769 if (!attachment.IsExplosive())
10770 {
10771 attachment.AddHealth("","",damage);
10772 return true;
10773 }
10774 }
10775 return false;
10776 }
10777
10779 {
10781 }
10782
10784 {
10786 return GetInventory().CanRemoveEntity();
10787
10788 return false;
10789 }
10790
10792 {
10793
10795 return false;
10796
10797
10799 return false;
10800
10801
10802
10804 if (delta == 0)
10805 return false;
10806
10807
10808 return true;
10809 }
10810
10812 {
10814 {
10815 if (ScriptInputUserData.CanStoreInputUserData())
10816 {
10817 ScriptInputUserData ctx = new ScriptInputUserData;
10822 ctx.
Write(destination_entity);
10824 ctx.
Write(slot_id);
10826 }
10827 }
10828 else if (!
g_Game.IsMultiplayer())
10829 {
10831 }
10832 }
10833
10835 {
10836 float split_quantity_new;
10840 InventoryLocation loc = new InventoryLocation;
10841
10842 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10843 {
10845 split_quantity_new = stack_max;
10846 else
10848
10850 {
10851 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10852 if (new_item)
10853 {
10854 new_item.SetResultOfSplit(true);
10855 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10857 new_item.
SetQuantity(split_quantity_new,
false,
true);
10858 }
10859 }
10860 }
10861 else if (destination_entity && slot_id == -1)
10862 {
10863 if (quantity > stack_max)
10864 split_quantity_new = stack_max;
10865 else
10866 split_quantity_new = quantity;
10867
10869 {
10870 GameInventory destinationInventory = destination_entity.GetInventory();
10872 {
10875 }
10876
10877 if (new_item)
10878 {
10879 new_item.SetResultOfSplit(true);
10880 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10882 new_item.
SetQuantity(split_quantity_new,
false,
true);
10883 }
10884 }
10885 }
10886 else
10887 {
10888 if (stack_max != 0)
10889 {
10891 {
10893 }
10894
10895 if (split_quantity_new == 0)
10896 {
10897 if (!
g_Game.IsMultiplayer())
10898 player.PhysicalPredictiveDropItem(this);
10899 else
10900 player.ServerDropEntity(this);
10901 return;
10902 }
10903
10905 {
10907
10908 if (new_item)
10909 {
10910 new_item.SetResultOfSplit(true);
10911 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10914 new_item.PlaceOnSurface();
10915 }
10916 }
10917 }
10918 }
10919 }
10920
10922 {
10923 float split_quantity_new;
10927 InventoryLocation loc = new InventoryLocation;
10928
10929 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10930 {
10932 split_quantity_new = stack_max;
10933 else
10935
10937 {
10938 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10939 if (new_item)
10940 {
10941 new_item.SetResultOfSplit(true);
10942 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10944 new_item.
SetQuantity(split_quantity_new,
false,
true);
10945 }
10946 }
10947 }
10948 else if (destination_entity && slot_id == -1)
10949 {
10950 if (quantity > stack_max)
10951 split_quantity_new = stack_max;
10952 else
10953 split_quantity_new = quantity;
10954
10956 {
10957 GameInventory destinationInventory = destination_entity.GetInventory();
10959 {
10962 }
10963
10964 if (new_item)
10965 {
10966 new_item.SetResultOfSplit(true);
10967 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10969 new_item.
SetQuantity(split_quantity_new,
false,
true);
10970 }
10971 }
10972 }
10973 else
10974 {
10975 if (stack_max != 0)
10976 {
10978 {
10980 }
10981
10983 {
10985
10986 if (new_item)
10987 {
10988 new_item.SetResultOfSplit(true);
10989 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10992 new_item.PlaceOnSurface();
10993 }
10994 }
10995 }
10996 }
10997 }
10998
11000 {
11002 {
11003 if (ScriptInputUserData.CanStoreInputUserData())
11004 {
11005 ScriptInputUserData ctx = new ScriptInputUserData;
11010 dst.WriteToContext(ctx);
11012 }
11013 }
11014 else if (!
g_Game.IsMultiplayer())
11015 {
11017 }
11018 }
11019
11021 {
11023 {
11024 if (ScriptInputUserData.CanStoreInputUserData())
11025 {
11026 ScriptInputUserData ctx = new ScriptInputUserData;
11031 ctx.
Write(destination_entity);
11037 }
11038 }
11039 else if (!
g_Game.IsMultiplayer())
11040 {
11042 }
11043 }
11044
11046 {
11048 }
11049
11051 {
11053 float split_quantity_new;
11055 if (dst.IsValid())
11056 {
11057 int slot_id = dst.GetSlot();
11059
11060 if (quantity > stack_max)
11061 split_quantity_new = stack_max;
11062 else
11063 split_quantity_new = quantity;
11064
11066 {
11068
11069 if (new_item)
11070 {
11071 new_item.SetResultOfSplit(true);
11072 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11074 new_item.
SetQuantity(split_quantity_new,
false,
true);
11075 }
11076
11077 return new_item;
11078 }
11079 }
11080
11081 return null;
11082 }
11083
11085 {
11087 float split_quantity_new;
11089 if (destination_entity)
11090 {
11092 if (quantity > stackable)
11093 split_quantity_new = stackable;
11094 else
11095 split_quantity_new = quantity;
11096
11098 {
11099 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11100 if (new_item)
11101 {
11102 new_item.SetResultOfSplit(true);
11103 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11105 new_item.
SetQuantity(split_quantity_new,
false,
true);
11106 }
11107 }
11108 }
11109 }
11110
11112 {
11114 {
11115 if (ScriptInputUserData.CanStoreInputUserData())
11116 {
11117 ScriptInputUserData ctx = new ScriptInputUserData;
11122 ItemBase destination_entity =
this;
11123 ctx.
Write(destination_entity);
11127 }
11128 }
11129 else if (!
g_Game.IsMultiplayer())
11130 {
11132 }
11133 }
11134
11136 {
11138 float split_quantity_new;
11140 if (player)
11141 {
11143 if (quantity > stackable)
11144 split_quantity_new = stackable;
11145 else
11146 split_quantity_new = quantity;
11147
11149 {
11150 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11151 new_item =
ItemBase.Cast(in_hands);
11152 if (new_item)
11153 {
11154 new_item.SetResultOfSplit(true);
11155 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11157 new_item.SetQuantity(split_quantity_new, false, true);
11158 }
11159 }
11160 }
11161 }
11162
11164 {
11166 float split_quantity_new = Math.Floor(quantity * 0.5);
11167
11169 return;
11170
11172
11173 if (new_item)
11174 {
11175 if (new_item.GetQuantityMax() < split_quantity_new)
11176 {
11177 split_quantity_new = new_item.GetQuantityMax();
11178 }
11179
11180 new_item.SetResultOfSplit(true);
11181 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11182
11184 {
11187 }
11188 else
11189 {
11191 new_item.
SetQuantity(split_quantity_new,
false,
true);
11192 }
11193 }
11194 }
11195
11197 {
11199 float split_quantity_new = Math.Floor(quantity / 2);
11200
11202 return;
11203
11204 InventoryLocation invloc = new InventoryLocation;
11206
11208 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11209
11210 if (new_item)
11211 {
11212 if (new_item.GetQuantityMax() < split_quantity_new)
11213 {
11214 split_quantity_new = new_item.GetQuantityMax();
11215 }
11217 {
11220 }
11221 else if (split_quantity_new > 1)
11222 {
11224 new_item.
SetQuantity(split_quantity_new,
false,
true);
11225 }
11226 }
11227 }
11228
11231 {
11232 SetWeightDirty();
11234
11235 if (parent)
11236 parent.OnAttachmentQuantityChangedEx(this, delta);
11237
11239 {
11241 {
11243 }
11245 {
11246 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11248 }
11249 }
11250 }
11251
11254 {
11255
11256 }
11257
11260 {
11262 }
11263
11265 {
11266 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11267
11269 {
11270 if (newLevel == GameConstants.STATE_RUINED)
11271 {
11273 EntityAI parent = GetHierarchyParent();
11274 if (parent && parent.IsFireplace())
11275 {
11276 CargoBase cargo = GetInventory().GetCargo();
11277 if (cargo)
11278 {
11280 {
11282 }
11283 }
11284 }
11285 }
11286
11288 {
11289
11291 return;
11292 }
11293
11294 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11295 {
11297 }
11298 }
11299 }
11300
11301
11303 {
11304 super.OnRightClick();
11305
11307 {
11309 {
11310 if (ScriptInputUserData.CanStoreInputUserData())
11311 {
11312 EntityAI root = GetHierarchyRoot();
11313 Man playerOwner = GetHierarchyRootPlayer();
11314 InventoryLocation dst = new InventoryLocation;
11315
11316
11317 if (!playerOwner && root && root == this)
11318 {
11320 }
11321 else
11322 {
11323
11324 GetInventory().GetCurrentInventoryLocation(dst);
11326 {
11327 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11329 {
11331 }
11332 else
11333 {
11335
11336
11337 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11338 {
11340 }
11341 else
11342 {
11343 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11344 }
11345 }
11346 }
11347 }
11348
11349 ScriptInputUserData ctx = new ScriptInputUserData;
11357 }
11358 }
11359 else if (!
g_Game.IsMultiplayer())
11360 {
11362 }
11363 }
11364 }
11365
11367 {
11368 if (root)
11369 {
11370 vector m4[4];
11371 root.GetTransform(m4);
11372 dst.SetGround(this, m4);
11373 }
11374 else
11375 {
11376 GetInventory().GetCurrentInventoryLocation(dst);
11377 }
11378 }
11379
11380 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11381 {
11382
11383 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11384 return false;
11385
11386 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11387 return false;
11388
11389
11391 return false;
11392
11393
11394 Magazine mag = Magazine.Cast(this);
11395 if (mag)
11396 {
11397 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11398 return false;
11399
11400 if (stack_max_limit)
11401 {
11402 Magazine other_mag = Magazine.Cast(other_item);
11403 if (other_item)
11404 {
11405 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11406 return false;
11407 }
11408
11409 }
11410 }
11411 else
11412 {
11413
11415 return false;
11416
11418 return false;
11419 }
11420
11421 PlayerBase player = null;
11422 if (CastTo(player, GetHierarchyRootPlayer()))
11423 {
11424 if (player.GetInventory().HasAttachment(this))
11425 return false;
11426
11427 if (player.IsItemsToDelete())
11428 return false;
11429 }
11430
11431 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11432 return false;
11433
11434 int slotID;
11436 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11437 return false;
11438
11439 return true;
11440 }
11441
11443 {
11445 }
11446
11448 {
11449 return m_IsResultOfSplit;
11450 }
11451
11453 {
11454 m_IsResultOfSplit = value;
11455 }
11456
11458 {
11460 }
11461
11463 {
11464 float other_item_quantity = other_item.GetQuantity();
11465 float this_free_space;
11466
11468
11470
11471 if (other_item_quantity > this_free_space)
11472 {
11473 return this_free_space;
11474 }
11475 else
11476 {
11477 return other_item_quantity;
11478 }
11479 }
11480
11482 {
11484 }
11485
11487 {
11489 return;
11490
11491 if (!IsMagazine() && other_item)
11492 {
11494 if (quantity_used != 0)
11495 {
11496 float hp1 = GetHealth01("","");
11497 float hp2 = other_item.GetHealth01("","");
11498 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11499 hpResult = hpResult / (
GetQuantity() + quantity_used);
11500
11501 hpResult *= GetMaxHealth();
11502 Math.Round(hpResult);
11503 SetHealth("", "Health", hpResult);
11504
11506 other_item.AddQuantity(-quantity_used);
11507 }
11508 }
11510 }
11511
11513 {
11514 #ifdef SERVER
11515 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11516 GetHierarchyParent().IncreaseLifetimeUp();
11517 #endif
11518 };
11519
11521 {
11522 PlayerBase p = PlayerBase.Cast(player);
11523
11524 array<int> recipesIds = p.m_Recipes;
11525 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11526 if (moduleRecipesManager)
11527 {
11528 EntityAI itemInHands = player.GetEntityInHands();
11529 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11530 }
11531
11532 for (int i = 0;i < recipesIds.Count(); i++)
11533 {
11534 int key = recipesIds.Get(i);
11535 string recipeName = moduleRecipesManager.GetRecipeName(key);
11537 }
11538 }
11539
11540
11541 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11542 {
11543 super.GetDebugActions(outputList);
11544
11545
11551
11552
11557
11562
11563
11567
11568
11570 {
11574 }
11575
11578
11579
11583
11585
11586 InventoryLocation loc = new InventoryLocation();
11587 GetInventory().GetCurrentInventoryLocation(loc);
11589 {
11590 if (Gizmo_IsSupported())
11593 }
11594
11596 }
11597
11598
11599
11600
11602 {
11603 super.OnAction(action_id, player, ctx);
11604
11606 {
11607 switch (action_id)
11608 {
11612 return true;
11616 return true;
11617 }
11618 }
11619
11621 {
11622 switch (action_id)
11623 {
11625 Delete();
11626 return true;
11627 }
11628 }
11629
11630 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11631 {
11632 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11633 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11634 PlayerBase p = PlayerBase.Cast(player);
11635 if (
EActions.RECIPES_RANGE_START < 1000)
11636 {
11637 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11638 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11639 }
11640 }
11641 #ifndef SERVER
11642 else if (action_id ==
EActions.WATCH_PLAYER)
11643 {
11644 PluginDeveloper.SetDeveloperItemClientEx(player);
11645 }
11646 #endif
11648 {
11649 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11650 {
11651 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11652 OnDebugButtonPressServer(id + 1);
11653 }
11654
11655 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11656 {
11657 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11659 }
11660
11661 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11662 {
11663 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11665 }
11666
11667 else if (action_id ==
EActions.ADD_QUANTITY)
11668 {
11669 if (IsMagazine())
11670 {
11671 Magazine mag = Magazine.Cast(this);
11672 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11673 }
11674 else
11675 {
11677 }
11678
11679 if (m_EM)
11680 {
11681 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11682 }
11683
11684 }
11685
11686 else if (action_id ==
EActions.REMOVE_QUANTITY)
11687 {
11688 if (IsMagazine())
11689 {
11690 Magazine mag2 = Magazine.Cast(this);
11691 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11692 }
11693 else
11694 {
11696 }
11697 if (m_EM)
11698 {
11699 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11700 }
11701
11702 }
11703
11704 else if (action_id ==
EActions.SET_QUANTITY_0)
11705 {
11707
11708 if (m_EM)
11709 {
11710 m_EM.SetEnergy(0);
11711 }
11712 }
11713
11714 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11715 {
11717
11718 if (m_EM)
11719 {
11720 m_EM.SetEnergy(m_EM.GetEnergyMax());
11721 }
11722 }
11723
11724 else if (action_id ==
EActions.ADD_HEALTH)
11725 {
11726 AddHealth("","",GetMaxHealth("","Health")/5);
11727 }
11728 else if (action_id ==
EActions.REMOVE_HEALTH)
11729 {
11730 AddHealth("","",-GetMaxHealth("","Health")/5);
11731 }
11732 else if (action_id ==
EActions.DESTROY_HEALTH)
11733 {
11734 SetHealth01("","",0);
11735 }
11736 else if (action_id ==
EActions.WATCH_ITEM)
11737 {
11739 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11740 #ifdef DEVELOPER
11741 SetDebugDeveloper_item(this);
11742 #endif
11743 }
11744
11745 else if (action_id ==
EActions.ADD_TEMPERATURE)
11746 {
11747 AddTemperature(20);
11748
11749 }
11750
11751 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11752 {
11753 AddTemperature(-20);
11754
11755 }
11756
11757 else if (action_id ==
EActions.FLIP_FROZEN)
11758 {
11759 SetFrozen(!GetIsFrozen());
11760
11761 }
11762
11763 else if (action_id ==
EActions.ADD_WETNESS)
11764 {
11766
11767 }
11768
11769 else if (action_id ==
EActions.REMOVE_WETNESS)
11770 {
11772
11773 }
11774
11775 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11776 {
11779
11780
11781 }
11782
11783 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11784 {
11787 }
11788
11789 else if (action_id ==
EActions.MAKE_SPECIAL)
11790 {
11791 auto debugParams = DebugSpawnParams.WithPlayer(player);
11792 OnDebugSpawnEx(debugParams);
11793 }
11794
11795 }
11796
11797
11798 return false;
11799 }
11800
11801
11802
11803
11807
11810
11811
11812
11814 {
11815 return false;
11816 }
11817
11818
11820 {
11821 return true;
11822 }
11823
11824
11826 {
11827 return true;
11828 }
11829
11830
11831
11833 {
11834 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11835 return g_Game.ConfigIsExisting(config_path);
11836 }
11837
11840 {
11841 return null;
11842 }
11843
11845 {
11846 return false;
11847 }
11848
11850 {
11851 return false;
11852 }
11853
11857
11858
11860 {
11861 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11862 return module_repairing.CanRepair(this, item_repair_kit);
11863 }
11864
11865
11866 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11867 {
11868 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11869 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11870 }
11871
11872
11874 {
11875
11876
11877
11878
11879
11880
11881
11882
11883 return 1;
11884 }
11885
11886
11887
11889 {
11891 }
11892
11893
11894
11896 {
11898 }
11899
11900
11909 {
11910 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11911
11912 if (player)
11913 {
11914 player.MessageStatus(text);
11915 }
11916 }
11917
11918
11927 {
11928 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11929
11930 if (player)
11931 {
11932 player.MessageAction(text);
11933 }
11934 }
11935
11936
11945 {
11946 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11947
11948 if (player)
11949 {
11950 player.MessageFriendly(text);
11951 }
11952 }
11953
11954
11963 {
11964 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11965
11966 if (player)
11967 {
11968 player.MessageImportant(text);
11969 }
11970 }
11971
11973 {
11974 return true;
11975 }
11976
11977
11978 override bool KindOf(
string tag)
11979 {
11980 bool found = false;
11981 string item_name = this.
GetType();
11983 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
11984
11985 int array_size = item_tag_array.Count();
11986 for (int i = 0; i < array_size; i++)
11987 {
11988 if (item_tag_array.Get(i) == tag)
11989 {
11990 found = true;
11991 break;
11992 }
11993 }
11994 return found;
11995 }
11996
11997
11999 {
12000
12001 super.OnRPC(sender, rpc_type,ctx);
12002
12003
12004 switch (rpc_type)
12005 {
12006 #ifndef SERVER
12007 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12008 Param2<bool, string> p = new Param2<bool, string>(false, "");
12009
12011 return;
12012
12013 bool play = p.param1;
12014 string soundSet = p.param2;
12015
12016 if (play)
12017 {
12019 {
12021 {
12023 }
12024 }
12025 else
12026 {
12028 }
12029 }
12030 else
12031 {
12033 }
12034
12035 break;
12036 #endif
12037
12038 }
12039
12041 {
12043 }
12044 }
12045
12046
12047
12048
12050 {
12051 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12052 return plugin.GetID(
name);
12053 }
12054
12056 {
12057 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12058 return plugin.GetName(id);
12059 }
12060
12063 {
12064
12065
12066 int varFlags;
12067 if (!ctx.
Read(varFlags))
12068 return;
12069
12070 if (varFlags & ItemVariableFlags.FLOAT)
12071 {
12073 }
12074 }
12075
12077 {
12078
12079 super.SerializeNumericalVars(floats_out);
12080
12081
12082
12084 {
12086 }
12087
12089 {
12091 }
12092
12094 {
12096 }
12097
12099 {
12104 }
12105
12107 {
12109 }
12110 }
12111
12113 {
12114
12115 super.DeSerializeNumericalVars(floats);
12116
12117
12118 int index = 0;
12119 int mask = Math.Round(floats.Get(index));
12120
12121 index++;
12122
12124 {
12126 {
12128 }
12129 else
12130 {
12131 float quantity = floats.Get(index);
12132 SetQuantity(quantity,
true,
false,
false,
false);
12133 }
12134 index++;
12135 }
12136
12138 {
12139 float wet = floats.Get(index);
12141 index++;
12142 }
12143
12145 {
12146 int liquidtype = Math.Round(floats.Get(index));
12148 index++;
12149 }
12150
12152 {
12154 index++;
12156 index++;
12158 index++;
12160 index++;
12161 }
12162
12164 {
12165 int cleanness = Math.Round(floats.Get(index));
12167 index++;
12168 }
12169 }
12170
12172 {
12173 super.WriteVarsToCTX(ctx);
12174
12175
12177 {
12179 }
12180
12182 {
12184 }
12185
12187 {
12189 }
12190
12192 {
12193 int r,g,b,a;
12199 }
12200
12202 {
12204 }
12205 }
12206
12208 {
12209 if (!super.ReadVarsFromCTX(ctx,version))
12210 return false;
12211
12212 int intValue;
12213 float value;
12214
12215 if (version < 140)
12216 {
12217 if (!ctx.
Read(intValue))
12218 return false;
12219
12220 m_VariablesMask = intValue;
12221 }
12222
12224 {
12225 if (!ctx.
Read(value))
12226 return false;
12227
12229 {
12231 }
12232 else
12233 {
12235 }
12236 }
12237
12238 if (version < 140)
12239 {
12241 {
12242 if (!ctx.
Read(value))
12243 return false;
12244 SetTemperatureDirect(value);
12245 }
12246 }
12247
12249 {
12250 if (!ctx.
Read(value))
12251 return false;
12253 }
12254
12256 {
12257 if (!ctx.
Read(intValue))
12258 return false;
12260 }
12261
12263 {
12264 int r,g,b,a;
12266 return false;
12268 return false;
12270 return false;
12272 return false;
12273
12275 }
12276
12278 {
12279 if (!ctx.
Read(intValue))
12280 return false;
12282 }
12283
12284 if (version >= 138 && version < 140)
12285 {
12287 {
12288 if (!ctx.
Read(intValue))
12289 return false;
12290 SetFrozen(intValue);
12291 }
12292 }
12293
12294 return true;
12295 }
12296
12297
12299 {
12302 {
12304 }
12305
12306 if (!super.OnStoreLoad(ctx, version))
12307 {
12309 return false;
12310 }
12311
12312 if (version >= 114)
12313 {
12314 bool hasQuickBarIndexSaved;
12315
12316 if (!ctx.
Read(hasQuickBarIndexSaved))
12317 {
12319 return false;
12320 }
12321
12322 if (hasQuickBarIndexSaved)
12323 {
12324 int itmQBIndex;
12325
12326
12327 if (!ctx.
Read(itmQBIndex))
12328 {
12330 return false;
12331 }
12332
12333 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12334 if (itmQBIndex != -1 && parentPlayer)
12335 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12336 }
12337 }
12338 else
12339 {
12340
12341 PlayerBase player;
12342 int itemQBIndex;
12343 if (version ==
int.
MAX)
12344 {
12345 if (!ctx.
Read(itemQBIndex))
12346 {
12348 return false;
12349 }
12350 }
12351 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12352 {
12353
12354 if (!ctx.
Read(itemQBIndex))
12355 {
12357 return false;
12358 }
12359 if (itemQBIndex != -1 && player)
12360 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12361 }
12362 }
12363
12364 if (version < 140)
12365 {
12366
12367 if (!LoadVariables(ctx, version))
12368 {
12370 return false;
12371 }
12372 }
12373
12374
12376 {
12378 return false;
12379 }
12380 if (version >= 132)
12381 {
12383 if (raib)
12384 {
12386 {
12388 return false;
12389 }
12390 }
12391 }
12392
12394 return true;
12395 }
12396
12397
12398
12400 {
12401 super.OnStoreSave(ctx);
12402
12403 PlayerBase player;
12404 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12405 {
12407
12408 int itemQBIndex = -1;
12409 itemQBIndex = player.FindQuickBarEntityIndex(this);
12410 ctx.
Write(itemQBIndex);
12411 }
12412 else
12413 {
12415 }
12416
12418
12420 if (raib)
12421 {
12423 }
12424 }
12425
12426
12428 {
12429 super.AfterStoreLoad();
12430
12432 {
12434 }
12435
12437 {
12440 }
12441 }
12442
12444 {
12445 super.EEOnAfterLoad();
12446
12448 {
12450 }
12451
12454 }
12455
12457 {
12458 return false;
12459 }
12460
12461
12462
12464 {
12466 {
12467 #ifdef PLATFORM_CONSOLE
12468
12470 {
12472 if (menu)
12473 {
12475 }
12476 }
12477 #endif
12478 }
12479
12481 {
12484 }
12485
12487 {
12488 SetWeightDirty();
12490 }
12492 {
12495 }
12496
12498 {
12501
12504 }
12506 {
12510 }
12511
12512 super.OnVariablesSynchronized();
12513 }
12514
12515
12516
12518 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12519 {
12520 if (!IsServerCheck(allow_client))
12521 return false;
12522
12524 return false;
12525
12528
12529 if (value <= (min + 0.001))
12530 value = min;
12531
12532 if (value == min)
12533 {
12534 if (destroy_config)
12535 {
12536 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12537 if (dstr)
12538 {
12540 this.Delete();
12541 return true;
12542 }
12543 }
12544 else if (destroy_forced)
12545 {
12547 this.Delete();
12548 return true;
12549 }
12550
12552 }
12553
12556
12558 {
12559 EntityAI parent = GetHierarchyRoot();
12560 InventoryLocation iLoc = new InventoryLocation();
12561 GetInventory().GetCurrentInventoryLocation(iLoc);
12563 {
12564 int iLocSlot = iLoc.
GetSlot();
12566 {
12568 }
12570 {
12572 }
12573 }
12574 }
12575
12577 {
12579
12580 if (delta)
12582 }
12583
12585
12586 return false;
12587 }
12588
12589
12591 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12592 {
12594 }
12595
12597 {
12600 }
12601
12603 {
12606 }
12607
12609 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12610 {
12611 float value_clamped = Math.Clamp(value, 0, 1);
12613 SetQuantity(result, destroy_config, destroy_forced);
12614 }
12615
12616
12619 {
12621 }
12622
12624 {
12626 }
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12638 {
12639 int slot = -1;
12640 GameInventory inventory = GetInventory();
12641 if (inventory)
12642 {
12643 InventoryLocation il = new InventoryLocation;
12646 }
12647
12649 }
12650
12652 {
12653 float quantity_max = 0;
12654
12656 {
12657 if (attSlotID != -1)
12658 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12659
12660 if (quantity_max <= 0)
12662 }
12663
12664 if (quantity_max <= 0)
12666
12667 return quantity_max;
12668 }
12669
12671 {
12673 }
12674
12676 {
12678 }
12679
12680
12682 {
12684 }
12685
12687 {
12689 }
12690
12692 {
12694 }
12695
12696
12698 {
12699
12700 float weightEx = GetWeightEx();
12701 float special = GetInventoryAndCargoWeight();
12702 return weightEx - special;
12703 }
12704
12705
12707 {
12709 }
12710
12712 {
12714 {
12715 #ifdef DEVELOPER
12716 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12717 {
12718 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12720 }
12721 #endif
12722
12723 return GetQuantity() * GetConfigWeightModified();
12724 }
12725 else if (HasEnergyManager())
12726 {
12727 #ifdef DEVELOPER
12728 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12729 {
12730 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12731 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12732 }
12733 #endif
12734 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12735 }
12736 else
12737 {
12738 #ifdef DEVELOPER
12739 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12740 {
12741 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12742 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12743 }
12744 #endif
12745 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12746 }
12747 }
12748
12751 {
12752 int item_count = 0;
12754
12755 GameInventory inventory = GetInventory();
12756 CargoBase cargo = inventory.
GetCargo();
12757 if (cargo != NULL)
12758 {
12760 }
12761
12763 for (int i = 0; i < nAttachments; ++i)
12764 {
12766 if (item)
12767 item_count += item.GetNumberOfItems();
12768 }
12769 return item_count;
12770 }
12771
12774 {
12775 float weight = 0;
12776 float wetness = 1;
12777 if (include_wetness)
12780 {
12781 weight = wetness * m_ConfigWeight;
12782 }
12784 {
12785 weight = 1;
12786 }
12787 return weight;
12788 }
12789
12790
12791
12793 {
12794 GameInventory inventory = GetInventory();
12795 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12796 {
12797 array<EntityAI> items = new array<EntityAI>;
12799 for (int i = 0; i < items.Count(); ++i)
12800 {
12802 if (item)
12803 {
12804 g_Game.ObjectDelete(item);
12805 }
12806 }
12807 }
12808 }
12809
12810
12811
12812
12814 {
12815 float energy = 0;
12816 if (HasEnergyManager())
12817 {
12818 energy = GetCompEM().GetEnergy();
12819 }
12820 return energy;
12821 }
12822
12823
12825 {
12826 super.OnEnergyConsumed();
12827
12829 }
12830
12832 {
12833 super.OnEnergyAdded();
12834
12836 }
12837
12838
12840 {
12841 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12842 {
12844 {
12845 float energy_0to1 = GetCompEM().GetEnergy0To1();
12847 }
12848 }
12849 }
12850
12851
12853 {
12854 return ConfigGetFloat("heatIsolation");
12855 }
12856
12858 {
12860 }
12861
12863 {
12864 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12865 if (
g_Game.ConfigIsExisting(paramPath))
12866 return g_Game.ConfigGetFloat(paramPath);
12867
12868 return 0.0;
12869 }
12870
12872 {
12873 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12874 if (
g_Game.ConfigIsExisting(paramPath))
12875 return g_Game.ConfigGetFloat(paramPath);
12876
12877 return 0.0;
12878 }
12879
12880 override void SetWet(
float value,
bool allow_client =
false)
12881 {
12882 if (!IsServerCheck(allow_client))
12883 return;
12884
12887
12889
12890 m_VarWet = Math.Clamp(value, min, max);
12891
12893 {
12896 }
12897 }
12898
12899 override void AddWet(
float value)
12900 {
12902 }
12903
12905 {
12907 }
12908
12910 {
12912 }
12913
12915 {
12917 }
12918
12920 {
12922 }
12923
12925 {
12927 }
12928
12929 override void OnWetChanged(
float newVal,
float oldVal)
12930 {
12933 if (newLevel != oldLevel)
12934 {
12936 }
12937 }
12938
12940 {
12941 SetWeightDirty();
12942 }
12943
12945 {
12946 return GetWetLevelInternal(
m_VarWet);
12947 }
12948
12949
12950
12952 {
12954 }
12955
12957 {
12959 }
12960
12962 {
12964 }
12965
12967 {
12969 }
12970
12971
12972
12974 {
12975 if (ConfigIsExisting("itemModelLength"))
12976 {
12977 return ConfigGetFloat("itemModelLength");
12978 }
12979 return 0;
12980 }
12981
12983 {
12984 if (ConfigIsExisting("itemAttachOffset"))
12985 {
12986 return ConfigGetFloat("itemAttachOffset");
12987 }
12988 return 0;
12989 }
12990
12991 override void SetCleanness(
int value,
bool allow_client =
false)
12992 {
12993 if (!IsServerCheck(allow_client))
12994 return;
12995
12997
12999
13002 }
13003
13005 {
13007 }
13008
13010 {
13011 return true;
13012 }
13013
13014
13015
13016
13018 {
13020 }
13021
13023 {
13025 }
13026
13027
13028
13029
13030 override void SetColor(
int r,
int g,
int b,
int a)
13031 {
13037 }
13039 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13040 {
13045 }
13046
13048 {
13050 }
13051
13054 {
13055 int r,g,b,a;
13057 r = r/255;
13058 g = g/255;
13059 b = b/255;
13060 a = a/255;
13061 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13062 }
13063
13064
13065
13066 override void SetLiquidType(
int value,
bool allow_client =
false)
13067 {
13068 if (!IsServerCheck(allow_client))
13069 return;
13070
13075 }
13076
13078 {
13079 return ConfigGetInt("varLiquidTypeInit");
13080 }
13081
13083 {
13085 }
13086
13088 {
13090 SetFrozen(false);
13091 }
13092
13095 {
13096 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13097 }
13098
13099
13102 {
13103 PlayerBase nplayer;
13104 if (PlayerBase.CastTo(nplayer, player))
13105 {
13107 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13108 }
13109 }
13110
13111
13114 {
13115 PlayerBase nplayer;
13116 if (PlayerBase.CastTo(nplayer,player))
13117 {
13118 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13119 }
13120
13121 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13122
13123 if (HasEnergyManager())
13124 {
13125 GetCompEM().UpdatePlugState();
13126 }
13127 }
13128
13129
13131 {
13132 super.OnPlacementStarted(player);
13133
13135 }
13136
13137 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13138 {
13140 {
13141 m_AdminLog.OnPlacementComplete(player,
this);
13142 }
13143
13144 super.OnPlacementComplete(player, position, orientation);
13145 }
13146
13147
13148
13149
13150
13152 {
13154 {
13155 return true;
13156 }
13157 else
13158 {
13159 return false;
13160 }
13161 }
13162
13163
13165 {
13167 {
13169 }
13170 }
13171
13172
13174 {
13176 }
13177
13179 {
13181 }
13182
13183 override void InsertAgent(
int agent,
float count = 1)
13184 {
13185 if (count < 1)
13186 return;
13187
13189 }
13190
13193 {
13195 }
13196
13197
13199 {
13201 }
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13232
13233
13234
13235
13236
13237
13238
13239
13240
13241
13242
13243
13245 {
13247 return false;
13248 return true;
13249 }
13250
13252 {
13253
13255 }
13256
13257
13260 {
13261 super.CheckForRoofLimited(timeTresholdMS);
13262
13263 float time =
g_Game.GetTime();
13264 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13265 {
13266 m_PreviousRoofTestTime = time;
13267 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13268 }
13269 }
13270
13271
13273 {
13275 {
13276 return 0;
13277 }
13278
13279 if (GetInventory().GetAttachmentSlotsCount() != 0)
13280 {
13281 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13282 if (filter)
13283 return filter.GetProtectionLevel(type, false, system);
13284 else
13285 return 0;
13286 }
13287
13288 string subclassPath, entryName;
13289
13290 switch (type)
13291 {
13293 entryName = "biological";
13294 break;
13296 entryName = "chemical";
13297 break;
13298 default:
13299 entryName = "biological";
13300 break;
13301 }
13302
13303 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13304
13305 return g_Game.ConfigGetFloat(subclassPath + entryName);
13306 }
13307
13308
13309
13312 {
13313 if (!IsMagazine())
13315
13317 }
13318
13319
13320
13321
13322
13327 {
13328 return true;
13329 }
13330
13332 {
13334 }
13335
13336
13337
13338
13339
13341 {
13342 if (parent)
13343 {
13344 if (parent.IsInherited(DayZInfected))
13345 return true;
13346
13347 if (!parent.IsRuined())
13348 return true;
13349 }
13350
13351 return true;
13352 }
13353
13355 {
13356 if (!super.CanPutAsAttachment(parent))
13357 {
13358 return false;
13359 }
13360
13361 if (!IsRuined() && !parent.IsRuined())
13362 {
13363 return true;
13364 }
13365
13366 return false;
13367 }
13368
13370 {
13371
13372
13373
13374
13375 return super.CanReceiveItemIntoCargo(item);
13376 }
13377
13379 {
13380
13381
13382
13383
13384 GameInventory attachmentInv = attachment.GetInventory();
13386 {
13387 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13388 return false;
13389 }
13390
13391 InventoryLocation loc = new InventoryLocation();
13392 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13393 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13394 return false;
13395
13396 return super.CanReceiveAttachment(attachment, slotId);
13397 }
13398
13400 {
13401 if (!super.CanReleaseAttachment(attachment))
13402 return false;
13403
13404 return GetInventory().AreChildrenAccessible();
13405 }
13406
13407
13408
13409
13410
13411
13412
13413
13414
13415
13416
13417
13418
13419
13420
13421
13422
13423
13424
13425
13426
13428 {
13429 int id = muzzle_owner.GetMuzzleID();
13430 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13431
13432 if (WPOF_array)
13433 {
13434 for (int i = 0; i < WPOF_array.Count(); i++)
13435 {
13436 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13437
13438 if (WPOF)
13439 {
13440 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13441 }
13442 }
13443 }
13444 }
13445
13446
13448 {
13449 int id = muzzle_owner.GetMuzzleID();
13451
13452 if (WPOBE_array)
13453 {
13454 for (int i = 0; i < WPOBE_array.Count(); i++)
13455 {
13456 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13457
13458 if (WPOBE)
13459 {
13460 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13461 }
13462 }
13463 }
13464 }
13465
13466
13468 {
13469 int id = muzzle_owner.GetMuzzleID();
13470 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13471
13472 if (WPOOH_array)
13473 {
13474 for (int i = 0; i < WPOOH_array.Count(); i++)
13475 {
13476 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13477
13478 if (WPOOH)
13479 {
13480 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13481 }
13482 }
13483 }
13484 }
13485
13486
13488 {
13489 int id = muzzle_owner.GetMuzzleID();
13490 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13491
13492 if (WPOOH_array)
13493 {
13494 for (int i = 0; i < WPOOH_array.Count(); i++)
13495 {
13496 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13497
13498 if (WPOOH)
13499 {
13500 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13501 }
13502 }
13503 }
13504 }
13505
13506
13508 {
13509 int id = muzzle_owner.GetMuzzleID();
13510 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13511
13512 if (WPOOH_array)
13513 {
13514 for (int i = 0; i < WPOOH_array.Count(); i++)
13515 {
13516 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13517
13518 if (WPOOH)
13519 {
13520 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13521 }
13522 }
13523 }
13524 }
13525
13526
13527
13529 {
13531 {
13532 return true;
13533 }
13534
13535 return false;
13536 }
13537
13539 {
13541 {
13542 return true;
13543 }
13544
13545 return false;
13546 }
13547
13549 {
13551 {
13552 return true;
13553 }
13554
13555 return false;
13556 }
13557
13559 {
13560 return false;
13561 }
13562
13565 {
13566 return UATimeSpent.DEFAULT_DEPLOY;
13567 }
13568
13569
13570
13571
13573 {
13575 SetSynchDirty();
13576 }
13577
13579 {
13581 }
13582
13583
13585 {
13586 return false;
13587 }
13588
13591 {
13592 string att_type = "None";
13593
13594 if (ConfigIsExisting("soundAttType"))
13595 {
13596 att_type = ConfigGetString("soundAttType");
13597 }
13598
13600 }
13601
13603 {
13605 }
13606
13607
13608
13609
13610
13616
13618 {
13621
13623 }
13624
13625
13627 {
13629 return;
13630
13632
13635
13638
13639 SoundParameters params = new SoundParameters();
13643 }
13644
13645
13647 {
13649 {
13652
13653 SetSynchDirty();
13654
13657 }
13658 }
13659
13661 {
13663 }
13664
13665
13667 {
13669 return;
13670
13672 SetSynchDirty();
13673
13676 }
13677
13679 {
13682 }
13683
13685 {
13687 }
13688
13689 void OnApply(PlayerBase player);
13690
13692 {
13693 return 1.0;
13694 };
13695
13697 {
13699 }
13700
13702 {
13704 }
13705
13707
13709 {
13710 SetDynamicPhysicsLifeTime(0.01);
13712 }
13713
13715 {
13716 array<string> zone_names = new array<string>;
13717 GetDamageZones(zone_names);
13718 for (int i = 0; i < zone_names.Count(); i++)
13719 {
13720 SetHealthMax(zone_names.Get(i),"Health");
13721 }
13722 SetHealthMax("","Health");
13723 }
13724
13727 {
13728 float global_health = GetHealth01("","Health");
13729 array<string> zones = new array<string>;
13730 GetDamageZones(zones);
13731
13732 for (int i = 0; i < zones.Count(); i++)
13733 {
13734 SetHealth01(zones.Get(i),"Health",global_health);
13735 }
13736 }
13737
13740 {
13741 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13742 }
13743
13745 {
13746 if (!hasRootAsPlayer)
13747 {
13748 if (refParentIB)
13749 {
13750
13751 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13752 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13753
13754 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13755 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13756
13759 }
13760 else
13761 {
13762
13765 }
13766 }
13767 }
13768
13770 {
13772 {
13773 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13774 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13775 {
13776 float heatPermCoef = 1.0;
13778 while (ent)
13779 {
13780 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13781 ent = ent.GetHierarchyParent();
13782 }
13783
13784 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13785 }
13786 }
13787 }
13788
13790 {
13791
13792 EntityAI parent = GetHierarchyParent();
13793 if (!parent)
13794 {
13795 hasParent = false;
13796 hasRootAsPlayer = false;
13797 }
13798 else
13799 {
13800 hasParent = true;
13801 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13802 refParentIB =
ItemBase.Cast(parent);
13803 }
13804 }
13805
13806 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13807 {
13808
13809 }
13810
13812 {
13813
13814 return false;
13815 }
13816
13818 {
13819
13820
13821 return false;
13822 }
13823
13825 {
13826
13827 return false;
13828 }
13829
13832 {
13833 return !GetIsFrozen() &&
IsOpen();
13834 }
13835
13837 {
13838 bool hasParent = false, hasRootAsPlayer = false;
13840
13841 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13842 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13843
13844 if (wwtu || foodDecay)
13845 {
13849
13850 if (processWetness || processTemperature || processDecay)
13851 {
13853
13854 if (processWetness)
13855 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13856
13857 if (processTemperature)
13859
13860 if (processDecay)
13861 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13862 }
13863 }
13864 }
13865
13868 {
13870 }
13871
13873 {
13876
13877 return super.GetTemperatureFreezeThreshold();
13878 }
13879
13881 {
13884
13885 return super.GetTemperatureThawThreshold();
13886 }
13887
13889 {
13892
13893 return super.GetItemOverheatThreshold();
13894 }
13895
13897 {
13899 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13900
13901 return super.GetTemperatureFreezeTime();
13902 }
13903
13905 {
13907 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13908
13909 return super.GetTemperatureThawTime();
13910 }
13911
13916
13918 {
13919 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13920 }
13921
13923 {
13924 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13925 }
13926
13929 {
13931 }
13932
13934 {
13936 }
13937
13939 {
13941 }
13942
13945 {
13946 return null;
13947 }
13948
13951 {
13952 return false;
13953 }
13954
13956 {
13958 {
13961 if (!trg)
13962 {
13964 explosive = this;
13965 }
13966
13967 explosive.PairRemote(trg);
13969
13970 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13971 trg.SetPersistentPairID(persistentID);
13972 explosive.SetPersistentPairID(persistentID);
13973
13974 return true;
13975 }
13976 return false;
13977 }
13978
13981 {
13982 float ret = 1.0;
13985 ret *= GetHealth01();
13986
13987 return ret;
13988 }
13989
13990 #ifdef DEVELOPER
13991 override void SetDebugItem()
13992 {
13993 super.SetDebugItem();
13994 _itemBase = this;
13995 }
13996
13998 {
13999 string text = super.GetDebugText();
14000
14002 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14003
14004 return text;
14005 }
14006 #endif
14007
14009 {
14010 return true;
14011 }
14012
14014
14016
14018 {
14021 }
14022
14023
14031
14047
14048 [
Obsolete(
"Use ItemSoundHandler instead")]
14051 {
14052 if (!
g_Game.IsDedicatedServer())
14053 {
14054 if (ConfigIsExisting("attachSoundSet"))
14055 {
14056 string cfg_path = "";
14057 string soundset = "";
14058 string type_name =
GetType();
14059
14062 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14063 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14064
14065 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14066 {
14067 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14068 {
14069 if (cfg_slot_array[i] == slot_type)
14070 {
14071 soundset = cfg_soundset_array[i];
14072 break;
14073 }
14074 }
14075 }
14076
14077 if (soundset != "")
14078 {
14079 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14081 }
14082 }
14083 }
14084 }
14085
14087}
14088
14090{
14092 if (entity)
14093 {
14094 bool is_item = entity.IsInherited(
ItemBase);
14095 if (is_item && full_quantity)
14096 {
14099 }
14100 }
14101 else
14102 {
14104 return NULL;
14105 }
14106 return entity;
14107}
14108
14110{
14111 if (item)
14112 {
14113 if (health > 0)
14114 item.SetHealth("", "", health);
14115
14116 if (item.CanHaveTemperature())
14117 {
14119 if (item.CanFreeze())
14120 item.SetFrozen(false);
14121 }
14122
14123 if (item.HasEnergyManager())
14124 {
14125 if (quantity >= 0)
14126 {
14127 item.GetCompEM().SetEnergy0To1(quantity);
14128 }
14129 else
14130 {
14132 }
14133 }
14134 else if (item.IsMagazine())
14135 {
14136 Magazine mag = Magazine.Cast(item);
14137 if (quantity >= 0)
14138 {
14139 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14140 }
14141 else
14142 {
14144 }
14145
14146 }
14147 else
14148 {
14149 if (quantity >= 0)
14150 {
14151 item.SetQuantityNormalized(quantity, false);
14152 }
14153 else
14154 {
14156 }
14157
14158 }
14159 }
14160}
14161
14162#ifdef DEVELOPER
14164#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.