Plugin API Reference

Everything RPG Reactor offers a plugin, written from the engine's own code: the functions meant for game plugins, RPG Reactor's plugin commands, and the editor plugin interface. Writing Plugins shows how to use them; the Engine API Reference lists every function in the runtime.

What a Plugin Is Written For

A plugin's @target line, which the Plugin Manager shows beside its author:

@targetWhat it is
ReactorA game plugin written for RPG Reactor (RPGReactor is the same)
MZ ReactorA game plugin written for both RPG Maker MZ and RPG Reactor
MZAn RPG Maker MZ plugin
MVAn RPG Maker MV plugin
ReactorEditorAn editor plugin

Functions for Game Plugins

Lighting on a 3D Map

  • Reactor3D.setMapAmbient(values, duration): Ease the map's ambient light to a new level and colour; values === null restores the authored ambient. (runtime/reactor_3d_lighting.js)

  • Reactor3D.switchLight(target, state): Turn a light, or every light of a tag, on, off or over. (runtime/reactor_3d_lighting.js)

  • Reactor3D.transformLight(target, values, duration): Ease a light, or every light of a tag, to new values over duration frames. values holds any of LIGHT_OVERRIDE_FIELDS; a field left out is left alone. Colour may be "#rrggbb" or a number. values === null clears the target's overrides. (runtime/reactor_3d_lighting.js)

3D Models

  • Reactor3D.transformModel(character, target, duration): Give a character's model a transform to ease to over duration frames (0: at once). (runtime/reactor_3d_models.js)

  • Reactor3D.playModelAnimation(character, name, options): Queue a named action animation on a character's model. (runtime/reactor_3d_models.js)

Ground

  • Reactor3D.deriveElevation(mapData, flags, options): A starting elevation derived from the map's own passability. An existing 2D map carries no height data, and asking an author to paint a whole city by hand before seeing anything in 3D is a poor first experience. Impassable cells are overwhelmingly walls, buildings and cliffs, so raising them recovers a recognisable massing from a map that was never authored for 3D — the starting point an author then edits, not a final answer. Passability is read the way Game_Map.checkPassage reads it: the planes are walked top-down and the first tile with a decisive flag wins, with [] tiles skipped because they say nothing about passage. *(runtime/reactor_3d.js)

  • Reactor3D.stairAt(mapData, x, y): Whether a stair piece stands on the cell x, y of a map. (runtime/reactor_3d_world.js)

Characters

  • character.reactorIsWalking(): Whether a walk to a tile is under way. (runtime/reactor_objects_map.js)

Vehicles

  • ReactorVehicles.Drive.state(): $gamePlayer._rrDrive while driving, every field a number; else null. (runtime/reactor_vehicles_drive.js)

Battles on the Map

  • $gameFight.commandVehicleAttack(): The vehicle's own attack, aimed at once (a HUD with its own lists; a script). (runtime/reactor_vehicles_mount.js)

Steam

For a game on Steam (Database › System 2 › Steam); every call does nothing without Steam. See Steam for games.

  • ReactorSteam.available(): Steam is running for this game
  • ReactorSteam.unlock(apiName): unlock an achievement
  • ReactorSteam.clear(apiName): lock it again (for testing)
  • ReactorSteam.isUnlocked(apiName): whether an achievement is unlocked
  • ReactorSteam.stat(name): an integer stat's value
  • ReactorSteam.setStat(name, value): set an integer stat

Runtime Events

ReactorEvents.on(name, handler) hears what happens in battles, on doors and in vehicles, without replacing a method. Runtime Events lists every event and what it carries.

RPG Reactor's Plugin Commands

RPG Reactor's own event commands are plugin commands of the plugin RPGReactor. Every argument arrives as text, as any plugin command's does. A plugin runs one as an event would:

PluginManager.callCommand(interpreter, "RPGReactor", "LightSwitch", { target: "#village", state: "on" });

Battle

Change Enemy Equipment (ChangeEnemyEquipment)

Puts a weapon or armor into one equipment slot of one enemy in the current troop, or empties the slot.

