Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Dregu committed Nov 7, 2023
1 parent 099f0d8 commit a8376ee
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 34 deletions.
14 changes: 12 additions & 2 deletions docs/game_data/spel2.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions docs/src/includes/_enums.md
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,8 @@ Name | Data | Description
[POST_LAYER_DESTRUCTION](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=ON.POST_LAYER_DESTRUCTION) | ON::POST_LAYER_DESTRUCTION | Params: [LAYER](#LAYER) layer<br/>Runs right after a layer has been unloaded and any entities there destroyed. Runs in pretty much all screens, even ones without entities. The screen has already changed at this point, meaning the screen being destoyed is in state.screen_last.<br/>
[PRE_PROCESS_INPUT](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=ON.PRE_PROCESS_INPUT) | ON::PRE_PROCESS_INPUT | Runs right before the game gets input from various devices and writes to a bunch of buttons-variables. Return true to disable all game input completely.<br/>
[POST_PROCESS_INPUT](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=ON.POST_PROCESS_INPUT) | ON::POST_PROCESS_INPUT | Runs right after the game gets input from various devices and writes to a bunch of buttons-variables. Probably the first chance you have to capture or edit buttons_gameplay or buttons_menu sort of things.<br/>
[PRE_GAME_LOOP](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=ON.PRE_GAME_LOOP) | ON::PRE_GAME_LOOP | Runs right before the main engine loop. Return true to block state updates and menu updates, i.e. to pause inside menus.<br/>
[POST_GAME_LOOP](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=ON.POST_GAME_LOOP) | ON::POST_GAME_LOOP | Runs right after the main engine loop.<br/>

## PARTICLEEMITTER

Expand Down
14 changes: 14 additions & 0 deletions docs/src/includes/_events.md
Original file line number Diff line number Diff line change
Expand Up @@ -619,3 +619,17 @@ Runs right before the game gets input from various devices and writes to a bunch
> Search script examples for [ON.POST_PROCESS_INPUT](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=ON.POST_PROCESS_INPUT)
Runs right after the game gets input from various devices and writes to a bunch of buttons-variables. Probably the first chance you have to capture or edit buttons_gameplay or buttons_menu sort of things.<br/>

## ON.PRE_GAME_LOOP


> Search script examples for [ON.PRE_GAME_LOOP](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=ON.PRE_GAME_LOOP)
Runs right before the main engine loop. Return true to block state updates and menu updates, i.e. to pause inside menus.<br/>

## ON.POST_GAME_LOOP


> Search script examples for [ON.POST_GAME_LOOP](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=ON.POST_GAME_LOOP)
Runs right after the main engine loop.<br/>
29 changes: 28 additions & 1 deletion docs/src/includes/_globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -1497,6 +1497,24 @@ Get the current timestamp in milliseconds since the Unix Epoch.

Gets the specified setting, values might need to be interpreted differently per setting

### get_speedhack


> Search script examples for [get_speedhack](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_speedhack)
#### float get_speedhack()

Get the current speedhack multiplier

### get_start_level_paused


> Search script examples for [get_start_level_paused](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_start_level_paused)
#### bool get_start_level_paused()

Returns true if the level pause hack is enabled

### god


Expand Down Expand Up @@ -1809,7 +1827,7 @@ Force the character unlocked in either ending to [ENT_TYPE](#ENT_TYPE). Set to 0
#### nil set_frametime(optional<double> frametime)

Set engine target frametime (1/framerate, default 1/60). Always capped by your GPU max FPS / VSync. To run the engine faster than rendered FPS, try update_state. Set to 0 to go as fast as possible. Call without arguments to reset.
Set engine target frametime (1/framerate, default 1/60). Always capped by your GPU max FPS / VSync. To run the engine faster than rendered FPS, try update_state. Set to 0 to go as fast as possible. Call without arguments to reset. Also see set_speedhack

### set_frametime_unfocused

Expand Down Expand Up @@ -1899,6 +1917,15 @@ end, ON.PRE_LOAD_SCREEN)

Sets the specified setting temporarily. These values are not saved and might reset to the users real settings if they visit the options menu. (Check example.) All settings are available in unsafe mode and only a smaller subset [SAFE_SETTING](#SAFE_SETTING) by default for [Hud](#Hud) and other visuals. Returns false, if setting failed.

### set_speedhack


> Search script examples for [set_speedhack](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_speedhack)
#### nil set_speedhack(optional<float> multiplier)

Set multiplier (default 1.0) for a QueryPerformanceCounter hook based speedhack, similar to the one in Cheat Engine. Call without arguments to reset. Also see set_frametime

### set_start_level_paused


Expand Down
2 changes: 1 addition & 1 deletion docs/src/includes/_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ Used to get and set [Overlunky](#Overlunky) settings in [Bucket](#Bucket)
Type | Name | Description
---- | ---- | -----------
map&lt;string, any&gt; | [options](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=options) | Current [Overlunky](#Overlunky) options. Read only.
map&lt;string, any&gt; | [set_options](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_options) | Write some select options here to change [Overlunky](#Overlunky) options. Just use the same keys as in options.
map&lt;string, any&gt; | [set_options](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_options) | Write [some select options](https://github.com/search?q=repo%3Aspelunky-fyi%2Foverlunky+legal_options+language%3AC%2B%2B&type=code&l=C%2B%2B) here to change [Overlunky](#Overlunky) options.
map&lt;string, [KEY](#KEY)&gt; | [keys](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=keys) | Current [Overlunky](#Overlunky) key bindings. Read only. You can use this to bind some custom feature to the same unknown key as currently bound by the user.
set&lt;string&gt; | [ignore_keys](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=ignore_keys) | Disable some key bindings in [Overlunky](#Overlunky), whatever key they are actually bound to. Remember this might not be bound to the default any more, so only use this if you also plan on overriding the current keybinding, or just need to disable some feature and don't care what key it is bound on.
set&lt;[KEY](#KEY)&gt; | [ignore_keycodes](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=ignore_keycodes) | Disable keys that may or may not be used by [Overlunky](#Overlunky). You should probably write the keycodes you need here just in case if you think using OL will interfere with your keybinds.
Expand Down
2 changes: 1 addition & 1 deletion src/game_api/bucket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct Overlunky
{
/// Current Overlunky options. Read only.
std::map<std::string, BucketItem> options;
/// Write some select options here to change Overlunky options. Just use the same keys as in options.
/// Write [some select options](https://github.com/search?q=repo%3Aspelunky-fyi%2Foverlunky+legal_options+language%3AC%2B%2B&type=code&l=C%2B%2B) here to change Overlunky options.
std::map<std::string, BucketItem> set_options;
/// Current Overlunky key bindings. Read only. You can use this to bind some custom feature to the same unknown key as currently bound by the user.
std::map<std::string, KEY> keys;
Expand Down
26 changes: 26 additions & 0 deletions src/game_api/flags.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -784,3 +784,29 @@ std::array player_inputs{
"Controller 3",
"Controller 4",
};

std::unordered_set<std::string> legal_options{
"disable_ghost_timer",
"disable_pause",
"draw_entity_info",
"draw_entity_tooltip",
"draw_grid",
"draw_hitboxes",
"draw_hitboxes_interpolated",
"draw_hotbar",
"draw_hud",
"draw_path",
"draw_script_messages",
"fade_script_messages",
"fly_mode",
"god_mode",
"god_mode_companions",
"hd_cursor",
"keyboard_control",
"lights",
"mouse_control",
"noclip",
"smooth_camera",
"pause_type",
"camera_hack",
};
4 changes: 1 addition & 3 deletions src/game_api/script/lua_vm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2646,10 +2646,8 @@ end
// POST_PROCESS_INPUT
// Runs right after the game gets input from various devices and writes to a bunch of buttons-variables. Probably the first chance you have to capture or edit buttons_gameplay or buttons_menu sort of things.
// PRE_GAME_LOOP
// Params: float deltatime
// Runs right before the main engine loop. Return true to disable.
// Runs right before the main engine loop. Return true to block state updates and menu updates, i.e. to pause inside menus.
// POST_GAME_LOOP
// Params: float deltatime
// Runs right after the main engine loop.
*/

Expand Down
26 changes: 0 additions & 26 deletions src/injected/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9365,32 +9365,6 @@ void check_focus()
}
}

std::unordered_set<std::string> legal_options{
"disable_ghost_timer",
"disable_pause",
"draw_entity_info",
"draw_entity_tooltip",
"draw_grid",
"draw_hitboxes",
"draw_hitboxes_interpolated",
"draw_hotbar",
"draw_hud",
"draw_path",
"draw_script_messages",
"fade_script_messages",
"fly_mode",
"god_mode",
"god_mode_companions",
"hd_cursor",
"keyboard_control",
"lights",
"mouse_control",
"noclip",
"smooth_camera",
"pause_type",
"camera_hack",
};

void update_bucket()
{
if (g_bucket->overlunky->set_selected_uid.has_value())
Expand Down

0 comments on commit a8376ee

Please sign in to comment.