Commit Graph
171 Commits
Author SHA1 Message Date
Max efb268af7d Add ride breakdown hook for scripting (#24243) 2026-04-18 03:25:23 +00:00
Michał Janiszewski 8d9aec1090 Fix #26304: Use common prototypes for JS entities (#26321)
Previously JS entities would create prototypes on each allocation in
`Sc*::New`. This change creates a single global protype for each entity
class which then gets copied upon entity allocation in JS realm.

Running test with "Live Ride Measurements" plugin on a park shared for
performance testing I get following results:

|                 | OpenRCT2::Scripting::HookEngine::Call | OpenRCT2::Scripting::ScMap::getAllEntities |
|-----------------|---------------------------------------|--------------------------------------------|
| duktape         | 68ms                                  | 10ms                                       |
| quickjs current | 318ms                                 | 126ms                                      |
| quickjs + fix   | 22ms                                  | 942µs                                      |

Previously each call to `getAllEntities` would result in 1382 calls to
`JS_SetPropertyFunctionList`, each costing 90.5µs.

Park used: https://files.catbox.moe/z6j2g4.park
2026-04-05 09:22:47 +02:00
Basssiiie cee8fcbee6 Remove some unused includes and simplify some others (#26317) 2026-04-03 23:04:34 +02:00
Michael Bernardi 4c8308464f QuickJS network and plugin version bumps 2026-04-01 12:54:43 +11:00
Michael Bernardi 79e10f98d5 Fix ScSocket 2026-04-01 02:19:01 +11:00
Michael Bernardi 421530c3ea Use class prototypes for all script types. 2026-04-01 02:19:01 +11:00
16cd1c07ff Swap Duktape for quickjs-ng
Co-authored-by: Basssiiie <Basssiiie@users.noreply.github.com>
Co-authored-by: Tulio Leao <tupaschoal@gmail.com>
2026-04-01 02:18:36 +11:00
Aaron van Geffen 1cc7006127 Reorganise game actions into folders (#25987) 2026-02-10 08:57:40 +01:00
matheusvb3 bba937a03d Remove more redundant namespace qualifiers (#25828) 2026-01-16 08:38:20 +01:00
Aaron van Geffen 40aaf97c07 Update copyright years to 2026 (#25741) 2026-01-05 13:42:59 +00:00
Aaron van Geffen abe58f6439 Move ClearAction, GameAction, ScenarioSetSettingAction into GameActions (#25045) 2025-08-29 06:32:05 -03:00
Aaron van Geffen bcb803df96 Move Footpath game actions into GameActions namespace 2025-08-26 14:48:16 +02:00
Jan Strauss 0522ae848b Add award plugin APIs (#24468)
* Add award plugin apis

* Address review feedback (use erase_if, extract AwardAdd method)

* Address review feedback (remove redundant comments, make AwardAdd static)

* Address review feedback (bump plugin api version, add changelog entry)
2025-07-13 07:04:26 -03:00
Cory Sanin 65b5d86e6c Feature: [Plugin] Add bindings for missing cheats
Added the following binds for completeness:
- ignoreRidePrice
- makeAllDestructible
- forcedParkRating*

`allowSpecialColourSchemes` was missing from the type definition file so I added that as well.

\*forcedParkRating required a little more logic than the boolean cheats and I added some safeguards to prevent setting invalid values
2025-07-08 09:18:25 +02:00
MaxandGymnasiast 5a95e5e27d Close #24313 - Add API for setting a car’s ‘isCrashed’ flag
Co-authored-by: Gymnasiast <Gymnasiast@users.noreply.github.com>
2025-05-12 21:42:46 +00:00
Max 08cb8cb8c3 Add plugin call for breakdowns (#24207) 2025-04-30 14:41:47 +00:00
ZeroBreakpoint 76cc04d044 Fix crash in map.getAllEntities("car") when car has an invalid ride 2025-04-17 19:18:23 +02:00
b92e05bc14 Scripting: Add Car.moveToTrack API (#23359)
* Scripting: Redraw vehicle when setting track location

* Scripting: introduce car.moveToTrack

A new function to move cars to tracks easier. Also redraws the car.

* Revert car.trackLocation to CoordsXYZD

reverts 30a555d3c2
car.moveToTrack() achieves the same thing in a saner API.

* Final fixes for vehicle.moveToTrack

added back tracklocation.Get with track type
added EntityTweener call at the end of travelBy/moveToTrack

* moveToTrack: final bassie review fixes.

* moveToTrack: use tile coords

* moveToTrack: api increment

---------

Co-authored-by: Guy Sviry <guy@axissecurity.com>
Co-authored-by: Tulio Leao <tupaschoal@gmail.com>
2025-04-02 23:42:30 +00:00
Michael Steenbeek be9f27e4f9 Mass rename constants (#23656) 2025-01-19 15:59:45 +00:00
Aaron van Geffen dbc394cb67 Scripting: list and use available costumes dynamically 2024-12-08 12:34:13 +01:00
Aaron van Geffen fa06a49302 Update copyright year to 2025 (#23514) 2024-12-31 20:30:04 +01:00
Aaron van Geffen 3685d1a24b clang-format: change IndentPPDirectives to BeforeHash (#23287) 2024-11-29 12:04:56 +09:00
Tulio Leao 4404415aec Fix #22891: getInstalledObject API function not implemented 2024-10-05 09:35:21 +00:00
AT41andTulio Leao 6e7b489304 Added additional stats to Plugin interface
Co-authored-by: Tulio Leao <tupaschoal@gmail.com>
2024-10-03 11:23:50 +00:00
kendfreyandTulio Leao 307523610e Add Park.generateGuest() to plugin API (#22883)
Co-authored-by: Tulio Leao <tupaschoal@gmail.com>
2024-10-02 06:49:43 -03:00
DuncanandTulio Leao e157a843f0 Large scenery object tiles for scripting (#22842)
Co-authored-by: Tulio Leao <tupaschoal@gmail.com>
2024-10-01 21:02:46 -03:00
Harry Hopkinson 89637013e8 Fix #21507: Expose suggestedGuestMaximum via hook (#21521) 2024-09-11 21:17:26 -03:00
Guy SviryandGuy Sviry 332df0f1db expose Vehicle.spin_sprite to Car scripting (#22392)
* expose spinSprite to Car scripting

---------

Co-authored-by: Guy Sviry <guy@axissecurity.com>
2024-08-07 18:13:33 +01:00
Aaron van Geffen 05e56517ab Adopt existing namespaces into OpenRCT2 namespace (#22368)
* Put all of TitleSequenceManager into the same namespace

* Move RideConstructionState into the OpenRCT2 namespace

* Adopt existing namespaces into OpenRCT2 namespace

This adds `using namespace OpenRCT2` to compilation units where appropriate,
as a means to get the codebase to compile until these units have been placed
in a namespace of their own.
2024-07-26 09:59:58 +02:00
Guy SviryandGuy Sviry 30a555d3c2 Expose vehicle.trackType to scripting (#22272)
Co-authored-by: Guy Sviry <guy@axissecurity.com>
2024-07-25 17:27:15 -03:00
Arnold Zhou a749698566 [Plugin API] Feat: Expose staff statistics (#22184) 2024-07-24 20:10:34 -03:00
Aaron van Geffen b5ef2693b0 Remove common.h include from all units 2024-07-09 16:45:19 +02:00
Arnold Zhou aa11d8ddfe Expose ride satisfaction to plugin api (#22172) 2024-07-08 10:53:14 +02:00
Aaron van Geffen 83e5aeb9c5 Increment versions for park format, script engine, network for new flags 2024-07-06 15:14:12 +02:00
Arnold Zhou a0f5d09408 Expose monthly expenditure history to plug-in API 2024-06-23 22:49:49 +02:00
Stephan Spengler 73043106ed [Plugin] Add banner index to banner creation result 2024-05-29 22:35:35 +02:00
spacek531 94750f4e34 Add plugin API to VehicleCrashedParticle 2024-05-29 12:32:41 +02:00
Arnold Zhou 01319ff352 Expose guest's favourite ride (ID) to plugin API 2024-05-27 15:18:02 +02:00
Stephan Spengler f4156e9043 Create or delete banners when tile elements are changed by plugins (#21627) 2024-05-17 07:54:51 -03:00
Aaron van Geffen 893392d987 Scripting: allow precise and safe control of peep animations 2024-05-05 21:09:41 +00:00
Aaron van Geffen 831c7651bb Scripting: tailor costume assignment to each staff type
In order to transition staff costumes to objects, we must further disentangle staff from regular peeps. This has many advantages, such as making custom entertainers or even handymen costumes. However, this means putting some restrictions on what costumes can be assigned to staff in the mean while.

We are aware of plug-ins allowing staff to be decorated like normal peeps, though, e.g. using @Manticore-007's Peep Editor. Splitting staff from peeps will mean breaking such functionality. We can do our very best to reverting 'invalid' staff to their normal outfits instead of them outright disappearing. However, in the mean time, we should disallow peep costumes from being assigned to staff to prevent further disappointment down the line.

Once we get to actually adding custom staff costumes, I plan to add a new plug-in API to get available costumes for a particular staff type. This would apply to entertainers, but also other staff types. This should make it easier for plug-in authors to tap into custom costumes in the future.
2024-05-05 22:41:52 +02:00
Katherine Norton cd528665e6 Expose whether the game is paused to the plugin API 2024-05-03 15:59:57 +00:00
Stephan Spengler 2913a0686a Add banner properties to plugin API for large scenery, walls and banners 2024-03-26 11:42:09 +00:00
Alex ParisiandTulio Leao efb6d48c4c Add plugin API to get registered plugin metadata (#20709)
* Added API for getAllPlugins

Added functionality to the Scripting API to allow Contexts to return a list of all registered plugins.

* Fixed naming conventions, returning list of authors

Changed function names to follow get/set convention. Removed unnecessary copies of shared pointers, now using auto instead. Changed the functionality to return an array of authors instead of a string.

* Added changelog entry

Also added myself to list of contributors

* Moved all functionality to ScPlugin

Created a ScPlugin class and moved the current getPlugins functionality there.

* Changed from method to property

Function names now match the get/set convention for properties. Also did some code cleanup.

* Update copyright

* Bump plugin version

---------

Co-authored-by: Tulio Leao <tupaschoal@gmail.com>
2024-02-16 05:53:48 -03:00
ζeh Matt 84213efde2 Fix using iterators that are deleted by the plugin 2024-01-25 17:01:00 +02:00
Katherine NortonandTulio Leao 0450435377 Add Plugin API for managing a guest's items (#21062)
* Add API for guest items in openrct2.d.ts

* Create GuestItem interfaces

* Set fields to readonly and add documentation

* Implement getting items array

* Implement checking if a guest has an item

* Implement removing items from guests

* Implement giving a guest an item

* Re-merge GuestItemType with FoodDrinkType

* Add more data validation for the EnumMaps

* Update versioning and changelog

* Add some errors to the give_item method

* Bump network version

* Update VoucherType to if/else

Co-authored-by: Tulio Leao <tupaschoal@gmail.com>

* Add static_assert to ScGuest.hpp

---------

Co-authored-by: Tulio Leao <tupaschoal@gmail.com>
2024-01-20 11:51:23 -03:00
ζeh Matt 8bcd409fb0 Fix #21145, #21158: Keep handles for intervals stable and resolve crash 2024-01-06 10:42:17 +02:00
James103 1d8dc111f1 Replace 2023 with 2024 in copyright headers (#21139)
Replace all instances of the year 2023 with 2024 in all copyright headers
2024-01-01 12:52:28 +01:00
ζeh Matt 0ffbd65576 Bump plugin API version 2023-10-08 02:30:55 +03:00
Stephan Spengler 39ecab4bd2 add small scenery tertiary colour to plugin API (#20818)
* add small scenery tertiary colour to plugin API

* bump API version
2023-10-01 11:27:04 +01:00