9265{
9267 {
9268 return true;
9269 }
9270};
9271
9273{
9274
9275};
9276
9277
9278
9280{
9284
9286
9289
9290
9291
9292
9293
9302
9308
9313
9318
9339 protected bool m_IsResultOfSplit
9340
9342
9347
9348
9349
9351
9355
9356
9357
9359
9362
9363
9364
9370
9371
9379
9382
9383
9385
9386
9388
9389
9394
9395
9400
9402
9403
9405
9406
9408 {
9413
9414 if (!
g_Game.IsDedicatedServer())
9415 {
9417 {
9419
9421 {
9423 }
9424 }
9425
9428 }
9429
9430 m_OldLocation = null;
9431
9433 {
9435 }
9436
9437 if (ConfigIsExisting("headSelectionsToHide"))
9438 {
9441 }
9442
9444 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9445 {
9447 }
9448
9450
9451 m_IsResultOfSplit = false;
9452
9454 }
9455
9457 {
9458 super.InitItemVariables();
9459
9465 m_Count = ConfigGetInt(
"count");
9466
9469
9474
9477
9482
9494
9498
9499
9502 if (ConfigIsExisting("canBeSplit"))
9503 {
9506 }
9507
9509 if (ConfigIsExisting("itemBehaviour"))
9511
9512
9515 RegisterNetSyncVariableInt("m_VarLiquidType");
9516 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9517
9518 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9519 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9520 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9521
9522 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9523 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9524 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9525 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9526
9527 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9528 RegisterNetSyncVariableBool("m_IsTakeable");
9529 RegisterNetSyncVariableBool("m_IsHologram");
9530
9533 {
9536 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9537 }
9538
9540
9542 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9544
9546 }
9547
9549 {
9551 }
9552
9554 {
9557 {
9562 }
9563 }
9564
9565 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9566 {
9568 {
9571 }
9572
9574 }
9575
9577 {
9583 }
9584
9586
9588 {
9590
9591 if (!action)
9592 {
9593 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9594 return;
9595 }
9596
9598 if (!ai)
9599 {
9601 return;
9602 }
9603
9605 if (!action_array)
9606 {
9607 action_array = new array<ActionBase_Basic>;
9609 }
9610 if (LogManager.IsActionLogEnable())
9611 {
9612 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9613 }
9614
9615 if (action_array.Find(action) != -1)
9616 {
9617 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9618 }
9619 else
9620 {
9621 action_array.Insert(action);
9622 }
9623 }
9624
9626 {
9627 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9628 ActionBase action = player.GetActionManager().GetAction(actionName);
9631
9632 if (action_array)
9633 {
9634 action_array.RemoveItem(action);
9635 }
9636 }
9637
9638
9639
9641 {
9642 ActionOverrideData overrideData = new ActionOverrideData();
9646
9648 if (!actionMap)
9649 {
9652 }
9653
9654 actionMap.Insert(this.
Type(), overrideData);
9655
9656 }
9657
9659
9661
9662
9664 {
9667
9670
9671 string config_to_search = "CfgVehicles";
9672 string muzzle_owner_config;
9673
9675 {
9676 if (IsInherited(Weapon))
9677 config_to_search = "CfgWeapons";
9678
9679 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9680
9681 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9682
9683 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9684
9685 if (config_OnFire_subclass_count > 0)
9686 {
9687 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9688
9689 for (int i = 0; i < config_OnFire_subclass_count; i++)
9690 {
9691 string particle_class = "";
9692 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9693 string config_OnFire_entry = config_OnFire_class + particle_class;
9694 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9695 WPOF_array.Insert(WPOF);
9696 }
9697
9698
9700 }
9701 }
9702
9704 {
9705 config_to_search = "CfgWeapons";
9706 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9707
9708 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9709
9710 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9711
9712 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9713 {
9714 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9715
9716 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9717 {
9718 string particle_class2 = "";
9719 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9720 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9721 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9722 WPOBE_array.Insert(WPOBE);
9723 }
9724
9725
9727 }
9728 }
9729 }
9730
9731
9733 {
9736
9738 {
9739 string config_to_search = "CfgVehicles";
9740
9741 if (IsInherited(Weapon))
9742 config_to_search = "CfgWeapons";
9743
9744 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9745 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9746
9747 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9748 {
9749
9751
9753 {
9755 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9757 return;
9758 }
9759
9762
9763
9764
9765 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9766 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9767
9768 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9769 {
9770 string particle_class = "";
9771 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9772 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9773 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9774
9775 if (entry_type == CT_CLASS)
9776 {
9777 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9778 WPOOH_array.Insert(WPOF);
9779 }
9780 }
9781
9782
9784 }
9785 }
9786 }
9787
9789 {
9791 }
9792
9794 {
9796 {
9798
9801
9804
9805 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9806 }
9807 }
9808
9810 {
9812 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9813
9815 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9816
9818 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9819
9821 {
9823 }
9824 }
9825
9827 {
9829 }
9830
9832 {
9835 else
9837
9839 {
9842 }
9843 else
9844 {
9847
9850 }
9851
9853 }
9854
9856 {
9858 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9859 }
9860
9862 {
9864 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9866 }
9867
9869 {
9871 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9872 }
9873
9875 {
9878
9879 OverheatingParticle OP = new OverheatingParticle();
9884
9886 }
9887
9889 {
9892
9893 return -1;
9894 }
9895
9897 {
9899 {
9902
9903 for (int i = count; i > 0; --i)
9904 {
9905 int id = i - 1;
9908
9911
9912 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9913 {
9914 if (p)
9915 {
9918 }
9919 }
9920 }
9921 }
9922 }
9923
9925 {
9927 {
9929 {
9930 int id = i - 1;
9932
9933 if (OP)
9934 {
9936
9937 if (p)
9938 {
9940 }
9941
9942 delete OP;
9943 }
9944 }
9945
9948 }
9949 }
9950
9953 {
9954 return 0.0;
9955 }
9956
9957
9959 {
9960 return 250;
9961 }
9962
9964 {
9965 return 0;
9966 }
9967
9970 {
9972 return true;
9973
9974 return false;
9975 }
9976
9979 {
9982
9984 {
9986 }
9987 else
9988 {
9989
9991 }
9992
9994 }
9995
10002 {
10003 return -1;
10004 }
10005
10006
10007
10008
10010 {
10012 {
10013 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10014 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10015
10016 if (r_index >= 0)
10017 {
10018 InventoryLocation r_il = new InventoryLocation;
10019 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10020
10021 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10024 {
10025 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10026 }
10028 {
10029 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10030 }
10031
10032 }
10033
10034 player.GetHumanInventory().ClearUserReservedLocation(this);
10035 }
10036
10039 }
10040
10041
10042
10043
10045 {
10046 return ItemBase.m_DebugActionsMask;
10047 }
10048
10050 {
10051 return ItemBase.m_DebugActionsMask & mask;
10052 }
10053
10055 {
10056 ItemBase.m_DebugActionsMask = mask;
10057 }
10058
10060 {
10061 ItemBase.m_DebugActionsMask |= mask;
10062 }
10063
10065 {
10066 ItemBase.m_DebugActionsMask &= ~mask;
10067 }
10068
10070 {
10072 {
10074 }
10075 else
10076 {
10078 }
10079 }
10080
10081
10083 {
10084 if (GetEconomyProfile())
10085 {
10086 float q_max = GetEconomyProfile().GetQuantityMax();
10087 if (q_max > 0)
10088 {
10089 float q_min = GetEconomyProfile().GetQuantityMin();
10090 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10091
10093 {
10094 ComponentEnergyManager comp = GetCompEM();
10096 {
10098 }
10099 }
10101 {
10103
10104 }
10105
10106 }
10107 }
10108 }
10109
10112 {
10113 EntityAI parent = GetHierarchyParent();
10114
10115 if (parent)
10116 {
10117 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10118 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10119 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10120 }
10121 }
10122
10125 {
10126 EntityAI parent = GetHierarchyParent();
10127
10128 if (parent)
10129 {
10130 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10131 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10132 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10133 }
10134 }
10135
10137 {
10138
10139
10140
10141
10143
10145 {
10146 if (ScriptInputUserData.CanStoreInputUserData())
10147 {
10148 ScriptInputUserData ctx = new ScriptInputUserData;
10154 ctx.
Write(use_stack_max);
10157
10159 {
10160 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10161 }
10162 }
10163 }
10164 else if (!
g_Game.IsMultiplayer())
10165 {
10167 }
10168 }
10169
10171 {
10173 }
10174
10176 {
10178 }
10179
10181 {
10183 }
10184
10186 {
10187
10188 return false;
10189 }
10190
10192 {
10193 return false;
10194 }
10195
10199 {
10200 return false;
10201 }
10202
10204 {
10205 return "";
10206 }
10207
10209
10211 {
10212 return false;
10213 }
10214
10216 {
10217 return true;
10218 }
10219
10220
10221
10223 {
10224 return true;
10225 }
10226
10228 {
10229 return true;
10230 }
10231
10233 {
10234 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10236 }
10237
10239 {
10241 }
10242
10244 {
10246 if (!is_being_placed)
10248 SetSynchDirty();
10249 }
10250
10251
10253
10255 {
10257 }
10258
10260 {
10262 }
10263
10265 {
10266 return 1;
10267 }
10268
10270 {
10271 return false;
10272 }
10273
10275 {
10277 SetSynchDirty();
10278 }
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10315 {
10316 super.OnMovedInsideCargo(container);
10317
10318 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10319 }
10320
10321 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10322 {
10323 super.EEItemLocationChanged(oldLoc, newLoc);
10324
10325 PlayerBase newPlayer = null;
10326 PlayerBase oldPlayer = null;
10327
10328 if (newLoc.GetParent())
10329 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10330
10331 if (oldLoc.GetParent())
10332 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10333
10335 {
10336 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10337
10338 if (rIndex >= 0)
10339 {
10340 InventoryLocation rIl = new InventoryLocation;
10341 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10342
10343 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10346 {
10347 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10348 }
10350 {
10352 }
10353
10354 }
10355 }
10356
10358 {
10359 if (newPlayer)
10360 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10361
10362 if (newPlayer == oldPlayer)
10363 {
10364 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10365 {
10367 {
10368 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10369 {
10370 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10371 }
10372 }
10373 else
10374 {
10375 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10376 }
10377 }
10378
10379 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10380 {
10381 int type = oldLoc.GetType();
10383 {
10384 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10385 }
10387 {
10388 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10389 }
10390 }
10391 if (!m_OldLocation)
10392 {
10393 m_OldLocation = new InventoryLocation;
10394 }
10395 m_OldLocation.Copy(oldLoc);
10396 }
10397 else
10398 {
10399 if (m_OldLocation)
10400 {
10401 m_OldLocation.Reset();
10402 }
10403 }
10404
10405 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10406 }
10407 else
10408 {
10409 if (newPlayer)
10410 {
10411 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10412 if (resIndex >= 0)
10413 {
10414 InventoryLocation il = new InventoryLocation;
10415 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10417 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10420 {
10421 il.
GetParent().GetOnReleaseLock().Invoke(it);
10422 }
10424 {
10426 }
10427
10428 }
10429 }
10431 {
10432
10434 }
10435
10436 if (m_OldLocation)
10437 {
10438 m_OldLocation.Reset();
10439 }
10440 }
10441
10443 {
10444 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10445 }
10446
10448 {
10449 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10450 }
10451 }
10452
10453 override void EOnContact(IEntity other, Contact extra)
10454 {
10456 {
10457 int liquidType = -1;
10459 if (impactSpeed > 0.0)
10460 {
10462 #ifndef SERVER
10464 #else
10466 SetSynchDirty();
10467 #endif
10469 }
10470 }
10471
10472 #ifdef SERVER
10473 if (GetCompEM() && GetCompEM().IsPlugged())
10474 {
10475 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10476 GetCompEM().UnplugThis();
10477 }
10478 #endif
10479 }
10480
10482
10484 {
10486 }
10487
10489 {
10490
10491 }
10492
10494 {
10495 super.OnItemLocationChanged(old_owner, new_owner);
10496
10497 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10498 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10499
10500 if (!relatedPlayer && playerNew)
10501 relatedPlayer = playerNew;
10502
10503 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10504 {
10506 if (actionMgr)
10507 {
10508 ActionBase currentAction = actionMgr.GetRunningAction();
10509 if (currentAction)
10511 }
10512 }
10513
10514 Man ownerPlayerOld = null;
10515 Man ownerPlayerNew = null;
10516
10517 if (old_owner)
10518 {
10519 if (old_owner.
IsMan())
10520 {
10521 ownerPlayerOld = Man.Cast(old_owner);
10522 }
10523 else
10524 {
10525 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10526 }
10527 }
10528 else
10529 {
10531 {
10533
10534 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10535 {
10536 GetCompEM().UnplugThis();
10537 }
10538 }
10539 }
10540
10541 if (new_owner)
10542 {
10543 if (new_owner.
IsMan())
10544 {
10545 ownerPlayerNew = Man.Cast(new_owner);
10546 }
10547 else
10548 {
10549 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10550 }
10551 }
10552
10553 if (ownerPlayerOld != ownerPlayerNew)
10554 {
10555 if (ownerPlayerOld)
10556 {
10557 array<EntityAI> subItemsExit = new array<EntityAI>;
10559 for (int i = 0; i < subItemsExit.Count(); i++)
10560 {
10563 }
10564 }
10565
10566 if (ownerPlayerNew)
10567 {
10568 array<EntityAI> subItemsEnter = new array<EntityAI>;
10570 for (int j = 0; j < subItemsEnter.Count(); j++)
10571 {
10574 }
10575 }
10576 }
10577 else if (ownerPlayerNew != null)
10578 {
10579 PlayerBase nplayer;
10580 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10581 {
10582 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10584 for (int k = 0; k < subItemsUpdate.Count(); k++)
10585 {
10587 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10588 }
10589 }
10590 }
10591
10592 if (old_owner)
10593 old_owner.OnChildItemRemoved(this);
10594 if (new_owner)
10595 new_owner.OnChildItemReceived(this);
10596 }
10597
10598
10600 {
10601 super.EEDelete(parent);
10602 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10603 if (player)
10604 {
10606
10607 if (player.IsAlive())
10608 {
10609 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10610 if (r_index >= 0)
10611 {
10612 InventoryLocation r_il = new InventoryLocation;
10613 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10614
10615 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10618 {
10619 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10620 }
10622 {
10623 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10624 }
10625
10626 }
10627
10628 player.RemoveQuickBarEntityShortcut(this);
10629 }
10630 }
10631 }
10632
10634 {
10635 super.EEKilled(killer);
10636
10639 {
10640 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10641 {
10642 if (IsMagazine())
10643 {
10644 if (Magazine.Cast(this).GetAmmoCount() > 0)
10645 {
10647 }
10648 }
10649 else
10650 {
10652 }
10653 }
10654 }
10655 }
10656
10658 {
10659 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10660
10661 super.OnWasAttached(parent, slot_id);
10662
10665
10668 }
10669
10671 {
10672 super.OnWasDetached(parent, slot_id);
10673
10676
10679 }
10680
10682 {
10683 int idx;
10686
10687 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10688 if (inventory_slots.Count() < 1)
10689 {
10690 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10691 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10692 }
10693 else
10694 {
10695 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10696 }
10697
10698 idx = inventory_slots.Find(slot);
10699 if (idx < 0)
10700 return "";
10701
10702 return attach_types.Get(idx);
10703 }
10704
10706 {
10707 int idx = -1;
10708 string slot;
10709
10712
10713 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10714 if (inventory_slots.Count() < 1)
10715 {
10716 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10717 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10718 }
10719 else
10720 {
10721 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10722 if (detach_types.Count() < 1)
10723 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10724 }
10725
10726 for (int i = 0; i < inventory_slots.Count(); i++)
10727 {
10728 slot = inventory_slots.Get(i);
10729 }
10730
10731 if (slot != "")
10732 {
10733 if (detach_types.Count() == 1)
10734 idx = 0;
10735 else
10736 idx = inventory_slots.Find(slot);
10737 }
10738 if (idx < 0)
10739 return "";
10740
10741 return detach_types.Get(idx);
10742 }
10743
10745 {
10746
10748
10749
10750 float min_time = 1;
10751 float max_time = 3;
10752 float delay = Math.RandomFloat(min_time, max_time);
10753
10754 explode_timer.Run(delay, this, "DoAmmoExplosion");
10755 }
10756
10758 {
10759 Magazine magazine = Magazine.Cast(this);
10760 int pop_sounds_count = 6;
10761 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10762
10763
10764 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10765 string sound_name = pop_sounds[ sound_idx ];
10766 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10767
10768
10769 magazine.ServerAddAmmoCount(-1);
10770
10771
10772 float min_temp_to_explode = 100;
10773
10774 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10775 {
10777 }
10778 }
10779
10780
10781 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10782 {
10783 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10784
10785 const int CHANCE_DAMAGE_CARGO = 4;
10786 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10787 const int CHANCE_DAMAGE_NOTHING = 2;
10788
10790 {
10791 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10792 int chances;
10793 int rnd;
10794
10795 if (GetInventory().GetCargo())
10796 {
10797 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10798 rnd = Math.RandomInt(0,chances);
10799
10800 if (rnd < CHANCE_DAMAGE_CARGO)
10801 {
10803 }
10804 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10805 {
10807 }
10808 }
10809 else
10810 {
10811 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10812 rnd = Math.RandomInt(0,chances);
10813
10814 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10815 {
10817 }
10818 }
10819 }
10820 }
10821
10823 {
10824 CargoBase cargo = GetInventory().GetCargo();
10825 if (cargo)
10826 {
10828 if (item_count > 0)
10829 {
10830 int random_pick = Math.RandomInt(0, item_count);
10832 if (!item.IsExplosive())
10833 {
10834 item.AddHealth("","",damage);
10835 return true;
10836 }
10837 }
10838 }
10839 return false;
10840 }
10841
10843 {
10844 GameInventory inventory = GetInventory();
10846 if (attachment_count > 0)
10847 {
10848 int random_pick = Math.RandomInt(0, attachment_count);
10850 if (!attachment.IsExplosive())
10851 {
10852 attachment.AddHealth("","",damage);
10853 return true;
10854 }
10855 }
10856 return false;
10857 }
10858
10860 {
10862 }
10863
10865 {
10867 return GetInventory().CanRemoveEntity();
10868
10869 return false;
10870 }
10871
10873 {
10874
10876 return false;
10877
10878
10880 return false;
10881
10882
10883
10885 if (delta == 0)
10886 return false;
10887
10888
10889 return true;
10890 }
10891
10893 {
10895 {
10896 if (ScriptInputUserData.CanStoreInputUserData())
10897 {
10898 ScriptInputUserData ctx = new ScriptInputUserData;
10903 ctx.
Write(destination_entity);
10905 ctx.
Write(slot_id);
10907 }
10908 }
10909 else if (!
g_Game.IsMultiplayer())
10910 {
10912 }
10913 }
10914
10916 {
10917 float split_quantity_new;
10921 InventoryLocation loc = new InventoryLocation;
10922
10923 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10924 {
10926 split_quantity_new = stack_max;
10927 else
10929
10931 {
10932 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10933 if (new_item)
10934 {
10935 new_item.SetResultOfSplit(true);
10936 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10938 new_item.
SetQuantity(split_quantity_new,
false,
true);
10939 }
10940 }
10941 }
10942 else if (destination_entity && slot_id == -1)
10943 {
10944 if (quantity > stack_max)
10945 split_quantity_new = stack_max;
10946 else
10947 split_quantity_new = quantity;
10948
10950 {
10951 GameInventory destinationInventory = destination_entity.GetInventory();
10953 {
10956 }
10957
10958 if (new_item)
10959 {
10960 new_item.SetResultOfSplit(true);
10961 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10963 new_item.
SetQuantity(split_quantity_new,
false,
true);
10964 }
10965 }
10966 }
10967 else
10968 {
10969 if (stack_max != 0)
10970 {
10972 {
10974 }
10975
10976 if (split_quantity_new == 0)
10977 {
10978 if (!
g_Game.IsMultiplayer())
10979 player.PhysicalPredictiveDropItem(this);
10980 else
10981 player.ServerDropEntity(this);
10982 return;
10983 }
10984
10986 {
10988
10989 if (new_item)
10990 {
10991 new_item.SetResultOfSplit(true);
10992 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10995 new_item.PlaceOnSurface();
10996 }
10997 }
10998 }
10999 }
11000 }
11001
11003 {
11004 float split_quantity_new;
11008 InventoryLocation loc = new InventoryLocation;
11009
11010 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11011 {
11013 split_quantity_new = stack_max;
11014 else
11016
11018 {
11019 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11020 if (new_item)
11021 {
11022 new_item.SetResultOfSplit(true);
11023 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11025 new_item.
SetQuantity(split_quantity_new,
false,
true);
11026 }
11027 }
11028 }
11029 else if (destination_entity && slot_id == -1)
11030 {
11031 if (quantity > stack_max)
11032 split_quantity_new = stack_max;
11033 else
11034 split_quantity_new = quantity;
11035
11037 {
11038 GameInventory destinationInventory = destination_entity.GetInventory();
11040 {
11043 }
11044
11045 if (new_item)
11046 {
11047 new_item.SetResultOfSplit(true);
11048 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11050 new_item.
SetQuantity(split_quantity_new,
false,
true);
11051 }
11052 }
11053 }
11054 else
11055 {
11056 if (stack_max != 0)
11057 {
11059 {
11061 }
11062
11064 {
11066
11067 if (new_item)
11068 {
11069 new_item.SetResultOfSplit(true);
11070 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11073 new_item.PlaceOnSurface();
11074 }
11075 }
11076 }
11077 }
11078 }
11079
11081 {
11083 {
11084 if (ScriptInputUserData.CanStoreInputUserData())
11085 {
11086 ScriptInputUserData ctx = new ScriptInputUserData;
11091 dst.WriteToContext(ctx);
11093 }
11094 }
11095 else if (!
g_Game.IsMultiplayer())
11096 {
11098 }
11099 }
11100
11102 {
11104 {
11105 if (ScriptInputUserData.CanStoreInputUserData())
11106 {
11107 ScriptInputUserData ctx = new ScriptInputUserData;
11112 ctx.
Write(destination_entity);
11118 }
11119 }
11120 else if (!
g_Game.IsMultiplayer())
11121 {
11123 }
11124 }
11125
11127 {
11129 }
11130
11132 {
11134 float split_quantity_new;
11136 if (dst.IsValid())
11137 {
11138 int slot_id = dst.GetSlot();
11140
11141 if (quantity > stack_max)
11142 split_quantity_new = stack_max;
11143 else
11144 split_quantity_new = quantity;
11145
11147 {
11149
11150 if (new_item)
11151 {
11152 new_item.SetResultOfSplit(true);
11153 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11155 new_item.
SetQuantity(split_quantity_new,
false,
true);
11156 }
11157
11158 return new_item;
11159 }
11160 }
11161
11162 return null;
11163 }
11164
11166 {
11168 float split_quantity_new;
11170 if (destination_entity)
11171 {
11173 if (quantity > stackable)
11174 split_quantity_new = stackable;
11175 else
11176 split_quantity_new = quantity;
11177
11179 {
11180 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11181 if (new_item)
11182 {
11183 new_item.SetResultOfSplit(true);
11184 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11186 new_item.
SetQuantity(split_quantity_new,
false,
true);
11187 }
11188 }
11189 }
11190 }
11191
11193 {
11195 {
11196 if (ScriptInputUserData.CanStoreInputUserData())
11197 {
11198 ScriptInputUserData ctx = new ScriptInputUserData;
11203 ItemBase destination_entity =
this;
11204 ctx.
Write(destination_entity);
11208 }
11209 }
11210 else if (!
g_Game.IsMultiplayer())
11211 {
11213 }
11214 }
11215
11217 {
11219 float split_quantity_new;
11221 if (player)
11222 {
11224 if (quantity > stackable)
11225 split_quantity_new = stackable;
11226 else
11227 split_quantity_new = quantity;
11228
11230 {
11231 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11232 new_item =
ItemBase.Cast(in_hands);
11233 if (new_item)
11234 {
11235 new_item.SetResultOfSplit(true);
11236 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11238 new_item.SetQuantity(split_quantity_new, false, true);
11239 }
11240 }
11241 }
11242 }
11243
11245 {
11247 float split_quantity_new = Math.Floor(quantity * 0.5);
11248
11250 return;
11251
11253
11254 if (new_item)
11255 {
11256 if (new_item.GetQuantityMax() < split_quantity_new)
11257 {
11258 split_quantity_new = new_item.GetQuantityMax();
11259 }
11260
11261 new_item.SetResultOfSplit(true);
11262 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11263
11265 {
11268 }
11269 else
11270 {
11272 new_item.
SetQuantity(split_quantity_new,
false,
true);
11273 }
11274 }
11275 }
11276
11278 {
11280 float split_quantity_new = Math.Floor(quantity / 2);
11281
11283 return;
11284
11285 InventoryLocation invloc = new InventoryLocation;
11287
11289 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11290
11291 if (new_item)
11292 {
11293 if (new_item.GetQuantityMax() < split_quantity_new)
11294 {
11295 split_quantity_new = new_item.GetQuantityMax();
11296 }
11298 {
11301 }
11302 else if (split_quantity_new > 1)
11303 {
11305 new_item.
SetQuantity(split_quantity_new,
false,
true);
11306 }
11307 }
11308 }
11309
11312 {
11313 SetWeightDirty();
11315
11316 if (parent)
11317 parent.OnAttachmentQuantityChangedEx(this, delta);
11318
11320 {
11322 {
11324 }
11326 {
11327 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11329 }
11330 }
11331 }
11332
11335 {
11336
11337 }
11338
11341 {
11343 }
11344
11346 {
11347 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11348
11350 {
11351 if (newLevel == GameConstants.STATE_RUINED)
11352 {
11354 EntityAI parent = GetHierarchyParent();
11355 if (parent && parent.IsFireplace())
11356 {
11357 CargoBase cargo = GetInventory().GetCargo();
11358 if (cargo)
11359 {
11361 {
11363 }
11364 }
11365 }
11366 }
11367
11369 {
11370
11372 return;
11373 }
11374
11375 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11376 {
11378 }
11379 }
11380 }
11381
11382
11384 {
11385 super.OnRightClick();
11386
11388 {
11390 {
11391 if (ScriptInputUserData.CanStoreInputUserData())
11392 {
11393 EntityAI root = GetHierarchyRoot();
11394 Man playerOwner = GetHierarchyRootPlayer();
11395 InventoryLocation dst = new InventoryLocation;
11396
11397
11398 if (!playerOwner && root && root == this)
11399 {
11401 }
11402 else
11403 {
11404
11405 GetInventory().GetCurrentInventoryLocation(dst);
11407 {
11408 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11410 {
11412 }
11413 else
11414 {
11416
11417
11418 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11419 {
11421 }
11422 else
11423 {
11424 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11425 }
11426 }
11427 }
11428 }
11429
11430 ScriptInputUserData ctx = new ScriptInputUserData;
11438 }
11439 }
11440 else if (!
g_Game.IsMultiplayer())
11441 {
11443 }
11444 }
11445 }
11446
11448 {
11449 if (root)
11450 {
11451 vector m4[4];
11452 root.GetTransform(m4);
11453 dst.SetGround(this, m4);
11454 }
11455 else
11456 {
11457 GetInventory().GetCurrentInventoryLocation(dst);
11458 }
11459 }
11460
11461 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11462 {
11463
11464 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11465 return false;
11466
11467 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11468 return false;
11469
11470
11472 return false;
11473
11474
11475 Magazine mag = Magazine.Cast(this);
11476 if (mag)
11477 {
11478 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11479 return false;
11480
11481 if (stack_max_limit)
11482 {
11483 Magazine other_mag = Magazine.Cast(other_item);
11484 if (other_item)
11485 {
11486 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11487 return false;
11488 }
11489
11490 }
11491 }
11492 else
11493 {
11494
11496 return false;
11497
11499 return false;
11500 }
11501
11502 PlayerBase player = null;
11503 if (CastTo(player, GetHierarchyRootPlayer()))
11504 {
11505 if (player.GetInventory().HasAttachment(this))
11506 return false;
11507
11508 if (player.IsItemsToDelete())
11509 return false;
11510 }
11511
11512 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11513 return false;
11514
11515 int slotID;
11517 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11518 return false;
11519
11520 return true;
11521 }
11522
11524 {
11526 }
11527
11529 {
11530 return m_IsResultOfSplit;
11531 }
11532
11534 {
11535 m_IsResultOfSplit = value;
11536 }
11537
11539 {
11541 }
11542
11544 {
11545 float other_item_quantity = other_item.GetQuantity();
11546 float this_free_space;
11547
11549
11551
11552 if (other_item_quantity > this_free_space)
11553 {
11554 return this_free_space;
11555 }
11556 else
11557 {
11558 return other_item_quantity;
11559 }
11560 }
11561
11563 {
11565 }
11566
11568 {
11570 return;
11571
11572 if (!IsMagazine() && other_item)
11573 {
11575 if (quantity_used != 0)
11576 {
11577 float hp1 = GetHealth01("","");
11578 float hp2 = other_item.GetHealth01("","");
11579 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11580 hpResult = hpResult / (
GetQuantity() + quantity_used);
11581
11582 hpResult *= GetMaxHealth();
11583 Math.Round(hpResult);
11584 SetHealth("", "Health", hpResult);
11585
11587 other_item.AddQuantity(-quantity_used);
11588 }
11589 }
11591 }
11592
11594 {
11595 #ifdef SERVER
11596 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11597 GetHierarchyParent().IncreaseLifetimeUp();
11598 #endif
11599 };
11600
11602 {
11603 PlayerBase p = PlayerBase.Cast(player);
11604
11605 array<int> recipesIds = p.m_Recipes;
11606 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11607 if (moduleRecipesManager)
11608 {
11609 EntityAI itemInHands = player.GetEntityInHands();
11610 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11611 }
11612
11613 for (int i = 0;i < recipesIds.Count(); i++)
11614 {
11615 int key = recipesIds.Get(i);
11616 string recipeName = moduleRecipesManager.GetRecipeName(key);
11618 }
11619 }
11620
11621
11622 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11623 {
11624 super.GetDebugActions(outputList);
11625
11626
11632
11633
11638
11643
11644
11648
11649
11651 {
11655 }
11656
11659
11660
11664
11666
11667 InventoryLocation loc = new InventoryLocation();
11668 GetInventory().GetCurrentInventoryLocation(loc);
11670 {
11671 if (Gizmo_IsSupported())
11674 }
11675
11677 }
11678
11679
11680
11681
11683 {
11684 super.OnAction(action_id, player, ctx);
11685
11687 {
11688 switch (action_id)
11689 {
11693 return true;
11697 return true;
11698 }
11699 }
11700
11702 {
11703 switch (action_id)
11704 {
11706 Delete();
11707 return true;
11708 }
11709 }
11710
11711 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11712 {
11713 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11714 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11715 PlayerBase p = PlayerBase.Cast(player);
11716 if (
EActions.RECIPES_RANGE_START < 1000)
11717 {
11718 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11719 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11720 }
11721 }
11722 #ifndef SERVER
11723 else if (action_id ==
EActions.WATCH_PLAYER)
11724 {
11725 PluginDeveloper.SetDeveloperItemClientEx(player);
11726 }
11727 #endif
11729 {
11730 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11731 {
11732 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11733 OnDebugButtonPressServer(id + 1);
11734 }
11735
11736 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11737 {
11738 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11740 }
11741
11742 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11743 {
11744 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11746 }
11747
11748 else if (action_id ==
EActions.ADD_QUANTITY)
11749 {
11750 if (IsMagazine())
11751 {
11752 Magazine mag = Magazine.Cast(this);
11753 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11754 }
11755 else
11756 {
11758 }
11759
11760 if (m_EM)
11761 {
11762 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11763 }
11764
11765 }
11766
11767 else if (action_id ==
EActions.REMOVE_QUANTITY)
11768 {
11769 if (IsMagazine())
11770 {
11771 Magazine mag2 = Magazine.Cast(this);
11772 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11773 }
11774 else
11775 {
11777 }
11778 if (m_EM)
11779 {
11780 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11781 }
11782
11783 }
11784
11785 else if (action_id ==
EActions.SET_QUANTITY_0)
11786 {
11788
11789 if (m_EM)
11790 {
11791 m_EM.SetEnergy(0);
11792 }
11793 }
11794
11795 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11796 {
11798
11799 if (m_EM)
11800 {
11801 m_EM.SetEnergy(m_EM.GetEnergyMax());
11802 }
11803 }
11804
11805 else if (action_id ==
EActions.ADD_HEALTH)
11806 {
11807 AddHealth("","",GetMaxHealth("","Health")/5);
11808 }
11809 else if (action_id ==
EActions.REMOVE_HEALTH)
11810 {
11811 AddHealth("","",-GetMaxHealth("","Health")/5);
11812 }
11813 else if (action_id ==
EActions.DESTROY_HEALTH)
11814 {
11815 SetHealth01("","",0);
11816 }
11817 else if (action_id ==
EActions.WATCH_ITEM)
11818 {
11820 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11821 #ifdef DEVELOPER
11822 SetDebugDeveloper_item(this);
11823 #endif
11824 }
11825
11826 else if (action_id ==
EActions.ADD_TEMPERATURE)
11827 {
11828 AddTemperature(20);
11829
11830 }
11831
11832 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11833 {
11834 AddTemperature(-20);
11835
11836 }
11837
11838 else if (action_id ==
EActions.FLIP_FROZEN)
11839 {
11840 SetFrozen(!GetIsFrozen());
11841
11842 }
11843
11844 else if (action_id ==
EActions.ADD_WETNESS)
11845 {
11847
11848 }
11849
11850 else if (action_id ==
EActions.REMOVE_WETNESS)
11851 {
11853
11854 }
11855
11856 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11857 {
11860
11861
11862 }
11863
11864 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11865 {
11868 }
11869
11870 else if (action_id ==
EActions.MAKE_SPECIAL)
11871 {
11872 auto debugParams = DebugSpawnParams.WithPlayer(player);
11873 OnDebugSpawnEx(debugParams);
11874 }
11875
11876 }
11877
11878
11879 return false;
11880 }
11881
11882
11883
11884
11888
11891
11892
11893
11895 {
11896 return false;
11897 }
11898
11899
11901 {
11902 return true;
11903 }
11904
11905
11907 {
11908 return true;
11909 }
11910
11911
11912
11914 {
11915 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11916 return g_Game.ConfigIsExisting(config_path);
11917 }
11918
11921 {
11922 return null;
11923 }
11924
11926 {
11927 return false;
11928 }
11929
11931 {
11932 return false;
11933 }
11934
11938
11939
11941 {
11942 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11943 return module_repairing.CanRepair(this, item_repair_kit);
11944 }
11945
11946
11947 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11948 {
11949 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11950 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11951 }
11952
11953
11955 {
11956
11957
11958
11959
11960
11961
11962
11963
11964 return 1;
11965 }
11966
11967
11968
11970 {
11972 }
11973
11974
11975
11977 {
11979 }
11980
11981
11990 {
11991 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11992
11993 if (player)
11994 {
11995 player.MessageStatus(text);
11996 }
11997 }
11998
11999
12008 {
12009 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12010
12011 if (player)
12012 {
12013 player.MessageAction(text);
12014 }
12015 }
12016
12017
12026 {
12027 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12028
12029 if (player)
12030 {
12031 player.MessageFriendly(text);
12032 }
12033 }
12034
12035
12044 {
12045 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12046
12047 if (player)
12048 {
12049 player.MessageImportant(text);
12050 }
12051 }
12052
12054 {
12055 return true;
12056 }
12057
12058
12059 override bool KindOf(
string tag)
12060 {
12061 bool found = false;
12062 string item_name = this.
GetType();
12064 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12065
12066 int array_size = item_tag_array.Count();
12067 for (int i = 0; i < array_size; i++)
12068 {
12069 if (item_tag_array.Get(i) == tag)
12070 {
12071 found = true;
12072 break;
12073 }
12074 }
12075 return found;
12076 }
12077
12078
12080 {
12081
12082 super.OnRPC(sender, rpc_type,ctx);
12083
12084
12085 switch (rpc_type)
12086 {
12087 #ifndef SERVER
12088 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12089 Param2<bool, string> p = new Param2<bool, string>(false, "");
12090
12092 return;
12093
12094 bool play = p.param1;
12095 string soundSet = p.param2;
12096
12097 if (play)
12098 {
12100 {
12102 {
12104 }
12105 }
12106 else
12107 {
12109 }
12110 }
12111 else
12112 {
12114 }
12115
12116 break;
12117 #endif
12118
12119 }
12120
12122 {
12124 }
12125 }
12126
12127
12128
12129
12131 {
12132 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12133 return plugin.GetID(
name);
12134 }
12135
12137 {
12138 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12139 return plugin.GetName(id);
12140 }
12141
12144 {
12145
12146
12147 int varFlags;
12148 if (!ctx.
Read(varFlags))
12149 return;
12150
12151 if (varFlags & ItemVariableFlags.FLOAT)
12152 {
12154 }
12155 }
12156
12158 {
12159
12160 super.SerializeNumericalVars(floats_out);
12161
12162
12163
12165 {
12167 }
12168
12170 {
12172 }
12173
12175 {
12177 }
12178
12180 {
12185 }
12186
12188 {
12190 }
12191 }
12192
12194 {
12195
12196 super.DeSerializeNumericalVars(floats);
12197
12198
12199 int index = 0;
12200 int mask = Math.Round(floats.Get(index));
12201
12202 index++;
12203
12205 {
12207 {
12209 }
12210 else
12211 {
12212 float quantity = floats.Get(index);
12213 SetQuantity(quantity,
true,
false,
false,
false);
12214 }
12215 index++;
12216 }
12217
12219 {
12220 float wet = floats.Get(index);
12222 index++;
12223 }
12224
12226 {
12227 int liquidtype = Math.Round(floats.Get(index));
12229 index++;
12230 }
12231
12233 {
12235 index++;
12237 index++;
12239 index++;
12241 index++;
12242 }
12243
12245 {
12246 int cleanness = Math.Round(floats.Get(index));
12248 index++;
12249 }
12250 }
12251
12253 {
12254 super.WriteVarsToCTX(ctx);
12255
12256
12258 {
12260 }
12261
12263 {
12265 }
12266
12268 {
12270 }
12271
12273 {
12274 int r,g,b,a;
12280 }
12281
12283 {
12285 }
12286 }
12287
12289 {
12290 if (!super.ReadVarsFromCTX(ctx,version))
12291 return false;
12292
12293 int intValue;
12294 float value;
12295
12296 if (version < 140)
12297 {
12298 if (!ctx.
Read(intValue))
12299 return false;
12300
12301 m_VariablesMask = intValue;
12302 }
12303
12305 {
12306 if (!ctx.
Read(value))
12307 return false;
12308
12310 {
12312 }
12313 else
12314 {
12316 }
12317 }
12318
12319 if (version < 140)
12320 {
12322 {
12323 if (!ctx.
Read(value))
12324 return false;
12325 SetTemperatureDirect(value);
12326 }
12327 }
12328
12330 {
12331 if (!ctx.
Read(value))
12332 return false;
12334 }
12335
12337 {
12338 if (!ctx.
Read(intValue))
12339 return false;
12341 }
12342
12344 {
12345 int r,g,b,a;
12347 return false;
12349 return false;
12351 return false;
12353 return false;
12354
12356 }
12357
12359 {
12360 if (!ctx.
Read(intValue))
12361 return false;
12363 }
12364
12365 if (version >= 138 && version < 140)
12366 {
12368 {
12369 if (!ctx.
Read(intValue))
12370 return false;
12371 SetFrozen(intValue);
12372 }
12373 }
12374
12375 return true;
12376 }
12377
12378
12380 {
12383 {
12385 }
12386
12387 if (!super.OnStoreLoad(ctx, version))
12388 {
12390 return false;
12391 }
12392
12393 if (version >= 114)
12394 {
12395 bool hasQuickBarIndexSaved;
12396
12397 if (!ctx.
Read(hasQuickBarIndexSaved))
12398 {
12400 return false;
12401 }
12402
12403 if (hasQuickBarIndexSaved)
12404 {
12405 int itmQBIndex;
12406
12407
12408 if (!ctx.
Read(itmQBIndex))
12409 {
12411 return false;
12412 }
12413
12414 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12415 if (itmQBIndex != -1 && parentPlayer)
12416 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12417 }
12418 }
12419 else
12420 {
12421
12422 PlayerBase player;
12423 int itemQBIndex;
12424 if (version ==
int.
MAX)
12425 {
12426 if (!ctx.
Read(itemQBIndex))
12427 {
12429 return false;
12430 }
12431 }
12432 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12433 {
12434
12435 if (!ctx.
Read(itemQBIndex))
12436 {
12438 return false;
12439 }
12440 if (itemQBIndex != -1 && player)
12441 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12442 }
12443 }
12444
12445 if (version < 140)
12446 {
12447
12448 if (!LoadVariables(ctx, version))
12449 {
12451 return false;
12452 }
12453 }
12454
12455
12457 {
12459 return false;
12460 }
12461 if (version >= 132)
12462 {
12464 if (raib)
12465 {
12467 {
12469 return false;
12470 }
12471 }
12472 }
12473
12475 return true;
12476 }
12477
12478
12479
12481 {
12482 super.OnStoreSave(ctx);
12483
12484 PlayerBase player;
12485 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12486 {
12488
12489 int itemQBIndex = -1;
12490 itemQBIndex = player.FindQuickBarEntityIndex(this);
12491 ctx.
Write(itemQBIndex);
12492 }
12493 else
12494 {
12496 }
12497
12499
12501 if (raib)
12502 {
12504 }
12505 }
12506
12507
12509 {
12510 super.AfterStoreLoad();
12511
12513 {
12515 }
12516
12518 {
12521 }
12522 }
12523
12525 {
12526 super.EEOnAfterLoad();
12527
12529 {
12531 }
12532
12535 }
12536
12538 {
12539 return false;
12540 }
12541
12542
12543
12545 {
12547 {
12548 #ifdef PLATFORM_CONSOLE
12549
12551 {
12553 if (menu)
12554 {
12556 }
12557 }
12558 #endif
12559 }
12560
12562 {
12565 }
12566
12568 {
12569 SetWeightDirty();
12571 }
12573 {
12576 }
12577
12579 {
12582
12585 }
12587 {
12591 }
12592
12593 super.OnVariablesSynchronized();
12594 }
12595
12596
12597
12599 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12600 {
12601 if (!IsServerCheck(allow_client))
12602 return false;
12603
12605 return false;
12606
12609
12610 if (value <= (min + 0.001))
12611 value = min;
12612
12613 if (value == min)
12614 {
12615 if (destroy_config)
12616 {
12617 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12618 if (dstr)
12619 {
12621 this.Delete();
12622 return true;
12623 }
12624 }
12625 else if (destroy_forced)
12626 {
12628 this.Delete();
12629 return true;
12630 }
12631
12633 }
12634
12637
12639 {
12640 EntityAI parent = GetHierarchyRoot();
12641 InventoryLocation iLoc = new InventoryLocation();
12642 GetInventory().GetCurrentInventoryLocation(iLoc);
12644 {
12645 int iLocSlot = iLoc.
GetSlot();
12647 {
12649 }
12651 {
12653 }
12654 }
12655 }
12656
12658 {
12660
12661 if (delta)
12663 }
12664
12666
12667 return false;
12668 }
12669
12670
12672 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12673 {
12675 }
12676
12678 {
12681 }
12682
12684 {
12687 }
12688
12690 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12691 {
12692 float value_clamped = Math.Clamp(value, 0, 1);
12694 SetQuantity(result, destroy_config, destroy_forced);
12695 }
12696
12697
12700 {
12702 }
12703
12705 {
12707 }
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12719 {
12720 int slot = -1;
12721 GameInventory inventory = GetInventory();
12722 if (inventory)
12723 {
12724 InventoryLocation il = new InventoryLocation;
12727 }
12728
12730 }
12731
12733 {
12734 float quantity_max = 0;
12735
12737 {
12738 if (attSlotID != -1)
12739 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12740
12741 if (quantity_max <= 0)
12743 }
12744
12745 if (quantity_max <= 0)
12747
12748 return quantity_max;
12749 }
12750
12752 {
12754 }
12755
12757 {
12759 }
12760
12761
12763 {
12765 }
12766
12768 {
12770 }
12771
12773 {
12775 }
12776
12777
12779 {
12780
12781 float weightEx = GetWeightEx();
12782 float special = GetInventoryAndCargoWeight();
12783 return weightEx - special;
12784 }
12785
12786
12788 {
12790 }
12791
12793 {
12795 {
12796 #ifdef DEVELOPER
12797 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12798 {
12799 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12801 }
12802 #endif
12803
12804 return GetQuantity() * GetConfigWeightModified();
12805 }
12806 else if (HasEnergyManager())
12807 {
12808 #ifdef DEVELOPER
12809 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12810 {
12811 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12812 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12813 }
12814 #endif
12815 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12816 }
12817 else
12818 {
12819 #ifdef DEVELOPER
12820 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12821 {
12822 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12823 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12824 }
12825 #endif
12826 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12827 }
12828 }
12829
12832 {
12833 int item_count = 0;
12835
12836 GameInventory inventory = GetInventory();
12837 CargoBase cargo = inventory.
GetCargo();
12838 if (cargo != NULL)
12839 {
12841 }
12842
12844 for (int i = 0; i < nAttachments; ++i)
12845 {
12847 if (item)
12848 item_count += item.GetNumberOfItems();
12849 }
12850 return item_count;
12851 }
12852
12855 {
12856 float weight = 0;
12857 float wetness = 1;
12858 if (include_wetness)
12861 {
12862 weight = wetness * m_ConfigWeight;
12863 }
12865 {
12866 weight = 1;
12867 }
12868 return weight;
12869 }
12870
12871
12872
12874 {
12875 GameInventory inventory = GetInventory();
12876 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12877 {
12878 array<EntityAI> items = new array<EntityAI>;
12880 for (int i = 0; i < items.Count(); ++i)
12881 {
12883 if (item)
12884 {
12885 g_Game.ObjectDelete(item);
12886 }
12887 }
12888 }
12889 }
12890
12891
12892
12893
12895 {
12896 float energy = 0;
12897 if (HasEnergyManager())
12898 {
12899 energy = GetCompEM().GetEnergy();
12900 }
12901 return energy;
12902 }
12903
12904
12906 {
12907 super.OnEnergyConsumed();
12908
12910 }
12911
12913 {
12914 super.OnEnergyAdded();
12915
12917 }
12918
12919
12921 {
12922 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12923 {
12925 {
12926 float energy_0to1 = GetCompEM().GetEnergy0To1();
12928 }
12929 }
12930 }
12931
12932
12934 {
12935 return ConfigGetFloat("heatIsolation");
12936 }
12937
12939 {
12941 }
12942
12944 {
12945 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12946 if (
g_Game.ConfigIsExisting(paramPath))
12947 return g_Game.ConfigGetFloat(paramPath);
12948
12949 return 0.0;
12950 }
12951
12953 {
12954 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12955 if (
g_Game.ConfigIsExisting(paramPath))
12956 return g_Game.ConfigGetFloat(paramPath);
12957
12958 return 0.0;
12959 }
12960
12961 override void SetWet(
float value,
bool allow_client =
false)
12962 {
12963 if (!IsServerCheck(allow_client))
12964 return;
12965
12968
12970
12971 m_VarWet = Math.Clamp(value, min, max);
12972
12974 {
12977 }
12978 }
12979
12980 override void AddWet(
float value)
12981 {
12983 }
12984
12986 {
12988 }
12989
12991 {
12993 }
12994
12996 {
12998 }
12999
13001 {
13003 }
13004
13006 {
13008 }
13009
13010 override void OnWetChanged(
float newVal,
float oldVal)
13011 {
13014 if (newLevel != oldLevel)
13015 {
13017 }
13018 }
13019
13021 {
13022 SetWeightDirty();
13023 }
13024
13026 {
13027 return GetWetLevelInternal(
m_VarWet);
13028 }
13029
13030
13031
13033 {
13035 }
13036
13038 {
13040 }
13041
13043 {
13045 }
13046
13048 {
13050 }
13051
13052
13053
13055 {
13056 if (ConfigIsExisting("itemModelLength"))
13057 {
13058 return ConfigGetFloat("itemModelLength");
13059 }
13060 return 0;
13061 }
13062
13064 {
13065 if (ConfigIsExisting("itemAttachOffset"))
13066 {
13067 return ConfigGetFloat("itemAttachOffset");
13068 }
13069 return 0;
13070 }
13071
13072 override void SetCleanness(
int value,
bool allow_client =
false)
13073 {
13074 if (!IsServerCheck(allow_client))
13075 return;
13076
13078
13080
13083 }
13084
13086 {
13088 }
13089
13091 {
13092 return true;
13093 }
13094
13095
13096
13097
13099 {
13101 }
13102
13104 {
13106 }
13107
13108
13109
13110
13111 override void SetColor(
int r,
int g,
int b,
int a)
13112 {
13118 }
13120 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13121 {
13126 }
13127
13129 {
13131 }
13132
13135 {
13136 int r,g,b,a;
13138 r = r/255;
13139 g = g/255;
13140 b = b/255;
13141 a = a/255;
13142 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13143 }
13144
13145
13146
13147 override void SetLiquidType(
int value,
bool allow_client =
false)
13148 {
13149 if (!IsServerCheck(allow_client))
13150 return;
13151
13156 }
13157
13159 {
13160 return ConfigGetInt("varLiquidTypeInit");
13161 }
13162
13164 {
13166 }
13167
13169 {
13171 SetFrozen(false);
13172 }
13173
13176 {
13177 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13178 }
13179
13180
13183 {
13184 PlayerBase nplayer;
13185 if (PlayerBase.CastTo(nplayer, player))
13186 {
13188 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13189 }
13190 }
13191
13192
13195 {
13196 PlayerBase nplayer;
13197 if (PlayerBase.CastTo(nplayer,player))
13198 {
13199 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13200 }
13201
13202 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13203
13204 if (HasEnergyManager())
13205 {
13206 GetCompEM().UpdatePlugState();
13207 }
13208 }
13209
13210
13212 {
13213 super.OnPlacementStarted(player);
13214
13216 }
13217
13218 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13219 {
13221 {
13222 m_AdminLog.OnPlacementComplete(player,
this);
13223 }
13224
13225 super.OnPlacementComplete(player, position, orientation);
13226 }
13227
13228
13229
13230
13231
13233 {
13235 {
13236 return true;
13237 }
13238 else
13239 {
13240 return false;
13241 }
13242 }
13243
13244
13246 {
13248 {
13250 }
13251 }
13252
13253
13255 {
13257 }
13258
13260 {
13262 }
13263
13264 override void InsertAgent(
int agent,
float count = 1)
13265 {
13266 if (count < 1)
13267 return;
13268
13270 }
13271
13274 {
13276 }
13277
13278
13280 {
13282 }
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295
13296
13297
13298
13299
13300
13301
13302
13303
13304
13305
13306
13307
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321
13322
13323
13324
13326 {
13328 return false;
13329 return true;
13330 }
13331
13333 {
13334
13336 }
13337
13338
13341 {
13342 super.CheckForRoofLimited(timeTresholdMS);
13343
13344 float time =
g_Game.GetTime();
13345 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13346 {
13347 m_PreviousRoofTestTime = time;
13348 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13349 }
13350 }
13351
13352
13354 {
13356 {
13357 return 0;
13358 }
13359
13360 if (GetInventory().GetAttachmentSlotsCount() != 0)
13361 {
13362 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13363 if (filter)
13364 return filter.GetProtectionLevel(type, false, system);
13365 else
13366 return 0;
13367 }
13368
13369 string subclassPath, entryName;
13370
13371 switch (type)
13372 {
13374 entryName = "biological";
13375 break;
13377 entryName = "chemical";
13378 break;
13379 default:
13380 entryName = "biological";
13381 break;
13382 }
13383
13384 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13385
13386 return g_Game.ConfigGetFloat(subclassPath + entryName);
13387 }
13388
13389
13390
13393 {
13394 if (!IsMagazine())
13396
13398 }
13399
13400
13401
13402
13403
13408 {
13409 return true;
13410 }
13411
13413 {
13415 }
13416
13417
13418
13419
13420
13422 {
13423 if (parent)
13424 {
13425 if (parent.IsInherited(DayZInfected))
13426 return true;
13427
13428 if (!parent.IsRuined())
13429 return true;
13430 }
13431
13432 return true;
13433 }
13434
13436 {
13437 if (!super.CanPutAsAttachment(parent))
13438 {
13439 return false;
13440 }
13441
13442 if (!IsRuined() && !parent.IsRuined())
13443 {
13444 return true;
13445 }
13446
13447 return false;
13448 }
13449
13451 {
13452
13453
13454
13455
13456 return super.CanReceiveItemIntoCargo(item);
13457 }
13458
13460 {
13461
13462
13463
13464
13465 GameInventory attachmentInv = attachment.GetInventory();
13467 {
13468 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13469 return false;
13470 }
13471
13472 InventoryLocation loc = new InventoryLocation();
13473 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13474 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13475 return false;
13476
13477 return super.CanReceiveAttachment(attachment, slotId);
13478 }
13479
13481 {
13482 if (!super.CanReleaseAttachment(attachment))
13483 return false;
13484
13485 return GetInventory().AreChildrenAccessible();
13486 }
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496
13497
13498
13499
13500
13501
13502
13503
13504
13505
13506
13507
13509 {
13510 int id = muzzle_owner.GetMuzzleID();
13511 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13512
13513 if (WPOF_array)
13514 {
13515 for (int i = 0; i < WPOF_array.Count(); i++)
13516 {
13517 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13518
13519 if (WPOF)
13520 {
13521 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13522 }
13523 }
13524 }
13525 }
13526
13527
13529 {
13530 int id = muzzle_owner.GetMuzzleID();
13532
13533 if (WPOBE_array)
13534 {
13535 for (int i = 0; i < WPOBE_array.Count(); i++)
13536 {
13537 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13538
13539 if (WPOBE)
13540 {
13541 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13542 }
13543 }
13544 }
13545 }
13546
13547
13549 {
13550 int id = muzzle_owner.GetMuzzleID();
13551 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13552
13553 if (WPOOH_array)
13554 {
13555 for (int i = 0; i < WPOOH_array.Count(); i++)
13556 {
13557 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13558
13559 if (WPOOH)
13560 {
13561 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13562 }
13563 }
13564 }
13565 }
13566
13567
13569 {
13570 int id = muzzle_owner.GetMuzzleID();
13571 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13572
13573 if (WPOOH_array)
13574 {
13575 for (int i = 0; i < WPOOH_array.Count(); i++)
13576 {
13577 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13578
13579 if (WPOOH)
13580 {
13581 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13582 }
13583 }
13584 }
13585 }
13586
13587
13589 {
13590 int id = muzzle_owner.GetMuzzleID();
13591 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13592
13593 if (WPOOH_array)
13594 {
13595 for (int i = 0; i < WPOOH_array.Count(); i++)
13596 {
13597 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13598
13599 if (WPOOH)
13600 {
13601 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13602 }
13603 }
13604 }
13605 }
13606
13607
13608
13610 {
13612 {
13613 return true;
13614 }
13615
13616 return false;
13617 }
13618
13620 {
13622 {
13623 return true;
13624 }
13625
13626 return false;
13627 }
13628
13630 {
13632 {
13633 return true;
13634 }
13635
13636 return false;
13637 }
13638
13640 {
13641 return false;
13642 }
13643
13646 {
13647 return UATimeSpent.DEFAULT_DEPLOY;
13648 }
13649
13650
13651
13652
13654 {
13656 SetSynchDirty();
13657 }
13658
13660 {
13662 }
13663
13664
13666 {
13667 return false;
13668 }
13669
13672 {
13673 string att_type = "None";
13674
13675 if (ConfigIsExisting("soundAttType"))
13676 {
13677 att_type = ConfigGetString("soundAttType");
13678 }
13679
13681 }
13682
13684 {
13686 }
13687
13688
13689
13690
13691
13697
13699 {
13702
13704 }
13705
13706
13708 {
13710 return;
13711
13713
13716
13719
13720 SoundParameters params = new SoundParameters();
13724 }
13725
13726
13728 {
13730 {
13733
13734 SetSynchDirty();
13735
13738 }
13739 }
13740
13742 {
13744 }
13745
13746
13748 {
13750 return;
13751
13753 SetSynchDirty();
13754
13757 }
13758
13760 {
13763 }
13764
13766 {
13768 }
13769
13770 void OnApply(PlayerBase player);
13771
13773 {
13774 return 1.0;
13775 };
13776
13778 {
13780 }
13781
13783 {
13785 }
13786
13788
13790 {
13791 SetDynamicPhysicsLifeTime(0.01);
13793 }
13794
13796 {
13797 array<string> zone_names = new array<string>;
13798 GetDamageZones(zone_names);
13799 for (int i = 0; i < zone_names.Count(); i++)
13800 {
13801 SetHealthMax(zone_names.Get(i),"Health");
13802 }
13803 SetHealthMax("","Health");
13804 }
13805
13808 {
13809 float global_health = GetHealth01("","Health");
13810 array<string> zones = new array<string>;
13811 GetDamageZones(zones);
13812
13813 for (int i = 0; i < zones.Count(); i++)
13814 {
13815 SetHealth01(zones.Get(i),"Health",global_health);
13816 }
13817 }
13818
13821 {
13822 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13823 }
13824
13826 {
13827 if (!hasRootAsPlayer)
13828 {
13829 if (refParentIB)
13830 {
13831
13832 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13833 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13834
13835 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13836 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13837
13840 }
13841 else
13842 {
13843
13846 }
13847 }
13848 }
13849
13851 {
13853 {
13854 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13855 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13856 {
13857 float heatPermCoef = 1.0;
13859 while (ent)
13860 {
13861 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13862 ent = ent.GetHierarchyParent();
13863 }
13864
13865 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13866 }
13867 }
13868 }
13869
13871 {
13872
13873 EntityAI parent = GetHierarchyParent();
13874 if (!parent)
13875 {
13876 hasParent = false;
13877 hasRootAsPlayer = false;
13878 }
13879 else
13880 {
13881 hasParent = true;
13882 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13883 refParentIB =
ItemBase.Cast(parent);
13884 }
13885 }
13886
13887 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13888 {
13889
13890 }
13891
13893 {
13894
13895 return false;
13896 }
13897
13899 {
13900
13901
13902 return false;
13903 }
13904
13906 {
13907
13908 return false;
13909 }
13910
13913 {
13914 return !GetIsFrozen() &&
IsOpen();
13915 }
13916
13918 {
13919 bool hasParent = false, hasRootAsPlayer = false;
13921
13922 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13923 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13924
13925 if (wwtu || foodDecay)
13926 {
13930
13931 if (processWetness || processTemperature || processDecay)
13932 {
13934
13935 if (processWetness)
13936 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13937
13938 if (processTemperature)
13940
13941 if (processDecay)
13942 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13943 }
13944 }
13945 }
13946
13949 {
13951 }
13952
13954 {
13957
13958 return super.GetTemperatureFreezeThreshold();
13959 }
13960
13962 {
13965
13966 return super.GetTemperatureThawThreshold();
13967 }
13968
13970 {
13973
13974 return super.GetItemOverheatThreshold();
13975 }
13976
13978 {
13980 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
13981
13982 return super.GetTemperatureFreezeTime();
13983 }
13984
13986 {
13988 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
13989
13990 return super.GetTemperatureThawTime();
13991 }
13992
13997
13999 {
14000 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14001 }
14002
14004 {
14005 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14006 }
14007
14010 {
14012 }
14013
14015 {
14017 }
14018
14020 {
14022 }
14023
14026 {
14027 return null;
14028 }
14029
14032 {
14033 return false;
14034 }
14035
14037 {
14039 {
14042 if (!trg)
14043 {
14045 explosive = this;
14046 }
14047
14048 explosive.PairRemote(trg);
14050
14051 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14052 trg.SetPersistentPairID(persistentID);
14053 explosive.SetPersistentPairID(persistentID);
14054
14055 return true;
14056 }
14057 return false;
14058 }
14059
14062 {
14063 float ret = 1.0;
14066 ret *= GetHealth01();
14067
14068 return ret;
14069 }
14070
14071 #ifdef DEVELOPER
14072 override void SetDebugItem()
14073 {
14074 super.SetDebugItem();
14075 _itemBase = this;
14076 }
14077
14079 {
14080 string text = super.GetDebugText();
14081
14083 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14084
14085 return text;
14086 }
14087 #endif
14088
14090 {
14091 return true;
14092 }
14093
14095
14097
14099 {
14102 }
14103
14104
14112
14128
14129 [
Obsolete(
"Use ItemSoundHandler instead")]
14132 {
14133 if (!
g_Game.IsDedicatedServer())
14134 {
14135 if (ConfigIsExisting("attachSoundSet"))
14136 {
14137 string cfg_path = "";
14138 string soundset = "";
14139 string type_name =
GetType();
14140
14143 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14144 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14145
14146 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14147 {
14148 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14149 {
14150 if (cfg_slot_array[i] == slot_type)
14151 {
14152 soundset = cfg_soundset_array[i];
14153 break;
14154 }
14155 }
14156 }
14157
14158 if (soundset != "")
14159 {
14160 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14162 }
14163 }
14164 }
14165 }
14166
14168}
14169
14171{
14173 if (entity)
14174 {
14175 bool is_item = entity.IsInherited(
ItemBase);
14176 if (is_item && full_quantity)
14177 {
14180 }
14181 }
14182 else
14183 {
14185 return NULL;
14186 }
14187 return entity;
14188}
14189
14191{
14192 if (item)
14193 {
14194 if (health > 0)
14195 item.SetHealth("", "", health);
14196
14197 if (item.CanHaveTemperature())
14198 {
14200 if (item.CanFreeze())
14201 item.SetFrozen(false);
14202 }
14203
14204 if (item.HasEnergyManager())
14205 {
14206 if (quantity >= 0)
14207 {
14208 item.GetCompEM().SetEnergy0To1(quantity);
14209 }
14210 else
14211 {
14213 }
14214 }
14215 else if (item.IsMagazine())
14216 {
14217 Magazine mag = Magazine.Cast(item);
14218 if (quantity >= 0)
14219 {
14220 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14221 }
14222 else
14223 {
14225 }
14226
14227 }
14228 else
14229 {
14230 if (quantity >= 0)
14231 {
14232 item.SetQuantityNormalized(quantity, false);
14233 }
14234 else
14235 {
14237 }
14238
14239 }
14240 }
14241}
14242
14243#ifdef DEVELOPER
14245#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
bool SetAttachSoundEvent()
bool SetDetachSoundEvent()
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionManagerBase(PlayerBase player)
map< typename, ref array< ActionBase_Basic > > TInputActionMap
void AddAction(typename actionName)
void RemoveAction(typename actionName)
TInputActionMap m_InputActionMap
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
const int ECE_PLACE_ON_SURFACE
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
Open
Implementations only.
override void EEOnCECreate()
DamageType
exposed from C++ (do not change)
PluginAdminLog m_AdminLog
override bool IsExplosive()
override bool IsPrepareToDelete()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
proto GizmoApi GetGizmoApi()
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
static bool HasDebugActionsMask(int mask)
bool HidesSelectionBySlot()
void SplitItem(PlayerBase player)
void CopyScriptPropertiesFrom(EntityAI oldItem)
override void InsertAgent(int agent, float count=1)
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
static void SetDebugActionsMask(int mask)
void SetIsDeploySound(bool is_deploy_sound)
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
override bool IsHeavyBehaviour()
override void SetWetMax()
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
void ClearStartItemSoundServer()
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
override void RemoveAllAgentsExcept(int agent_to_keep)
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
bool CanBeMovedOverride()
override void SetWet(float value, bool allow_client=false)
ref TIntArray m_SingleUseActions
void StartItemSoundServer(int id, int slotId)
override void ProcessVariables()
ref TStringArray m_HeadHidingSelections
float GetWeightSpecialized(bool forceRecalc=false)
bool LoadAgents(ParamsReadContext ctx, int version)
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
ref array< ref OverheatingParticle > m_OverheatingParticles
override float GetTemperatureFreezeThreshold()
bool m_IsSoundSynchRemote
void StopItemSoundServer(int id)
static void ToggleDebugActionsMask(int mask)
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetTemperatureFreezeTime()
ref array< int > m_CompatibleLocks
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
float m_TemperaturePerQuantityWeight
bool m_RecipesInitialized
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
override float GetTemperatureThawThreshold()
override void OnEnergyConsumed()
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
override EWetnessLevel GetWetLevel()
float GetSingleInventoryItemWeight()
ref TIntArray m_InteractActions
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
bool CanPlayDeployLoopSound()
override float GetWetMax()
bool CanBeUsedForSuicide()
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
bool m_CanBeMovedOverride
override string ChangeIntoOnAttach(string slot)
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
override float GetQuantity()
int m_ShotsToStartOverheating
override void OnWetChanged(float newVal, float oldVal)
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void OnOverheatingDecay()
float GetDryingIncrement(string pIncrementName)
void SoundSynchRemoteReset()
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
override bool CanReleaseAttachment(EntityAI attachment)
override void OnMovedInsideCargo(EntityAI container)
void SetCEBasedQuantity()
bool m_CanPlayImpactSound
override string GetAttachmentSoundType()
float GetOverheatingCoef()
array< string > GetHeadHidingSelection()
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
override bool IsStoreLoad()
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
void SetResultOfSplit(bool value)
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
void UpdateAllOverheatingParticles()
float GetSoakingIncrement(string pIncrementName)
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetStoreLoadedQuantity()
const int ITEM_SOUNDS_MAX
float GetItemModelLength()
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
void CombineItems(ItemBase other_item, bool use_stack_max=true)
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
void TransferAgents(int agents)
transfer agents from another item
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
float GetHeatIsolationInit()
void SetCanBeMovedOverride(bool setting)
override bool HasQuantity()
bool IsCargoException4x3(EntityAI item)
ref TIntArray m_ContinuousActions
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
void LoadParticleConfigOnFire(int id)
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
override float GetWetInit()
int m_ImpactSoundSurfaceHash
int m_MaxOverheatingValue
void SetupSpawnedItem(ItemBase item, float health, float quantity)
bool ShouldSplitQuantity(float quantity)
static ref map< string, int > m_WeaponTypeToID
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
array< int > GetValidFinishers()
returns an array of possible finishers
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
ItemSoundHandler GetItemSoundHandler()
override int GetQuantityMin()
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
override int GetQuickBarBonus()
override void SetTakeable(bool pState)
float m_OverheatingDecayInterval
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
void RemoveAudioVisualsOnClient()
static void AddDebugActionsMask(int mask)
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
bool CanRepair(ItemBase item_repair_kit)
bool can_this_be_combined
EffectSound m_SoundDeploy
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
float GetDeployTime()
how long it takes to deploy this item in seconds
override bool IsSplitable()
bool DamageItemAttachments(float damage)
override void WriteVarsToCTX(ParamsWriteContext ctx)
void ConvertEnergyToQuantity()
override void RemoveAllAgents()
override void SetQuantityToMinimum()
bool m_WantPlayImpactSound
override float GetTemperatureThawTime()
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
float m_StoreLoadedQuantity
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
float GetFilterDamageRatio()
override void SetLiquidType(int value, bool allow_client=false)
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
void OnApply(PlayerBase player)
override void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
ref Timer m_CheckOverheating
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool IsOneHandedBehaviour()
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetDisinfectQuantity(int system=0, Param param1=null)
override bool IsHologram()
float GetItemAttachOffset()
static int GetDebugActionsMask()
override int GetLiquidType()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnEnergyAdded()
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
EffectSound m_DeployLoopSoundEx
override void DeSerializeNumericalVars(array< float > floats)
void StopItemDynamicPhysics()
override void SetStoreLoad(bool value)
float GetOverheatingValue()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
override void EOnContact(IEntity other, Contact extra)
void SplitIntoStackMaxHands(PlayerBase player)
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override void SetStoreLoadedQuantity(float value)
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void OnLiquidTypeChanged(int oldType, int newType)
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void PlayDeployFinishSound()
bool AllowFoodConsumption()
bool m_IsOverheatingEffectActive
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
bool PairWithDevice(notnull ItemBase otherDevice)
static void RemoveDebugActionsMask(int mask)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void PerformDamageSystemReinit()
override void ClearInventory()
static int m_LastRegisteredWeaponID
ItemBase GetLightSourceItem()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
override float GetItemOverheatThreshold()
void StopDeployLoopSoundEx()
override void SerializeNumericalVars(array< float > floats_out)
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
static int m_DebugActionsMask
void KillAllOverheatingParticles()
bool CanBeCookedOnStick()
override int GetQuantityMax()
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
void OnActivatedByTripWire()
override void RemoveAgent(int agent_id)
bool m_ItemBeingDroppedPhys
override bool CanPutAsAttachment(EntityAI parent)
void PlayDetachSound(string slot_type)
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override bool IsBeingPlaced()
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
bool m_FixDamageSystemInit
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
void LoadParticleConfigOnOverheating(int id)
bool IsSoundSynchRemote()
override void OnRightClick()
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
bool IsActionTargetVisible()
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
int NameToID(string name)
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
void ClearStopItemSoundServer()
override string ChangeIntoOnDetach()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
EffectSound m_SoundDeployFinish
float GetQuantityNormalizedScripted()
override void SetCleanness(int value, bool allow_client=false)
override float GetWetMin()
ref ItemSoundHandler m_ItemSoundHandler
override bool KindOf(string tag)
void ItemSoundHandler(ItemBase parent)
EffectSound m_LockingSound
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
void RemoteDetonatorTrigger()
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
override void Explode(int damageType, string ammoType="")
void OnItemLocationChanged(ItemBase item)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
proto native EntityAI GetAttachmentFromIndex(int index)
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
proto native int AttachmentCount()
Returns count of attachments attached to this item.
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
bool WriteToContext(ParamsWriteContext ctx)
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
override bool CanDisplayCargo()
override void OnInventoryEnter(Man player)
override string GetFoldSoundset()
override bool CanPutAsAttachment(EntityAI parent)
override bool CanReceiveItemIntoCargo(EntityAI item)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
override void EEDelete(EntityAI parent)
override bool CanBeRepairedByCrafting()
override void OnPlacementStarted(Man player)
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override bool IsElectricAppliance()
override bool IsItemTent()
override void SetActions()
override string GetLoopFoldSoundset()
override bool CanMakeGardenplot()
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override WrittenNoteData GetWrittenNoteData()
override int GetDamageSystemVersionChange()
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
override void InitItemVariables()
override void SetActionAnimOverrides()
override void OnCreatePhysics()
override string GetDeploySoundset()
override float GetBandagingEffectivity()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void OnStoreSave(ParamsWriteContext ctx)
override void AfterStoreLoad()
override int GetOnDigWormsAmount()
override bool IsSelfAdjustingTemperature()
override bool IsPlayerInside(PlayerBase player, string selection)
override void OnVariablesSynchronized()
override void RefreshPhysics()
override bool CanObstruct()
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanPutInCargo(EntityAI parent)
override string GetLoopDeploySoundset()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override void OnInventoryExit(Man player)
override bool IsTakeable()
override bool IsIgnoredByConstruction()
override void InitItemSounds()
override void EEKilled(Object killer)
override void OnCombine(ItemBase other_item)
override bool CanExplodeInFire()
override bool IsFacingPlayer(PlayerBase player, string selection)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
override bool IsBloodContainer()
override bool IsClothing()
override bool CanBeSplit()
override bool IsDeployable()
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
override bool CanBeDisinfected()
override float GetInfectionChance(int system=0, Param param=null)
override void OnEndPlacement()
float GetOverheatingLimitMax()
void SetOverheatingLimitMax(float max)
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
float GetOverheatingLimitMin()
void SetOverheatingLimitMin(float min)
void RegisterParticle(Particle p)
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
void SetControlledDevice(EntityAI pDevice)
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
void SetCalcDetails(string details)
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Serializer ParamsReadContext
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Serializer ParamsWriteContext
const int COMP_TYPE_ENERGY_MANAGER
void Error(string err)
Messagebox with error message.
proto native void SetColor(int color)
array< string > TStringArray
void Obsolete(string msg="")
EntityEvent
Entity events for event-mask, or throwing event from code.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
const int VARIABLE_LIQUIDTYPE
const int VARIABLE_CLEANNESS
const int VARIABLE_TEMPERATURE
const int VARIABLE_QUANTITY
static proto float AbsFloat(float f)
Returns absolute value.
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_DEBUG_ACTION
vector GetPosition()
Get the world position of the Effect.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.