Attachment Sound Type getting from config file.
9206{
9208 {
9209 return true;
9210 }
9211};
9212
9213
9214
9216{
9220
9222
9225
9226
9227
9228
9229
9238
9244
9249
9254
9275 protected bool m_IsResultOfSplit
9276
9278
9283
9284
9285
9287
9291
9292
9293
9295
9298
9299
9300
9306
9307
9315
9318
9319
9321
9322
9324
9325
9330
9331
9336
9337
9339
9340
9342 {
9347
9348 if (!
GetGame().IsDedicatedServer())
9349 {
9351 {
9353
9355 {
9357 }
9358 }
9359
9362 }
9363
9364 m_OldLocation = null;
9365
9367 {
9369 }
9370
9371 if (ConfigIsExisting("headSelectionsToHide"))
9372 {
9375 }
9376
9378 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9379 {
9381 }
9382
9384
9385 m_IsResultOfSplit = false;
9386
9388 }
9389
9391 {
9392 super.InitItemVariables();
9393
9399 m_Count = ConfigGetInt(
"count");
9400
9403
9408
9411
9416
9428
9432
9433
9436 if (ConfigIsExisting("canBeSplit"))
9437 {
9440 }
9441
9443 if (ConfigIsExisting("itemBehaviour"))
9445
9446
9449 RegisterNetSyncVariableInt("m_VarLiquidType");
9450 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9451
9452 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9453 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9454 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9455
9456 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9457 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9458 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9459 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9460
9461 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9462 RegisterNetSyncVariableBool("m_IsTakeable");
9463 RegisterNetSyncVariableBool("m_IsHologram");
9464
9467 {
9470 }
9471
9473
9475 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9477
9478 }
9479
9481 {
9483 }
9484
9486 {
9489 {
9494 }
9495 }
9496
9497 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9498 {
9500 {
9503 }
9504
9506 }
9507
9509 {
9515 }
9516
9518
9520 {
9522
9523 if (!action)
9524 {
9525 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9526 return;
9527 }
9528
9530 if (!ai)
9531 {
9533 return;
9534 }
9535
9537 if (!action_array)
9538 {
9539 action_array = new array<ActionBase_Basic>;
9541 }
9542 if (LogManager.IsActionLogEnable())
9543 {
9544 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9545 }
9546
9547 if (action_array.Find(action) != -1)
9548 {
9549 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9550 }
9551 else
9552 {
9553 action_array.Insert(action);
9554 }
9555 }
9556
9558 {
9560 ActionBase action = player.GetActionManager().GetAction(actionName);
9563
9564 if (action_array)
9565 {
9566 action_array.RemoveItem(action);
9567 }
9568 }
9569
9570
9571
9573 {
9574 ActionOverrideData overrideData = new ActionOverrideData();
9578
9580 if (!actionMap)
9581 {
9584 }
9585
9586 actionMap.Insert(this.
Type(), overrideData);
9587
9588 }
9589
9591
9593
9594
9596 {
9599
9602
9603 string config_to_search = "CfgVehicles";
9604 string muzzle_owner_config;
9605
9607 {
9608 if (IsInherited(Weapon))
9609 config_to_search = "CfgWeapons";
9610
9611 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9612
9613 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9614
9616
9617 if (config_OnFire_subclass_count > 0)
9618 {
9619 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9620
9621 for (int i = 0; i < config_OnFire_subclass_count; i++)
9622 {
9623 string particle_class = "";
9625 string config_OnFire_entry = config_OnFire_class + particle_class;
9626 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9627 WPOF_array.Insert(WPOF);
9628 }
9629
9630
9632 }
9633 }
9634
9636 {
9637 config_to_search = "CfgWeapons";
9638 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9639
9640 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9641
9643
9644 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9645 {
9646 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9647
9648 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9649 {
9650 string particle_class2 = "";
9652 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9653 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9654 WPOBE_array.Insert(WPOBE);
9655 }
9656
9657
9659 }
9660 }
9661 }
9662
9663
9665 {
9668
9670 {
9671 string config_to_search = "CfgVehicles";
9672
9673 if (IsInherited(Weapon))
9674 config_to_search = "CfgWeapons";
9675
9676 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9677 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9678
9679 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
9680 {
9681
9683
9685 {
9687 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9689 return;
9690 }
9691
9694
9695
9696
9698 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9699
9700 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9701 {
9702 string particle_class = "";
9704 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9706
9707 if (entry_type == CT_CLASS)
9708 {
9709 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9710 WPOOH_array.Insert(WPOF);
9711 }
9712 }
9713
9714
9716 }
9717 }
9718 }
9719
9721 {
9723 }
9724
9726 {
9728 {
9730
9733
9736
9737 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9738 }
9739 }
9740
9742 {
9744 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9745
9747 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9748
9750 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9751
9753 {
9755 }
9756 }
9757
9759 {
9761 }
9762
9764 {
9767 else
9769
9771 {
9774 }
9775 else
9776 {
9779
9782 }
9783
9785 }
9786
9788 {
9790 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9791 }
9792
9794 {
9796 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9798 }
9799
9801 {
9803 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9804 }
9805
9807 {
9810
9811 OverheatingParticle OP = new OverheatingParticle();
9816
9818 }
9819
9821 {
9824
9825 return -1;
9826 }
9827
9829 {
9831 {
9834
9835 for (int i = count; i > 0; --i)
9836 {
9837 int id = i - 1;
9840
9843
9844 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9845 {
9846 if (p)
9847 {
9850 }
9851 }
9852 }
9853 }
9854 }
9855
9857 {
9859 {
9861 {
9862 int id = i - 1;
9864
9865 if (OP)
9866 {
9868
9869 if (p)
9870 {
9872 }
9873
9874 delete OP;
9875 }
9876 }
9877
9880 }
9881 }
9882
9885 {
9886 return 0.0;
9887 }
9888
9889
9891 {
9892 return 250;
9893 }
9894
9896 {
9897 return 0;
9898 }
9899
9902 {
9904 return true;
9905
9906 return false;
9907 }
9908
9911 {
9914
9916 {
9918 }
9919 else
9920 {
9921
9923 }
9924
9926 }
9927
9934 {
9935 return -1;
9936 }
9937
9938
9939
9940
9942 {
9944 {
9946 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9947
9948 if (r_index >= 0)
9949 {
9950 InventoryLocation r_il = new InventoryLocation;
9951 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9952
9953 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9956 {
9957 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9958 }
9960 {
9961 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9962 }
9963
9964 }
9965
9966 player.GetHumanInventory().ClearUserReservedLocation(this);
9967 }
9968
9971 }
9972
9973
9974
9975
9977 {
9978 return ItemBase.m_DebugActionsMask;
9979 }
9980
9982 {
9983 return ItemBase.m_DebugActionsMask & mask;
9984 }
9985
9987 {
9988 ItemBase.m_DebugActionsMask = mask;
9989 }
9990
9992 {
9993 ItemBase.m_DebugActionsMask |= mask;
9994 }
9995
9997 {
9998 ItemBase.m_DebugActionsMask &= ~mask;
9999 }
10000
10002 {
10004 {
10006 }
10007 else
10008 {
10010 }
10011 }
10012
10013
10015 {
10016 if (GetEconomyProfile())
10017 {
10018 float q_max = GetEconomyProfile().GetQuantityMax();
10019 if (q_max > 0)
10020 {
10021 float q_min = GetEconomyProfile().GetQuantityMin();
10022 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10023
10025 {
10026 ComponentEnergyManager comp = GetCompEM();
10028 {
10030 }
10031 }
10033 {
10035
10036 }
10037
10038 }
10039 }
10040 }
10041
10044 {
10045 EntityAI parent = GetHierarchyParent();
10046
10047 if (parent)
10048 {
10049 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10050 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10051 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10052 }
10053 }
10054
10057 {
10058 EntityAI parent = GetHierarchyParent();
10059
10060 if (parent)
10061 {
10062 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10063 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10064 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10065 }
10066 }
10067
10069 {
10070
10071
10072
10073
10075
10077 {
10078 if (ScriptInputUserData.CanStoreInputUserData())
10079 {
10080 ScriptInputUserData ctx = new ScriptInputUserData;
10086 ctx.
Write(use_stack_max);
10089
10091 {
10092 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10093 }
10094 }
10095 }
10096 else if (!
GetGame().IsMultiplayer())
10097 {
10099 }
10100 }
10101
10103 {
10105 }
10106
10108 {
10110 }
10111
10113 {
10115 }
10116
10118 {
10119
10120 return false;
10121 }
10122
10124 {
10125 return false;
10126 }
10127
10131 {
10132 return false;
10133 }
10134
10136 {
10137 return "";
10138 }
10139
10141
10143 {
10144 return false;
10145 }
10146
10148 {
10149 return true;
10150 }
10151
10152
10153
10155 {
10156 return true;
10157 }
10158
10160 {
10161 return true;
10162 }
10163
10165 {
10166 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10168 }
10169
10171 {
10173 }
10174
10176 {
10178 if (!is_being_placed)
10180 SetSynchDirty();
10181 }
10182
10183
10185
10187 {
10189 }
10190
10192 {
10194 }
10195
10197 {
10198 return 1;
10199 }
10200
10202 {
10203 return false;
10204 }
10205
10207 {
10209 SetSynchDirty();
10210 }
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10247 {
10248 super.OnMovedInsideCargo(container);
10249
10250 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10251 }
10252
10253 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10254 {
10255 super.EEItemLocationChanged(oldLoc,newLoc);
10256
10257 PlayerBase new_player = null;
10258 PlayerBase old_player = null;
10259
10260 if (newLoc.GetParent())
10261 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10262
10263 if (oldLoc.GetParent())
10264 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10265
10267 {
10268 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
10269
10270 if (r_index >= 0)
10271 {
10272 InventoryLocation r_il = new InventoryLocation;
10273 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10274
10275 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10278 {
10279 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10280 }
10282 {
10283 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10284 }
10285
10286 }
10287 }
10288
10290 {
10291 if (new_player)
10292 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
10293
10294 if (new_player == old_player)
10295 {
10296
10297 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10298 {
10300 {
10301 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10302 {
10303 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10304 }
10305 }
10306 else
10307 {
10308 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10309 }
10310 }
10311
10312 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10313 {
10314 int type = oldLoc.GetType();
10316 {
10317 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10318 }
10320 {
10321 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10322 }
10323 }
10324 if (!m_OldLocation)
10325 {
10326 m_OldLocation = new InventoryLocation;
10327 }
10328 m_OldLocation.Copy(oldLoc);
10329 }
10330 else
10331 {
10332 if (m_OldLocation)
10333 {
10334 m_OldLocation.Reset();
10335 }
10336 }
10337
10339 }
10340 else
10341 {
10342 if (new_player)
10343 {
10344 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10345 if (res_index >= 0)
10346 {
10347 InventoryLocation il = new InventoryLocation;
10348 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
10350 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
10353 {
10354 il.
GetParent().GetOnReleaseLock().Invoke(it);
10355 }
10357 {
10359 }
10360
10361 }
10362 }
10364 {
10365
10367 }
10368
10369 if (m_OldLocation)
10370 {
10371 m_OldLocation.Reset();
10372 }
10373 }
10374 }
10375
10376 override void EOnContact(IEntity other, Contact extra)
10377 {
10379 {
10380 int liquidType = -1;
10382 if (impactSpeed > 0.0)
10383 {
10385 #ifndef SERVER
10387 #else
10389 SetSynchDirty();
10390 #endif
10392 }
10393 }
10394
10395 #ifdef SERVER
10396 if (GetCompEM() && GetCompEM().IsPlugged())
10397 {
10398 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10399 GetCompEM().UnplugThis();
10400 }
10401 #endif
10402 }
10403
10405
10407 {
10409 }
10410
10412 {
10413
10414 }
10415
10417 {
10418 super.OnItemLocationChanged(old_owner, new_owner);
10419
10420 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10421 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10422
10423 if (!relatedPlayer && playerNew)
10424 relatedPlayer = playerNew;
10425
10426 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10427 {
10429 if (actionMgr)
10430 {
10431 ActionBase currentAction = actionMgr.GetRunningAction();
10432 if (currentAction)
10434 }
10435 }
10436
10437 Man ownerPlayerOld = null;
10438 Man ownerPlayerNew = null;
10439
10440 if (old_owner)
10441 {
10442 if (old_owner.
IsMan())
10443 {
10444 ownerPlayerOld = Man.Cast(old_owner);
10445 }
10446 else
10447 {
10448 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10449 }
10450 }
10451 else
10452 {
10454 {
10456
10457 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10458 {
10459 GetCompEM().UnplugThis();
10460 }
10461 }
10462 }
10463
10464 if (new_owner)
10465 {
10466 if (new_owner.
IsMan())
10467 {
10468 ownerPlayerNew = Man.Cast(new_owner);
10469 }
10470 else
10471 {
10472 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10473 }
10474 }
10475
10476 if (ownerPlayerOld != ownerPlayerNew)
10477 {
10478 if (ownerPlayerOld)
10479 {
10480 array<EntityAI> subItemsExit = new array<EntityAI>;
10482 for (int i = 0; i < subItemsExit.Count(); i++)
10483 {
10486 }
10487 }
10488
10489 if (ownerPlayerNew)
10490 {
10491 array<EntityAI> subItemsEnter = new array<EntityAI>;
10493 for (int j = 0; j < subItemsEnter.Count(); j++)
10494 {
10497 }
10498 }
10499 }
10500 else if (ownerPlayerNew != null)
10501 {
10502 PlayerBase nplayer;
10503 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10504 {
10505 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10507 for (int k = 0; k < subItemsUpdate.Count(); k++)
10508 {
10510 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10511 }
10512 }
10513 }
10514
10515 if (old_owner)
10516 old_owner.OnChildItemRemoved(this);
10517 if (new_owner)
10518 new_owner.OnChildItemReceived(this);
10519 }
10520
10521
10523 {
10524 super.EEDelete(parent);
10525 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10526 if (player)
10527 {
10529
10530 if (player.IsAlive())
10531 {
10532 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10533 if (r_index >= 0)
10534 {
10535 InventoryLocation r_il = new InventoryLocation;
10536 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10537
10538 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10541 {
10542 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10543 }
10545 {
10546 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10547 }
10548
10549 }
10550
10551 player.RemoveQuickBarEntityShortcut(this);
10552 }
10553 }
10554 }
10555
10557 {
10558 super.EEKilled(killer);
10559
10562 {
10563 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10564 {
10565 if (IsMagazine())
10566 {
10567 if (Magazine.Cast(this).GetAmmoCount() > 0)
10568 {
10570 }
10571 }
10572 else
10573 {
10575 }
10576 }
10577 }
10578 }
10579
10581 {
10582 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10583
10584 super.OnWasAttached(parent, slot_id);
10585
10588
10590 }
10591
10593 {
10594 super.OnWasDetached(parent, slot_id);
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 ];
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 if (GetInventory().GetCargo())
10744 {
10745 int item_count = GetInventory().GetCargo().GetItemCount();
10746 if (item_count > 0)
10747 {
10748 int random_pick = Math.RandomInt(0, item_count);
10750 if (!item.IsExplosive())
10751 {
10752 item.AddHealth("","",damage);
10753 return true;
10754 }
10755 }
10756 }
10757 return false;
10758 }
10759
10761 {
10762 int attachment_count = GetInventory().AttachmentCount();
10763 if (attachment_count > 0)
10764 {
10765 int random_pick = Math.RandomInt(0, attachment_count);
10766 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
10767 if (!attachment.IsExplosive())
10768 {
10769 attachment.AddHealth("","",damage);
10770 return true;
10771 }
10772 }
10773 return false;
10774 }
10775
10777 {
10779 }
10780
10782 {
10784 return GetInventory().CanRemoveEntity();
10785
10786 return false;
10787 }
10788
10790 {
10791
10793 return false;
10794
10795
10797 return false;
10798
10799
10800
10802 if (delta == 0)
10803 return false;
10804
10805
10806 return true;
10807 }
10808
10810 {
10812 {
10813 if (ScriptInputUserData.CanStoreInputUserData())
10814 {
10815 ScriptInputUserData ctx = new ScriptInputUserData;
10820 ctx.
Write(destination_entity);
10822 ctx.
Write(slot_id);
10824 }
10825 }
10826 else if (!
GetGame().IsMultiplayer())
10827 {
10829 }
10830 }
10831
10833 {
10834 float split_quantity_new;
10838 InventoryLocation loc = new InventoryLocation;
10839
10840 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10841 {
10843 split_quantity_new = stack_max;
10844 else
10846
10848 {
10849 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10850 if (new_item)
10851 {
10852 new_item.SetResultOfSplit(true);
10853 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10855 new_item.
SetQuantity(split_quantity_new,
false,
true);
10856 }
10857 }
10858 }
10859 else if (destination_entity && slot_id == -1)
10860 {
10861 if (quantity > stack_max)
10862 split_quantity_new = stack_max;
10863 else
10864 split_quantity_new = quantity;
10865
10867 {
10869 {
10872 }
10873
10874 if (new_item)
10875 {
10876 new_item.SetResultOfSplit(true);
10877 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10879 new_item.
SetQuantity(split_quantity_new,
false,
true);
10880 }
10881 }
10882 }
10883 else
10884 {
10885 if (stack_max != 0)
10886 {
10888 {
10890 }
10891
10892 if (split_quantity_new == 0)
10893 {
10894 if (!
GetGame().IsMultiplayer())
10895 player.PhysicalPredictiveDropItem(this);
10896 else
10897 player.ServerDropEntity(this);
10898 return;
10899 }
10900
10902 {
10904
10905 if (new_item)
10906 {
10907 new_item.SetResultOfSplit(true);
10908 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10911 new_item.PlaceOnSurface();
10912 }
10913 }
10914 }
10915 }
10916 }
10917
10919 {
10920 float split_quantity_new;
10924 InventoryLocation loc = new InventoryLocation;
10925
10926 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10927 {
10929 split_quantity_new = stack_max;
10930 else
10932
10934 {
10935 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10936 if (new_item)
10937 {
10938 new_item.SetResultOfSplit(true);
10939 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10941 new_item.
SetQuantity(split_quantity_new,
false,
true);
10942 }
10943 }
10944 }
10945 else if (destination_entity && slot_id == -1)
10946 {
10947 if (quantity > stack_max)
10948 split_quantity_new = stack_max;
10949 else
10950 split_quantity_new = quantity;
10951
10953 {
10955 {
10958 }
10959
10960 if (new_item)
10961 {
10962 new_item.SetResultOfSplit(true);
10963 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10965 new_item.
SetQuantity(split_quantity_new,
false,
true);
10966 }
10967 }
10968 }
10969 else
10970 {
10971 if (stack_max != 0)
10972 {
10974 {
10976 }
10977
10979 {
10981
10982 if (new_item)
10983 {
10984 new_item.SetResultOfSplit(true);
10985 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10988 new_item.PlaceOnSurface();
10989 }
10990 }
10991 }
10992 }
10993 }
10994
10996 {
10998 {
10999 if (ScriptInputUserData.CanStoreInputUserData())
11000 {
11001 ScriptInputUserData ctx = new ScriptInputUserData;
11006 dst.WriteToContext(ctx);
11008 }
11009 }
11010 else if (!
GetGame().IsMultiplayer())
11011 {
11013 }
11014 }
11015
11017 {
11019 {
11020 if (ScriptInputUserData.CanStoreInputUserData())
11021 {
11022 ScriptInputUserData ctx = new ScriptInputUserData;
11027 ctx.
Write(destination_entity);
11033 }
11034 }
11035 else if (!
GetGame().IsMultiplayer())
11036 {
11038 }
11039 }
11040
11042 {
11044 }
11045
11047 {
11049 float split_quantity_new;
11051 if (dst.IsValid())
11052 {
11053 int slot_id = dst.GetSlot();
11055
11056 if (quantity > stack_max)
11057 split_quantity_new = stack_max;
11058 else
11059 split_quantity_new = quantity;
11060
11062 {
11064
11065 if (new_item)
11066 {
11067 new_item.SetResultOfSplit(true);
11068 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11070 new_item.
SetQuantity(split_quantity_new,
false,
true);
11071 }
11072
11073 return new_item;
11074 }
11075 }
11076
11077 return null;
11078 }
11079
11081 {
11083 float split_quantity_new;
11085 if (destination_entity)
11086 {
11088 if (quantity > stackable)
11089 split_quantity_new = stackable;
11090 else
11091 split_quantity_new = quantity;
11092
11094 {
11095 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11096 if (new_item)
11097 {
11098 new_item.SetResultOfSplit(true);
11099 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11101 new_item.
SetQuantity(split_quantity_new,
false,
true);
11102 }
11103 }
11104 }
11105 }
11106
11108 {
11110 {
11111 if (ScriptInputUserData.CanStoreInputUserData())
11112 {
11113 ScriptInputUserData ctx = new ScriptInputUserData;
11118 ItemBase destination_entity =
this;
11119 ctx.
Write(destination_entity);
11123 }
11124 }
11125 else if (!
GetGame().IsMultiplayer())
11126 {
11128 }
11129 }
11130
11132 {
11134 float split_quantity_new;
11136 if (player)
11137 {
11139 if (quantity > stackable)
11140 split_quantity_new = stackable;
11141 else
11142 split_quantity_new = quantity;
11143
11145 {
11146 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11147 new_item =
ItemBase.Cast(in_hands);
11148 if (new_item)
11149 {
11150 new_item.SetResultOfSplit(true);
11151 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11153 new_item.SetQuantity(split_quantity_new, false, true);
11154 }
11155 }
11156 }
11157 }
11158
11160 {
11162 float split_quantity_new = Math.Floor(quantity * 0.5);
11163
11165 return;
11166
11168
11169 if (new_item)
11170 {
11171 if (new_item.GetQuantityMax() < split_quantity_new)
11172 {
11173 split_quantity_new = new_item.GetQuantityMax();
11174 }
11175
11176 new_item.SetResultOfSplit(true);
11177 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11178
11180 {
11183 }
11184 else
11185 {
11187 new_item.
SetQuantity(split_quantity_new,
false,
true);
11188 }
11189 }
11190 }
11191
11193 {
11195 float split_quantity_new = Math.Floor(quantity / 2);
11196
11198 return;
11199
11200 InventoryLocation invloc = new InventoryLocation;
11202
11204 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11205
11206 if (new_item)
11207 {
11208 if (new_item.GetQuantityMax() < split_quantity_new)
11209 {
11210 split_quantity_new = new_item.GetQuantityMax();
11211 }
11213 {
11216 }
11217 else if (split_quantity_new > 1)
11218 {
11220 new_item.
SetQuantity(split_quantity_new,
false,
true);
11221 }
11222 }
11223 }
11224
11227 {
11228 SetWeightDirty();
11230
11231 if (parent)
11232 parent.OnAttachmentQuantityChangedEx(this, delta);
11233
11235 {
11237 {
11239 }
11241 {
11242 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11244 }
11245 }
11246
11247 }
11248
11251 {
11252
11253 }
11254
11257 {
11259 }
11260
11262 {
11263 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11264
11266 {
11267 if (newLevel == GameConstants.STATE_RUINED)
11268 {
11270 EntityAI parent = GetHierarchyParent();
11271 if (parent && parent.IsFireplace())
11272 {
11273 CargoBase cargo = GetInventory().GetCargo();
11274 if (cargo)
11275 {
11277 {
11279 }
11280 }
11281 }
11282 }
11283
11285 {
11286
11288 return;
11289 }
11290
11291 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11292 {
11294 }
11295 }
11296 }
11297
11298
11300 {
11301 super.OnRightClick();
11302
11304 {
11306 {
11307 if (ScriptInputUserData.CanStoreInputUserData())
11308 {
11309 EntityAI root = GetHierarchyRoot();
11310 Man playerOwner = GetHierarchyRootPlayer();
11311 InventoryLocation dst = new InventoryLocation;
11312
11313
11314 if (!playerOwner && root && root == this)
11315 {
11317 }
11318 else
11319 {
11320
11321 GetInventory().GetCurrentInventoryLocation(dst);
11323 {
11326 {
11328 }
11329 else
11330 {
11332
11333
11334 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11335 {
11337 }
11338 else
11339 {
11340 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11341 }
11342 }
11343 }
11344 }
11345
11346 ScriptInputUserData ctx = new ScriptInputUserData;
11354 }
11355 }
11356 else if (!
GetGame().IsMultiplayer())
11357 {
11359 }
11360 }
11361 }
11362
11364 {
11365 if (root)
11366 {
11367 vector m4[4];
11368 root.GetTransform(m4);
11369 dst.SetGround(this, m4);
11370 }
11371 else
11372 {
11373 GetInventory().GetCurrentInventoryLocation(dst);
11374 }
11375 }
11376
11377 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11378 {
11379
11380 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11381 return false;
11382
11383 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11384 return false;
11385
11386
11388 return false;
11389
11390
11391 Magazine mag = Magazine.Cast(this);
11392 if (mag)
11393 {
11394 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11395 return false;
11396
11397 if (stack_max_limit)
11398 {
11399 Magazine other_mag = Magazine.Cast(other_item);
11400 if (other_item)
11401 {
11402 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11403 return false;
11404 }
11405
11406 }
11407 }
11408 else
11409 {
11410
11412 return false;
11413
11415 return false;
11416 }
11417
11418 PlayerBase player = null;
11419 if (CastTo(player, GetHierarchyRootPlayer()))
11420 {
11421 if (player.GetInventory().HasAttachment(this))
11422 return false;
11423
11424 if (player.IsItemsToDelete())
11425 return false;
11426 }
11427
11428 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11429 return false;
11430
11431 int slotID;
11433 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11434 return false;
11435
11436 return true;
11437 }
11438
11440 {
11442 }
11443
11445 {
11446 return m_IsResultOfSplit;
11447 }
11448
11450 {
11451 m_IsResultOfSplit = value;
11452 }
11453
11455 {
11457 }
11458
11460 {
11461 float other_item_quantity = other_item.GetQuantity();
11462 float this_free_space;
11463
11465
11467
11468 if (other_item_quantity > this_free_space)
11469 {
11470 return this_free_space;
11471 }
11472 else
11473 {
11474 return other_item_quantity;
11475 }
11476 }
11477
11479 {
11481 }
11482
11484 {
11486 return;
11487
11488 if (!IsMagazine() && other_item)
11489 {
11491 if (quantity_used != 0)
11492 {
11493 float hp1 = GetHealth01("","");
11494 float hp2 = other_item.GetHealth01("","");
11495 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11496 hpResult = hpResult / (
GetQuantity() + quantity_used);
11497
11498 hpResult *= GetMaxHealth();
11499 Math.Round(hpResult);
11500 SetHealth("", "Health", hpResult);
11501
11503 other_item.AddQuantity(-quantity_used);
11504 }
11505 }
11507 }
11508
11510 {
11511 #ifdef SERVER
11512 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11513 GetHierarchyParent().IncreaseLifetimeUp();
11514 #endif
11515 };
11516
11518 {
11519 PlayerBase p = PlayerBase.Cast(player);
11520
11521 array<int> recipesIds = p.m_Recipes;
11522 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11523 if (moduleRecipesManager)
11524 {
11525 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
11526 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11527 }
11528
11529 for (int i = 0;i < recipesIds.Count(); i++)
11530 {
11531 int key = recipesIds.Get(i);
11532 string recipeName = moduleRecipesManager.GetRecipeName(key);
11534 }
11535 }
11536
11537
11538 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11539 {
11540 super.GetDebugActions(outputList);
11541
11542
11548
11549
11554
11559
11560
11564
11565
11567 {
11571 }
11572
11575
11576
11580
11582
11583 InventoryLocation loc = new InventoryLocation();
11584 GetInventory().GetCurrentInventoryLocation(loc);
11586 {
11587 if (Gizmo_IsSupported())
11590 }
11591
11593 }
11594
11595
11596
11597
11599 {
11600 super.OnAction(action_id, player, ctx);
11601
11603 {
11604 switch (action_id)
11605 {
11608 return true;
11611 return true;
11612 }
11613 }
11614
11616 {
11617 switch (action_id)
11618 {
11620 Delete();
11621 return true;
11622 }
11623 }
11624
11625 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11626 {
11627 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11628 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11629 PlayerBase p = PlayerBase.Cast(player);
11630 if (
EActions.RECIPES_RANGE_START < 1000)
11631 {
11632 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11633 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11634 }
11635 }
11636 #ifndef SERVER
11637 else if (action_id ==
EActions.WATCH_PLAYER)
11638 {
11639 PluginDeveloper.SetDeveloperItemClientEx(player);
11640 }
11641 #endif
11643 {
11644 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11645 {
11646 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11647 OnDebugButtonPressServer(id + 1);
11648 }
11649
11650 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11651 {
11652 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11654 }
11655
11656 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11657 {
11658 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11660 }
11661
11662 else if (action_id ==
EActions.ADD_QUANTITY)
11663 {
11664 if (IsMagazine())
11665 {
11666 Magazine mag = Magazine.Cast(this);
11667 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11668 }
11669 else
11670 {
11672 }
11673
11674 if (m_EM)
11675 {
11676 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11677 }
11678
11679 }
11680
11681 else if (action_id ==
EActions.REMOVE_QUANTITY)
11682 {
11683 if (IsMagazine())
11684 {
11685 Magazine mag2 = Magazine.Cast(this);
11686 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11687 }
11688 else
11689 {
11691 }
11692 if (m_EM)
11693 {
11694 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11695 }
11696
11697 }
11698
11699 else if (action_id ==
EActions.SET_QUANTITY_0)
11700 {
11702
11703 if (m_EM)
11704 {
11705 m_EM.SetEnergy(0);
11706 }
11707 }
11708
11709 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11710 {
11712
11713 if (m_EM)
11714 {
11715 m_EM.SetEnergy(m_EM.GetEnergyMax());
11716 }
11717 }
11718
11719 else if (action_id ==
EActions.ADD_HEALTH)
11720 {
11721 AddHealth("","",GetMaxHealth("","Health")/5);
11722 }
11723 else if (action_id ==
EActions.REMOVE_HEALTH)
11724 {
11725 AddHealth("","",-GetMaxHealth("","Health")/5);
11726 }
11727 else if (action_id ==
EActions.DESTROY_HEALTH)
11728 {
11729 SetHealth01("","",0);
11730 }
11731 else if (action_id ==
EActions.WATCH_ITEM)
11732 {
11734 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11735 #ifdef DEVELOPER
11736 SetDebugDeveloper_item(this);
11737 #endif
11738 }
11739
11740 else if (action_id ==
EActions.ADD_TEMPERATURE)
11741 {
11742 AddTemperature(20);
11743
11744 }
11745
11746 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11747 {
11748 AddTemperature(-20);
11749
11750 }
11751
11752 else if (action_id ==
EActions.FLIP_FROZEN)
11753 {
11754 SetFrozen(!GetIsFrozen());
11755
11756 }
11757
11758 else if (action_id ==
EActions.ADD_WETNESS)
11759 {
11761
11762 }
11763
11764 else if (action_id ==
EActions.REMOVE_WETNESS)
11765 {
11767
11768 }
11769
11770 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11771 {
11774
11775
11776 }
11777
11778 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11779 {
11782 }
11783
11784 else if (action_id ==
EActions.MAKE_SPECIAL)
11785 {
11786 auto debugParams = DebugSpawnParams.WithPlayer(player);
11787 OnDebugSpawnEx(debugParams);
11788 }
11789
11790 }
11791
11792
11793 return false;
11794 }
11795
11796
11797
11798
11802
11805
11806
11807
11809 {
11810 return false;
11811 }
11812
11813
11815 {
11816 return true;
11817 }
11818
11819
11821 {
11822 return true;
11823 }
11824
11825
11826
11828 {
11829 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11831 }
11832
11835 {
11836 return null;
11837 }
11838
11840 {
11841 return false;
11842 }
11843
11845 {
11846 return false;
11847 }
11848
11852
11853
11855 {
11856 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11857 return module_repairing.CanRepair(this, item_repair_kit);
11858 }
11859
11860
11861 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11862 {
11863 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11864 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11865 }
11866
11867
11869 {
11870
11871
11872
11873
11874
11875
11876
11877
11878 return 1;
11879 }
11880
11881
11882
11884 {
11886 }
11887
11888
11889
11891 {
11893 }
11894
11895
11904 {
11905 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11906
11907 if (player)
11908 {
11909 player.MessageStatus(text);
11910 }
11911 }
11912
11913
11922 {
11923 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11924
11925 if (player)
11926 {
11927 player.MessageAction(text);
11928 }
11929 }
11930
11931
11940 {
11941 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11942
11943 if (player)
11944 {
11945 player.MessageFriendly(text);
11946 }
11947 }
11948
11949
11958 {
11959 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11960
11961 if (player)
11962 {
11963 player.MessageImportant(text);
11964 }
11965 }
11966
11968 {
11969 return true;
11970 }
11971
11972
11973 override bool KindOf(
string tag)
11974 {
11975 bool found = false;
11976 string item_name = this.
GetType();
11979
11980 int array_size = item_tag_array.Count();
11981 for (int i = 0; i < array_size; i++)
11982 {
11983 if (item_tag_array.Get(i) == tag)
11984 {
11985 found = true;
11986 break;
11987 }
11988 }
11989 return found;
11990 }
11991
11992
11994 {
11995
11996 super.OnRPC(sender, rpc_type,ctx);
11997
11998
11999 switch (rpc_type)
12000 {
12001 #ifndef SERVER
12002 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12003 Param2<bool, string> p = new Param2<bool, string>(false, "");
12004
12006 return;
12007
12008 bool play = p.param1;
12009 string soundSet = p.param2;
12010
12011 if (play)
12012 {
12014 {
12016 {
12018 }
12019 }
12020 else
12021 {
12023 }
12024 }
12025 else
12026 {
12028 }
12029
12030 break;
12031 #endif
12032
12033 }
12034
12036 {
12038 }
12039 }
12040
12041
12042
12043
12045 {
12046 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12047 return plugin.GetID(
name);
12048 }
12049
12051 {
12052 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12053 return plugin.GetName(id);
12054 }
12055
12058 {
12059
12060
12061 int varFlags;
12062 if (!ctx.
Read(varFlags))
12063 return;
12064
12065 if (varFlags & ItemVariableFlags.FLOAT)
12066 {
12068 }
12069 }
12070
12072 {
12073
12074 super.SerializeNumericalVars(floats_out);
12075
12076
12077
12079 {
12081 }
12082
12084 {
12086 }
12087
12089 {
12091 }
12092
12094 {
12099 }
12100
12102 {
12104 }
12105 }
12106
12108 {
12109
12110 super.DeSerializeNumericalVars(floats);
12111
12112
12113 int index = 0;
12114 int mask = Math.Round(floats.Get(index));
12115
12116 index++;
12117
12119 {
12121 {
12123 }
12124 else
12125 {
12126 float quantity = floats.Get(index);
12127 SetQuantity(quantity,
true,
false,
false,
false);
12128 }
12129 index++;
12130 }
12131
12133 {
12134 float wet = floats.Get(index);
12136 index++;
12137 }
12138
12140 {
12141 int liquidtype = Math.Round(floats.Get(index));
12143 index++;
12144 }
12145
12147 {
12149 index++;
12151 index++;
12153 index++;
12155 index++;
12156 }
12157
12159 {
12160 int cleanness = Math.Round(floats.Get(index));
12162 index++;
12163 }
12164 }
12165
12167 {
12168 super.WriteVarsToCTX(ctx);
12169
12170
12172 {
12174 }
12175
12177 {
12179 }
12180
12182 {
12184 }
12185
12187 {
12188 int r,g,b,a;
12194 }
12195
12197 {
12199 }
12200 }
12201
12203 {
12204 if (!super.ReadVarsFromCTX(ctx,version))
12205 return false;
12206
12207 int intValue;
12208 float value;
12209
12210 if (version < 140)
12211 {
12212 if (!ctx.
Read(intValue))
12213 return false;
12214
12215 m_VariablesMask = intValue;
12216 }
12217
12219 {
12220 if (!ctx.
Read(value))
12221 return false;
12222
12224 {
12226 }
12227 else
12228 {
12230 }
12231 }
12232
12233 if (version < 140)
12234 {
12236 {
12237 if (!ctx.
Read(value))
12238 return false;
12239 SetTemperatureDirect(value);
12240 }
12241 }
12242
12244 {
12245 if (!ctx.
Read(value))
12246 return false;
12248 }
12249
12251 {
12252 if (!ctx.
Read(intValue))
12253 return false;
12255 }
12256
12258 {
12259 int r,g,b,a;
12261 return false;
12263 return false;
12265 return false;
12267 return false;
12268
12270 }
12271
12273 {
12274 if (!ctx.
Read(intValue))
12275 return false;
12277 }
12278
12279 if (version >= 138 && version < 140)
12280 {
12282 {
12283 if (!ctx.
Read(intValue))
12284 return false;
12285 SetFrozen(intValue);
12286 }
12287 }
12288
12289 return true;
12290 }
12291
12292
12294 {
12297 {
12299 }
12300
12301 if (!super.OnStoreLoad(ctx, version))
12302 {
12304 return false;
12305 }
12306
12307 if (version >= 114)
12308 {
12309 bool hasQuickBarIndexSaved;
12310
12311 if (!ctx.
Read(hasQuickBarIndexSaved))
12312 {
12314 return false;
12315 }
12316
12317 if (hasQuickBarIndexSaved)
12318 {
12319 int itmQBIndex;
12320
12321
12322 if (!ctx.
Read(itmQBIndex))
12323 {
12325 return false;
12326 }
12327
12328 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12329 if (itmQBIndex != -1 && parentPlayer)
12330 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12331 }
12332 }
12333 else
12334 {
12335
12336 PlayerBase player;
12337 int itemQBIndex;
12338 if (version ==
int.
MAX)
12339 {
12340 if (!ctx.
Read(itemQBIndex))
12341 {
12343 return false;
12344 }
12345 }
12346 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12347 {
12348
12349 if (!ctx.
Read(itemQBIndex))
12350 {
12352 return false;
12353 }
12354 if (itemQBIndex != -1 && player)
12355 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12356 }
12357 }
12358
12359 if (version < 140)
12360 {
12361
12362 if (!LoadVariables(ctx, version))
12363 {
12365 return false;
12366 }
12367 }
12368
12369
12371 {
12373 return false;
12374 }
12375 if (version >= 132)
12376 {
12378 if (raib)
12379 {
12381 {
12383 return false;
12384 }
12385 }
12386 }
12387
12389 return true;
12390 }
12391
12392
12393
12395 {
12396 super.OnStoreSave(ctx);
12397
12398 PlayerBase player;
12399 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12400 {
12402
12403 int itemQBIndex = -1;
12404 itemQBIndex = player.FindQuickBarEntityIndex(this);
12405 ctx.
Write(itemQBIndex);
12406 }
12407 else
12408 {
12410 }
12411
12413
12415 if (raib)
12416 {
12418 }
12419 }
12420
12421
12423 {
12424 super.AfterStoreLoad();
12425
12427 {
12429 }
12430
12432 {
12435 }
12436 }
12437
12439 {
12440 super.EEOnAfterLoad();
12441
12443 {
12445 }
12446
12449 }
12450
12452 {
12453 return false;
12454 }
12455
12456
12457
12459 {
12461 {
12462 #ifdef PLATFORM_CONSOLE
12463
12465 {
12467 if (menu)
12468 {
12470 }
12471 }
12472 #endif
12473 }
12474
12476 {
12479 }
12480
12482 {
12483 SetWeightDirty();
12485 }
12487 {
12490 }
12491
12493 {
12496 }
12498 {
12501 }
12502
12503 super.OnVariablesSynchronized();
12504 }
12505
12506
12507
12509 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12510 {
12511 if (!IsServerCheck(allow_client))
12512 return false;
12513
12515 return false;
12516
12519
12520 if (value <= (min + 0.001))
12521 value = min;
12522
12523 if (value == min)
12524 {
12525 if (destroy_config)
12526 {
12527 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12528 if (dstr)
12529 {
12531 this.Delete();
12532 return true;
12533 }
12534 }
12535 else if (destroy_forced)
12536 {
12538 this.Delete();
12539 return true;
12540 }
12541
12543 }
12544
12547
12549 {
12551
12552 if (delta)
12554 }
12555
12557
12558 return false;
12559 }
12560
12561
12563 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12564 {
12566 }
12567
12569 {
12572 }
12573
12575 {
12578 }
12579
12581 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12582 {
12583 float value_clamped = Math.Clamp(value, 0, 1);
12585 SetQuantity(result, destroy_config, destroy_forced);
12586 }
12587
12588
12591 {
12593 }
12594
12596 {
12598 }
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12610 {
12611 int slot = -1;
12612 if (GetInventory())
12613 {
12614 InventoryLocation il = new InventoryLocation;
12615 GetInventory().GetCurrentInventoryLocation(il);
12617 }
12618
12620 }
12621
12623 {
12624 float quantity_max = 0;
12625
12627 {
12628 if (attSlotID != -1)
12629 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12630
12631 if (quantity_max <= 0)
12633 }
12634
12635 if (quantity_max <= 0)
12637
12638 return quantity_max;
12639 }
12640
12642 {
12644 }
12645
12647 {
12649 }
12650
12651
12653 {
12655 }
12656
12658 {
12660 }
12661
12663 {
12665 }
12666
12667
12669 {
12670
12671 float weightEx = GetWeightEx();
12672 float special = GetInventoryAndCargoWeight();
12673 return weightEx - special;
12674 }
12675
12676
12678 {
12680 }
12681
12683 {
12685 {
12686 #ifdef DEVELOPER
12687 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12688 {
12689 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12691 }
12692 #endif
12693
12694 return GetQuantity() * GetConfigWeightModified();
12695 }
12696 else if (HasEnergyManager())
12697 {
12698 #ifdef DEVELOPER
12699 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12700 {
12701 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12702 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12703 }
12704 #endif
12705 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12706 }
12707 else
12708 {
12709 #ifdef DEVELOPER
12710 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12711 {
12712 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12713 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12714 }
12715 #endif
12716 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12717 }
12718 }
12719
12722 {
12723 int item_count = 0;
12725
12726 if (GetInventory().GetCargo() != NULL)
12727 {
12728 item_count = GetInventory().GetCargo().GetItemCount();
12729 }
12730
12731 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
12732 {
12733 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
12734 if (item)
12735 item_count += item.GetNumberOfItems();
12736 }
12737 return item_count;
12738 }
12739
12742 {
12743 float weight = 0;
12744 float wetness = 1;
12745 if (include_wetness)
12748 {
12749 weight = wetness * m_ConfigWeight;
12750 }
12752 {
12753 weight = 1;
12754 }
12755 return weight;
12756 }
12757
12758
12759
12761 {
12762 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
12763 {
12764 GameInventory inv = GetInventory();
12765 array<EntityAI> items = new array<EntityAI>;
12767 for (int i = 0; i < items.Count(); i++)
12768 {
12770 if (item)
12771 {
12773 }
12774 }
12775 }
12776 }
12777
12778
12779
12780
12782 {
12783 float energy = 0;
12784 if (HasEnergyManager())
12785 {
12786 energy = GetCompEM().GetEnergy();
12787 }
12788 return energy;
12789 }
12790
12791
12793 {
12794 super.OnEnergyConsumed();
12795
12797 }
12798
12800 {
12801 super.OnEnergyAdded();
12802
12804 }
12805
12806
12808 {
12809 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12810 {
12812 {
12813 float energy_0to1 = GetCompEM().GetEnergy0To1();
12815 }
12816 }
12817 }
12818
12819
12821 {
12822 return ConfigGetFloat("heatIsolation");
12823 }
12824
12826 {
12828 }
12829
12831 {
12832 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12833 if (
GetGame().ConfigIsExisting(paramPath))
12835
12836 return 0.0;
12837 }
12838
12840 {
12841 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12842 if (
GetGame().ConfigIsExisting(paramPath))
12844
12845 return 0.0;
12846 }
12847
12848 override void SetWet(
float value,
bool allow_client =
false)
12849 {
12850 if (!IsServerCheck(allow_client))
12851 return;
12852
12855
12857
12858 m_VarWet = Math.Clamp(value, min, max);
12859
12861 {
12864 }
12865 }
12866
12867 override void AddWet(
float value)
12868 {
12870 }
12871
12873 {
12875 }
12876
12878 {
12880 }
12881
12883 {
12885 }
12886
12888 {
12890 }
12891
12893 {
12895 }
12896
12897 override void OnWetChanged(
float newVal,
float oldVal)
12898 {
12901 if (newLevel != oldLevel)
12902 {
12904 }
12905 }
12906
12908 {
12909 SetWeightDirty();
12910 }
12911
12913 {
12914 return GetWetLevelInternal(
m_VarWet);
12915 }
12916
12917
12918
12920 {
12922 }
12923
12925 {
12927 }
12928
12930 {
12932 }
12933
12935 {
12937 }
12938
12939
12940
12942 {
12943 if (ConfigIsExisting("itemModelLength"))
12944 {
12945 return ConfigGetFloat("itemModelLength");
12946 }
12947 return 0;
12948 }
12949
12951 {
12952 if (ConfigIsExisting("itemAttachOffset"))
12953 {
12954 return ConfigGetFloat("itemAttachOffset");
12955 }
12956 return 0;
12957 }
12958
12959 override void SetCleanness(
int value,
bool allow_client =
false)
12960 {
12961 if (!IsServerCheck(allow_client))
12962 return;
12963
12965
12967
12970 }
12971
12973 {
12975 }
12976
12978 {
12979 return true;
12980 }
12981
12982
12983
12984
12986 {
12988 }
12989
12991 {
12993 }
12994
12995
12996
12997
12998 override void SetColor(
int r,
int g,
int b,
int a)
12999 {
13005 }
13007 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13008 {
13013 }
13014
13016 {
13018 }
13019
13022 {
13023 int r,g,b,a;
13025 r = r/255;
13026 g = g/255;
13027 b = b/255;
13028 a = a/255;
13029 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13030 }
13031
13032
13033
13034 override void SetLiquidType(
int value,
bool allow_client =
false)
13035 {
13036 if (!IsServerCheck(allow_client))
13037 return;
13038
13043 }
13044
13046 {
13047 return ConfigGetInt("varLiquidTypeInit");
13048 }
13049
13051 {
13053 }
13054
13056 {
13058 SetFrozen(false);
13059 }
13060
13063 {
13064 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13065 }
13066
13067
13070 {
13071 PlayerBase nplayer;
13072 if (PlayerBase.CastTo(nplayer, player))
13073 {
13075
13076 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13077 }
13078 }
13079
13080
13083 {
13084 PlayerBase nplayer;
13085 if (PlayerBase.CastTo(nplayer,player))
13086 {
13087
13088 nplayer.SetEnableQuickBarEntityShortcut(this,false);
13089
13090 }
13091
13092
13093 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13094
13095
13096 if (HasEnergyManager())
13097 {
13098 GetCompEM().UpdatePlugState();
13099 }
13100 }
13101
13102
13104 {
13105 super.OnPlacementStarted(player);
13106
13108 }
13109
13110 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13111 {
13113 {
13114 m_AdminLog.OnPlacementComplete(player,
this);
13115 }
13116
13117 super.OnPlacementComplete(player, position, orientation);
13118 }
13119
13120
13121
13122
13123
13125 {
13127 {
13128 return true;
13129 }
13130 else
13131 {
13132 return false;
13133 }
13134 }
13135
13136
13138 {
13140 {
13142 }
13143 }
13144
13145
13147 {
13149 }
13150
13152 {
13154 }
13155
13156 override void InsertAgent(
int agent,
float count = 1)
13157 {
13158 if (count < 1)
13159 return;
13160
13162 }
13163
13166 {
13168 }
13169
13170
13172 {
13174 }
13175
13176
13177
13178
13179
13180
13181
13182
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
13218 {
13220 return false;
13221 return true;
13222 }
13223
13225 {
13226
13228 }
13229
13230
13233 {
13234 super.CheckForRoofLimited(timeTresholdMS);
13235
13237 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13238 {
13239 m_PreviousRoofTestTime = time;
13240 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13241 }
13242 }
13243
13244
13246 {
13248 {
13249 return 0;
13250 }
13251
13252 if (GetInventory().GetAttachmentSlotsCount() != 0)
13253 {
13254 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13255 if (filter)
13256 return filter.GetProtectionLevel(type, false, system);
13257 else
13258 return 0;
13259 }
13260
13261 string subclassPath, entryName;
13262
13263 switch (type)
13264 {
13266 entryName = "biological";
13267 break;
13269 entryName = "chemical";
13270 break;
13271 default:
13272 entryName = "biological";
13273 break;
13274 }
13275
13276 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13277
13279 }
13280
13281
13282
13285 {
13286 if (!IsMagazine())
13288
13290 }
13291
13292
13293
13294
13295
13300 {
13301 return true;
13302 }
13303
13305 {
13307 }
13308
13309
13310
13311
13312
13314 {
13315 if (parent)
13316 {
13317 if (parent.IsInherited(DayZInfected))
13318 return true;
13319
13320 if (!parent.IsRuined())
13321 return true;
13322 }
13323
13324 return true;
13325 }
13326
13328 {
13329 if (!super.CanPutAsAttachment(parent))
13330 {
13331 return false;
13332 }
13333
13334 if (!IsRuined() && !parent.IsRuined())
13335 {
13336 return true;
13337 }
13338
13339 return false;
13340 }
13341
13343 {
13344
13345
13346
13347
13348 return super.CanReceiveItemIntoCargo(item);
13349 }
13350
13352 {
13353
13354
13355
13356
13357 GameInventory attachmentInv = attachment.GetInventory();
13359 {
13360 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13361 return false;
13362 }
13363
13364 InventoryLocation loc = new InventoryLocation();
13365 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13366 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13367 return false;
13368
13369 return super.CanReceiveAttachment(attachment, slotId);
13370 }
13371
13373 {
13374 if (!super.CanReleaseAttachment(attachment))
13375 return false;
13376
13377 return GetInventory().AreChildrenAccessible();
13378 }
13379
13380
13381
13382
13383
13384
13385
13386
13387
13388
13389
13390
13391
13392
13393
13394
13395
13396
13397
13398
13399
13401 {
13402 int id = muzzle_owner.GetMuzzleID();
13403 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13404
13405 if (WPOF_array)
13406 {
13407 for (int i = 0; i < WPOF_array.Count(); i++)
13408 {
13409 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13410
13411 if (WPOF)
13412 {
13413 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13414 }
13415 }
13416 }
13417 }
13418
13419
13421 {
13422 int id = muzzle_owner.GetMuzzleID();
13424
13425 if (WPOBE_array)
13426 {
13427 for (int i = 0; i < WPOBE_array.Count(); i++)
13428 {
13429 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13430
13431 if (WPOBE)
13432 {
13433 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13434 }
13435 }
13436 }
13437 }
13438
13439
13441 {
13442 int id = muzzle_owner.GetMuzzleID();
13443 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13444
13445 if (WPOOH_array)
13446 {
13447 for (int i = 0; i < WPOOH_array.Count(); i++)
13448 {
13449 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13450
13451 if (WPOOH)
13452 {
13453 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13454 }
13455 }
13456 }
13457 }
13458
13459
13461 {
13462 int id = muzzle_owner.GetMuzzleID();
13463 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13464
13465 if (WPOOH_array)
13466 {
13467 for (int i = 0; i < WPOOH_array.Count(); i++)
13468 {
13469 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13470
13471 if (WPOOH)
13472 {
13473 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13474 }
13475 }
13476 }
13477 }
13478
13479
13481 {
13482 int id = muzzle_owner.GetMuzzleID();
13483 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13484
13485 if (WPOOH_array)
13486 {
13487 for (int i = 0; i < WPOOH_array.Count(); i++)
13488 {
13489 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13490
13491 if (WPOOH)
13492 {
13493 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13494 }
13495 }
13496 }
13497 }
13498
13499
13500
13502 {
13504 {
13505 return true;
13506 }
13507
13508 return false;
13509 }
13510
13512 {
13514 {
13515 return true;
13516 }
13517
13518 return false;
13519 }
13520
13522 {
13524 {
13525 return true;
13526 }
13527
13528 return false;
13529 }
13530
13532 {
13533 return false;
13534 }
13535
13538 {
13539 return UATimeSpent.DEFAULT_DEPLOY;
13540 }
13541
13542
13543
13544
13546 {
13548 SetSynchDirty();
13549 }
13550
13552 {
13554 }
13555
13556
13558 {
13559 return false;
13560 }
13561
13564 {
13565 string att_type = "None";
13566
13567 if (ConfigIsExisting("soundAttType"))
13568 {
13569 att_type = ConfigGetString("soundAttType");
13570 }
13571
13573 }
13574
13576 {
13578 }
13579
13580
13581
13582
13583
13589
13591 {
13594
13596 }
13597
13598
13600 {
13602 return;
13603
13605
13608
13611
13612 SoundParameters params = new SoundParameters();
13616 }
13617
13618
13620 {
13622 return;
13623
13625 SetSynchDirty();
13626
13629 }
13630
13631
13633 {
13635 return;
13636
13638 SetSynchDirty();
13639
13642 }
13643
13645 {
13647 }
13648
13650 {
13652 }
13653
13656 {
13657 if (!
GetGame().IsDedicatedServer())
13658 {
13659 if (ConfigIsExisting("attachSoundSet"))
13660 {
13661 string cfg_path = "";
13662 string soundset = "";
13663 string type_name =
GetType();
13664
13667 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13668 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13669
13670 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13671 {
13672 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13673 {
13674 if (cfg_slot_array[i] == slot_type)
13675 {
13676 soundset = cfg_soundset_array[i];
13677 break;
13678 }
13679 }
13680 }
13681
13682 if (soundset != "")
13683 {
13684 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
13686 }
13687 }
13688 }
13689 }
13690
13692 {
13693
13694 }
13695
13696 void OnApply(PlayerBase player);
13697
13699 {
13700 return 1.0;
13701 };
13702
13704 {
13706 }
13707
13709 {
13711 }
13712
13714
13716 {
13717 SetDynamicPhysicsLifeTime(0.01);
13719 }
13720
13722 {
13723 array<string> zone_names = new array<string>;
13724 GetDamageZones(zone_names);
13725 for (int i = 0; i < zone_names.Count(); i++)
13726 {
13727 SetHealthMax(zone_names.Get(i),"Health");
13728 }
13729 SetHealthMax("","Health");
13730 }
13731
13734 {
13735 float global_health = GetHealth01("","Health");
13736 array<string> zones = new array<string>;
13737 GetDamageZones(zones);
13738
13739 for (int i = 0; i < zones.Count(); i++)
13740 {
13741 SetHealth01(zones.Get(i),"Health",global_health);
13742 }
13743 }
13744
13747 {
13748 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13749 }
13750
13752 {
13753 if (!hasRootAsPlayer)
13754 {
13755 if (refParentIB)
13756 {
13757
13758 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13759 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13760
13761 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13762 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13763
13766 }
13767 else
13768 {
13769
13772 }
13773 }
13774 }
13775
13777 {
13779 {
13780 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13781 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13782 {
13783 float heatPermCoef = 1.0;
13785 while (ent)
13786 {
13787 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13788 ent = ent.GetHierarchyParent();
13789 }
13790
13791 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13792 }
13793 }
13794 }
13795
13797 {
13798
13799 EntityAI parent = GetHierarchyParent();
13800 if (!parent)
13801 {
13802 hasParent = false;
13803 hasRootAsPlayer = false;
13804 }
13805 else
13806 {
13807 hasParent = true;
13808 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13809 refParentIB =
ItemBase.Cast(parent);
13810 }
13811 }
13812
13813 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13814 {
13815
13816 }
13817
13819 {
13820
13821 return false;
13822 }
13823
13825 {
13826
13827
13828 return false;
13829 }
13830
13832 {
13833
13834 return false;
13835 }
13836
13839 {
13840 return !GetIsFrozen() &&
IsOpen();
13841 }
13842
13844 {
13845 bool hasParent = false, hasRootAsPlayer = false;
13847
13848 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13849 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13850
13851 if (wwtu || foodDecay)
13852 {
13856
13857 if (processWetness || processTemperature || processDecay)
13858 {
13860
13861 if (processWetness)
13862 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13863
13864 if (processTemperature)
13866
13867 if (processDecay)
13868 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13869 }
13870 }
13871 }
13872
13875 {
13877 }
13878
13880 {
13883
13884 return super.GetTemperatureFreezeThreshold();
13885 }
13886
13888 {
13891
13892 return super.GetTemperatureThawThreshold();
13893 }
13894
13896 {
13899
13900 return super.GetItemOverheatThreshold();
13901 }
13902
13904 {
13906 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13907
13908 return super.GetTemperatureFreezeTime();
13909 }
13910
13912 {
13914 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13915
13916 return super.GetTemperatureThawTime();
13917 }
13918
13923
13925 {
13926 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13927 }
13928
13930 {
13931 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13932 }
13933
13936 {
13938 }
13939
13941 {
13943 }
13944
13946 {
13948 }
13949
13952 {
13953 return null;
13954 }
13955
13958 {
13959 return false;
13960 }
13961
13963 {
13965 {
13968 if (!trg)
13969 {
13971 explosive = this;
13972 }
13973
13974 explosive.PairRemote(trg);
13976
13977 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13978 trg.SetPersistentPairID(persistentID);
13979 explosive.SetPersistentPairID(persistentID);
13980
13981 return true;
13982 }
13983 return false;
13984 }
13985
13988 {
13989 float ret = 1.0;
13992 ret *= GetHealth01();
13993
13994 return ret;
13995 }
13996
13997 #ifdef DEVELOPER
13998 override void SetDebugItem()
13999 {
14000 super.SetDebugItem();
14001 _itemBase = this;
14002 }
14003
14005 {
14006 string text = super.GetDebugText();
14007
14009 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14010
14011 return text;
14012 }
14013 #endif
14014
14016 {
14017 return true;
14018 }
14019
14021
14023
14025 {
14028 }
14029
14030
14038
14054}
14055
14057{
14059 if (entity)
14060 {
14061 bool is_item = entity.IsInherited(
ItemBase);
14062 if (is_item && full_quantity)
14063 {
14066 }
14067 }
14068 else
14069 {
14071 return NULL;
14072 }
14073 return entity;
14074}
14075
14077{
14078 if (item)
14079 {
14080 if (health > 0)
14081 item.SetHealth("", "", health);
14082
14083 if (item.CanHaveTemperature())
14084 {
14086 if (item.CanFreeze())
14087 item.SetFrozen(false);
14088 }
14089
14090 if (item.HasEnergyManager())
14091 {
14092 if (quantity >= 0)
14093 {
14094 item.GetCompEM().SetEnergy0To1(quantity);
14095 }
14096 else
14097 {
14099 }
14100 }
14101 else if (item.IsMagazine())
14102 {
14103 Magazine mag = Magazine.Cast(item);
14104 if (quantity >= 0)
14105 {
14106 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14107 }
14108 else
14109 {
14111 }
14112
14113 }
14114 else
14115 {
14116 if (quantity >= 0)
14117 {
14118 item.SetQuantityNormalized(quantity, false);
14119 }
14120 else
14121 {
14123 }
14124
14125 }
14126 }
14127}
14128
14129#ifdef DEVELOPER
14131#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
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 CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
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
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)
void StartItemSoundServer(int id)
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()
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)
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
proto native void GizmoSelectObject(Object object)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
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 bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
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 void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, 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)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
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
proto native CGame GetGame()
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
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
class JsonUndergroundAreaTriggerData GetPosition
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.