ArgumentTypeMeaning
enemyIndexnumberWhich troop member, counted from 0.
slotIndexnumberWhich equipment slot, counted from 0.
kindnumber2 for a weapon, 3 for an armor.
itemIdnumberThe weapon or armor's database number; 0 empties the slot.

Vehicles

Get On Reactor Vehicle (GetOnVehicle)

Puts the party on a vehicle, walking aboard or at once.

ArgumentTypeMeaning
vehiclestringWhich vehicle: left out or "this" is the event running the command; also "nearest", "ridden", "boat", "ship" or "airship" (the stock ones), an event number on this map, or a vehicle's identity such as "0:3".
instantbooleanBoards at once with no walk; false when left out.
waitbooleanHolds the event until boarding is done; true when left out.

Get Off Reactor Vehicle (GetOffVehicle)

Takes the party off the vehicle it is riding.

ArgumentTypeMeaning
instantbooleanGets off at once with no walk; false when left out.
waitbooleanHolds the event until the party is off; true when left out.

3D

Play Model Animation (PlayModelAnimation)

Plays a named animation on a character's 3D model; several in a row queue up and play one after another.

ArgumentTypeMeaning
targetnumberWhose model: 0 this event, -1 the player, -2 and below the followers, or an event number (a placed prop is 10000 + its prop number).
animationstringThe animation's name from the model; empty stops the animation and clears the queue.
waitbooleanHolds the event until that animation has played once through (at most 1800 frames); the player can still walk meanwhile.

Set Model Animation Speed (SetModelAnimationSpeed)

Changes how fast a character's 3D model animates.

ArgumentTypeMeaning
targetnumberWhose model: 0 this event, -1 the player, -2 and below the followers, or an event number.
speednumberSpeed in percent, 1 to 1000; 100 when left out or not a number.

Play 3D Effect (PlayModelEffect)

Plays one of a 3D model's own effects at the spot it was placed on the model.

ArgumentTypeMeaning
targetnumberWhose model: 0 this event, -1 the player, -2 and below the followers, or an event number.
effectstringThe effect's name from the model's effects list; empty does nothing.

Speak 3D Dialogue (SpeakModel3D)

Plays a voice clip from a 3D character and moves its mouth with the sound, or stops that voice.

ArgumentTypeMeaning
operationspeak | stop"stop" stops the character's voice; anything else speaks.
targetnumberWho speaks: 0 this event, -1 the player, -2 and below the followers, or an event number.
audiostringThe sound file in audio/se, without its extension.
volumenumberVolume, 90 when left out.
pitchnumberPitch, 100 when left out.
pannumberLeft-right pan, 0 when left out.
waitbooleanHolds the event until the voice finishes; true unless "false".

Change 3D Camera (ChangeCamera3D)

Moves the 3D map camera to another view, eased over a number of frames.

