diff --git a/docs/game_data/spel2.lua b/docs/game_data/spel2.lua index 3eaaf6188..5d2c5596a 100644 --- a/docs/game_data/spel2.lua +++ b/docs/game_data/spel2.lua @@ -1171,28 +1171,28 @@ function list_char_mods() end ---@param index integer ---@return AABB function get_hud_position(index) end +---Olmec cutscene moves Olmec and destroys the four floor tiles, so those things never happen if the cutscene is disabled, and Olmec will spawn on even ground. More useful for level gen mods, where the cutscene doesn't make sense. You can also set olmec_cutscene.timer to the last frame (809) to skip to the end, with Olmec in the hole. ---@param enable boolean ---@return nil function set_olmec_cutscene_enabled(enable) end ----Tiamat cutscene is also responsible for locking the exit door ----So you may need to close it yourself if you still want to be required to kill Tiamat +---Tiamat cutscene is also responsible for locking the exit door, so you may need to close it yourself if you still want Tiamat kill to be required ---@param enable boolean ---@return nil function set_tiamat_cutscene_enabled(enable) end ---Activate custom variables for position used for detecting the player (normally hardcoded) ----note: because those variables are custom and game does not initiate them, you need to do it yourself for each Tiamat entity, recommending `set_post_entity_spawn` +---note: because those variables are custom and game does not initiate them, you need to do it yourself for each Tiamat entity, recommending set_post_entity_spawn ---default game values are: attack_x = 17.5 attack_y = 62.5 ---@param activate boolean ---@return nil function activate_tiamat_position_hack(activate) end ---Activate custom variables for speed and y coordinate limit for crushing elevator ----note: because those variables are custom and game does not initiate them, you need to do it yourself for each CrushElevator entity, recommending `set_post_entity_spawn` +---note: because those variables are custom and game does not initiate them, you need to do it yourself for each CrushElevator entity, recommending set_post_entity_spawn ---default game values are: speed = 0.0125, y_limit = 98.5 ---@param activate boolean ---@return nil function activate_crush_elevator_hack(activate) end ---Activate custom variables for y coordinate limit for hundun and spawn of it's heads ----note: because those variables are custom and game does not initiate them, you need to do it yourself for each Hundun entity, recommending `set_post_entity_spawn` +---note: because those variables are custom and game does not initiate them, you need to do it yourself for each Hundun entity, recommending set_post_entity_spawn ---default game value are: y_limit = 98.5, rising_speed_x = 0, rising_speed_y = 0.0125, bird_head_spawn_y = 55, snake_head_spawn_y = 71 ---@param activate boolean ---@return nil @@ -1202,6 +1202,23 @@ function activate_hundun_hack(activate) end ---@param enable boolean ---@return nil function set_boss_door_control_enabled(enable) end +---Run state update manually, i.e. simulate one logic frame. Use in e.g. POST_UPDATE, but be mindful of infinite loops, this will cause another POST_UPDATE. Can even be called thousands of times to simulate minutes of gameplay in a few seconds. +---@return nil +function update_state() end +---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. +---@param frametime double? +---@return nil +function set_frametime(frametime) end +---Get engine target frametime (1/framerate, default 1/60). +---@return double? +function get_frametime() end +---Set engine target frametime when game is unfocused (1/framerate, default 1/33). Always capped by the engine frametime. Set to 0 to go as fast as possible. Call without arguments to reset. +---@param frametime double? +---@return nil +function set_frametime_unfocused(frametime) end +---Get engine target frametime when game is unfocused (1/framerate, default 1/33). +---@return double? +function get_frametime_unfocused() end ---@return boolean function toast_visible() end ---@return boolean @@ -4048,10 +4065,10 @@ function Movable:generic_update_world(move, sprint_factor, disable_gravity, on_r ---@field timer integer ---@class LogicalDoor : Entity - ---@field door_type ENT_TYPE - ---@field platform_type ENT_TYPE - ---@field visible boolean - ---@field platform_spawned boolean @Is set true when you bomb the door, no matter what door, can't be reset + ---@field door_type ENT_TYPE @Spawns this entity when not covered by floor. Must be initialized to valid ENT_TYPE before revealed, or crashes the game. + ---@field platform_type ENT_TYPE @Spawns this entity below when tile below is uncovered. Doesn't spawn anything if it was never covered by floor, unless platform_spawned is set to false. Must be initialized to valid ENT_TYPE before revealed, or crashes the game. + ---@field visible boolean @Set automatically when not covered by floor. + ---@field platform_spawned boolean @Set automatically when tile below is not covered by floor. Unset to force the platform to spawn if it was never covered in the first place. ---@class LogicalSound : Entity ---@field sound SoundMeta diff --git a/docs/index.html b/docs/index.html index 257adfe7c..062d7cae8 100644 --- a/docs/index.html +++ b/docs/index.html @@ -743,6 +743,12 @@
-Search script examples for set_olmec_cutscene_enabled
Olmec cutscene moves Olmec and destroys the four floor tiles, so those things never happen if the cutscene is disabled, and Olmec will spawn on even ground. More useful for level gen mods, where the cutscene doesn't make sense. You can also set olmec_cutscene.timer to the last frame (809) to skip to the end, with Olmec in the hole.
+@@ -4529,7 +4546,7 @@Search script examples for set_olmec_phase_y_level
Activate custom variables for speed and y coordinate limit for crushing elevator
-note: because those variables are custom and game does not initiate them, you need to do it yourself for each CrushElevator entity, recommending set_post_entity_spawn
+note: because those variables are custom and game does not initiate them, you need to do it yourself for each CrushElevator entity, recommending set_post_entity_spawn
default game values are: speed = 0.0125, y_limit = 98.5
@@ -4537,7 +4554,7 @@activate_hundun_hack
Activate custom variables for y coordinate limit for hundun and spawn of it's heads
-note: because those variables are custom and game does not initiate them, you need to do it yourself for each Hundun entity, recommending set_post_entity_spawn
+note: because those variables are custom and game does not initiate them, you need to do it yourself for each Hundun entity, recommending set_post_entity_spawn
default game value are: y_limit = 98.5, rising_speed_x = 0, rising_speed_y = 0.0125, bird_head_spawn_y = 55, snake_head_spawn_y = 71
@@ -4607,6 +4624,18 @@get_frame
Get the current global frame count since the game was started. You can use this to make some timers yourself, the engine runs at 60fps.
+++Search script examples for get_frametime
+
Get engine target frametime (1/framerate, default 1/60).
+++Search script examples for get_frametime_unfocused
+
Get engine target frametime when game is unfocused (1/framerate, default 1/33).
Search script examples for get_id
@@ -4829,6 +4858,18 @@set_ending_unlock
nil set_ending_unlock(ENT_TYPE type)
Force the character unlocked in either ending to ENT_TYPE. Set to 0 to reset to the default guys. Does not affect the texture of the actual savior. (See example)
+set_frametime
+++Search script examples for set_frametime
+nil set_frametime(optional
+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_frametime_unfocused
+++Search script examples for set_frametime_unfocused
+nil set_frametime_unfocused(optional
+frametime) Set engine target frametime when game is unfocused (1/framerate, default 1/33). Always capped by the engine frametime. Set to 0 to go as fast as possible. Call without arguments to reset.
set_journal_enabled
Search script examples for set_journal_enabled
@@ -4922,8 +4963,7 @@set_tiamat_cutscene_enabled
Search script examples for set_tiamat_cutscene_enabled
nil set_tiamat_cutscene_enabled(bool enable)
-Tiamat cutscene is also responsible for locking the exit door -So you may need to close it yourself if you still want to be required to kill Tiamat
+Tiamat cutscene is also responsible for locking the exit door, so you may need to close it yourself if you still want Tiamat kill to be required
show_journal
Search script examples for show_journal
@@ -4956,6 +4996,12 @@update_liquid_collision_at
nil update_liquid_collision_at(float x, float y, bool add)
Updates the floor collisions used by the liquids, set add to false to remove tile of collision, set to true to add one
+update_state
+++Search script examples for update_state
+nil update_state()
+Run state update manually, i.e. simulate one logic frame. Use in e.g. POST_UPDATE, but be mindful of infinite loops, this will cause another POST_UPDATE. Can even be called thousands of times to simulate minutes of gameplay in a few seconds.
warp
Search script examples for warp
@@ -5234,7 +5280,7 @@Position functions
nil activate_tiamat_position_hack(bool activate)
Activate custom variables for position used for detecting the player (normally hardcoded) -note: because those variables are custom and game does not initiate them, you need to do it yourself for each Tiamat entity, recommending
set_post_entity_spawn
+note: because those variables are custom and game does not initiate them, you need to do it yourself for each Tiamat entity, recommending set_post_entity_spawn default game values are: attack_x = 17.5 attack_y = 62.5distance
@@ -19473,22 +19519,22 @@LogicalDoor
ENT_TYPE door_type -+ Spawns this entity when not covered by floor. Must be initialized to valid ENT_TYPE before revealed, or crashes the game. ENT_TYPE platform_type -+ Spawns this entity below when tile below is uncovered. Doesn't spawn anything if it was never covered by floor, unless platform_spawned is set to false. Must be initialized to valid ENT_TYPE before revealed, or crashes the game. bool visible -+ Set automatically when not covered by floor. bool platform_spawned -Is set true when you bomb the door, no matter what door, can't be reset +Set automatically when tile below is not covered by floor. Unset to force the platform to spawn if it was never covered in the first place. LogicalDrain
diff --git a/docs/light.html b/docs/light.html index 89a123b71..338439c15 100644 --- a/docs/light.html +++ b/docs/light.html @@ -743,6 +743,12 @@get_frame ++ get_frametime + ++ get_frametime_unfocused + get_id @@ -842,6 +848,12 @@set_ending_unlock ++ set_frametime + ++ set_frametime_unfocused + set_journal_enabled @@ -878,6 +890,9 @@update_liquid_collision_at ++ update_state + warp @@ -4367,7 +4382,9 @@set_olmec_cutscene_enabled
-Search script examples for set_olmec_cutscene_enabled
nil set_olmec_cutscene_enabled(bool enable)
set_olmec_phase_y_level
+nil set_olmec_cutscene_enabled(bool enable)
+Olmec cutscene moves Olmec and destroys the four floor tiles, so those things never happen if the cutscene is disabled, and Olmec will spawn on even ground. More useful for level gen mods, where the cutscene doesn't make sense. You can also set olmec_cutscene.timer to the last frame (809) to skip to the end, with Olmec in the hole.
+set_olmec_phase_y_level
@@ -4529,7 +4546,7 @@Search script examples for set_olmec_phase_y_level
Generic functions
nil activate_crush_elevator_hack(bool activate)
Activate custom variables for speed and y coordinate limit for crushing elevator -note: because those variables are custom and game does not initiate them, you need to do it yourself for each CrushElevator entity, recommending
set_post_entity_spawn
+note: because those variables are custom and game does not initiate them, you need to do it yourself for each CrushElevator entity, recommending set_post_entity_spawn default game values are: speed = 0.0125, y_limit = 98.5activate_hundun_hack
@@ -4537,7 +4554,7 @@activate_hundun_hack
nil activate_hundun_hack(bool activate)
Activate custom variables for y coordinate limit for hundun and spawn of it's heads -note: because those variables are custom and game does not initiate them, you need to do it yourself for each Hundun entity, recommending
set_post_entity_spawn
+note: because those variables are custom and game does not initiate them, you need to do it yourself for each Hundun entity, recommending set_post_entity_spawn default game value are: y_limit = 98.5, rising_speed_x = 0, rising_speed_y = 0.0125, bird_head_spawn_y = 55, snake_head_spawn_y = 71change_poison_timer
@@ -4607,6 +4624,18 @@get_frame
int get_frame()
Get the current global frame count since the game was started. You can use this to make some timers yourself, the engine runs at 60fps.
+get_frametime
+++Search script examples for get_frametime
+optional<double> get_frametime()
+Get engine target frametime (1/framerate, default 1/60).
+get_frametime_unfocused
+++Search script examples for get_frametime_unfocused
+optional<double> get_frametime_unfocused()
+Get engine target frametime when game is unfocused (1/framerate, default 1/33).
get_id
Search script examples for get_id
@@ -4829,6 +4858,18 @@set_ending_unlock
nil set_ending_unlock(ENT_TYPE type)
Force the character unlocked in either ending to ENT_TYPE. Set to 0 to reset to the default guys. Does not affect the texture of the actual savior. (See example)
+set_frametime
+++Search script examples for set_frametime
+nil set_frametime(optional
+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_frametime_unfocused
+++Search script examples for set_frametime_unfocused
+nil set_frametime_unfocused(optional
+frametime) Set engine target frametime when game is unfocused (1/framerate, default 1/33). Always capped by the engine frametime. Set to 0 to go as fast as possible. Call without arguments to reset.
set_journal_enabled
Search script examples for set_journal_enabled
@@ -4922,8 +4963,7 @@set_tiamat_cutscene_enabled
Search script examples for set_tiamat_cutscene_enabled
nil set_tiamat_cutscene_enabled(bool enable)
-Tiamat cutscene is also responsible for locking the exit door -So you may need to close it yourself if you still want to be required to kill Tiamat
+Tiamat cutscene is also responsible for locking the exit door, so you may need to close it yourself if you still want Tiamat kill to be required
show_journal
Search script examples for show_journal
@@ -4956,6 +4996,12 @@update_liquid_collision_at
nil update_liquid_collision_at(float x, float y, bool add)
Updates the floor collisions used by the liquids, set add to false to remove tile of collision, set to true to add one
+update_state
+++Search script examples for update_state
+nil update_state()
+Run state update manually, i.e. simulate one logic frame. Use in e.g. POST_UPDATE, but be mindful of infinite loops, this will cause another POST_UPDATE. Can even be called thousands of times to simulate minutes of gameplay in a few seconds.
warp
Search script examples for warp
@@ -5234,7 +5280,7 @@Position functions
nil activate_tiamat_position_hack(bool activate)
Activate custom variables for position used for detecting the player (normally hardcoded) -note: because those variables are custom and game does not initiate them, you need to do it yourself for each Tiamat entity, recommending
set_post_entity_spawn
+note: because those variables are custom and game does not initiate them, you need to do it yourself for each Tiamat entity, recommending set_post_entity_spawn default game values are: attack_x = 17.5 attack_y = 62.5distance
@@ -19473,22 +19519,22 @@LogicalDoor
ENT_TYPE door_type -+ Spawns this entity when not covered by floor. Must be initialized to valid ENT_TYPE before revealed, or crashes the game. ENT_TYPE platform_type -+ Spawns this entity below when tile below is uncovered. Doesn't spawn anything if it was never covered by floor, unless platform_spawned is set to false. Must be initialized to valid ENT_TYPE before revealed, or crashes the game. bool visible -+ Set automatically when not covered by floor. bool platform_spawned -Is set true when you bomb the door, no matter what door, can't be reset +Set automatically when tile below is not covered by floor. Unset to force the platform to spawn if it was never covered in the first place. LogicalDrain
diff --git a/docs/src/includes/_globals.md b/docs/src/includes/_globals.md index d615c2625..cf7698446 100644 --- a/docs/src/includes/_globals.md +++ b/docs/src/includes/_globals.md @@ -891,6 +891,7 @@ Sets the maximum length of a thrown rope (anchor segment not included). Unfortun #### nil set_olmec_cutscene_enabled(bool enable) +[Olmec](#Olmec) cutscene moves [Olmec](#Olmec) and destroys the four floor tiles, so those things never happen if the cutscene is disabled, and [Olmec](#Olmec) will spawn on even ground. More useful for level gen mods, where the cutscene doesn't make sense. You can also set olmec_cutscene.timer to the last frame (809) to skip to the end, with [Olmec](#Olmec) in the hole. ### set_olmec_phase_y_level @@ -1143,7 +1144,7 @@ Returns true if the nth bit is set in the number. #### nil activate_crush_elevator_hack(bool activate) Activate custom variables for speed and y coordinate limit for crushing elevator -note: because those variables are custom and game does not initiate them, you need to do it yourself for each [CrushElevator](#CrushElevator) entity, recommending `set_post_entity_spawn` +note: because those variables are custom and game does not initiate them, you need to do it yourself for each [CrushElevator](#CrushElevator) entity, recommending set_post_entity_spawn default game values are: speed = 0.0125, y_limit = 98.5 ### activate_hundun_hack @@ -1154,7 +1155,7 @@ default game values are: speed = 0.0125, y_limit = 98.5 #### nil activate_hundun_hack(bool activate) Activate custom variables for y coordinate limit for hundun and spawn of it's heads -note: because those variables are custom and game does not initiate them, you need to do it yourself for each [Hundun](#Hundun) entity, recommending `set_post_entity_spawn` +note: because those variables are custom and game does not initiate them, you need to do it yourself for each [Hundun](#Hundun) entity, recommending set_post_entity_spawn default game value are: y_limit = 98.5, rising_speed_x = 0, rising_speed_y = 0.0125, bird_head_spawn_y = 55, snake_head_spawn_y = 71 ### change_poison_timer @@ -1258,6 +1259,24 @@ Same as `Player.get_heart_color` Get the current global frame count since the game was started. You can use this to make some timers yourself, the engine runs at 60fps. +### get_frametime + + +> Search script examples for [get_frametime](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_frametime) + +#### optional<double> get_frametime() + +Get engine target frametime (1/framerate, default 1/60). + +### get_frametime_unfocused + + +> Search script examples for [get_frametime_unfocused](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_frametime_unfocused) + +#### optional<double> get_frametime_unfocused() + +Get engine target frametime when game is unfocused (1/framerate, default 1/33). + ### get_id @@ -1588,6 +1607,24 @@ end, ON.WIN) Force the character unlocked in either ending to [ENT_TYPE](#ENT_TYPE). Set to 0 to reset to the default guys. Does not affect the texture of the actual savior. (See example) +### set_frametime + + +> Search script examples for [set_frametime](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_frametime) + +#### nil set_frametime(optionalframetime) + +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_frametime_unfocused + + +> Search script examples for [set_frametime_unfocused](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_frametime_unfocused) + +#### nil set_frametime_unfocused(optional frametime) + +Set engine target frametime when game is unfocused (1/framerate, default 1/33). Always capped by the engine frametime. Set to 0 to go as fast as possible. Call without arguments to reset. + ### set_journal_enabled @@ -1709,8 +1746,7 @@ Set layer to search for storage items on #### nil set_tiamat_cutscene_enabled(bool enable) -[Tiamat](#Tiamat) cutscene is also responsible for locking the exit door -So you may need to close it yourself if you still want to be required to kill [Tiamat](#Tiamat) +[Tiamat](#Tiamat) cutscene is also responsible for locking the exit door, so you may need to close it yourself if you still want [Tiamat](#Tiamat) kill to be required ### show_journal @@ -1762,6 +1798,15 @@ Gets line1_A, intersection point and line2_B and calls the 3 parameter version o Updates the floor collisions used by the liquids, set add to false to remove tile of collision, set to true to add one +### update_state + + +> Search script examples for [update_state](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=update_state) + +#### nil update_state() + +Run state update manually, i.e. simulate one logic frame. Use in e.g. POST_UPDATE, but be mindful of infinite loops, this will cause another POST_UPDATE. Can even be called thousands of times to simulate minutes of gameplay in a few seconds. + ### warp @@ -2202,7 +2247,7 @@ end, SPAWN_TYPE.ANY, 0, ENT_TYPE.MONS_TIAMAT) #### nil activate_tiamat_position_hack(bool activate) Activate custom variables for position used for detecting the player (normally hardcoded) -note: because those variables are custom and game does not initiate them, you need to do it yourself for each [Tiamat](#Tiamat) entity, recommending `set_post_entity_spawn` +note: because those variables are custom and game does not initiate them, you need to do it yourself for each [Tiamat](#Tiamat) entity, recommending set_post_entity_spawn default game values are: attack_x = 17.5 attack_y = 62.5 ### distance diff --git a/docs/src/includes/_types.md b/docs/src/includes/_types.md index e62cc7f36..05a4faed6 100644 --- a/docs/src/includes/_types.md +++ b/docs/src/includes/_types.md @@ -3994,10 +3994,10 @@ Derived from [Entity](#Entity) Type | Name | Description ---- | ---- | ----------- -[ENT_TYPE](#ENT_TYPE) | [door_type](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=door_type) | -[ENT_TYPE](#ENT_TYPE) | [platform_type](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=platform_type) | -bool | [visible](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=visible) | -bool | [platform_spawned](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=platform_spawned) | Is set true when you bomb the door, no matter what door, can't be reset +[ENT_TYPE](#ENT_TYPE) | [door_type](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=door_type) | Spawns this entity when not covered by floor. Must be initialized to valid [ENT_TYPE](#ENT_TYPE) before revealed, or crashes the game. +[ENT_TYPE](#ENT_TYPE) | [platform_type](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=platform_type) | Spawns this entity below when tile below is uncovered. Doesn't spawn anything if it was never covered by floor, unless platform_spawned is set to false. Must be initialized to valid [ENT_TYPE](#ENT_TYPE) before revealed, or crashes the game. +bool | [visible](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=visible) | Set automatically when not covered by floor. +bool | [platform_spawned](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=platform_spawned) | Set automatically when tile below is not covered by floor. Unset to force the platform to spawn if it was never covered in the first place. ### LogicalDrain