diff --git a/docs/game_data/spel2.lua b/docs/game_data/spel2.lua index 8902ca796..4da308385 100644 --- a/docs/game_data/spel2.lua +++ b/docs/game_data/spel2.lua @@ -936,16 +936,16 @@ function send_input(uid, buttons) end function clear_screen_callback(screen_id, cb_id) end ---Returns unique id for the callback to be used in [clear_screen_callback](https://spelunky-fyi.github.io/overlunky/#clear_screen_callback) or `nil` if screen_id is not valid. ---Sets a callback that is called right before the screen is drawn, return `true` to skip the default rendering. ----The callback signature is bool render_screen(Screen* self, VanillaRenderContext render_ctx) +---The callback signature is bool render_screen(Screen self, VanillaRenderContext render_ctx) ---@param screen_id integer ----@param fun fun(self: Screen*, render_ctx: VanillaRenderContext): boolean +---@param fun fun(self: Screen, render_ctx: VanillaRenderContext): boolean ---@return CallbackId? function set_pre_render_screen(screen_id, fun) end ---Returns unique id for the callback to be used in [clear_screen_callback](https://spelunky-fyi.github.io/overlunky/#clear_screen_callback) or `nil` if screen_id is not valid. ---Sets a callback that is called right after the screen is drawn. ----The callback signature is nil render_screen(Screen* self, VanillaRenderContext render_ctx) +---The callback signature is nil render_screen(Screen self, VanillaRenderContext render_ctx) ---@param screen_id integer ----@param fun fun(self: Screen*, render_ctx: VanillaRenderContext): nil +---@param fun fun(self: Screen, render_ctx: VanillaRenderContext): nil ---@return CallbackId? function set_post_render_screen(screen_id, fun) end ---Returns unique id for the callback to be used in [clear_callback](https://spelunky-fyi.github.io/overlunky/#clear_callback) or `nil` if uid is not valid. diff --git a/docs/parse_source.py b/docs/parse_source.py index d4964f5b2..c4ee629c2 100644 --- a/docs/parse_source.py +++ b/docs/parse_source.py @@ -267,7 +267,6 @@ def run_parse(): member_funs = {} member_vars = [] for line in data: - #line = line.replace("*", "") if not class_name and ("struct" in line or "class" in line): m = re.match(r"(struct|class)\s+(\S+)", line) if m and not line.endswith(";"): @@ -381,7 +380,6 @@ def run_parse(): comment = [] data = open(file, "r").read().split("\n") for line in data: - #line = line.replace("*", "") m = re.search(r'lua\[[\'"]([^\'"]*)[\'"]\];', line) if m: events.append({"name": m.group(1), "comment": comment}) @@ -398,7 +396,6 @@ def run_parse(): comment = [] data = open(file, "r").read().split("\n") for line in data: - #line = line.replace("*", "") if line == "": comment = [] @@ -721,7 +718,8 @@ def run_parse(): r"->([:<>\w]+){", var[1] ) # Use var[1] instead of cpp because it could be replaced on the sol::property stuff if m_return_type: - sig = f"{m_return_type[1]} {var_name}" + type = replace_fun(m_return_type[1]) + sig = f"{type} {var_name}" vars.append( {"name": var_name, "type": cpp, "signature": sig} ) @@ -838,7 +836,6 @@ def run_parse(): comment = [] data = open(file, "r").read().split("\n") for line in data: - #line = line.replace("*", "") m = re.findall(r"new_usertype\<(.*?)\>", line) if m: type = m[0] diff --git a/docs/src/includes/_globals.md b/docs/src/includes/_globals.md index fb839803c..14a582a33 100644 --- a/docs/src/includes/_globals.md +++ b/docs/src/includes/_globals.md @@ -291,7 +291,7 @@ This is run right after the entity is spawned but before and particular properti Returns unique id for the callback to be used in [clear_screen_callback](#clear_screen_callback) or `nil` if screen_id is not valid. Sets a callback that is called right after the screen is drawn. -
The callback signature is nil render_screen([Screen](#Screen)* self, [VanillaRenderContext](#VanillaRenderContext) render_ctx) +
The callback signature is nil render_screen([Screen](#Screen) self, [VanillaRenderContext](#VanillaRenderContext) render_ctx) ### set_pre_entity_spawn @@ -314,7 +314,7 @@ In many cases replacing the intended entity won't have the indended effect or wi Returns unique id for the callback to be used in [clear_screen_callback](#clear_screen_callback) or `nil` if screen_id is not valid. Sets a callback that is called right before the screen is drawn, return `true` to skip the default rendering. -
The callback signature is bool render_screen([Screen](#Screen)* self, [VanillaRenderContext](#VanillaRenderContext) render_ctx) +
The callback signature is bool render_screen([Screen](#Screen) self, [VanillaRenderContext](#VanillaRenderContext) render_ctx) ### set_timeout @@ -627,7 +627,7 @@ Get uids of matching entities overlapping with the given hitbox. Set `entity_typ > Search script examples for [get_entity](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_entity) -#### [Entity](#Entity) get_entity(int uid) +#### [Entity](#Entity) get_entity(int uid) Get the [Entity](#Entity) behind an uid, converted to the correct type. To see what type you will get, consult the [entity hierarchy list](https://github.com/spelunky-fyi/overlunky/blob/main/docs/entities-hierarchy.md) diff --git a/docs/src/includes/_types.md b/docs/src/includes/_types.md index 1e217ec89..005db0324 100644 --- a/docs/src/includes/_types.md +++ b/docs/src/includes/_types.md @@ -843,8 +843,8 @@ bool | [render_inactive](https://github.com/spelunky-fyi/overlunky/search?l=Lua& int | [texture_num](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=texture_num) | [Entity](#Entity) | [get_entity()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_entity) | bool | [set_normal_map_texture(TEXTURE texture_id)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_normal_map_texture) | Sets second_texture to the texture specified, then sets third_texture to SHINE_0 and texture_num to 3. You still have to change shader to 30 to render with normal map (same as COG normal maps) -std::optional<[TEXTURE](#TEXTURE)> | [get_second_texture](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_second_texture) | -std::optional<[TEXTURE](#TEXTURE)> | [get_third_texture](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_third_texture) | +optional<[TEXTURE](#TEXTURE)> | [get_second_texture](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_second_texture) | +optional<[TEXTURE](#TEXTURE)> | [get_third_texture](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_third_texture) | bool | [set_second_texture(TEXTURE texture_id)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_second_texture) | bool | [set_third_texture(TEXTURE texture_id)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_third_texture) | bool | [set_texture_num(int texture_id)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_texture_num) | Set the number of textures that may be used, need to have them set before for it to work @@ -1678,8 +1678,8 @@ Used in [ScreenCharacterSelect](#ScreenCharacterSelect), [ScreenTitle](#ScreenTi Type | Name | Description ---- | ---- | ----------- [ParticleDB](#ParticleDB) | [particle_type](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=particle_type) | -uint32_t | [particle_count](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=particle_count) | -uint32_t | [particle_count_back_layer](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=particle_count_back_layer) | +int | [particle_count](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=particle_count) | +int | [particle_count_back_layer](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=particle_count_back_layer) | int | [entity_uid](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=entity_uid) | float | [x](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=x) | float | [y](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=y) | diff --git a/src/game_api/script/lua_vm.cpp b/src/game_api/script/lua_vm.cpp index 76989940c..1effb9bc0 100644 --- a/src/game_api/script/lua_vm.cpp +++ b/src/game_api/script/lua_vm.cpp @@ -985,7 +985,7 @@ end /// Check the [entity hierarchy list](https://github.com/spelunky-fyi/overlunky/blob/main/docs/entities-hierarchy.md) for what the exact ENT_TYPE's can this function affect lua["set_contents"] = set_contents; /// Get the Entity behind an uid, converted to the correct type. To see what type you will get, consult the [entity hierarchy list](https://github.com/spelunky-fyi/overlunky/blob/main/docs/entities-hierarchy.md) - // lua["get_entity"] = [](uint32_t uid) -> Entity* {}; + // lua["get_entity"] = [](uint32_t uid) -> Entity*{}; /// NoDoc /// Get the [Entity](#Entity) behind an uid, without converting to the correct type (do not use, use `get_entity` instead) lua["get_entity_raw"] = get_entity_ptr; @@ -1420,7 +1420,7 @@ end /// Returns unique id for the callback to be used in [clear_screen_callback](#clear_screen_callback) or `nil` if screen_id is not valid. /// Sets a callback that is called right before the screen is drawn, return `true` to skip the default rendering. - ///
The callback signature is bool render_screen(Screen* self, VanillaRenderContext render_ctx) + ///
The callback signature is bool render_screen(Screen self, VanillaRenderContext render_ctx) lua["set_pre_render_screen"] = [](int screen_id, sol::function fun) -> sol::optional { if (Screen* screen = get_screen_ptr(screen_id)) @@ -1444,7 +1444,7 @@ end }; /// Returns unique id for the callback to be used in [clear_screen_callback](#clear_screen_callback) or `nil` if screen_id is not valid. /// Sets a callback that is called right after the screen is drawn. - ///
The callback signature is nil render_screen(Screen* self, VanillaRenderContext render_ctx) + ///
The callback signature is nil render_screen(Screen self, VanillaRenderContext render_ctx) lua["set_post_render_screen"] = [](int screen_id, sol::function fun) -> sol::optional { if (Screen* screen = get_screen_ptr(screen_id))