Write Forza Horizon 2 mods in C# or VB.NET. This first release brings the whole FH2 Mod Platform API to .NET. It also adds the FH2 classes, which let you work with the game itself without addresses or hooks:
vb
ANNA.Items("Car").Add("Repair", Sub() Player.Car?.Repair())
AddHandler Game.Tick, Sub() If Player.Car?.SpeedKmh > 300 Then UI.Notify("Slow down", "")
If World.Waypoint IsNot Nothing Then Player.TeleportTo(World.Waypoint.Value)
This is a preview. The API can still change before 1.0, and some classes haven't been tested much in the game yet (see Known issues below).
•The whole platform API (API 9, platform 2.8.0) in .NET: game text, title-screen entries, files, the game database, hooks and patches, settings, pages, hotkeys, commands, sessions and crash dumps.
•Two ways to ship, from the same project:
- Hosted: reload while the game runs, and use breakpoints.
- NativeAOT: one DLL, loaded like any C++ mod, with no runtime needed.
•VB.NET works in both.
•Scripts: drop a .cs or .vb file in fh2-mods-dotnet\scripts\ and it runs. No project needed.
•Reloading: rebuild and the mod swaps in, from a key or the console.
•The console (~): the log as it's written, and a prompt for every mod's commands.
The FH2 classes
•`Game`: the frame, the game's thread, every car's physics step, IsDriving, Language.
•`Player`, `Vehicle`, `World`: your car and every other car, with repair, headlights, exhaust flames and backfires; the time of day; the map's waypoint; and Player.TeleportTo.
•`Garage`, `CarCatalog`, `Profile`: cars you own, every car's names, the profile's values.
•`ANNA`: entries in FH2 ANNA's menu.
•`UI`, `Hud`, `Camera`, `Audio`: HUD notifications, the speedometer, camera shake, your own sounds.
•`Controller`, `GameInput`, `GameWindow`: the controller, feeding the game's controls, playing without a controller, the mouse and keys.
•`Menus`, `UiElement`, `SettingsTile`, `ButtonIcons` and more: everything a mouse and keyboard mod needs.