9289{
9291 {
9292 return true;
9293 }
9294};
9295
9297{
9298
9299};
9300
9301
9302
9304{
9308
9310
9313
9314
9315
9316
9317
9326
9332
9337
9342
9363 protected bool m_IsResultOfSplit
9364
9366
9371
9372
9373
9375
9379
9380
9381
9383
9386
9387
9388
9394
9395
9403
9406
9407
9409
9410
9412
9413
9418
9419
9424
9426
9427
9429
9430
9432 {
9437
9438 if (!
g_Game.IsDedicatedServer())
9439 {
9441 {
9443
9445 {
9447 }
9448 }
9449
9452 }
9453
9454 m_OldLocation = null;
9455
9457 {
9459 }
9460
9461 if (ConfigIsExisting("headSelectionsToHide"))
9462 {
9465 }
9466
9468 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9469 {
9471 }
9472
9474
9475 m_IsResultOfSplit = false;
9476
9478 }
9479
9481 {
9482 super.InitItemVariables();
9483
9489 m_Count = ConfigGetInt(
"count");
9490
9493
9498
9501
9506
9518
9522
9523
9526 if (ConfigIsExisting("canBeSplit"))
9527 {
9530 }
9531
9533 if (ConfigIsExisting("itemBehaviour"))
9535
9536
9539 RegisterNetSyncVariableInt("m_VarLiquidType");
9540 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9541
9542 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9543 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9544 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9545
9546 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9547 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9548 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9549 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9550
9551 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9552 RegisterNetSyncVariableBool("m_IsTakeable");
9553 RegisterNetSyncVariableBool("m_IsHologram");
9554
9557 {
9560 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
9561 }
9562
9564
9566 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9568
9570 }
9571
9573 {
9575 }
9576
9578 {
9581 {
9586 }
9587 }
9588
9589 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
9590 {
9592 {
9595 }
9596
9598 }
9599
9601 {
9607 }
9608
9610
9612 {
9614
9615 if (!action)
9616 {
9617 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
9618 return;
9619 }
9620
9622 if (!ai)
9623 {
9625 return;
9626 }
9627
9629 if (!action_array)
9630 {
9631 action_array = new array<ActionBase_Basic>;
9633 }
9634 if (LogManager.IsActionLogEnable())
9635 {
9636 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
9637 }
9638
9639 if (action_array.Find(action) != -1)
9640 {
9641 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
9642 }
9643 else
9644 {
9645 action_array.Insert(action);
9646 }
9647 }
9648
9650 {
9651 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9652 ActionBase action = player.GetActionManager().GetAction(actionName);
9655
9656 if (action_array)
9657 {
9658 action_array.RemoveItem(action);
9659 }
9660 }
9661
9662
9663
9665 {
9666 ActionOverrideData overrideData = new ActionOverrideData();
9670
9672 if (!actionMap)
9673 {
9676 }
9677
9678 actionMap.Insert(this.
Type(), overrideData);
9679
9680 }
9681
9683
9685
9686
9688 {
9691
9694
9695 string config_to_search = "CfgVehicles";
9696 string muzzle_owner_config;
9697
9699 {
9700 if (IsInherited(Weapon))
9701 config_to_search = "CfgWeapons";
9702
9703 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9704
9705 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9706
9707 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
9708
9709 if (config_OnFire_subclass_count > 0)
9710 {
9711 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9712
9713 for (int i = 0; i < config_OnFire_subclass_count; i++)
9714 {
9715 string particle_class = "";
9716 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
9717 string config_OnFire_entry = config_OnFire_class + particle_class;
9718 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9719 WPOF_array.Insert(WPOF);
9720 }
9721
9722
9724 }
9725 }
9726
9728 {
9729 config_to_search = "CfgWeapons";
9730 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9731
9732 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9733
9734 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9735
9736 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9737 {
9738 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9739
9740 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9741 {
9742 string particle_class2 = "";
9743 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9744 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9745 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9746 WPOBE_array.Insert(WPOBE);
9747 }
9748
9749
9751 }
9752 }
9753 }
9754
9755
9757 {
9760
9762 {
9763 string config_to_search = "CfgVehicles";
9764
9765 if (IsInherited(Weapon))
9766 config_to_search = "CfgWeapons";
9767
9768 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
9769 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9770
9771 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
9772 {
9773
9775
9777 {
9779 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9781 return;
9782 }
9783
9786
9787
9788
9789 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
9790 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9791
9792 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9793 {
9794 string particle_class = "";
9795 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9796 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9797 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
9798
9799 if (entry_type == CT_CLASS)
9800 {
9801 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9802 WPOOH_array.Insert(WPOF);
9803 }
9804 }
9805
9806
9808 }
9809 }
9810 }
9811
9813 {
9815 }
9816
9818 {
9820 {
9822
9825
9828
9829 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9830 }
9831 }
9832
9834 {
9836 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9837
9839 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9840
9842 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9843
9845 {
9847 }
9848 }
9849
9851 {
9853 }
9854
9856 {
9859 else
9861
9863 {
9866 }
9867 else
9868 {
9871
9874 }
9875
9877 }
9878
9880 {
9882 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9883 }
9884
9886 {
9888 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
9890 }
9891
9893 {
9895 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9896 }
9897
9899 {
9902
9903 OverheatingParticle OP = new OverheatingParticle();
9908
9910 }
9911
9913 {
9916
9917 return -1;
9918 }
9919
9921 {
9923 {
9926
9927 for (int i = count; i > 0; --i)
9928 {
9929 int id = i - 1;
9932
9935
9936 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9937 {
9938 if (p)
9939 {
9942 }
9943 }
9944 }
9945 }
9946 }
9947
9949 {
9951 {
9953 {
9954 int id = i - 1;
9956
9957 if (OP)
9958 {
9960
9961 if (p)
9962 {
9964 }
9965
9966 delete OP;
9967 }
9968 }
9969
9972 }
9973 }
9974
9977 {
9978 return 0.0;
9979 }
9980
9981
9983 {
9984 return 250;
9985 }
9986
9988 {
9989 return 0;
9990 }
9991
9994 {
9996 return true;
9997
9998 return false;
9999 }
10000
10003 {
10006
10008 {
10010 }
10011 else
10012 {
10013
10015 }
10016
10018 }
10019
10026 {
10027 return -1;
10028 }
10029
10030
10031
10032
10034 {
10036 {
10037 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10038 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10039
10040 if (r_index >= 0)
10041 {
10042 InventoryLocation r_il = new InventoryLocation;
10043 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10044
10045 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10048 {
10049 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10050 }
10052 {
10053 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10054 }
10055
10056 }
10057
10058 player.GetHumanInventory().ClearUserReservedLocation(this);
10059 }
10060
10063 }
10064
10065
10066
10067
10069 {
10070 return ItemBase.m_DebugActionsMask;
10071 }
10072
10074 {
10075 return ItemBase.m_DebugActionsMask & mask;
10076 }
10077
10079 {
10080 ItemBase.m_DebugActionsMask = mask;
10081 }
10082
10084 {
10085 ItemBase.m_DebugActionsMask |= mask;
10086 }
10087
10089 {
10090 ItemBase.m_DebugActionsMask &= ~mask;
10091 }
10092
10094 {
10096 {
10098 }
10099 else
10100 {
10102 }
10103 }
10104
10105
10107 {
10108 if (GetEconomyProfile())
10109 {
10110 float q_max = GetEconomyProfile().GetQuantityMax();
10111 if (q_max > 0)
10112 {
10113 float q_min = GetEconomyProfile().GetQuantityMin();
10114 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10115
10117 {
10118 ComponentEnergyManager comp = GetCompEM();
10120 {
10122 }
10123 }
10125 {
10127
10128 }
10129
10130 }
10131 }
10132 }
10133
10136 {
10137 EntityAI parent = GetHierarchyParent();
10138
10139 if (parent)
10140 {
10141 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10142 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10143 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
10144 }
10145 }
10146
10149 {
10150 EntityAI parent = GetHierarchyParent();
10151
10152 if (parent)
10153 {
10154 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10155 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10156 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
10157 }
10158 }
10159
10161 {
10162
10163
10164
10165
10167
10169 {
10170 if (ScriptInputUserData.CanStoreInputUserData())
10171 {
10172 ScriptInputUserData ctx = new ScriptInputUserData;
10178 ctx.
Write(use_stack_max);
10181
10183 {
10184 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10185 }
10186 }
10187 }
10188 else if (!
g_Game.IsMultiplayer())
10189 {
10191 }
10192 }
10193
10195 {
10197 }
10198
10200 {
10202 }
10203
10205 {
10207 }
10208
10210 {
10211
10212 return false;
10213 }
10214
10216 {
10217 return false;
10218 }
10219
10223 {
10224 return false;
10225 }
10226
10228 {
10229 return "";
10230 }
10231
10233
10235 {
10236 return false;
10237 }
10238
10240 {
10241 return true;
10242 }
10243
10244
10245
10247 {
10248 return true;
10249 }
10250
10252 {
10253 return true;
10254 }
10255
10257 {
10258 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
10260 }
10261
10263 {
10265 }
10266
10268 {
10270 if (!is_being_placed)
10272 SetSynchDirty();
10273 }
10274
10275
10277
10279 {
10281 }
10282
10284 {
10286 }
10287
10289 {
10290 return 1;
10291 }
10292
10294 {
10295 return false;
10296 }
10297
10299 {
10301 SetSynchDirty();
10302 }
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10339 {
10340 super.OnMovedInsideCargo(container);
10341
10342 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10343 }
10344
10345 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10346 {
10347 super.EEItemLocationChanged(oldLoc, newLoc);
10348
10349 PlayerBase newPlayer = null;
10350 PlayerBase oldPlayer = null;
10351
10352 if (newLoc.GetParent())
10353 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10354
10355 if (oldLoc.GetParent())
10356 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10357
10359 {
10360 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
10361
10362 if (rIndex >= 0)
10363 {
10364 InventoryLocation rIl = new InventoryLocation;
10365 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
10366
10367 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
10370 {
10371 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
10372 }
10374 {
10376 }
10377
10378 }
10379 }
10380
10382 {
10383 if (newPlayer)
10384 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
10385
10386 if (newPlayer == oldPlayer)
10387 {
10388 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10389 {
10391 {
10392 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10393 {
10394 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10395 }
10396 }
10397 else
10398 {
10399 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10400 }
10401 }
10402
10403 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10404 {
10405 int type = oldLoc.GetType();
10407 {
10408 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10409 }
10411 {
10412 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10413 }
10414 }
10415 if (!m_OldLocation)
10416 {
10417 m_OldLocation = new InventoryLocation;
10418 }
10419 m_OldLocation.Copy(oldLoc);
10420 }
10421 else
10422 {
10423 if (m_OldLocation)
10424 {
10425 m_OldLocation.Reset();
10426 }
10427 }
10428
10429 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
10430 }
10431 else
10432 {
10433 if (newPlayer)
10434 {
10435 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10436 if (resIndex >= 0)
10437 {
10438 InventoryLocation il = new InventoryLocation;
10439 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
10441 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
10444 {
10445 il.
GetParent().GetOnReleaseLock().Invoke(it);
10446 }
10448 {
10450 }
10451
10452 }
10453 }
10455 {
10456
10458 }
10459
10460 if (m_OldLocation)
10461 {
10462 m_OldLocation.Reset();
10463 }
10464 }
10465
10467 {
10468 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
10469 }
10470
10472 {
10473 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
10474 }
10475 }
10476
10477 override void EOnContact(IEntity other, Contact extra)
10478 {
10480 {
10481 int liquidType = -1;
10483 if (impactSpeed > 0.0)
10484 {
10486 #ifndef SERVER
10488 #else
10490 SetSynchDirty();
10491 #endif
10493 }
10494 }
10495
10496 #ifdef SERVER
10497 if (GetCompEM() && GetCompEM().IsPlugged())
10498 {
10499 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
10500 GetCompEM().UnplugThis();
10501 }
10502 #endif
10503 }
10504
10506
10508 {
10510 }
10511
10513 {
10514
10515 }
10516
10518 {
10519 super.OnItemLocationChanged(old_owner, new_owner);
10520
10521 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10522 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10523
10524 if (!relatedPlayer && playerNew)
10525 relatedPlayer = playerNew;
10526
10527 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10528 {
10530 if (actionMgr)
10531 {
10532 ActionBase currentAction = actionMgr.GetRunningAction();
10533 if (currentAction)
10535 }
10536 }
10537
10538 Man ownerPlayerOld = null;
10539 Man ownerPlayerNew = null;
10540
10541 if (old_owner)
10542 {
10543 if (old_owner.
IsMan())
10544 {
10545 ownerPlayerOld = Man.Cast(old_owner);
10546 }
10547 else
10548 {
10549 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10550 }
10551 }
10552 else
10553 {
10555 {
10557
10558 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
10559 {
10560 GetCompEM().UnplugThis();
10561 }
10562 }
10563 }
10564
10565 if (new_owner)
10566 {
10567 if (new_owner.
IsMan())
10568 {
10569 ownerPlayerNew = Man.Cast(new_owner);
10570 }
10571 else
10572 {
10573 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10574 }
10575 }
10576
10577 if (ownerPlayerOld != ownerPlayerNew)
10578 {
10579 if (ownerPlayerOld)
10580 {
10581 array<EntityAI> subItemsExit = new array<EntityAI>;
10583 for (int i = 0; i < subItemsExit.Count(); i++)
10584 {
10587 }
10588 }
10589
10590 if (ownerPlayerNew)
10591 {
10592 array<EntityAI> subItemsEnter = new array<EntityAI>;
10594 for (int j = 0; j < subItemsEnter.Count(); j++)
10595 {
10598 }
10599 }
10600 }
10601 else if (ownerPlayerNew != null)
10602 {
10603 PlayerBase nplayer;
10604 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10605 {
10606 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10608 for (int k = 0; k < subItemsUpdate.Count(); k++)
10609 {
10611 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10612 }
10613 }
10614 }
10615
10616 if (old_owner)
10617 old_owner.OnChildItemRemoved(this);
10618 if (new_owner)
10619 new_owner.OnChildItemReceived(this);
10620 }
10621
10622
10624 {
10625 super.EEDelete(parent);
10626 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10627 if (player)
10628 {
10630
10631 if (player.IsAlive())
10632 {
10633 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10634 if (r_index >= 0)
10635 {
10636 InventoryLocation r_il = new InventoryLocation;
10637 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10638
10639 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10642 {
10643 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
10644 }
10646 {
10647 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
10648 }
10649
10650 }
10651
10652 player.RemoveQuickBarEntityShortcut(this);
10653 }
10654 }
10655 }
10656
10658 {
10659 super.EEKilled(killer);
10660
10663 {
10664 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10665 {
10666 if (IsMagazine())
10667 {
10668 if (Magazine.Cast(this).GetAmmoCount() > 0)
10669 {
10671 }
10672 }
10673 else
10674 {
10676 }
10677 }
10678 }
10679 }
10680
10682 {
10683 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10684
10685 super.OnWasAttached(parent, slot_id);
10686
10689
10692 }
10693
10695 {
10696 super.OnWasDetached(parent, slot_id);
10697
10700
10703 }
10704
10706 {
10707 int idx;
10710
10711 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10712 if (inventory_slots.Count() < 1)
10713 {
10714 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10715 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10716 }
10717 else
10718 {
10719 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10720 }
10721
10722 idx = inventory_slots.Find(slot);
10723 if (idx < 0)
10724 return "";
10725
10726 return attach_types.Get(idx);
10727 }
10728
10730 {
10731 int idx = -1;
10732 string slot;
10733
10736
10737 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10738 if (inventory_slots.Count() < 1)
10739 {
10740 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10741 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10742 }
10743 else
10744 {
10745 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10746 if (detach_types.Count() < 1)
10747 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10748 }
10749
10750 for (int i = 0; i < inventory_slots.Count(); i++)
10751 {
10752 slot = inventory_slots.Get(i);
10753 }
10754
10755 if (slot != "")
10756 {
10757 if (detach_types.Count() == 1)
10758 idx = 0;
10759 else
10760 idx = inventory_slots.Find(slot);
10761 }
10762 if (idx < 0)
10763 return "";
10764
10765 return detach_types.Get(idx);
10766 }
10767
10769 {
10770
10772
10773
10774 float min_time = 1;
10775 float max_time = 3;
10776 float delay = Math.RandomFloat(min_time, max_time);
10777
10778 explode_timer.Run(delay, this, "DoAmmoExplosion");
10779 }
10780
10782 {
10783 Magazine magazine = Magazine.Cast(this);
10784 int pop_sounds_count = 6;
10785 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10786
10787
10788 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10789 string sound_name = pop_sounds[ sound_idx ];
10790 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
10791
10792
10793 magazine.ServerAddAmmoCount(-1);
10794
10795
10796 float min_temp_to_explode = 100;
10797
10798 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
10799 {
10801 }
10802 }
10803
10804
10805 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
10806 {
10807 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
10808
10809 const int CHANCE_DAMAGE_CARGO = 4;
10810 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10811 const int CHANCE_DAMAGE_NOTHING = 2;
10812
10814 {
10815 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
10816 int chances;
10817 int rnd;
10818
10819 if (GetInventory().GetCargo())
10820 {
10821 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10822 rnd = Math.RandomInt(0,chances);
10823
10824 if (rnd < CHANCE_DAMAGE_CARGO)
10825 {
10827 }
10828 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10829 {
10831 }
10832 }
10833 else
10834 {
10835 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10836 rnd = Math.RandomInt(0,chances);
10837
10838 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10839 {
10841 }
10842 }
10843 }
10844 }
10845
10847 {
10848 CargoBase cargo = GetInventory().GetCargo();
10849 if (cargo)
10850 {
10852 if (item_count > 0)
10853 {
10854 int random_pick = Math.RandomInt(0, item_count);
10856 if (!item.IsExplosive())
10857 {
10858 item.AddHealth("","",damage);
10859 return true;
10860 }
10861 }
10862 }
10863 return false;
10864 }
10865
10867 {
10868 GameInventory inventory = GetInventory();
10870 if (attachment_count > 0)
10871 {
10872 int random_pick = Math.RandomInt(0, attachment_count);
10874 if (!attachment.IsExplosive())
10875 {
10876 attachment.AddHealth("","",damage);
10877 return true;
10878 }
10879 }
10880 return false;
10881 }
10882
10884 {
10886 }
10887
10889 {
10891 return GetInventory().CanRemoveEntity();
10892
10893 return false;
10894 }
10895
10897 {
10898
10900 return false;
10901
10902
10904 return false;
10905
10906
10907
10909 if (delta == 0)
10910 return false;
10911
10912
10913 return true;
10914 }
10915
10917 {
10919 {
10920 if (ScriptInputUserData.CanStoreInputUserData())
10921 {
10922 ScriptInputUserData ctx = new ScriptInputUserData;
10927 ctx.
Write(destination_entity);
10929 ctx.
Write(slot_id);
10931 }
10932 }
10933 else if (!
g_Game.IsMultiplayer())
10934 {
10936 }
10937 }
10938
10940 {
10941 float split_quantity_new;
10945 InventoryLocation loc = new InventoryLocation;
10946
10947 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10948 {
10950 split_quantity_new = stack_max;
10951 else
10953
10955 {
10956 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
10957 if (new_item)
10958 {
10959 new_item.SetResultOfSplit(true);
10960 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10962 new_item.
SetQuantity(split_quantity_new,
false,
true);
10963 }
10964 }
10965 }
10966 else if (destination_entity && slot_id == -1)
10967 {
10968 if (quantity > stack_max)
10969 split_quantity_new = stack_max;
10970 else
10971 split_quantity_new = quantity;
10972
10974 {
10975 GameInventory destinationInventory = destination_entity.GetInventory();
10977 {
10980 }
10981
10982 if (new_item)
10983 {
10984 new_item.SetResultOfSplit(true);
10985 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10987 new_item.
SetQuantity(split_quantity_new,
false,
true);
10988 }
10989 }
10990 }
10991 else
10992 {
10993 if (stack_max != 0)
10994 {
10996 {
10998 }
10999
11000 if (split_quantity_new == 0)
11001 {
11002 if (!
g_Game.IsMultiplayer())
11003 player.PhysicalPredictiveDropItem(this);
11004 else
11005 player.ServerDropEntity(this);
11006 return;
11007 }
11008
11010 {
11012
11013 if (new_item)
11014 {
11015 new_item.SetResultOfSplit(true);
11016 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11019 new_item.PlaceOnSurface();
11020 }
11021 }
11022 }
11023 }
11024 }
11025
11027 {
11028 float split_quantity_new;
11032 InventoryLocation loc = new InventoryLocation;
11033
11034 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11035 {
11037 split_quantity_new = stack_max;
11038 else
11040
11042 {
11043 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
11044 if (new_item)
11045 {
11046 new_item.SetResultOfSplit(true);
11047 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11049 new_item.
SetQuantity(split_quantity_new,
false,
true);
11050 }
11051 }
11052 }
11053 else if (destination_entity && slot_id == -1)
11054 {
11055 if (quantity > stack_max)
11056 split_quantity_new = stack_max;
11057 else
11058 split_quantity_new = quantity;
11059
11061 {
11062 GameInventory destinationInventory = destination_entity.GetInventory();
11064 {
11067 }
11068
11069 if (new_item)
11070 {
11071 new_item.SetResultOfSplit(true);
11072 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11074 new_item.
SetQuantity(split_quantity_new,
false,
true);
11075 }
11076 }
11077 }
11078 else
11079 {
11080 if (stack_max != 0)
11081 {
11083 {
11085 }
11086
11088 {
11090
11091 if (new_item)
11092 {
11093 new_item.SetResultOfSplit(true);
11094 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11097 new_item.PlaceOnSurface();
11098 }
11099 }
11100 }
11101 }
11102 }
11103
11105 {
11107 {
11108 if (ScriptInputUserData.CanStoreInputUserData())
11109 {
11110 ScriptInputUserData ctx = new ScriptInputUserData;
11115 dst.WriteToContext(ctx);
11117 }
11118 }
11119 else if (!
g_Game.IsMultiplayer())
11120 {
11122 }
11123 }
11124
11126 {
11128 {
11129 if (ScriptInputUserData.CanStoreInputUserData())
11130 {
11131 ScriptInputUserData ctx = new ScriptInputUserData;
11136 ctx.
Write(destination_entity);
11142 }
11143 }
11144 else if (!
g_Game.IsMultiplayer())
11145 {
11147 }
11148 }
11149
11151 {
11153 }
11154
11156 {
11158 float split_quantity_new;
11160 if (dst.IsValid())
11161 {
11162 int slot_id = dst.GetSlot();
11164
11165 if (quantity > stack_max)
11166 split_quantity_new = stack_max;
11167 else
11168 split_quantity_new = quantity;
11169
11171 {
11173
11174 if (new_item)
11175 {
11176 new_item.SetResultOfSplit(true);
11177 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11179 new_item.
SetQuantity(split_quantity_new,
false,
true);
11180 }
11181
11182 return new_item;
11183 }
11184 }
11185
11186 return null;
11187 }
11188
11190 {
11192 float split_quantity_new;
11194 if (destination_entity)
11195 {
11197 if (quantity > stackable)
11198 split_quantity_new = stackable;
11199 else
11200 split_quantity_new = quantity;
11201
11203 {
11204 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
11205 if (new_item)
11206 {
11207 new_item.SetResultOfSplit(true);
11208 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11210 new_item.
SetQuantity(split_quantity_new,
false,
true);
11211 }
11212 }
11213 }
11214 }
11215
11217 {
11219 {
11220 if (ScriptInputUserData.CanStoreInputUserData())
11221 {
11222 ScriptInputUserData ctx = new ScriptInputUserData;
11227 ItemBase destination_entity =
this;
11228 ctx.
Write(destination_entity);
11232 }
11233 }
11234 else if (!
g_Game.IsMultiplayer())
11235 {
11237 }
11238 }
11239
11241 {
11243 float split_quantity_new;
11245 if (player)
11246 {
11248 if (quantity > stackable)
11249 split_quantity_new = stackable;
11250 else
11251 split_quantity_new = quantity;
11252
11254 {
11255 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
11256 new_item =
ItemBase.Cast(in_hands);
11257 if (new_item)
11258 {
11259 new_item.SetResultOfSplit(true);
11260 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11262 new_item.SetQuantity(split_quantity_new, false, true);
11263 }
11264 }
11265 }
11266 }
11267
11269 {
11271 float split_quantity_new = Math.Floor(quantity * 0.5);
11272
11274 return;
11275
11277
11278 if (new_item)
11279 {
11280 if (new_item.GetQuantityMax() < split_quantity_new)
11281 {
11282 split_quantity_new = new_item.GetQuantityMax();
11283 }
11284
11285 new_item.SetResultOfSplit(true);
11286 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11287
11289 {
11292 }
11293 else
11294 {
11296 new_item.
SetQuantity(split_quantity_new,
false,
true);
11297 }
11298 }
11299 }
11300
11302 {
11304 float split_quantity_new = Math.Floor(quantity / 2);
11305
11307 return;
11308
11309 InventoryLocation invloc = new InventoryLocation;
11311
11313 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11314
11315 if (new_item)
11316 {
11317 if (new_item.GetQuantityMax() < split_quantity_new)
11318 {
11319 split_quantity_new = new_item.GetQuantityMax();
11320 }
11322 {
11325 }
11326 else if (split_quantity_new > 1)
11327 {
11329 new_item.
SetQuantity(split_quantity_new,
false,
true);
11330 }
11331 }
11332 }
11333
11336 {
11337 SetWeightDirty();
11339
11340 if (parent)
11341 parent.OnAttachmentQuantityChangedEx(this, delta);
11342
11344 {
11346 {
11348 }
11350 {
11351 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
11353 }
11354 }
11355 }
11356
11359 {
11360
11361 }
11362
11365 {
11367 }
11368
11370 {
11371 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11372
11374 {
11375 if (newLevel == GameConstants.STATE_RUINED)
11376 {
11378 EntityAI parent = GetHierarchyParent();
11379 if (parent && parent.IsFireplace())
11380 {
11381 CargoBase cargo = GetInventory().GetCargo();
11382 if (cargo)
11383 {
11385 {
11387 }
11388 }
11389 }
11390 }
11391
11393 {
11394
11396 return;
11397 }
11398
11399 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11400 {
11402 }
11403 }
11404 }
11405
11406
11408 {
11409 super.OnRightClick();
11410
11412 {
11414 {
11415 if (ScriptInputUserData.CanStoreInputUserData())
11416 {
11417 EntityAI root = GetHierarchyRoot();
11418 Man playerOwner = GetHierarchyRootPlayer();
11419 InventoryLocation dst = new InventoryLocation;
11420
11421
11422 if (!playerOwner && root && root == this)
11423 {
11425 }
11426 else
11427 {
11428
11429 GetInventory().GetCurrentInventoryLocation(dst);
11431 {
11432 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
11434 {
11436 }
11437 else
11438 {
11440
11441
11442 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
11443 {
11445 }
11446 else
11447 {
11448 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11449 }
11450 }
11451 }
11452 }
11453
11454 ScriptInputUserData ctx = new ScriptInputUserData;
11462 }
11463 }
11464 else if (!
g_Game.IsMultiplayer())
11465 {
11467 }
11468 }
11469 }
11470
11472 {
11473 if (root)
11474 {
11475 vector m4[4];
11476 root.GetTransform(m4);
11477 dst.SetGround(this, m4);
11478 }
11479 else
11480 {
11481 GetInventory().GetCurrentInventoryLocation(dst);
11482 }
11483 }
11484
11485 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
11486 {
11487
11488 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
11489 return false;
11490
11491 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11492 return false;
11493
11494
11496 return false;
11497
11498
11499 Magazine mag = Magazine.Cast(this);
11500 if (mag)
11501 {
11502 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11503 return false;
11504
11505 if (stack_max_limit)
11506 {
11507 Magazine other_mag = Magazine.Cast(other_item);
11508 if (other_item)
11509 {
11510 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11511 return false;
11512 }
11513
11514 }
11515 }
11516 else
11517 {
11518
11520 return false;
11521
11523 return false;
11524 }
11525
11526 PlayerBase player = null;
11527 if (CastTo(player, GetHierarchyRootPlayer()))
11528 {
11529 if (player.GetInventory().HasAttachment(this))
11530 return false;
11531
11532 if (player.IsItemsToDelete())
11533 return false;
11534 }
11535
11536 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11537 return false;
11538
11539 int slotID;
11541 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11542 return false;
11543
11544 return true;
11545 }
11546
11548 {
11550 }
11551
11553 {
11554 return m_IsResultOfSplit;
11555 }
11556
11558 {
11559 m_IsResultOfSplit = value;
11560 }
11561
11563 {
11565 }
11566
11568 {
11569 float other_item_quantity = other_item.GetQuantity();
11570 float this_free_space;
11571
11573
11575
11576 if (other_item_quantity > this_free_space)
11577 {
11578 return this_free_space;
11579 }
11580 else
11581 {
11582 return other_item_quantity;
11583 }
11584 }
11585
11587 {
11589 }
11590
11592 {
11594 return;
11595
11596 if (!IsMagazine() && other_item)
11597 {
11599 if (quantity_used != 0)
11600 {
11601 float hp1 = GetHealth01("","");
11602 float hp2 = other_item.GetHealth01("","");
11603 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
11604 hpResult = hpResult / (
GetQuantity() + quantity_used);
11605
11606 hpResult *= GetMaxHealth();
11607 Math.Round(hpResult);
11608 SetHealth("", "Health", hpResult);
11609
11611 other_item.AddQuantity(-quantity_used);
11612 }
11613 }
11615 }
11616
11618 {
11619 #ifdef SERVER
11620 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11621 GetHierarchyParent().IncreaseLifetimeUp();
11622 #endif
11623 };
11624
11626 {
11627 PlayerBase p = PlayerBase.Cast(player);
11628
11629 array<int> recipesIds = p.m_Recipes;
11630 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11631 if (moduleRecipesManager)
11632 {
11633 EntityAI itemInHands = player.GetEntityInHands();
11634 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
11635 }
11636
11637 for (int i = 0;i < recipesIds.Count(); i++)
11638 {
11639 int key = recipesIds.Get(i);
11640 string recipeName = moduleRecipesManager.GetRecipeName(key);
11642 }
11643 }
11644
11645
11646 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11647 {
11648 super.GetDebugActions(outputList);
11649
11650
11656
11657
11662
11667
11668
11672
11673
11675 {
11679 }
11680
11683
11684
11688
11690
11691 InventoryLocation loc = new InventoryLocation();
11692 GetInventory().GetCurrentInventoryLocation(loc);
11694 {
11695 if (Gizmo_IsSupported())
11698 }
11699
11701 }
11702
11703
11704
11705
11707 {
11708 super.OnAction(action_id, player, ctx);
11709
11711 {
11712 switch (action_id)
11713 {
11717 return true;
11721 return true;
11722 }
11723 }
11724
11726 {
11727 switch (action_id)
11728 {
11730 Delete();
11731 return true;
11732 }
11733 }
11734
11735 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
11736 {
11737 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
11738 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
11739 PlayerBase p = PlayerBase.Cast(player);
11740 if (
EActions.RECIPES_RANGE_START < 1000)
11741 {
11742 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11743 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11744 }
11745 }
11746 #ifndef SERVER
11747 else if (action_id ==
EActions.WATCH_PLAYER)
11748 {
11749 PluginDeveloper.SetDeveloperItemClientEx(player);
11750 }
11751 #endif
11753 {
11754 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11755 {
11756 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11757 OnDebugButtonPressServer(id + 1);
11758 }
11759
11760 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11761 {
11762 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11764 }
11765
11766 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11767 {
11768 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11770 }
11771
11772 else if (action_id ==
EActions.ADD_QUANTITY)
11773 {
11774 if (IsMagazine())
11775 {
11776 Magazine mag = Magazine.Cast(this);
11777 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11778 }
11779 else
11780 {
11782 }
11783
11784 if (m_EM)
11785 {
11786 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11787 }
11788
11789 }
11790
11791 else if (action_id ==
EActions.REMOVE_QUANTITY)
11792 {
11793 if (IsMagazine())
11794 {
11795 Magazine mag2 = Magazine.Cast(this);
11796 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11797 }
11798 else
11799 {
11801 }
11802 if (m_EM)
11803 {
11804 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11805 }
11806
11807 }
11808
11809 else if (action_id ==
EActions.SET_QUANTITY_0)
11810 {
11812
11813 if (m_EM)
11814 {
11815 m_EM.SetEnergy(0);
11816 }
11817 }
11818
11819 else if (action_id ==
EActions.SET_MAX_QUANTITY)
11820 {
11822
11823 if (m_EM)
11824 {
11825 m_EM.SetEnergy(m_EM.GetEnergyMax());
11826 }
11827 }
11828
11829 else if (action_id ==
EActions.ADD_HEALTH)
11830 {
11831 AddHealth("","",GetMaxHealth("","Health")/5);
11832 }
11833 else if (action_id ==
EActions.REMOVE_HEALTH)
11834 {
11835 AddHealth("","",-GetMaxHealth("","Health")/5);
11836 }
11837 else if (action_id ==
EActions.DESTROY_HEALTH)
11838 {
11839 SetHealth01("","",0);
11840 }
11841 else if (action_id ==
EActions.WATCH_ITEM)
11842 {
11844 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
11845 #ifdef DEVELOPER
11846 SetDebugDeveloper_item(this);
11847 #endif
11848 }
11849
11850 else if (action_id ==
EActions.ADD_TEMPERATURE)
11851 {
11852 AddTemperature(20);
11853
11854 }
11855
11856 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
11857 {
11858 AddTemperature(-20);
11859
11860 }
11861
11862 else if (action_id ==
EActions.FLIP_FROZEN)
11863 {
11864 SetFrozen(!GetIsFrozen());
11865
11866 }
11867
11868 else if (action_id ==
EActions.ADD_WETNESS)
11869 {
11871
11872 }
11873
11874 else if (action_id ==
EActions.REMOVE_WETNESS)
11875 {
11877
11878 }
11879
11880 else if (action_id ==
EActions.LIQUIDTYPE_UP)
11881 {
11884
11885
11886 }
11887
11888 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
11889 {
11892 }
11893
11894 else if (action_id ==
EActions.MAKE_SPECIAL)
11895 {
11896 auto debugParams = DebugSpawnParams.WithPlayer(player);
11897 OnDebugSpawnEx(debugParams);
11898 }
11899
11900 }
11901
11902
11903 return false;
11904 }
11905
11906
11907
11908
11912
11915
11916
11917
11919 {
11920 return false;
11921 }
11922
11923
11925 {
11926 return true;
11927 }
11928
11929
11931 {
11932 return true;
11933 }
11934
11935
11936
11938 {
11939 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
11940 return g_Game.ConfigIsExisting(config_path);
11941 }
11942
11945 {
11946 return null;
11947 }
11948
11950 {
11951 return false;
11952 }
11953
11955 {
11956 return false;
11957 }
11958
11962
11963
11965 {
11966 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11967 return module_repairing.CanRepair(this, item_repair_kit);
11968 }
11969
11970
11971 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
11972 {
11973 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
11974 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11975 }
11976
11977
11979 {
11980
11981
11982
11983
11984
11985
11986
11987
11988 return 1;
11989 }
11990
11991
11992
11994 {
11996 }
11997
11998
11999
12001 {
12003 }
12004
12005
12014 {
12015 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12016
12017 if (player)
12018 {
12019 player.MessageStatus(text);
12020 }
12021 }
12022
12023
12032 {
12033 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12034
12035 if (player)
12036 {
12037 player.MessageAction(text);
12038 }
12039 }
12040
12041
12050 {
12051 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12052
12053 if (player)
12054 {
12055 player.MessageFriendly(text);
12056 }
12057 }
12058
12059
12068 {
12069 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12070
12071 if (player)
12072 {
12073 player.MessageImportant(text);
12074 }
12075 }
12076
12078 {
12079 return true;
12080 }
12081
12082
12083 override bool KindOf(
string tag)
12084 {
12085 bool found = false;
12086 string item_name = this.
GetType();
12088 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
12089
12090 int array_size = item_tag_array.Count();
12091 for (int i = 0; i < array_size; i++)
12092 {
12093 if (item_tag_array.Get(i) == tag)
12094 {
12095 found = true;
12096 break;
12097 }
12098 }
12099 return found;
12100 }
12101
12102
12104 {
12105
12106 super.OnRPC(sender, rpc_type,ctx);
12107
12108
12109 switch (rpc_type)
12110 {
12111 #ifndef SERVER
12112 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12113 Param2<bool, string> p = new Param2<bool, string>(false, "");
12114
12116 return;
12117
12118 bool play = p.param1;
12119 string soundSet = p.param2;
12120
12121 if (play)
12122 {
12124 {
12126 {
12128 }
12129 }
12130 else
12131 {
12133 }
12134 }
12135 else
12136 {
12138 }
12139
12140 break;
12141 #endif
12142
12143 }
12144
12146 {
12148 }
12149 }
12150
12151
12152
12153
12155 {
12156 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12157 return plugin.GetID(
name);
12158 }
12159
12161 {
12162 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
12163 return plugin.GetName(id);
12164 }
12165
12168 {
12169
12170
12171 int varFlags;
12172 if (!ctx.
Read(varFlags))
12173 return;
12174
12175 if (varFlags & ItemVariableFlags.FLOAT)
12176 {
12178 }
12179 }
12180
12182 {
12183
12184 super.SerializeNumericalVars(floats_out);
12185
12186
12187
12189 {
12191 }
12192
12194 {
12196 }
12197
12199 {
12201 }
12202
12204 {
12209 }
12210
12212 {
12214 }
12215 }
12216
12218 {
12219
12220 super.DeSerializeNumericalVars(floats);
12221
12222
12223 int index = 0;
12224 int mask = Math.Round(floats.Get(index));
12225
12226 index++;
12227
12229 {
12231 {
12233 }
12234 else
12235 {
12236 float quantity = floats.Get(index);
12237 SetQuantity(quantity,
true,
false,
false,
false);
12238 }
12239 index++;
12240 }
12241
12243 {
12244 float wet = floats.Get(index);
12246 index++;
12247 }
12248
12250 {
12251 int liquidtype = Math.Round(floats.Get(index));
12253 index++;
12254 }
12255
12257 {
12259 index++;
12261 index++;
12263 index++;
12265 index++;
12266 }
12267
12269 {
12270 int cleanness = Math.Round(floats.Get(index));
12272 index++;
12273 }
12274 }
12275
12277 {
12278 super.WriteVarsToCTX(ctx);
12279
12280
12282 {
12284 }
12285
12287 {
12289 }
12290
12292 {
12294 }
12295
12297 {
12298 int r,g,b,a;
12304 }
12305
12307 {
12309 }
12310 }
12311
12313 {
12314 if (!super.ReadVarsFromCTX(ctx,version))
12315 return false;
12316
12317 int intValue;
12318 float value;
12319
12320 if (version < 140)
12321 {
12322 if (!ctx.
Read(intValue))
12323 return false;
12324
12325 m_VariablesMask = intValue;
12326 }
12327
12329 {
12330 if (!ctx.
Read(value))
12331 return false;
12332
12334 {
12336 }
12337 else
12338 {
12340 }
12341 }
12342
12343 if (version < 140)
12344 {
12346 {
12347 if (!ctx.
Read(value))
12348 return false;
12349 SetTemperatureDirect(value);
12350 }
12351 }
12352
12354 {
12355 if (!ctx.
Read(value))
12356 return false;
12358 }
12359
12361 {
12362 if (!ctx.
Read(intValue))
12363 return false;
12365 }
12366
12368 {
12369 int r,g,b,a;
12371 return false;
12373 return false;
12375 return false;
12377 return false;
12378
12380 }
12381
12383 {
12384 if (!ctx.
Read(intValue))
12385 return false;
12387 }
12388
12389 if (version >= 138 && version < 140)
12390 {
12392 {
12393 if (!ctx.
Read(intValue))
12394 return false;
12395 SetFrozen(intValue);
12396 }
12397 }
12398
12399 return true;
12400 }
12401
12402
12404 {
12407 {
12409 }
12410
12411 if (!super.OnStoreLoad(ctx, version))
12412 {
12414 return false;
12415 }
12416
12417 if (version >= 114)
12418 {
12419 bool hasQuickBarIndexSaved;
12420
12421 if (!ctx.
Read(hasQuickBarIndexSaved))
12422 {
12424 return false;
12425 }
12426
12427 if (hasQuickBarIndexSaved)
12428 {
12429 int itmQBIndex;
12430
12431
12432 if (!ctx.
Read(itmQBIndex))
12433 {
12435 return false;
12436 }
12437
12438 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12439 if (itmQBIndex != -1 && parentPlayer)
12440 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12441 }
12442 }
12443 else
12444 {
12445
12446 PlayerBase player;
12447 int itemQBIndex;
12448 if (version ==
int.
MAX)
12449 {
12450 if (!ctx.
Read(itemQBIndex))
12451 {
12453 return false;
12454 }
12455 }
12456 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12457 {
12458
12459 if (!ctx.
Read(itemQBIndex))
12460 {
12462 return false;
12463 }
12464 if (itemQBIndex != -1 && player)
12465 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12466 }
12467 }
12468
12469 if (version < 140)
12470 {
12471
12472 if (!LoadVariables(ctx, version))
12473 {
12475 return false;
12476 }
12477 }
12478
12479
12481 {
12483 return false;
12484 }
12485 if (version >= 132)
12486 {
12488 if (raib)
12489 {
12491 {
12493 return false;
12494 }
12495 }
12496 }
12497
12499 return true;
12500 }
12501
12502
12503
12505 {
12506 super.OnStoreSave(ctx);
12507
12508 PlayerBase player;
12509 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12510 {
12512
12513 int itemQBIndex = -1;
12514 itemQBIndex = player.FindQuickBarEntityIndex(this);
12515 ctx.
Write(itemQBIndex);
12516 }
12517 else
12518 {
12520 }
12521
12523
12525 if (raib)
12526 {
12528 }
12529 }
12530
12531
12533 {
12534 super.AfterStoreLoad();
12535
12537 {
12539 }
12540
12542 {
12545 }
12546 }
12547
12549 {
12550 super.EEOnAfterLoad();
12551
12553 {
12555 }
12556
12559 }
12560
12562 {
12563 return false;
12564 }
12565
12566
12567
12569 {
12571 {
12572 #ifdef PLATFORM_CONSOLE
12573
12575 {
12577 if (menu)
12578 {
12580 }
12581 }
12582 #endif
12583 }
12584
12586 {
12589 }
12590
12592 {
12593 SetWeightDirty();
12595 }
12597 {
12600 }
12601
12603 {
12606
12609 }
12611 {
12615 }
12616
12617 super.OnVariablesSynchronized();
12618 }
12619
12620
12621
12623 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
12624 {
12625 if (!IsServerCheck(allow_client))
12626 return false;
12627
12629 return false;
12630
12633
12634 if (value <= (min + 0.001))
12635 value = min;
12636
12637 if (value == min)
12638 {
12639 if (destroy_config)
12640 {
12641 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12642 if (dstr)
12643 {
12645 this.Delete();
12646 return true;
12647 }
12648 }
12649 else if (destroy_forced)
12650 {
12652 this.Delete();
12653 return true;
12654 }
12655
12657 }
12658
12661
12663 {
12664 EntityAI parent = GetHierarchyRoot();
12665 InventoryLocation iLoc = new InventoryLocation();
12666 GetInventory().GetCurrentInventoryLocation(iLoc);
12668 {
12669 int iLocSlot = iLoc.
GetSlot();
12671 {
12673 }
12675 {
12677 }
12678 }
12679 }
12680
12682 {
12684
12685 if (delta)
12687 }
12688
12690
12691 return false;
12692 }
12693
12694
12696 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12697 {
12699 }
12700
12702 {
12705 }
12706
12708 {
12711 }
12712
12714 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
12715 {
12716 float value_clamped = Math.Clamp(value, 0, 1);
12718 SetQuantity(result, destroy_config, destroy_forced);
12719 }
12720
12721
12724 {
12726 }
12727
12729 {
12731 }
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12743 {
12744 int slot = -1;
12745 GameInventory inventory = GetInventory();
12746 if (inventory)
12747 {
12748 InventoryLocation il = new InventoryLocation;
12751 }
12752
12754 }
12755
12757 {
12758 float quantity_max = 0;
12759
12761 {
12762 if (attSlotID != -1)
12763 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12764
12765 if (quantity_max <= 0)
12767 }
12768
12769 if (quantity_max <= 0)
12771
12772 return quantity_max;
12773 }
12774
12776 {
12778 }
12779
12781 {
12783 }
12784
12785
12787 {
12789 }
12790
12792 {
12794 }
12795
12797 {
12799 }
12800
12801
12803 {
12804
12805 float weightEx = GetWeightEx();
12806 float special = GetInventoryAndCargoWeight();
12807 return weightEx - special;
12808 }
12809
12810
12812 {
12814 }
12815
12817 {
12819 {
12820 #ifdef DEVELOPER
12821 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12822 {
12823 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12825 }
12826 #endif
12827
12828 return GetQuantity() * GetConfigWeightModified();
12829 }
12830 else if (HasEnergyManager())
12831 {
12832 #ifdef DEVELOPER
12833 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12834 {
12835 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12836 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
12837 }
12838 #endif
12839 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12840 }
12841 else
12842 {
12843 #ifdef DEVELOPER
12844 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12845 {
12846 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12847 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
12848 }
12849 #endif
12850 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
12851 }
12852 }
12853
12856 {
12857 int item_count = 0;
12859
12860 GameInventory inventory = GetInventory();
12861 CargoBase cargo = inventory.
GetCargo();
12862 if (cargo != NULL)
12863 {
12865 }
12866
12868 for (int i = 0; i < nAttachments; ++i)
12869 {
12871 if (item)
12872 item_count += item.GetNumberOfItems();
12873 }
12874 return item_count;
12875 }
12876
12879 {
12880 float weight = 0;
12881 float wetness = 1;
12882 if (include_wetness)
12885 {
12886 weight = wetness * m_ConfigWeight;
12887 }
12889 {
12890 weight = 1;
12891 }
12892 return weight;
12893 }
12894
12895
12896
12898 {
12899 GameInventory inventory = GetInventory();
12900 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
12901 {
12902 array<EntityAI> items = new array<EntityAI>;
12904 for (int i = 0; i < items.Count(); ++i)
12905 {
12907 if (item)
12908 {
12909 g_Game.ObjectDelete(item);
12910 }
12911 }
12912 }
12913 }
12914
12915
12916
12917
12919 {
12920 float energy = 0;
12921 if (HasEnergyManager())
12922 {
12923 energy = GetCompEM().GetEnergy();
12924 }
12925 return energy;
12926 }
12927
12928
12930 {
12931 super.OnEnergyConsumed();
12932
12934 }
12935
12937 {
12938 super.OnEnergyAdded();
12939
12941 }
12942
12943
12945 {
12946 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12947 {
12949 {
12950 float energy_0to1 = GetCompEM().GetEnergy0To1();
12952 }
12953 }
12954 }
12955
12956
12958 {
12959 return ConfigGetFloat("heatIsolation");
12960 }
12961
12963 {
12965 }
12966
12968 {
12969 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
12970 if (
g_Game.ConfigIsExisting(paramPath))
12971 return g_Game.ConfigGetFloat(paramPath);
12972
12973 return 0.0;
12974 }
12975
12977 {
12978 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
12979 if (
g_Game.ConfigIsExisting(paramPath))
12980 return g_Game.ConfigGetFloat(paramPath);
12981
12982 return 0.0;
12983 }
12984
12985 override void SetWet(
float value,
bool allow_client =
false)
12986 {
12987 if (!IsServerCheck(allow_client))
12988 return;
12989
12992
12994
12995 m_VarWet = Math.Clamp(value, min, max);
12996
12998 {
13001 }
13002 }
13003
13004 override void AddWet(
float value)
13005 {
13007 }
13008
13010 {
13012 }
13013
13015 {
13017 }
13018
13020 {
13022 }
13023
13025 {
13027 }
13028
13030 {
13032 }
13033
13034 override void OnWetChanged(
float newVal,
float oldVal)
13035 {
13038 if (newLevel != oldLevel)
13039 {
13041 }
13042 }
13043
13045 {
13046 SetWeightDirty();
13047 }
13048
13050 {
13051 return GetWetLevelInternal(
m_VarWet);
13052 }
13053
13054
13055
13057 {
13059 }
13060
13062 {
13064 }
13065
13067 {
13069 }
13070
13072 {
13074 }
13075
13076
13077
13079 {
13080 if (ConfigIsExisting("itemModelLength"))
13081 {
13082 return ConfigGetFloat("itemModelLength");
13083 }
13084 return 0;
13085 }
13086
13088 {
13089 if (ConfigIsExisting("itemAttachOffset"))
13090 {
13091 return ConfigGetFloat("itemAttachOffset");
13092 }
13093 return 0;
13094 }
13095
13096 override void SetCleanness(
int value,
bool allow_client =
false)
13097 {
13098 if (!IsServerCheck(allow_client))
13099 return;
13100
13102
13104
13107 }
13108
13110 {
13112 }
13113
13115 {
13116 return true;
13117 }
13118
13119
13120
13121
13123 {
13125 }
13126
13128 {
13130 }
13131
13132
13133
13134
13135 override void SetColor(
int r,
int g,
int b,
int a)
13136 {
13142 }
13144 override void GetColor(out
int r,out
int g,out
int b,out
int a)
13145 {
13150 }
13151
13153 {
13155 }
13156
13159 {
13160 int r,g,b,a;
13162 r = r/255;
13163 g = g/255;
13164 b = b/255;
13165 a = a/255;
13166 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13167 }
13168
13169
13170
13171 override void SetLiquidType(
int value,
bool allow_client =
false)
13172 {
13173 if (!IsServerCheck(allow_client))
13174 return;
13175
13180 }
13181
13183 {
13184 return ConfigGetInt("varLiquidTypeInit");
13185 }
13186
13188 {
13190 }
13191
13193 {
13195 SetFrozen(false);
13196 }
13197
13200 {
13201 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13202 }
13203
13204
13207 {
13208 PlayerBase nplayer;
13209 if (PlayerBase.CastTo(nplayer, player))
13210 {
13212 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13213 }
13214 }
13215
13216
13219 {
13220 PlayerBase nplayer;
13221 if (PlayerBase.CastTo(nplayer,player))
13222 {
13223 nplayer.SetEnableQuickBarEntityShortcut(this, false);
13224 }
13225
13226 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13227
13228 if (HasEnergyManager())
13229 {
13230 GetCompEM().UpdatePlugState();
13231 }
13232 }
13233
13234
13236 {
13237 super.OnPlacementStarted(player);
13238
13240 }
13241
13242 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
13243 {
13245 {
13246 m_AdminLog.OnPlacementComplete(player,
this);
13247 }
13248
13249 super.OnPlacementComplete(player, position, orientation);
13250 }
13251
13252
13253
13254
13255
13257 {
13259 {
13260 return true;
13261 }
13262 else
13263 {
13264 return false;
13265 }
13266 }
13267
13268
13270 {
13272 {
13274 }
13275 }
13276
13277
13279 {
13281 }
13282
13284 {
13286 }
13287
13288 override void InsertAgent(
int agent,
float count = 1)
13289 {
13290 if (count < 1)
13291 return;
13292
13294 }
13295
13298 {
13300 }
13301
13302
13304 {
13306 }
13307
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321
13322
13323
13324
13325
13326
13327
13328
13329
13330
13331
13332
13333
13334
13335
13336
13337
13338
13339
13340
13341
13342
13343
13344
13345
13346
13347
13348
13350 {
13352 return false;
13353 return true;
13354 }
13355
13357 {
13358
13360 }
13361
13362
13365 {
13366 super.CheckForRoofLimited(timeTresholdMS);
13367
13368 float time =
g_Game.GetTime();
13369 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13370 {
13371 m_PreviousRoofTestTime = time;
13372 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13373 }
13374 }
13375
13376
13378 {
13380 {
13381 return 0;
13382 }
13383
13384 if (GetInventory().GetAttachmentSlotsCount() != 0)
13385 {
13386 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
13387 if (filter)
13388 return filter.GetProtectionLevel(type, false, system);
13389 else
13390 return 0;
13391 }
13392
13393 string subclassPath, entryName;
13394
13395 switch (type)
13396 {
13398 entryName = "biological";
13399 break;
13401 entryName = "chemical";
13402 break;
13403 default:
13404 entryName = "biological";
13405 break;
13406 }
13407
13408 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
13409
13410 return g_Game.ConfigGetFloat(subclassPath + entryName);
13411 }
13412
13413
13414
13417 {
13418 if (!IsMagazine())
13420
13422 }
13423
13424
13425
13426
13427
13432 {
13433 return true;
13434 }
13435
13437 {
13439 }
13440
13441
13442
13443
13444
13446 {
13447 if (parent)
13448 {
13449 if (parent.IsInherited(DayZInfected))
13450 return true;
13451
13452 if (!parent.IsRuined())
13453 return true;
13454 }
13455
13456 return true;
13457 }
13458
13460 {
13461 if (!super.CanPutAsAttachment(parent))
13462 {
13463 return false;
13464 }
13465
13466 if (!IsRuined() && !parent.IsRuined())
13467 {
13468 return true;
13469 }
13470
13471 return false;
13472 }
13473
13475 {
13476
13477
13478
13479
13480 return super.CanReceiveItemIntoCargo(item);
13481 }
13482
13484 {
13485
13486
13487
13488
13489 GameInventory attachmentInv = attachment.GetInventory();
13491 {
13492 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13493 return false;
13494 }
13495
13496 InventoryLocation loc = new InventoryLocation();
13497 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13498 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
13499 return false;
13500
13501 return super.CanReceiveAttachment(attachment, slotId);
13502 }
13503
13505 {
13506 if (!super.CanReleaseAttachment(attachment))
13507 return false;
13508
13509 return GetInventory().AreChildrenAccessible();
13510 }
13511
13512
13513
13514
13515
13516
13517
13518
13519
13520
13521
13522
13523
13524
13525
13526
13527
13528
13529
13530
13531
13533 {
13534 int id = muzzle_owner.GetMuzzleID();
13535 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
13536
13537 if (WPOF_array)
13538 {
13539 for (int i = 0; i < WPOF_array.Count(); i++)
13540 {
13541 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13542
13543 if (WPOF)
13544 {
13545 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13546 }
13547 }
13548 }
13549 }
13550
13551
13553 {
13554 int id = muzzle_owner.GetMuzzleID();
13556
13557 if (WPOBE_array)
13558 {
13559 for (int i = 0; i < WPOBE_array.Count(); i++)
13560 {
13561 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13562
13563 if (WPOBE)
13564 {
13565 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13566 }
13567 }
13568 }
13569 }
13570
13571
13573 {
13574 int id = muzzle_owner.GetMuzzleID();
13575 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13576
13577 if (WPOOH_array)
13578 {
13579 for (int i = 0; i < WPOOH_array.Count(); i++)
13580 {
13581 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13582
13583 if (WPOOH)
13584 {
13585 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13586 }
13587 }
13588 }
13589 }
13590
13591
13593 {
13594 int id = muzzle_owner.GetMuzzleID();
13595 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13596
13597 if (WPOOH_array)
13598 {
13599 for (int i = 0; i < WPOOH_array.Count(); i++)
13600 {
13601 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13602
13603 if (WPOOH)
13604 {
13605 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13606 }
13607 }
13608 }
13609 }
13610
13611
13613 {
13614 int id = muzzle_owner.GetMuzzleID();
13615 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13616
13617 if (WPOOH_array)
13618 {
13619 for (int i = 0; i < WPOOH_array.Count(); i++)
13620 {
13621 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13622
13623 if (WPOOH)
13624 {
13625 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13626 }
13627 }
13628 }
13629 }
13630
13631
13632
13634 {
13636 {
13637 return true;
13638 }
13639
13640 return false;
13641 }
13642
13644 {
13646 {
13647 return true;
13648 }
13649
13650 return false;
13651 }
13652
13654 {
13656 {
13657 return true;
13658 }
13659
13660 return false;
13661 }
13662
13664 {
13665 return false;
13666 }
13667
13670 {
13671 return UATimeSpent.DEFAULT_DEPLOY;
13672 }
13673
13674
13675
13676
13678 {
13680 SetSynchDirty();
13681 }
13682
13684 {
13686 }
13687
13688
13690 {
13691 return false;
13692 }
13693
13696 {
13697 string att_type = "None";
13698
13699 if (ConfigIsExisting("soundAttType"))
13700 {
13701 att_type = ConfigGetString("soundAttType");
13702 }
13703
13705 }
13706
13708 {
13710 }
13711
13712
13713
13714
13715
13721
13723 {
13726
13728 }
13729
13730
13732 {
13734 return;
13735
13737
13740
13743
13744 SoundParameters params = new SoundParameters();
13748 }
13749
13750
13752 {
13754 {
13757
13758 SetSynchDirty();
13759
13762 }
13763 }
13764
13766 {
13768 }
13769
13770
13772 {
13774 return;
13775
13777 SetSynchDirty();
13778
13781 }
13782
13784 {
13787 }
13788
13790 {
13792 }
13793
13794 void OnApply(PlayerBase player);
13795
13797 {
13798 return 1.0;
13799 };
13800
13802 {
13804 }
13805
13807 {
13809 }
13810
13812
13814 {
13815 SetDynamicPhysicsLifeTime(0.01);
13817 }
13818
13820 {
13821 array<string> zone_names = new array<string>;
13822 GetDamageZones(zone_names);
13823 for (int i = 0; i < zone_names.Count(); i++)
13824 {
13825 SetHealthMax(zone_names.Get(i),"Health");
13826 }
13827 SetHealthMax("","Health");
13828 }
13829
13832 {
13833 float global_health = GetHealth01("","Health");
13834 array<string> zones = new array<string>;
13835 GetDamageZones(zones);
13836
13837 for (int i = 0; i < zones.Count(); i++)
13838 {
13839 SetHealth01(zones.Get(i),"Health",global_health);
13840 }
13841 }
13842
13845 {
13846 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13847 }
13848
13850 {
13851 if (!hasRootAsPlayer)
13852 {
13853 if (refParentIB)
13854 {
13855
13856 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
13857 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13858
13859 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
13860 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13861
13864 }
13865 else
13866 {
13867
13870 }
13871 }
13872 }
13873
13875 {
13877 {
13878 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
13879 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
13880 {
13881 float heatPermCoef = 1.0;
13883 while (ent)
13884 {
13885 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13886 ent = ent.GetHierarchyParent();
13887 }
13888
13889 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13890 }
13891 }
13892 }
13893
13895 {
13896
13897 EntityAI parent = GetHierarchyParent();
13898 if (!parent)
13899 {
13900 hasParent = false;
13901 hasRootAsPlayer = false;
13902 }
13903 else
13904 {
13905 hasParent = true;
13906 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13907 refParentIB =
ItemBase.Cast(parent);
13908 }
13909 }
13910
13911 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
13912 {
13913
13914 }
13915
13917 {
13918
13919 return false;
13920 }
13921
13923 {
13924
13925
13926 return false;
13927 }
13928
13930 {
13931
13932 return false;
13933 }
13934
13937 {
13938 return !GetIsFrozen() &&
IsOpen();
13939 }
13940
13942 {
13943 bool hasParent = false, hasRootAsPlayer = false;
13945
13946 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
13947 bool foodDecay =
g_Game.IsFoodDecayEnabled();
13948
13949 if (wwtu || foodDecay)
13950 {
13954
13955 if (processWetness || processTemperature || processDecay)
13956 {
13958
13959 if (processWetness)
13960 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13961
13962 if (processTemperature)
13964
13965 if (processDecay)
13966 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13967 }
13968 }
13969 }
13970
13973 {
13975 }
13976
13978 {
13981
13982 return super.GetTemperatureFreezeThreshold();
13983 }
13984
13986 {
13989
13990 return super.GetTemperatureThawThreshold();
13991 }
13992
13994 {
13997
13998 return super.GetItemOverheatThreshold();
13999 }
14000
14002 {
14004 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
14005
14006 return super.GetTemperatureFreezeTime();
14007 }
14008
14010 {
14012 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
14013
14014 return super.GetTemperatureThawTime();
14015 }
14016
14021
14023 {
14024 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14025 }
14026
14028 {
14029 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14030 }
14031
14034 {
14036 }
14037
14039 {
14041 }
14042
14044 {
14046 }
14047
14050 {
14051 return null;
14052 }
14053
14056 {
14057 return false;
14058 }
14059
14061 {
14063 {
14066 if (!trg)
14067 {
14069 explosive = this;
14070 }
14071
14072 explosive.PairRemote(trg);
14074
14075 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14076 trg.SetPersistentPairID(persistentID);
14077 explosive.SetPersistentPairID(persistentID);
14078
14079 return true;
14080 }
14081 return false;
14082 }
14083
14086 {
14087 float ret = 1.0;
14090 ret *= GetHealth01();
14091
14092 return ret;
14093 }
14094
14095 #ifdef DEVELOPER
14096 override void SetDebugItem()
14097 {
14098 super.SetDebugItem();
14099 _itemBase = this;
14100 }
14101
14103 {
14104 string text = super.GetDebugText();
14105
14107 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
14108
14109 return text;
14110 }
14111 #endif
14112
14114 {
14115 return true;
14116 }
14117
14119
14121
14123 {
14126 }
14127
14128
14136
14152
14153 [
Obsolete(
"Use ItemSoundHandler instead")]
14156 {
14157 if (!
g_Game.IsDedicatedServer())
14158 {
14159 if (ConfigIsExisting("attachSoundSet"))
14160 {
14161 string cfg_path = "";
14162 string soundset = "";
14163 string type_name =
GetType();
14164
14167 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
14168 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
14169
14170 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
14171 {
14172 for (int i = 0; i < cfg_soundset_array.Count(); i++)
14173 {
14174 if (cfg_slot_array[i] == slot_type)
14175 {
14176 soundset = cfg_soundset_array[i];
14177 break;
14178 }
14179 }
14180 }
14181
14182 if (soundset != "")
14183 {
14184 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
14186 }
14187 }
14188 }
14189 }
14190
14192}
14193
14195{
14197 if (entity)
14198 {
14199 bool is_item = entity.IsInherited(
ItemBase);
14200 if (is_item && full_quantity)
14201 {
14204 }
14205 }
14206 else
14207 {
14209 return NULL;
14210 }
14211 return entity;
14212}
14213
14215{
14216 if (item)
14217 {
14218 if (health > 0)
14219 item.SetHealth("", "", health);
14220
14221 if (item.CanHaveTemperature())
14222 {
14224 if (item.CanFreeze())
14225 item.SetFrozen(false);
14226 }
14227
14228 if (item.HasEnergyManager())
14229 {
14230 if (quantity >= 0)
14231 {
14232 item.GetCompEM().SetEnergy0To1(quantity);
14233 }
14234 else
14235 {
14237 }
14238 }
14239 else if (item.IsMagazine())
14240 {
14241 Magazine mag = Magazine.Cast(item);
14242 if (quantity >= 0)
14243 {
14244 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14245 }
14246 else
14247 {
14249 }
14250
14251 }
14252 else
14253 {
14254 if (quantity >= 0)
14255 {
14256 item.SetQuantityNormalized(quantity, false);
14257 }
14258 else
14259 {
14261 }
14262
14263 }
14264 }
14265}
14266
14267#ifdef DEVELOPER
14269#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.