ArgumentTypeMeaning
modefixed | topDown | isometric | thirdPerson | firstPersonThe camera mode; some other spellings are accepted, and an unknown one is fixed.
pitchnumberTilt in degrees, -89 to 89; blank uses the mode's own.
yawnumberTurn in degrees, -360 to 360; blank uses the mode's own.
distancenumberDistance from what it looks at, in tiles, 0.5 to 1024; blank uses the mode's own.
fovnumberField of view in degrees, 5 to 150; blank uses the mode's own.
focusauto | display | player | eventWhat the camera centres on; anything else is auto (the mode's own choice).
eventIdnumberFor focus event: the event to follow; 0 is this event.
durationnumberFrames to ease over, 0 to 6000; 0 is at once.
waitbooleanHolds the event until the camera has arrived (only when duration is above 0).
keepbooleanKeeps this camera on later maps instead of each map's own.

Transform 3D Model (TransformModel3D)

Moves, turns and scales a character's 3D model from its placed pose, eased over a number of frames.

ArgumentTypeMeaning
targetnumberWhose model: 0 this event, -1 the player, -2 and below the followers, or an event number (a placed prop is 10000 + its prop number).
offsetXnumberShift left-right in tiles; 0 when left out.
offsetYnumberShift along the map's depth (toward or away from the bottom of the map) in tiles; 0 when left out.
offsetZnumberShift up or down in tiles; 0 when left out.
yawnumberTurn in degrees; 0 when left out.
pitchnumberTilt forward or back in degrees; 0 when left out.
rollnumberRoll sideways in degrees; 0 when left out.
scaleXnumberWidth scale; 1 when left out or not above 0.
scaleYnumberHeight scale; 1 when left out or not above 0.
scaleZnumberDepth scale; 1 when left out or not above 0.
durationnumberFrames to ease over; 0 is at once.
waitbooleanHolds the event for the duration.

Lighting

Switch Light (LightSwitch)

Turns a map light, or every light with a tag, on, off, or the other way.

ArgumentTypeMeaning
targetstringA light's id, or "#tag" for every light with that tag.
stateon | off | toggle"off" turns it off, "toggle" flips it, anything else turns it on.

Transform Light (TransformLight)

Eases a map light, or every light with a tag, to new position, direction, size, brightness or color.

ArgumentTypeMeaning
targetstringA light's id, or "#tag" for every light with that tag.
xnumberPosition across in tiles (an offset when the light rides a character); blank leaves it as placed.
ynumberPosition down the map in tiles (an offset when the light rides a character); blank leaves it as placed.
heightnumberHeight in tiles; blank leaves it as placed.
yawnumberDirection it points, in degrees; blank leaves it as placed.
pitchnumberTilt in degrees; blank leaves it as placed.
radiusnumberReach in tiles; blank leaves it as placed.
anglenumberCone angle in degrees, for a spotlight; blank leaves it as placed.
widthnumberBeam width in tiles; blank leaves it as placed.
intensitynumberBrightness; blank leaves it as placed.
colorstringColor as "#rrggbb"; blank leaves it as placed.
durationnumberFrames to ease over; 0 is at once.
waitbooleanHolds the event for the duration.
resetbooleanDrops what earlier commands set on this target, back to the light as placed; the other fields are then ignored.

Change Ambient Light (AmbientLight)

Eases the map's overall ambient light to a new brightness and color.

ArgumentTypeMeaning
intensitynumberBrightness from 0 to 1; blank leaves it as it is.
colorstringColor as "#rrggbb"; blank leaves it as it is.
durationnumberFrames to ease over; 0 is at once.
waitbooleanHolds the event for the duration.
resetbooleanGoes back to the map's own ambient light at once; the other fields are then ignored.

Game Flow

Scoped Wait (ScopedWait)

Holds the event until something happens while the player keeps moving: a character's actions finish, time passes, a switch flips or a variable reaches a value.

ArgumentTypeMeaning
targetstringWhose actions to wait on: "all" (the default when left out), 0 this event, -1 the player, or an event number; only used by the actions mode.
modeactions | duration | switch | variableWhat ends the wait; anything else is actions (model animations and, for one character, a forced move route; at most 3600 frames).
durationnumberFor duration: frames to wait; 0 when left out.
switchIdnumberFor switch: the switch to watch; 1 when left out.
switchValuebooleanFor switch: "false" waits for OFF, anything else for ON.
variableIdnumberFor variable: the variable to watch; 1 when left out.
op>= | > | = | < | <= | !=For variable: how it is compared with value; anything else is >=.
valuenumberFor variable: the number compared against; 0 when left out.
resumebooleanLets the waiting event carry on with its own movement while it waits; true unless "false".

Quest (QuestSet)

Discovers, completes, fails, resets, tracks or stops tracking a quest.

ArgumentTypeMeaning
questIdstringThe quest's number or key (the older name "quest" is read too).
actiondiscover | complete | fail | reset | track | untrackWhat to do; discover when left out. track also discovers it; untrack only stops tracking if it is the tracked quest.

Quest Objective (QuestObjective)

Shows, hides, completes, fails or reopens one objective of a quest, or all of them.

ArgumentTypeMeaning
questIdstringThe quest's number or key (the older name "quest" is read too).
objectivestringThe objective's number counted from 1, or "all" (also when left out).
statecomplete | show | hide | fail | resetWhat to set it to; complete when left out. reset opens it again.

Quest Reward (QuestReward)

Shows or hides a quest's reward in the log, or gives it to the party.

ArgumentTypeMeaning
questIdstringThe quest's number or key (the older name "quest" is read too).
rewardstringThe reward's number counted from 1, or "all" (also when left out).
stateshow | hide | give"give" hands it over once, "hide" hides it, anything else shows it; show when left out.

Open Quest Log (OpenQuestLog)

Opens the quest log screen.

ArgumentTypeMeaning
questIdstringA quest's number or key to open the log on; left out, the log opens as usual. Not used when the log is VisuStella's.

Steam Achievement (SteamAchievement)

Unlocks a Steam achievement, or locks it again for testing.

ArgumentTypeMeaning
apistringThe achievement's API name from Steamworks (letters, digits, _ . -).
actionunlock | clear"clear" locks it again; anything else unlocks; unlock when left out.

Character Creation (CharacterCreation)

Opens the character creation screen, or the character choice screen, as the game is set up.

ArgumentTypeMeaning
oncebooleanSkips the screen when the player already has a character; any value given counts as on, so leave it out for off.
requiredbooleanThe player must finish, with no way back; any value given counts as on, so leave it out for off.
switchIdnumberA switch turned ON when the player has their character and OFF when they backed out; 0 for none.

User Interfaces

Call User Interface (CallUserInterface)

Opens one of the game's custom user interface screens; does nothing in battle.

ArgumentTypeMeaning
interfaceIdnumberThe interface's number from the User Interface editor; 0 does nothing.

Party Followers

Change Follower Formation (ChangeFollowerFormation)

Changes how the followers walk behind the leader, kept with the save.

ArgumentTypeMeaning
formationfile | loose | rank | wedge | column | scatteredThe shape; any other value goes back to the game's own formation.
spacingnumberTiles between members, 1 to 4.
stragglenumberHow late and unevenly they follow, 0 to 100.

Follower Orders (FollowerOrders)

Tells followers to follow, stay, walk to a tile, come back to the leader, hide or show.

ArgumentTypeMeaning
whoall | follower | actor"follower" is one place in the line, "actor" the follower who is that actor, anything else every follower.
indexnumberFor follower: the place in the line, counted from 1.
actorIdnumberFor actor: the actor's database number.
orderfollow | stay | goto | come | hide | showThe order; follow when left out.
xnumberFor goto: the tile's x.
ynumberFor goto: the tile's y.
directionnumberFor goto: the way to face on arrival (2 down, 4 left, 6 right, 8 up); anything else keeps its facing.
waitbooleanFor goto and come: holds the event until they arrive.

Battles on the Map

Start Battle on Map (StartMapBattle)

Starts a battle right on the map with the units there, or the ordinary battle screen when the mode in force is Classic.

ArgumentTypeMeaning
modeclassic | tactical | action | firstPersonThe battle mode; any other value (or none) uses the mode in force: the next-battle setting, the troop's, this map's, then the game's.
whonear | map"near" takes the units near the party that the start rule takes; anything else takes every unit on the map.
troopIdnumberA troop whose members join the battle, placed round the party; 0 for none. Classic mode fights this troop on the battle screen.
turnsteam | initiativeHow turns go; any other value uses the game's setting.
objectivedefeatAll | survive | defeatUnit | switch | variableWhat wins the battle; anything else is defeatAll.
turnsToSurvivenumberFor survive: the turns to last (at least 1).
unitEventIdnumberFor defeatUnit: the event number of the unit to beat.
goalSwitchIdnumberFor switch: the battle is won when this switch is ON.
goalVariableIdnumberFor variable: the variable that is checked.
goalValuenumberFor variable: the battle is won when the variable is at least this value.
onTransferkeep | escapeWhat happens if the party leaves the map mid-battle: "keep" keeps the battle, anything else counts as an escape.
viewstring"map" keeps the map's own camera on a 3D map; any other value uses the battle's own view; left out, the game's setting decides.
canEscapebooleanWhether the party may run away.
canLosebooleanWhether the game goes on after a loss instead of ending.
waitbooleanHolds the event until the battle ends, then takes the If Win / If Escape / If Lose branch.
resultVariablenumberA variable that gets the result (0 win, 1 escape, 2 lose); 0 for none.

Spawn Unit (SpawnUnit)

Puts a new actor or enemy unit on the map, which joins a battle that is running.

ArgumentTypeMeaning
recordactor | enemyThe kind of database record; anything else is enemy.
idnumberThe actor's or enemy's database number.
teamally | enemy | neutralIts side; left out, ally for an actor and enemy for an enemy. Any other value spawns nothing.
atcell | event | variables"event" places it on a free spot next to a character, "variables" reads the tile from two variables, anything else uses x and y as the tile.
xnumberThe tile's x, or with at = variables the variable holding it.
ynumberThe tile's y, or with at = variables the variable holding it.
eventIdnumberFor at = event: the character to stand next to (0 this event, -1 the player, or an event number).
heightnumberOn a tile with several floors, which floor (a height); left out, the ground.
directionnumberThe way it faces: 2 down, 4 left, 6 right, 8 up; 0 or left out keeps the default.
templatenumberAn event on this map whose pages the unit copies; 0 for none.

Change Unit Side (ChangeUnitSide)

Moves a unit to another side, in a battle running now and in later battles on this map.

ArgumentTypeMeaning
eventIdnumberThe unit's event number; 0 is this event.
teamally | enemy | neutralThe new side; any other value (or none) gives the unit back its own side from its event.

Remove Unit (RemoveUnit)

Takes a unit out of the battle on the map.

ArgumentTypeMeaning
eventIdnumberThe unit's event number; 0 is this event.
keepbooleanLeaves the event standing on the map instead of erasing it.

End Battle on Map (EndMapBattle)

Ends the battle on the map with the result given.

ArgumentTypeMeaning
resultwin | lose | escapeHow it ends; anything else is win.

Change Battle Goal (ChangeBattleGoal)

Changes what wins the battle that is running on the map, checked at once.

ArgumentTypeMeaning
objectivedefeatAll | survive | defeatUnit | switch | variableWhat wins the battle; anything else is defeatAll.
turnsToSurvivenumberFor survive: the turns to last (at least 1).
unitEventIdnumberFor defeatUnit: the event number of the unit to beat; it joins the battle if it is not in it.
goalSwitchIdnumberFor switch: the battle is won when this switch is ON.
goalVariableIdnumberFor variable: the variable that is checked.
goalValuenumberFor variable: the battle is won when the variable is at least this value.

Change Battle Mode (ChangeBattleMode)

Sets which kind of battle the game, this map, or only the next battle uses.

ArgumentTypeMeaning
modeclassic | tactical | action | firstPerson | defaultThe battle mode; "default" or any other value clears the setting for that scope.
scopegame | map | nextWhere it applies: "map" this map, "next" the next battle only, anything else the whole game.

Set Terrain Cost (SetTerrainCost)

Sets how many steps it costs to move onto a region or terrain tag in tactical battles from now on.

ArgumentTypeMeaning
typeregion | terrain"terrain" means a terrain tag; anything else a region.
idnumberThe region (1 and up) or terrain tag (0 and up).
costnumberSteps it costs, up to 20; 0 blocks it, 1 or a non-number is the ordinary step.

Media Surfaces

Show Media Surface (ShowVideoSurface)

Shows a video or picture as a flat surface on the map, on a character, or on the screen; a new surface with the same number replaces the old one.

ArgumentTypeMeaning
idnumberThe surface's number, 1 to 999999 (also read as surfaceId or videoId); required.
moviestringThe file (also read as file or filename): a .webm or .mp4 in movies/, or a .png, .jpg, .webp or .jxl in img/pictures/; required.
targetmap | event | this-event | player | screenWhat it is placed on (also read as bindTo); map when left out.
eventIdnumberFor target event: the event's number.
xnumberOn the map the tile x; on a character an offset in pixels; on the screen the pixel x of its centre. 0 when left out.
ynumberOn the map the tile y; on a character an offset in pixels; on the screen the pixel y of its centre. 0 when left out.
znumberHeight above the ground in tiles, on 3D maps only; 0 when left out.
widthnumberWidth in pixels, 1 to 8192; 320 when left out.
heightnumberHeight in pixels, 1 to 8192; 180 when left out.
rotationXnumberTurn about the x axis in degrees; 0 when left out.
rotationYnumberTurn about the y axis in degrees; 0 when left out.
rotationZnumberTurn about the z axis in degrees (also read as rotation); 0 when left out.
scaleXnumberHorizontal scale; 1 when left out.
scaleYnumberVertical scale; 1 when left out.
opacitynumberOpacity 0 to 255 (or alpha, 0 to 1); fully opaque when left out.
loopbooleanPlays the video over and over; true when left out, and turned off when wait is on.
mutedbooleanPlays without sound; true when left out unless audio is given.
audiobooleanThe opposite of muted, read when muted is left out.
volumenumberVolume 0 to 100; 100 when left out.
playbackRatenumberPlayback speed, 0.05 to 16; 1 when left out.
layernumberDrawing layer, a number or below (0), ground (1), characters (3), above (5), screen (10); 3 when left out.
depthnumberOn a 3D map, moves it toward the camera in tiles; in 2D it orders surfaces within a layer. 0 when left out.
cullingDistancenumberHides it when it is this far outside the screen (2D, pixels) or from the camera (3D); 0 never hides it.
scanlinesnumberDraws TV scanlines over it: true/false, or a strength from 0 to 1; 0 when left out.
cornersjsonFour {x, y} points for a bent shape instead of the width × height rectangle (also x0..y3 one by one); left out, the rectangle.
worldCornersjsonFour {x, y} points the surface is stretched to in the world; left out, not used.
waitbooleanHolds the event until the video ends; ignored for a picture.

Transform Media Surface (TransformVideoSurface)

Changes a media surface that is showing: only the fields given change, at once.

ArgumentTypeMeaning
idnumberThe number of a surface that is showing; required.
targetmap | event | this-event | player | screenWhat it is placed on.
eventIdnumberFor target event: the event's number.
xnumberAs in Show Media Surface.
ynumberAs in Show Media Surface.
znumberAs in Show Media Surface.
widthnumberWidth in pixels; also resizes its shape unless it has corners set by hand.
heightnumberHeight in pixels; also resizes its shape unless it has corners set by hand.
rotationXnumberAs in Show Media Surface.
rotationYnumberAs in Show Media Surface.
rotationZnumberAs in Show Media Surface.
scaleXnumberAs in Show Media Surface.
scaleYnumberAs in Show Media Surface.
opacitynumberOpacity 0 to 255 (or alpha, 0 to 1).
loopbooleanAs in Show Media Surface.
mutedbooleanAs in Show Media Surface.
audiobooleanThe opposite of muted, read when muted is left out.
volumenumberVolume 0 to 100.
playbackRatenumberPlayback speed, 0.05 to 16.
layernumberAs in Show Media Surface.
depthnumberAs in Show Media Surface.
cullingDistancenumberAs in Show Media Surface.
scanlinesnumberAs in Show Media Surface.
cornersjsonFour {x, y} points (also x0..y3 one by one); setting them marks the corners as set by hand.
worldCornersjsonAs in Show Media Surface.

Stop Media Surface (StopVideoSurface)

Removes a media surface and releases any event waiting on it.

ArgumentTypeMeaning
idnumberThe surface's number (also read as surfaceId or videoId).

Not in the Event Command List

Scoped Wait (old name) (WaitForModelAnimation)

The first name of Scoped Wait, kept so events saved with it still work; it does exactly what Scoped Wait does.

ArgumentTypeMeaning
targetstringAs in Scoped Wait.
modeactions | duration | switch | variableAs in Scoped Wait.
durationnumberAs in Scoped Wait.
switchIdnumberAs in Scoped Wait.
switchValuebooleanAs in Scoped Wait.
variableIdnumberAs in Scoped Wait.
op>= | > | = | < | <= | !=As in Scoped Wait.
valuenumberAs in Scoped Wait.
resumebooleanAs in Scoped Wait.

Call Battle Room Event (BattleRoomEvent)

In a battle fought in a Battle Room, runs the current page of one of that room's events (the Battle Presentation editor adds it to a troop page).

ArgumentTypeMeaning
eventIdnumberThe event's number on the Battle Room's map.

Skip Battle Sequence (BattleSequenceSkip)

Skips the battle action sequence that is playing, landing all its hits at once.

No arguments.

Battle Room Camera (BattleRoomCamera)

In a battle fought in a Battle Room, moves the room's camera to a set place and angle.

ArgumentTypeMeaning
xnumberWhere it looks, across the room in tiles; left out keeps the current value.
ynumberWhere it looks, down the room in tiles; left out keeps the current value.
znumberHeight of the point it looks at, in tiles; left out keeps the current value.
yawnumberTurn in degrees; left out keeps the current value.
pitchnumberTilt in degrees; left out keeps the current value.
distancenumberDistance from the point it looks at, in tiles; left out keeps the current value.

Set Reactor Vehicle Location (SetVehicleLocation)

Moves a parked Reactor vehicle to a tile on this map, or takes it out of the world.

ArgumentTypeMeaning
vehiclestringWhich vehicle: left out or "this" is the event running the command; also an event number on this map, a vehicle's identity such as "0:3", "nearest" or "ridden".
removebooleanTakes the vehicle out of the world instead of moving it; false when left out.
xnumberThe tile's x; required to move it.
ynumberThe tile's y; required to move it.
yawnumberThe way it faces, in degrees; 0 when left out.
znumberOn a tile with several floors, the height to stand on; left out, the ground.

Editor Plugins: ReactorEditor

An editor plugin (@target ReactorEditor, in a project's js/editor-plugins/) asks for its context once: const plugin = ReactorEditor.plugin('MyPlugin');. What it adds through the context goes when the project closes. Writing Plugins has an example.

ReactorEditor

  • ReactorEditor.plugin(name): A plugin's context: made the first time it is asked for, while the plugin's script runs.
  • ReactorEditor.version: The interface's version: 1. A later one keeps what this one has.
  • ReactorEditor.events: The editor's moments a plugin can hear with plugin.on(event, handler).
  • ReactorEditor.project: The open project: { path, name }, or null.
  • ReactorEditor.database: The project's Database as the editor holds it: read it; change it through the Database.
  • ReactorEditor.currentMap(): The map open in the editor, or null.

A Plugin's Context

  • plugin.name: The plugin's name: its file's, without .js.
  • plugin.parameters: Its settings as the Plugin Manager saved them (each a string, as a game plugin's are).
  • plugin.addMenuItem({ label, action } = {}): An entry under the editor's Plugins menu: its label, what choosing it does. Answers the menu entry.
  • plugin.addToolbarButton({ title, icon, action } = {}): A button on the main toolbar, in a group of the plugins' own before the Forge's: its icon (a file of the plugin's own folder, a URL or SVG markup), its tooltip, what a click does. Answers the button; button.setActive(on) lights it as the toolbar's own buttons are lit.
  • plugin.addPanel({ id, title, icon, render, onToggle } = {}): A panel over the map's corner with the editor's panel header (its icon, title, close button): render(body, panel) fills it each time it opens or is refreshed; onToggle(open) hears it open and close. Answers the panel: panel.open(), close(), toggle(), refresh().
  • plugin.file(relative): A file of the plugin's own folder, js/editor-plugins/<its name>/ (its icon, a picture), as a URL the editor can load.
  • plugin.on(event, handler): Hear one of the editor's moments (ReactorEditor.events): handler(detail). Answers a function that stops listening.
  • plugin.onDispose(fn): Run fn when the plugin is unloaded (the project closes, or the list is saved again): undo what it changed itself.
  • plugin.notify(text): A short message in the editor's own dialog, titled with the plugin's name.

The Editor's Moments

plugin.on(event, handler) hears: projectOpened, mapLoaded, beforeSave, saved, playtest, projectClosing.