Files
ReSkate/Extension/Console/commands.h
T
AyeZeeBB 6d542536e1 Plugins: sandboxed Luau plugins in mods, phase 1 (the host, and the base, console and storage APIs)
A mod with a reskate-plugin.json is a plugin: Luau scripts that run in their own VM, with only
the reskate API ReSkate registers for them. Luau 0.741 is vendored in External/luau (the VM and
compiler only: no native code generation, no loadstring, io or C modules).

- Limits: 64 MB of memory, 50 ms a call, 2 ms a tick on average (over it for 3 s stops it),
  more than 5 errors in 10 s stops it, 50 log lines a second. A plugin over a limit cannot catch
  it in a pcall and carry on.
- API: reskate.log, on (load, unload, tick, level_loaded, level_unloading), timers, the level,
  its own package's files and JSON, require inside the package; console.command and print
  ("console"); storage get, set, add and keys ("storage"), 1 MB in
  %LOCALAPPDATA%\ReSkate\Plugins\<mod>\storage.json.
- Found every 2 s among the mods mods.json leaves on: switching a mod, or changing a plugin's
  files, loads, unloads or reloads it without a restart. A package holding a program is refused.
- plugin list, commands, reload, off and on in the console. A plugin cannot take a name of
  ReSkate's own commands.
- Tests: DINGOSDK_BUILD_PLUGIN_TESTS, including plugins written to break the sandbox.
2026-10-19 11:55:27 -05:00

44 lines
2.2 KiB
C++

#pragma once
#include "Engine/Core/Console/command_registry.h"
#include "Extension/UI/Overlay/overlay.h"
namespace dingosdk::console {
using Model = overlay::Model;
using Commands = Registry<Model>;
using Entry = Commands::Entry;
using Argument = Commands::Argument;
const Commands &game_commands();
Argument argument(std::string name, Type type = Type::text, bool optional = false);
Entry action(std::string name, std::string description, Group group, std::vector<Argument> arguments = {});
Entry variable(std::string name, std::string description, Group group, Argument argument);
State boolean_state(bool available, bool value, std::string reason = {}, std::string detail = {});
void register_movement_commands(Commands &);
void register_ai_commands(Commands &);
void register_settings_commands(Commands &);
void register_world_commands(Commands &);
void register_graphics_commands(Commands &);
void register_progression_commands(Commands &);
void register_object_commands(Commands &);
void register_park_editor_commands(Commands &);
void register_multiplayer_commands(Commands &);
void register_perf_commands(Commands &);
// perf_commands.cpp: starts `perf memory`'s trace with the game when RESKATE_MEMORY_TRACE asks for it.
void start_memory_trace_from_environment() noexcept;
void register_item_commands(Commands &);
void register_trainer_commands(Commands &);
void register_hall_of_meat_commands(Commands &);
void register_road_rash_commands(Commands &);
void register_board_break_commands(Commands &);
void register_grind_exit_commands(Commands &);
void register_replay_keyframes_commands(Commands &);
void register_plugin_commands(Commands &);
// Runtime adapters. Invoked only by the verified game-thread dispatcher.
void request_debug(overlay::DebugAction, bool enabled = false, float value = 0);
void request_feature(overlay::OfflineFeatureGroup, bool enabled);
void request_engine_variable(std::string_view name, bool restore, bool value);
std::string request_named_setting(std::string_view name, std::string_view value, bool restore);
std::string request_reset_named_settings();
void request_level(const std::string &level, const std::string &start, const std::string &sublevel,
const std::string &substart);
} // namespace dingosdk::console