Mod Creation__Updating Your Mods_Updating Core API Changelog 1.4.0 - risk-of-thunder/R2Wiki GitHub Wiki
There have been widespread inventory api changes to support normal and temp items. GetItemCount, GiveItem, RemoveItem, etc exist for backwards compatibility, but the codebase now uses GiveItemPermanent, GiveItemTemp, etc. Any IL hook that used to match for those method names will now fail to match.
- The game now contains different "containers" for types of items, including Permanent and Temporary
- These are summed and eventually put into an "effective item count" container, which contains the finalized amount of items for stat/behaviour purposes.
- The int[] array representing the amount of items is no longer utilized by the game internally.
- GetItemCount: Takes from the Effective Item Count.
- Add Item: Redirects to adding specifically a Permanent Item.
- Remove Item: Reditects to removing specifically a Permanent Item.
- Temporary items are given as a normalized float, representing how "decayed" the item is.
- For example, giving 0.5f of a temporary item will grant a new item that's 50% decayed. while giving 1.5f of a temporary item will grant two temporary items (where one of them has a 50% decayed value)
DLC3Content.Items.ExtraEquipment (Functional Coupler) allows each equipment slot to hold multiple equipment that you can cycle through. As a result, the array that used to store your various equipment has changed from equipmentStateSlots[slot] to _equipmentStateSlots[slot][set].
While the old GetEquipment and SetEquipment still exist for backwards compatibility, they are obsolete as new overloads exist for an explicit set argument.
UniquePickup is the new generalised way to handle "instance" pickups (such as information from within the droplet) instead of PickupIndex.
In order to convert a pickup index to the new system use new UniquePickup(pickupIndex).
Numerous classes have changed field and method signatures. Expect IL Hooks that were trying to match for the old ldfld/call to fail.
- BossGroup: changed type for
bossDrops - ChestBehavior:
dropPickuphas no setter anymore; usecurrentPickupin general - OptionChestBehavior:
generatedDrops->generatedPickups - PickupDisplay:
pickupIndex->pickupState - PickupDropletController:
NetworkpickupIndex->NetworkpickupState - PickupIndexNetworker:
NetworkpickupIndexhas been changed topickupIndexand is also obsolete. UseNetworkPickupStateinstead. - PickupPickerController
- RouletteChestController: anything referencing
PickupIndextype has been changed toUniquePickup - ShopTerminalBehavior
- Various changes in the droptable classes: BasicPickUpDropTable, FreeChestDropTable, etc
Some enums have inserted new values in the middle of the list order, effectively shifting some values. For any affected enums you'll need to recompile your mod and reserialize any assets.
- The enums in
BaseActivity - InterruptPriority: added
TauntandImmobilize - CharacterBody.BodyFlags:
- Renamed
IgnoreKnockback->IgnoreKnockup - Changed values for
UsesAmbientLevelandIgnoresRecordDeathEvent
- Renamed
- DamageType:
- Removed
Frost - Changed value for
OutOfBounds
- Removed
- DamageTypeExtended
- Changed value for
ChefSource - Removed
Amputate
- Changed value for
- ItemTier
- Added
FoodTier - Since
AssignedAtRuntimehas been shifted, this will cause issues for custom item tiers
- Added
- VisibilityLevel: added
Untargetable
These fields have been retroactively added to all content packs. You can now get a body index with, for example, RoR2Content.BodyPrefabs.WispBody.bodyIndex instead of having to cache that value after the catalog has been initialized or by using BodyCatalog.FindBodyIndex.
If after updating MMHOOK you see a hook highlighted with a red line in your project, or the following error is logged when launching the game
TypeLoadException: Could not resolve type with token <address> from typeref (expected class 'hook_<name>' in assembly '')
it means the hook can't be found. While this can be simply because the original method has been removed, it is more likely to be due to all the various method overloads this DLC has added for backwards compatibility.
Let's take CombatDirector.SpendAllCreditsOnMapSpawns for example. In the past there used to be only one such method with that name, so the hook was simply called On.RoR2.CombatDirector.SpendAllCreditsOnMapSpawns. Now that there are two overloads for uniqueness they also include the method argument types, e.g,
On.RoR2.CombatDirector.SpendAllCreditsOnMapSpawns_Transform
On.RoR2.CombatDirector.SpendAllCreditsOnMapSpawns_Transform_WeightedSelection1while the original simple hook name is nowhere to be found. While fixing the hook means updating the name, you should look at the methods in the source code to see which is now obsolete and use the other one. That's because the obsolete one is simply a wrapper for the general method which is always called.
Methods that are known to have been affected (this is not an exhaustive list, feel free to expand):
- CombatDirector.SpendAllCreditsOnMapSpawns
- DotController.AddDot
- SkinDef.RuntimeSkin.ApplyAsync
-
EntityStates.ArtifactShell.ArtifactShellBaseState
-
DoOnPurchase,OnPurchasesignature change- This also affects inherited states, such as
WaitForKey
- This also affects inherited states, such as
-
-
Removed EntityStates.Chef.IceCube
-
EntityStates.EngiTurret.EngiTurretWeapon.FireBeam
- Fixed an issue where a specific method was not being called, causing issues with inheriting states (see Xi Construct mega laser)
-
EntityStates.FalseSon.LaserFather
- Removed
laserPrefab
- Removed
-
Entitystates.Vulture.FlyToLand
- Changed return type for GetFootPosition
-
InterfaceInstanceTracker has been added. It works like InstanceTracker but interfaces.
-
CharacterAI.AIFireEquipmentOnOwnerDeath
- Renamed
delayBeforeFiringEquipment->SetGameOverTimer - Removed
WaitToFireEquipment
- Renamed
-
Items.ContagiousItemManager
- Removed
itemsToCheck
- Removed
-
Convert any
ComboSkillDeftoComboSkillDefBase. Not breaking, but the former is marked as obsolete and likely not working. -
UI.ItemIcon
-
itemIndexis now a property and the original field has changed to_itemIndex
-
-
UI.Nameplate
-
SetBody->Initialize
-
-
UI.PingIndicator
- Removed
pingHighlightand addedpingTargetRenderers; multiple highlight renderers are now supported.
- Removed
-
AimAnimator
- Renamed
Start->TryInitializeAnimator
- Renamed
-
ArtifactTrialMissionController
- Changed signature for
GenerateDrop
- Changed signature for
-
BuffDefStockThresholdIcon
- Moved the icon override and threshold to a struct; possible overrides are now possible at various thresholds
-
BulletAttack
- Changed
directionfrom field to property - TODO access the rest
- Changed
-
CharacterBody
- The
TransmitItemBehaviormethods have changed signature
- The
-
CharacterMotor
- Changed signature for
ModifyGravity
- Changed signature for
-
CombatDirector
- Spawn changed signature
-
CostTypeCatalog
- Changed signature for
PayCost,PayCostItems,PayCostEquipment
- Changed signature for
-
CostTypeDef
- Changed signature for
PayCostDelegateandPayCost -
PayCostContexthas changed from class to struct
- Changed signature for
-
DamageInfo
- Removed
canRejectForce
- Removed
-
Glyphs
- Changed signature for
GetGlyphString
- Changed signature for
-
GrandParentSunController
- Removed
minimumStacksBeforeApplyingBurns
- Removed
-
GravitatePickup
- Removed
Start(empty method)
- Removed
-
HealthComponent
- Added
TakeDamageForce(PhysForceInfo)and the otherTakeDamageForcemethods call that internally (may cause IL hooks to break)
- Added
-
Inventory
- Added separate containers for Temporary Items and Permanent Items
- Added a system to lessen the amount of OnInventoryChanged calls.
- Bunch of changes related to EquipmentStates to accomodate the new yellow boss item
- Added the ability to disable inventories. where any items within the inventory have an effective item count of 0
-
ItemStealController
- A bunch of method signature changes
-
JumpVolume
- Changed signature for
onJump
- Changed signature for
-
MeridianEventTriggerInteraction
- Removed
SetPlayersInvulnerable
- Removed
-
MultishopController
- Changed signature for
OnPurchase
- Changed signature for
-
OutlineHighlight
- Removed
highlightQueue
- Removed
-
OutsideInteractableLocker
-
LockInforemoved and effectively fused withCandidates - Changed type for
eggLockInfoMap
-
-
OverlapAttack
- Changed signature for
PerformDamage
- Changed signature for
-
PhysForceInfo
- Changed
flags->_flags - Removed
ignoreGroundStickFlag,disableAirControlUntilCollisionFlag, andmassIsOneFlag
- Changed
-
PickRandomObjectOnAwake
- Moved
Awake->OnEnable
- Moved
-
PlayerCharacterMasterController
- Removed
GetForward
- Removed
-
PortalDialerController
- Changed signature for
OnActivationServer
- Changed signature for
-
PreloadContent
- It now uses
PreloadGameObjectsandPreloadSkinDefParamsinstead of asset references
- It now uses
-
Run
- Removed
stagesPerLoop,onLoopEvent - Added
LoopBeginArgs
- Removed
-
SceneExitController
- Changed
GetDestinationSceneToPreload->TryDetermineDestinationScene
- Changed
-
ScrapperController
- Removed
lastScrappedItemIndex,itemsEaten,Start,Update - The code for
BeginScrapping(int)has moved toBeginScrapping(UniquePickup)which can lead to IL hook fails
- Removed
-
SpawnReporter
- Changed signature for
IncrementSpawnCountandIncrementCount
- Changed signature for
-
SphereSearch
- Changed signature for
SearchData
- Changed signature for
-
TargetNearbyHealthComponents
- Removed
sphereSearch
- Removed
-
TeleportHelper
- Added
TeleportBodyArgsand changed the signature forcachedTeleportRequestsForPlayersInVehiclesandRequestVehicleExitAndWaitForCallback
- Added
-
TeleporterInteraction
- Replaced
bossShrineIndicatorwith_bossShrineCounter
- Replaced
-
Util
-
CleanseBodyis obsolete now; useCleanseSystem.CleanseBodyinstead
-
-
WorkQueue
- Changed
CanAffordProjectile->CanDoWorkNow
- Changed
-
UnseenHandIndicator
- Changed type for
pairs
- Changed type for
Chinchi, Nebby