From aa3da5140aa5d0238173abb94e61611f2beb3023 Mon Sep 17 00:00:00 2001 From: Mr-Auto <36127424+Mr-Auto@users.noreply.github.com> Date: Wed, 4 Oct 2023 19:34:30 +0200 Subject: [PATCH] do stuff, break some probably --- docs/game_data/spel2.lua | 238 +++++++++++++++++----------------- docs/generate.py | 6 +- docs/parse_source.py | 7 +- docs/src/includes/_globals.md | 46 +++---- docs/src/includes/_types.md | 83 ++++++------ docs/validator.py | 12 +- src/game_api/render_api.hpp | 9 +- 7 files changed, 204 insertions(+), 197 deletions(-) diff --git a/docs/game_data/spel2.lua b/docs/game_data/spel2.lua index 4290f8e66..d72f61153 100644 --- a/docs/game_data/spel2.lua +++ b/docs/game_data/spel2.lua @@ -1776,18 +1776,18 @@ do ---@class ArenaState ---@field current_arena integer - ---@field player_teams integer[] @size: 4 + ---@field player_teams Array ---@field format integer ---@field ruleset integer - ---@field player_lives integer[] @size: 4 - ---@field player_totalwins integer[] @size: 4 - ---@field player_won boolean[] @size: 4 + ---@field player_lives Array + ---@field player_totalwins Array + ---@field player_won Array ---@field timer integer @The menu selection for timer, default values 0..20 where 0 == 30 seconds, 19 == 10 minutes and 20 == infinite. Can go higher, although this will glitch the menu text. Actual time (seconds) = (state.arena.timer + 1) x 30 ---@field timer_ending integer ---@field wins integer ---@field lives integer ---@field time_to_win integer - ---@field player_idolheld_countdown integer[] @size: 4 + ---@field player_idolheld_countdown Array ---@field health integer ---@field bombs integer ---@field ropes integer @@ -1832,12 +1832,12 @@ do ---@class Items ---@field player_count integer ---@field saved_pets_count integer - ---@field saved_pets ENT_TYPE[] @size: 4 @Pet information for level transition - ---@field is_pet_cursed boolean[] @size: 4 - ---@field is_pet_poisoned boolean[] @size: 4 + ---@field saved_pets Array @Pet information for level transition + ---@field is_pet_cursed Array + ---@field is_pet_poisoned Array ---@field leader integer @Index of leader player in coop - ---@field player_inventory Inventory[] @size: MAX_PLAYERS - ---@field player_select SelectPlayerSlot[] @size: MAX_PLAYERS + ---@field player_inventory Array + ---@field player_select Array ---@class LiquidPhysicsEngine ---@field pause boolean @@ -1858,7 +1858,7 @@ do ---@field engine LiquidPhysicsEngine ---@class LiquidPhysics - ---@field pools LiquidPool[] @size: 5 + ---@field pools Array ---@class StateMemory ---@field screen_last integer @Previous SCREEN, used to check where we're coming from when loading another SCREEN @@ -1957,14 +1957,14 @@ do ---@field screen_change_counter integer ---@field time_startup integer @Number of frames since the game was launched ---@field storage_uid integer @entity uid of the first floor_storage entity - ---@field waddler_storage ENT_TYPE[] @size: 99 - ---@field waddler_metadata integer[] @size: 99 + ---@field waddler_storage Array + ---@field waddler_metadata Array ---@field journal_progress_sticker_count integer - ---@field journal_progress_sticker_slots JournalProgressStickerSlot[] @size: 40 @stickers for notable items and entities in journal progress page + ---@field journal_progress_sticker_slots Array @stickers for notable items and entities in journal progress page ---@field journal_progress_stain_count integer - ---@field journal_progress_stain_slots JournalProgressStainSlot[] @size: 30 @blood splats and paw prints in journal progress page + ---@field journal_progress_stain_slots Array @blood splats and paw prints in journal progress page ---@field journal_progress_theme_count integer - ---@field journal_progress_theme_slots integer[] @size: 9 @visited themes in journal progress page + ---@field journal_progress_theme_slots Array @visited themes in journal progress page ---@field theme_info ThemeInfo @Points to the current ThemeInfo ---@field logic LogicList @Level logic like dice game and cutscenes ---@field liquid LiquidPhysics @@ -1978,11 +1978,11 @@ do ---@field size number ---@class Illumination - ---@field lights LightParams[] @size: 4 @Table of light1, light2, ... etc. + ---@field lights Array @Table of light1, light2, ... etc. ---@field light1 LightParams ---@field light2 LightParams ---@field light3 LightParams - ---@field light4 LightParams @It's rendered on anys around, not as an actual bright spot + ---@field light4 LightParams @It's rendered on objects around, not as an actual bright spot ---@field brightness number ---@field brightness_multiplier number ---@field light_pos_x number @@ -2020,7 +2020,7 @@ do ---@field inertia number ---@class Online - ---@field online_players OnlinePlayer[] @size: 4 + ---@field online_players Array ---@field local_player OnlinePlayer ---@field lobby OnlineLobby @@ -2081,7 +2081,7 @@ do ---@class RoomOwnersInfo ---@field owned_items custom_map @key/index is the uid of an item - ---@field owned_rooms RoomOwnerDetails[] + ---@field owned_rooms Array ---@class ItemOwnerDetails ---@field owner_type ENT_TYPE @@ -2152,8 +2152,8 @@ do ---@field random_chance fun(self, inverse_chance: integer, type: PRNG_CLASS): boolean @Returns true with a chance of `1/inverse_chance` ---@field random_index fun(self, i: integer, type: PRNG_CLASS): integer? @Generate a integer number in the range `[1, i]` or `nil` if `i < 1` ---@field random_int fun(self, min: integer, max: integer, type: PRNG_CLASS): integer? @Generate a integer number in the range `[min, max]` or `nil` if `max < min` - ---@field get_pair any @&PRNG::get_pair - ---@field set_pair any @&PRNG::set_pair + ---@field get_pair fun(self, type: PRNG_CLASS): integer, integer + ---@field set_pair fun(self, type: PRNG_CLASS, first: integer, second: integer): nil local PRNG = nil ---Drop-in replacement for `math.random()` ---@return number @@ -2298,7 +2298,7 @@ function PRNG:random(min, max) end ---@field get_metadata fun(self): integer @e.g. for turkey: stores health, poison/curse state, for mattock: remaining swings (returned value is transferred) ---@field apply_metadata fun(self, metadata: integer): nil ---@field set_invisible fun(self, value: boolean): nil - ---@field get_items fun(self): integer[] + ---@field get_items fun(self): Array ---@field is_in_liquid fun(self): boolean @Returns true if entity is in water/lava ---@field is_cursed fun(self): boolean ---@field set_pre_virtual fun(self, entry: ENTITY_OVERRIDE, fun: function): CallbackId @Hooks before the virtual function at index `entry`. @@ -2405,7 +2405,7 @@ function Entity:overlaps_with(other) end ---@field add_money fun(self, money: integer): nil @Adds or subtracts the specified amount of money to the movable's (player's) inventory. Shows the calculation animation in the HUD. ---@field is_on_fire fun(self): boolean ---@field damage fun(self, damage_dealer_uid: integer, damage_amount: integer, stun_time: integer, velocity_x: number, velocity_y: number, iframes: integer): boolean @Damage the movable by the specified amount, stuns and gives it invincibility for the specified amount of frames and applies the velocities
Returns: true if entity was affected, damage_dealer should break etc. false if the event should be ignored by damage_dealer? - ---@field get_all_behaviors fun(self): integer[] @Get all avaible behavior ids + ---@field get_all_behaviors fun(self): Array @Get all avaible behavior ids ---@field set_behavior fun(self, behavior_id: integer): boolean @Set behavior, this is more than just state as it's an active function, for example climbing ladder is a behavior and it doesn't actually need ladder/rope entity
Returns false if entity doesn't have this behavior id ---@field get_behavior fun(self): integer @Get the current behavior id ---@field set_gravity fun(self, gravity: number): nil @Force the gravity for this entity. Will override anything set by special states like swimming too, unless you reset it. Default 1.0 @@ -2451,7 +2451,7 @@ function Movable:generic_update_world(move, sprint_factor, disable_gravity, on_r ---@field remove_powerup fun(self, powerup_type: ENT_TYPE): nil @Removes a currently applied powerup. Specify `ENT_TYPE.ITEM_POWERUP_xxx`, not `ENT_TYPE.ITEM_PICKUP_xxx`! Removing the Eggplant crown does not seem to undo the throwing of eggplants, the other powerups seem to work. ---@field give_powerup fun(self, powerup_type: ENT_TYPE): nil @Gives the player/monster the specified powerup. Specify `ENT_TYPE.ITEM_POWERUP_xxx`, not `ENT_TYPE.ITEM_PICKUP_xxx`! Giving true crown to a monster crashes the game. ---@field has_powerup fun(self, powerup_type: ENT_TYPE): boolean @Checks whether the player/monster has a certain powerup - ---@field get_powerups fun(self): ENT_TYPE[] @Return all powerups that the entity has + ---@field get_powerups fun(self): Array @Return all powerups that the entity has ---@field unequip_backitem fun(self): nil @Unequips the currently worn backitem ---@field worn_backitem fun(self): integer @Returns the uid of the currently worn backitem, or -1 if wearing nothing @@ -2473,19 +2473,19 @@ function Movable:generic_update_world(move, sprint_factor, disable_gravity, on_r ---@field kills_level integer ---@field kills_total integer ---@field collected_money_total integer @Total money collected during previous levels (so excluding the current one) - ---@field collected_money_count integer @Count/size for the `collected_money` Arrays - ---@field collected_money ENT_TYPE[] @size: 512 @Types of gold/gems collected during this level, used later to display during the transition - ---@field collected_money_values integer[] @size: 512 @Values of gold/gems collected during this level, used later to display during the transition - ---@field killed_enemies ENT_TYPE[] @size: 256 @Types of enemies killed during this level, used later to display during the transition + ---@field collected_money_count integer @Count/size for the `collected_money` arrays + ---@field collected_money Array @Types of gold/gems collected during this level, used later to display during the transition + ---@field collected_money_values Array @Values of gold/gems collected during this level, used later to display during the transition + ---@field killed_enemies Array @Types of enemies killed during this level, used later to display during the transition ---@field companion_count integer @Number of companions, it will determinate how many companions will be transfered to next level
Increments when player acquires new companion, decrements when one of them dies - ---@field companions ENT_TYPE[] @size: 8 @Used to transfer information to transition/next level. Is not updated during a level
You can use `ON.PRE_LEVEL_GENERATION` to access/edit this - ---@field companion_held_items ENT_TYPE[] @size: 8 @Used to transfer information to transition/next level. Is not updated during a level
You can use `ON.PRE_LEVEL_GENERATION` to access/edit this - ---@field companion_held_item_metadatas integer[] @size: 8 @Metadata of items held by companions (health, is cursed etc.)
Used to transfer information to transition/next level. Is not updated during a level
You can use `ON.PRE_LEVEL_GENERATION` to access/edit this - ---@field companion_trust integer[] @size: 8 @(0..3) Used to transfer information to transition/next level. Is not updated during a level
You can use `ON.PRE_LEVEL_GENERATION` to access/edit this - ---@field companion_health integer[] @size: 8 @Used to transfer information to transition/next level. Is not updated during a level
You can use `ON.PRE_LEVEL_GENERATION` to access/edit this - ---@field companion_poison_tick_timers integer[] @size: 8 @Used to transfer information to transition/next level. Is not updated during a level
You can use `ON.PRE_LEVEL_GENERATION` to access/edit this - ---@field is_companion_cursed boolean[] @size: 8 @Used to transfer information to transition/next level. Is not updated during a level
You can use `ON.PRE_LEVEL_GENERATION` to access/edit this - ---@field acquired_powerups ENT_TYPE[] @size: 30 @Used to transfer information to transition/next level. Is not updated during a level
You can use `ON.PRE_LEVEL_GENERATION` to access/edit this + ---@field companions Array @Used to transfer information to transition/next level. Is not updated during a level
You can use `ON.PRE_LEVEL_GENERATION` to access/edit this + ---@field companion_held_items Array @Used to transfer information to transition/next level. Is not updated during a level
You can use `ON.PRE_LEVEL_GENERATION` to access/edit this + ---@field companion_held_item_metadatas Array @Metadata of items held by companions (health, is cursed etc.)
Used to transfer information to transition/next level. Is not updated during a level
You can use `ON.PRE_LEVEL_GENERATION` to access/edit this + ---@field companion_trust Array @(0..3) Used to transfer information to transition/next level. Is not updated during a level
You can use `ON.PRE_LEVEL_GENERATION` to access/edit this + ---@field companion_health Array @Used to transfer information to transition/next level. Is not updated during a level
You can use `ON.PRE_LEVEL_GENERATION` to access/edit this + ---@field companion_poison_tick_timers Array @Used to transfer information to transition/next level. Is not updated during a level
You can use `ON.PRE_LEVEL_GENERATION` to access/edit this + ---@field is_companion_cursed Array @Used to transfer information to transition/next level. Is not updated during a level
You can use `ON.PRE_LEVEL_GENERATION` to access/edit this + ---@field acquired_powerups Array @Used to transfer information to transition/next level. Is not updated during a level
You can use `ON.PRE_LEVEL_GENERATION` to access/edit this ---@class Ai ---@field target Entity @@ -2637,17 +2637,17 @@ function Movable:generic_update_world(move, sprint_factor, disable_gravity, on_r ---@field timer integer ---@class MotherStatue : Floor - ---@field players_standing boolean[] @size: 4 @Table of player1_standing, player2_standing, ... etc. + ---@field players_standing Array @Table of player1_standing, player2_standing, ... etc. ---@field player1_standing boolean ---@field player2_standing boolean ---@field player3_standing boolean ---@field player4_standing boolean - ---@field players_health_received boolean[] @size: 4 @Table of player1_health_received, player2_health_received, ... etc. + ---@field players_health_received Array @Table of player1_health_received, player2_health_received, ... etc. ---@field player1_health_received boolean ---@field player2_health_received boolean ---@field player3_health_received boolean ---@field player4_health_received boolean - ---@field players_health_timer integer[] @size: 4 @Table of player1_health_timer, player2_health_timer, ... etc. + ---@field players_health_timer Array @Table of player1_health_timer, player2_health_timer, ... etc. ---@field player1_health_timer integer ---@field player2_health_timer integer ---@field player3_health_timer integer @@ -2887,7 +2887,7 @@ function Movable:generic_update_world(move, sprint_factor, disable_gravity, on_r ---@field shop_owner boolean ---@class Yang : RoomOwner - ---@field turkeys_in_den integer[] @Table of uid's of the turkeys, goes only up to 3, is nil when yang is angry + ---@field turkeys_in_den Array @Table of uid's of the turkeys, goes only up to 3, is nil when yang is angry ---@field first_message_shown boolean @I'm looking for turkeys, wanna help? ---@field quest_incomplete boolean @Is set to false when the quest is over (Yang dead or second turkey delivered) ---@field special_message_shown boolean @Tusk palace/black market/one way door - message shown @@ -3785,7 +3785,7 @@ function Movable:generic_update_world(move, sprint_factor, disable_gravity, on_r ---@field shake number ---@class PrizeDispenser : Movable - ---@field item_ids integer[] @size: 6 @Id's of the items (not types), by default 0-24, look at [change_diceshop_prizes](#change_diceshop_prizes) for the list of default prizes
so for example: id 0 equals ITEM_PICKUP_BOMBBAG, id 1 equals ITEM_PICKUP_BOMBBOX etc. Game generates 6 but uses max 5 for Tusk dice shop + ---@field item_ids Array @Id's of the items (not types), by default 0-24, look at [change_diceshop_prizes](#change_diceshop_prizes) for the list of default prizes
so for example: id 0 equals ITEM_PICKUP_BOMBBAG, id 1 equals ITEM_PICKUP_BOMBBOX etc. Game generates 6 but uses max 5 for Tusk dice shop ---@field prizes_spawned integer ---@class Web : Movable @@ -4227,8 +4227,8 @@ function MovableBehavior:get_state_id() end ---@field y number ---@field offset_x number ---@field offset_y number - ---@field emitted_particles Particle[] - ---@field emitted_particles_back_layer Particle[] + ---@field emitted_particles Array + ---@field emitted_particles_back_layer Array ---@class Particle ---@field x number @@ -4272,7 +4272,7 @@ function MovableBehavior:get_state_id() end ---@field post_transition fun(self): nil @Handles loading the next level screen from a transition screen ---@field spawn_players fun(self): nil @Spawns the players with inventory at `state.level_gen.spawn_x/y`. Also shop and kali background and probably other stuff for some stupid reason. ---@field spawn_effects fun(self): nil @Sets the camera bounds and position. Spawns jelly and orbs and the flag in coop. Sets timers/conditions for more jellies and ghosts. Enables the special fog/ember/ice etc particle effects. - ---@field get_level_file fun(self): string @Returns: The .lvl file to load (e.g. dwelling = dwellingarea.lvl except when level == 4 (cavebossarea.lvl)) + ---@field get_level_file fun(self): char @Returns: The .lvl file to load (e.g. dwelling = dwellingarea.lvl except when level == 4 (cavebossarea.lvl)) ---@field get_theme_id fun(self): integer @Returns: THEME, or subtheme in CO ---@field get_base_id fun(self): integer @Returns: THEME, or logical base THEME for special levels (Abzu->Tide Pool etc) ---@field get_floor_spreading_type fun(self): integer @Returns: ENT_TYPE used for floor spreading (generic or one of the styled floors) @@ -4437,7 +4437,7 @@ function MovableBehavior:get_state_id() end ---@field post_transition fun(self): nil ---@field spawn_players fun(self): nil ---@field spawn_effects fun(self): nil - ---@field get_level_file fun(self): string + ---@field get_level_file fun(self): char ---@field get_theme_id fun(self): integer ---@field get_base_id fun(self): integer ---@field get_floor_spreading_type fun(self): integer @@ -4466,8 +4466,8 @@ function MovableBehavior:get_state_id() end ---@field do_procedural_spawn fun(self, info: SpawnInfo): nil ---@class PreLoadLevelFilesContext - ---@field override_level_files fun(self, levels: string[]): nil @Block all loading `.lvl` files and instead load the specified `.lvl` files. This includes `generic.lvl` so if you need it specify it here.
All `.lvl` files are loaded relative to `Data/Levels`, but they can be completely custom `.lvl` files that ship with your mod so long as they are in said folder.
Use at your own risk, some themes/levels expect a certain level file to be loaded. - ---@field add_level_files fun(self, levels: string[]): nil @Load additional levels files other than the ones that would usually be loaded. Stacks with `override_level_files` if that was called first.
All `.lvl` files are loaded relative to `Data/Levels`, but they can be completely custom `.lvl` files that ship with your mod so long as they are in said folder. + ---@field override_level_files fun(self, levels: Array): nil @Block all loading `.lvl` files and instead load the specified `.lvl` files. This includes `generic.lvl` so if you need it specify it here.
All `.lvl` files are loaded relative to `Data/Levels`, but they can be completely custom `.lvl` files that ship with your mod so long as they are in said folder.
Use at your own risk, some themes/levels expect a certain level file to be loaded. + ---@field add_level_files fun(self, levels: Array): nil @Load additional levels files other than the ones that would usually be loaded. Stacks with `override_level_files` if that was called first.
All `.lvl` files are loaded relative to `Data/Levels`, but they can be completely custom `.lvl` files that ship with your mod so long as they are in said folder. ---@class DoorCoords ---@field door1_x number @@ -4521,19 +4521,19 @@ function MovableBehavior:get_state_id() end ---@field beg_state integer ---@class SaveData - ---@field places boolean[] @size: 16 - ---@field bestiary boolean[] @size: 78 - ---@field people boolean[] @size: 38 - ---@field items boolean[] @size: 54 - ---@field traps boolean[] @size: 24 + ---@field places Array + ---@field bestiary Array + ---@field people Array + ---@field items Array + ---@field traps Array ---@field last_daily string ---@field characters integer @20bit bitmask of unlocked characters ---@field tutorial_state integer @Tutorial state 0..4. Changes the camp layout, camera and lighting. (0=nothing, 1=journal got, 2=key spawned, 3=door unlocked, 4=complete) ---@field shortcuts integer @Terra quest state 0..10 (0=not met ... 10=complete) - ---@field bestiary_killed integer[] @size: 78 - ---@field bestiary_killed_by integer[] @size: 78 - ---@field people_killed integer[] @size: 38 - ---@field people_killed_by integer[] @size: 38 + ---@field bestiary_killed Array + ---@field bestiary_killed_by Array + ---@field people_killed Array + ---@field people_killed_by Array ---@field plays integer ---@field deaths integer ---@field wins_normal integer @@ -4546,8 +4546,8 @@ function MovableBehavior:get_state_id() end ---@field time_best integer ---@field time_total integer ---@field time_tutorial integer - ---@field character_deaths integer[] @size: 20 - ---@field pets_rescued integer[] @size: 3 + ---@field character_deaths Array + ---@field pets_rescued Array ---@field completed_normal boolean ---@field completed_ironman boolean ---@field completed_hard boolean @@ -4558,16 +4558,16 @@ function MovableBehavior:get_state_id() end ---@field theme_last integer ---@field score_last integer ---@field time_last integer - ---@field stickers ENT_TYPE[] @size: 20 - ---@field players integer[] @size: 4 + ---@field stickers Array + ---@field players Array ---@field constellation Constellation ---@class Constellation ---@field star_count integer - ---@field stars ConstellationStar[] @size: 45 + ---@field stars Array ---@field scale number ---@field line_count integer - ---@field lines ConstellationLine[] @size: 90 + ---@field lines Array ---@field line_red_intensity number ---@class ConstellationStar @@ -4591,7 +4591,7 @@ function MovableBehavior:get_state_id() end ---@field to integer ---@class CustomSound - ---@field get_parameters fun(self): table + ---@field get_parameters fun(self): table local CustomSound = nil ---@return PlayingSound function CustomSound:play() end @@ -4613,15 +4613,15 @@ function CustomSound:play(paused, sound_type) end ---@field set_volume fun(self, volume: number): boolean ---@field set_looping fun(self, loop_mode: SOUND_LOOP_MODE): boolean ---@field set_callback fun(self, callback: SoundCallbackFunction): boolean - ---@field get_parameters fun(self): table + ---@field get_parameters fun(self): table ---@field get_parameter fun(self, parameter_index: VANILLA_SOUND_PARAM): number? ---@field set_parameter fun(self, parameter_index: VANILLA_SOUND_PARAM, value: number): boolean ---@class SoundMeta ---@field x number ---@field y number - ---@field left_channel number[] @size: 38 - ---@field right_channel number[] @size: 38 + ---@field left_channel Array + ---@field right_channel Array ---@field start_over boolean @when false, current track starts from the beginning, is immediately set back to true ---@field playing boolean @set to false to turn off @@ -4655,12 +4655,12 @@ function CustomSound:play(paused, sound_type) end ---@field down integer ---@class PlayerInputs - ---@field player_slots PlayerSlot[] @size: MAX_PLAYERS + ---@field player_slots Array ---@field player_slot_1 PlayerSlot ---@field player_slot_2 PlayerSlot ---@field player_slot_3 PlayerSlot ---@field player_slot_4 PlayerSlot - ---@field player_settings PlayerSlotSettings[] @size: MAX_PLAYERS + ---@field player_settings Array ---@field player_slot_1_settings PlayerSlotSettings ---@field player_slot_2_settings PlayerSlotSettings ---@field player_slot_3_settings PlayerSlotSettings @@ -4670,8 +4670,8 @@ function CustomSound:play(paused, sound_type) end ---@field draw_line fun(self, x1: number, y1: number, x2: number, y2: number, thickness: number, color: uColor): nil @Draws a line on screen ---@field draw_triangle fun(self, p1: Vec2, p2: Vec2, p3: Vec2, thickness: number, color: uColor): nil @Draws a triangle on screen. ---@field draw_triangle_filled fun(self, p1: Vec2, p2: Vec2, p3: Vec2, color: uColor): nil @Draws a filled triangle on screen. - ---@field draw_poly fun(self, points: Vec2[], thickness: number, color: uColor): nil @Draws a polyline on screen. - ---@field draw_poly_filled fun(self, points: Vec2[], color: uColor): nil @Draws a filled convex polyline on screen. + ---@field draw_poly fun(self, points: Array, thickness: number, color: uColor): nil @Draws a polyline on screen. + ---@field draw_poly_filled fun(self, points: Array, color: uColor): nil @Draws a filled convex polyline on screen. ---@field draw_bezier_cubic fun(self, p1: Vec2, p2: Vec2, p3: Vec2, p4: Vec2, thickness: number, color: uColor): nil @Draws a cubic bezier curve on screen. ---@field draw_bezier_quadratic fun(self, p1: Vec2, p2: Vec2, p3: Vec2, thickness: number, color: uColor): nil @Draws a quadratic bezier curve on screen. ---@field draw_circle fun(self, x: number, y: number, radius: number, thickness: number, color: uColor): nil @Draws a circle on screen @@ -4687,11 +4687,11 @@ function CustomSound:play(paused, sound_type) end ---@field win_button fun(self, text: string): boolean @Add a button ---@field win_input_text fun(self, label: string, value: string): string @Add a text field ---@field win_input_int fun(self, label: string, value: integer): integer @Add an integer field - ---@field win_input_float fun(self, label: string, value: number): number @Add a number field + ---@field win_input_float fun(self, label: string, value: number): number @Add a float field ---@field win_slider_int fun(self, label: string, value: integer, min: integer, max: integer): integer @Add an integer slider ---@field win_drag_int fun(self, label: string, value: integer, min: integer, max: integer): integer @Add an integer dragfield - ---@field win_slider_float fun(self, label: string, value: number, min: number, max: number): number @Add an number slider - ---@field win_drag_float fun(self, label: string, value: number, min: number, max: number): number @Add an number dragfield + ---@field win_slider_float fun(self, label: string, value: number, min: number, max: number): number @Add an float slider + ---@field win_drag_float fun(self, label: string, value: number, min: number, max: number): number @Add an float dragfield ---@field win_check fun(self, label: string, value: boolean): boolean @Add a checkbox ---@field win_combo fun(self, label: string, selected: integer, opts: string): integer @Add a combo box ---@field win_popid fun(self): nil @Pop unique identifier from the stack. Put after the input. @@ -4821,7 +4821,7 @@ function GuiDrawContext:win_pushid(id) end ---@field showcursor boolean ---@class VanillaRenderContext - ---@field draw_text_size fun(self, text: string, scale_x: number, scale_y: number, fontstyle: integer): number, number @Measure the provided text using the built-in renderer
If you can, consider creating your own TextRenderingInfo instead
You can then use `:text_size()` and `draw_text` with that one any
`draw_text_size` works by creating new TextRenderingInfo just to call `:text_size()`, which is not very optimal + ---@field draw_text_size fun(self, text: string, scale_x: number, scale_y: number, fontstyle: integer): number, number @Measure the provided text using the built-in renderer
If you can, consider creating your own TextRenderingInfo instead
You can then use `:text_size()` and `draw_text` with that one object
`draw_text_size` works by creating new TextRenderingInfo just to call `:text_size()`, which is not very optimal ---@field set_corner_finish fun(self, c: CORNER_FINISH): nil @Set the prefered way of drawing corners for the non filled shapes ---@field draw_screen_line fun(self, A: Vec2, B: Vec2, thickness: number, color: Color): nil @Draws a line on screen using the built-in renderer from point `A` to point `B`.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events ---@field draw_screen_rect fun(self, rect: AABB, thickness: number, color: Color, angle: number?, px: number?, py: number?): nil @Draw rectangle in screen coordinates from top-left to bottom-right using the built-in renderer with optional `angle`.
`px`/`py` is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc. (corner from the AABB, not the visible one from adding the `thickness`)
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events @@ -4912,7 +4912,7 @@ function VanillaRenderContext:draw_screen_texture(texture_id, tri, color) end ---Draw a polyline on screen from points using the built-in renderer ---Draws from the first to the last point, use `closed` to connect first and last as well ---Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events ----@param points Vec2[] +---@param points Array ---@param thickness number ---@param color Color ---@param closed boolean @@ -4929,7 +4929,7 @@ function VanillaRenderContext:draw_screen_poly(points, thickness, color, closed) ---Draw a convex polygon on screen from points using the built-in renderer ---Can probably draw almost any polygon, but the convex one is guaranteed to look correct ---Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events ----@param points Vec2[] +---@param points Array ---@param color Color ---@return nil function VanillaRenderContext:draw_screen_poly_filled(points, color) end @@ -5016,7 +5016,7 @@ function VanillaRenderContext:draw_world_texture(texture_id, source, dest, color ---Draw a polyline in world coordinates from points using the built-in renderer ---Draws from the first to the last point, use `closed` to connect first and last as well ---Use in combination with ON.RENDER_PRE_DRAW_DEPTH event ----@param points Vec2[] +---@param points Array ---@param thickness number ---@param color Color ---@param closed boolean @@ -5033,7 +5033,7 @@ function VanillaRenderContext:draw_world_poly(points, thickness, color, closed) ---Draw a convex polygon in world coordinates from points using the built-in renderer ---Can probably draw almost any polygon, but the convex one is guaranteed to look correct ---Use in combination with ON.RENDER_PRE_DRAW_DEPTH event ----@param points Vec2[] +---@param points Array ---@param color Color ---@return nil function VanillaRenderContext:draw_world_poly_filled(points, color) end @@ -5085,13 +5085,13 @@ function VanillaRenderContext:draw_world_poly_filled(points, color) end ---@field width number ---@field height number ---@field special_texture_id integer @Used to draw buttons and stuff, default is -1 wich uses the buttons texture - ---@field get_dest fun(self): Letter[] @Returns refrence to the letter coordinates relative to the x,y position - ---@field get_source fun(self): Letter[] @Returns refrence to the letter coordinates in the texture + ---@field get_dest fun(self): Array @Returns refrence to the letter coordinates relative to the x,y position + ---@field get_source fun(self): Array @Returns refrence to the letter coordinates in the texture ---@field text_size fun(self): number, number @{width, height}, is only updated when you set/change the text. This is equivalent to draw_text_size - ---@field rotate fun(self, angle: number, px: number?, py: number?): nil @Rotates the text around the pivot point (default 0), pivot is relative to the text position (x, y), use px and py to offset it + ---@field rotate fun(self, angle: number, px: number?, py: number?): nil @Rotates void the text around the pivot point (default 0), pivot is relative to the text position (x, y), use px and py to offset it ---@field set_text fun(self, text: string, scale_x: number, scale_y: number, alignment: VANILLA_TEXT_ALIGNMENT, fontstyle: VANILLA_FONT_STYLE): nil @Changes the text, only position stays the same, everything else (like rotation) is reset or set according to the parameters ---@field get_font fun(self): TEXTURE - ---@field set_font fun(self, id: TEXTURE): nil + ---@field set_font fun(self, id: TEXTURE): boolean ---@class HudInventory ---@field enabled boolean @@ -5123,7 +5123,7 @@ function VanillaRenderContext:draw_world_poly_filled(points, color) end ---@field timer integer ---@class HudData - ---@field inventory HudInventory[] @size: MAX_PLAYERS + ---@field inventory Array ---@field udjat boolean ---@field money_total integer ---@field money_counter integer @@ -5133,7 +5133,7 @@ function VanillaRenderContext:draw_world_poly_filled(points, color) end ---@field level_num integer ---@field seed integer ---@field opacity number - ---@field players HudPlayer[] @size: MAX_PLAYERS + ---@field players Array ---@field money HudMoney ---@field timer HudElement ---@field level HudElement @@ -5315,8 +5315,8 @@ function Quad:is_point_inside(x, y, epsilon) end ---@field cthulhu_timer number ---@field selected_menu_index integer ---@field menu_text_opacity number - ---@field spear_position number[] @size: 6 - ---@field spear_dangler SpearDanglerAnimFrames[] @size: 6 + ---@field spear_position Array + ---@field spear_dangler Array ---@field play_scroll_descend_timer number ---@field scroll_text STRINGID @@ -5408,15 +5408,15 @@ function Quad:is_point_inside(x, y, epsilon) end ---@field quick_select_panel TextureRenderingInfo ---@field quick_select_selected_char_background TextureRenderingInfo ---@field quick_select_panel_related TextureRenderingInfo - ---@field player_shutter_timer number[] @size: MAX_PLAYERS - ---@field player_x number[] @size: MAX_PLAYERS - ---@field player_y number[] @size: MAX_PLAYERS - ---@field player_arrow_slidein_timer number[][] @size: MAX_PLAYERS - ---@field player_facing_left boolean[] @size: MAX_PLAYERS - ---@field player_quickselect_shown boolean[] @size: MAX_PLAYERS - ---@field player_quickselect_fadein_timer number[] @size: MAX_PLAYERS - ---@field player_quickselect_coords number[][] @size: MAX_PLAYERS - ---@field player_quickselect_wiggle_angle number[] @size: MAX_PLAYERS + ---@field player_shutter_timer Array + ---@field player_x Array + ---@field player_y Array + ---@field player_arrow_slidein_timer Array, MAX_PLAYERS> + ---@field player_facing_left Array + ---@field player_quickselect_shown Array + ---@field player_quickselect_fadein_timer Array + ---@field player_quickselect_coords Array, MAX_PLAYERS> + ---@field player_quickselect_wiggle_angle Array ---@field topleft_woodpanel_esc_slidein_timer number ---@field start_panel_slidein_timer number ---@field action_buttons_keycap_size number @@ -5427,7 +5427,7 @@ function Quad:is_point_inside(x, y, epsilon) end ---@field opacity number ---@field start_pressed boolean ---@field transition_to_game_started boolean - ---@field flying_things FlyingThing[] @size: 6 + ---@field flying_things Array ---@field flying_thing_countdown integer ---@field particle_ceilingdust_smoke ParticleEmitterInfo ---@field particle_ceilingdust_rubble ParticleEmitterInfo @@ -5514,11 +5514,11 @@ function Quad:is_point_inside(x, y, epsilon) end ---@field woodpanel_cutout_big_money3 TextureRenderingInfo ---@field big_dollar_sign TextureRenderingInfo ---@field unknown26 TextureRenderingInfo - ---@field player_stats_scroll_numeric_value integer[] @size: MAX_PLAYERS - ---@field player_secondary_icon TextureRenderingInfo[] @size: MAX_PLAYERS - ---@field player_icon TextureRenderingInfo[] @size: MAX_PLAYERS - ---@field player_secondary_icon_type integer[] @size: MAX_PLAYERS - ---@field player_icon_index integer[] @size: MAX_PLAYERS + ---@field player_stats_scroll_numeric_value Array + ---@field player_secondary_icon Array + ---@field player_icon Array + ---@field player_secondary_icon_type Array + ---@field player_icon_index Array ---@field hourglasses TextureRenderingInfo ---@field small_dollar_signs TextureRenderingInfo ---@field this_level_money_color Color @@ -5575,7 +5575,7 @@ function Quad:is_point_inside(x, y, epsilon) end ---@field woodpanel_top_visible boolean ---@field woodpanel_bottom_visible boolean ---@field toggle_panels_slidein boolean - ---@field players OnlineLobbyScreenPlayer[] @size: 4 + ---@field players Array ---@field background_image TextureRenderingInfo ---@field topleft_woodpanel_esc TextureRenderingInfo ---@field topleft_woodpanel_esc_slidein_timer number @@ -5746,7 +5746,7 @@ function Quad:is_point_inside(x, y, epsilon) end ---@field time_text_info TextRenderingInfo ---@field time_value_text_info TextRenderingInfo ---@field sticker_count integer - ---@field stickers TextureRenderingInfo[] @size: 20 + ---@field stickers Array ---@class ScreenArenaMenu : Screen ---@field brick_background_animation ScreenZoomAnimation @@ -5919,16 +5919,16 @@ function Quad:is_point_inside(x, y, epsilon) end ---@field score_counter TextureRenderingInfo ---@field unknown27 TextureRenderingInfo ---@field lava_bubbles TextureRenderingInfo - ---@field player_won boolean[] @size: MAX_PLAYERS + ---@field player_won Array ---@field victory_jump_y_pos number ---@field victory_jump_velocity number ---@field animation_frame integer ---@field squash_and_celebrate boolean - ---@field player_ready boolean[] @size: MAX_PLAYERS + ---@field player_ready Array ---@field next_transition_timer integer - ---@field player_bottom_pillar_offset number[] @size: MAX_PLAYERS - ---@field player_crushing_pillar_height number[] @size: MAX_PLAYERS - ---@field player_create_giblets boolean[] @size: MAX_PLAYERS + ---@field player_bottom_pillar_offset Array + ---@field player_crushing_pillar_height Array + ---@field player_create_giblets Array ---@field next_sidepanel_slidein_timer number end @@ -5978,9 +5978,9 @@ function MagmamanSpawnPosition:new(x_, y_) end ---Create a new color - defaults to black ---@return Color function Color:new() end ----@param color Color +---@param r Colo ---@return Color -function Color:new(color) end +function Color:new(r) end ---@param color Color ---@return Color function Color:new(color) end @@ -6019,9 +6019,9 @@ function CustomTheme:new() end Vec2 = nil ---@return Vec2 function Vec2:new() end ----@param vec2 Vec2 +---@param 2 Vec ---@return Vec2 -function Vec2:new(vec2) end +function Vec2:new(2) end ---@param x_ number ---@param y_ number ---@return Vec2 @@ -6032,9 +6032,9 @@ AABB = nil ---@return AABB function AABB:new() end ---Copy an axis aligned bounding box ----@param aabb AABB +---@param B AAB ---@return AABB -function AABB:new(aabb) end +function AABB:new(B) end ---@param top_left Vec2 ---@param bottom_right Vec2 ---@return AABB @@ -6050,9 +6050,9 @@ function AABB:new(left_, top_, right_, bottom_) end Triangle = nil ---@return Triangle function Triangle:new() end ----@param triangle Triangle +---@param e Triangl ---@return Triangle -function Triangle:new(triangle) end +function Triangle:new(e) end ---@param _a Vec2 ---@param _b Vec2 ---@param _c Vec2 @@ -6070,9 +6070,9 @@ function Triangle:new(ax, ay, bx, by, cx, cy) end Quad = nil ---@return Quad function Quad:new() end ----@param quad Quad +---@param d Qua ---@return Quad -function Quad:new(quad) end +function Quad:new(d) end ---@param bottom_left_ Vec2 ---@param bottom_right_ Vec2 ---@param top_right_ Vec2 diff --git a/docs/generate.py b/docs/generate.py index 2f2e8f01a..0a26bd915 100644 --- a/docs/generate.py +++ b/docs/generate.py @@ -21,8 +21,8 @@ "int64_t": "int", "ImU32": "int", "in_port_t": "int", - "custom_vector<": "array<", - "vector<": "array<", + "size_t": "int", + "custom_vector<": "vector<", "span<": "array<", "unordered_map<": "map<", "game_map<": "map<", @@ -40,7 +40,7 @@ "constexpr": "", "const ": "", "static": "", - "variadic_args va": "int, int...", + "variadic_args va": "ENT_TYPE, ENT_TYPE...", "EmittedParticlesInfo": "array", "ImVec2": "Vec2", "SoundCallbackFunction": "function", diff --git a/docs/parse_source.py b/docs/parse_source.py index 8f00d989e..1e34b36c7 100644 --- a/docs/parse_source.py +++ b/docs/parse_source.py @@ -260,7 +260,6 @@ def run_parse(): member_funs = {} member_vars = [] for line in data: - line = replace_fun(line) line = line.replace("*", "") if not class_name and ("struct" in line or "class" in line): m = re.match(r"(struct|class)\s+(\S+)", line) @@ -767,9 +766,10 @@ def run_parse(): if entry_name in underlying_cpp_type["member_funs"]: for fun in underlying_cpp_type["member_funs"][entry_name]: ret = fun["return"] + ret = replace_fun(ret) ret = f"optional<{ret}>" if ret else "bool" ret = ret if entry_name != "dtor" else "nil" - args = fun["param"].strip() + args = replace_fun(fun["param"]).strip() args = f"{name} self, {args}" if args else f"{name} self" binds = entry["binds"] if binds: @@ -782,9 +782,10 @@ def run_parse(): break else: ret = entry["ret"] + ret = replace_fun(ret) ret = f"optional<{ret}>" if ret else "bool" ret = ret if entry_name != "dtor" else "nil" - args = " ".join(entry["args"]) + args = replace_fun(" ".join(entry["args"])) args = f"{name} self, {args}" if args else f"{name} self" pre_signature = f"{ret} {entry_name}({args})" post_signature = f"nil {entry_name}({args})" diff --git a/docs/src/includes/_globals.md b/docs/src/includes/_globals.md index abb9d73ea..525c2d5ff 100644 --- a/docs/src/includes/_globals.md +++ b/docs/src/includes/_globals.md @@ -356,7 +356,7 @@ Hook the sendto and recvfrom functions and start dumping network data to termina > Search script examples for [get_address](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_address) -#### size_t get_address(string address_name) +#### int get_address(string address_name) Get the address for a pattern name @@ -365,7 +365,7 @@ Get the address for a pattern name > Search script examples for [get_rva](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_rva) -#### size_t get_rva(string address_name) +#### int get_rva(string address_name) Get the rva for a pattern name @@ -452,7 +452,7 @@ Make `mount_uid` carry `rider_uid` on their back. Only use this with actual moun > Search script examples for [change_waddler_drop](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=change_waddler_drop) -#### nil change_waddler_drop(array<[ENT_TYPE](#ENT_TYPE)> ent_types) +#### nil change_waddler_drop(vector<[ENT_TYPE](#ENT_TYPE)> ent_types) Change [ENT_TYPE](#ENT_TYPE)'s spawned when [Waddler](#Waddler) dies, by default there are 3:
{ITEM_PICKUP_COMPASS, ITEM_CHEST, ITEM_KEY}
@@ -482,9 +482,9 @@ Calls the enter door function, position doesn't matter, can also enter closed do > Search script examples for [entity_get_items_by](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=entity_get_items_by) -#### array<int> entity_get_items_by(int uid, array<[ENT_TYPE](#ENT_TYPE)> entity_types, int mask) +#### vector<int> entity_get_items_by(int uid, vector<[ENT_TYPE](#ENT_TYPE)> entity_types, int mask) -#### array<int> entity_get_items_by(int uid, [ENT_TYPE](#ENT_TYPE) entity_type, int mask) +#### vector<int> entity_get_items_by(int uid, [ENT_TYPE](#ENT_TYPE) entity_type, int mask) Gets uids of entities attached to given entity uid. Use `entity_type` and `mask` ([MASK](#MASK)) to filter, set them to 0 to return all attached entities. @@ -493,7 +493,7 @@ Gets uids of entities attached to given entity uid. Use `entity_type` and `mask` > Search script examples for [entity_has_item_type](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=entity_has_item_type) -#### bool entity_has_item_type(int uid, array<[ENT_TYPE](#ENT_TYPE)> entity_types) +#### bool entity_has_item_type(int uid, vector<[ENT_TYPE](#ENT_TYPE)> entity_types) #### bool entity_has_item_type(int uid, [ENT_TYPE](#ENT_TYPE) entity_type) @@ -522,7 +522,7 @@ Remove item by uid from entity > Search script examples for [filter_entities](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=filter_entities) -#### array<int> filter_entities(array entities, function predicate) +#### vector<int> filter_entities(vector entities, function predicate) Returns a list of all uids in `entities` for which `predicate(get_entity(uid))` returns true @@ -558,9 +558,9 @@ Get door target `world`, `level`, `theme` > Search script examples for [get_entities_at](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_entities_at) -#### array<int> get_entities_at(array<[ENT_TYPE](#ENT_TYPE)> entity_types, int mask, float x, float y, [LAYER](#LAYER) layer, float radius) +#### vector<int> get_entities_at(vector<[ENT_TYPE](#ENT_TYPE)> entity_types, int mask, float x, float y, [LAYER](#LAYER) layer, float radius) -#### array<int> get_entities_at([ENT_TYPE](#ENT_TYPE) entity_type, int mask, float x, float y, [LAYER](#LAYER) layer, float radius) +#### vector<int> get_entities_at([ENT_TYPE](#ENT_TYPE) entity_type, int mask, float x, float y, [LAYER](#LAYER) layer, float radius) Get uids of matching entities inside some radius ([ENT_TYPE](#ENT_TYPE), [MASK](#MASK)). Set `entity_type` or `mask` to `0` to ignore that, can also use table of entity_types Recommended to always set the mask, even if you look for one entity type @@ -581,9 +581,9 @@ end > Search script examples for [get_entities_by](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_entities_by) -#### array<int> get_entities_by(array<[ENT_TYPE](#ENT_TYPE)> entity_types, int mask, [LAYER](#LAYER) layer) +#### vector<int> get_entities_by(vector<[ENT_TYPE](#ENT_TYPE)> entity_types, int mask, [LAYER](#LAYER) layer) -#### array<int> get_entities_by([ENT_TYPE](#ENT_TYPE) entity_type, int mask, [LAYER](#LAYER) layer) +#### vector<int> get_entities_by([ENT_TYPE](#ENT_TYPE) entity_type, int mask, [LAYER](#LAYER) layer) Get uids of entities by some conditions ([ENT_TYPE](#ENT_TYPE), [MASK](#MASK)). Set `entity_type` or `mask` to `0` to ignore that, can also use table of entity_types. Recommended to always set the mask, even if you look for one entity type @@ -605,7 +605,7 @@ end, ON.LEVEL) > Search script examples for [get_entities_by_type](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_entities_by_type) -#### array<int> get_entities_by_type(int, int...) +#### vector<int> get_entities_by_type([ENT_TYPE](#ENT_TYPE), [ENT_TYPE](#ENT_TYPE)...) Get uids of entities matching id. This function is variadic, meaning it accepts any number of id's. You can even pass a table! @@ -616,9 +616,9 @@ This function can be slower than the [get_entities_by](#get_entities_by) with th > Search script examples for [get_entities_overlapping_hitbox](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_entities_overlapping_hitbox) -#### array<int> get_entities_overlapping_hitbox(array<[ENT_TYPE](#ENT_TYPE)> entity_types, int mask, [AABB](#AABB) hitbox, [LAYER](#LAYER) layer) +#### vector<int> get_entities_overlapping_hitbox(vector<[ENT_TYPE](#ENT_TYPE)> entity_types, int mask, [AABB](#AABB) hitbox, [LAYER](#LAYER) layer) -#### array<int> get_entities_overlapping_hitbox([ENT_TYPE](#ENT_TYPE) entity_type, int mask, [AABB](#AABB) hitbox, [LAYER](#LAYER) layer) +#### vector<int> get_entities_overlapping_hitbox([ENT_TYPE](#ENT_TYPE) entity_type, int mask, [AABB](#AABB) hitbox, [LAYER](#LAYER) layer) Get uids of matching entities overlapping with the given hitbox. Set `entity_type` or `mask` to `0` to ignore that, can also use table of entity_types @@ -2557,7 +2557,7 @@ Adding other entities will result in not obtainable items or game crash > Search script examples for [change_diceshop_prizes](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=change_diceshop_prizes) -#### nil change_diceshop_prizes(array<[ENT_TYPE](#ENT_TYPE)> ent_types) +#### nil change_diceshop_prizes(vector<[ENT_TYPE](#ENT_TYPE)> ent_types) Change [ENT_TYPE](#ENT_TYPE)'s spawned in dice shops (Madame Tusk as well), by default there are 25:
{ITEM_PICKUP_BOMBBAG, ITEM_PICKUP_BOMBBOX, ITEM_PICKUP_ROPEPILE, ITEM_PICKUP_COMPASS, ITEM_PICKUP_PASTE, ITEM_PICKUP_PARACHUTE, ITEM_PURCHASABLE_CAPE, ITEM_PICKUP_SPECTACLES, ITEM_PICKUP_CLIMBINGGLOVES, ITEM_PICKUP_PITCHERSMITT, @@ -2651,7 +2651,7 @@ Gets an existing sound, either if a file at the same path was already loaded or > Search script examples for [change_altar_damage_spawns](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=change_altar_damage_spawns) -#### nil change_altar_damage_spawns(array<[ENT_TYPE](#ENT_TYPE)> ent_types) +#### nil change_altar_damage_spawns(vector<[ENT_TYPE](#ENT_TYPE)> ent_types) Change [ENT_TYPE](#ENT_TYPE)'s spawned when you damage the altar, by default there are 6:
{MONS_BAT, MONS_BEE, MONS_SPIDER, MONS_JIANGSHI, MONS_FEMALE_JIANGSHI, MONS_VAMPIRE}
@@ -2663,7 +2663,7 @@ Use empty table as argument to reset to the game default > Search script examples for [change_sunchallenge_spawns](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=change_sunchallenge_spawns) -#### nil change_sunchallenge_spawns(array<[ENT_TYPE](#ENT_TYPE)> ent_types) +#### nil change_sunchallenge_spawns(vector<[ENT_TYPE](#ENT_TYPE)> ent_types) Change [ENT_TYPE](#ENT_TYPE)'s spawned by `FLOOR_SUNCHALLENGE_GENERATOR`, by default there are 4:
{MONS_WITCHDOCTOR, MONS_VAMPIRE, MONS_SORCERESS, MONS_NECROMANCER}
@@ -3331,7 +3331,7 @@ Same as import(). > Search script examples for [read_prng](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=read_prng) -`array read_prng()`
+`vector read_prng()`
Read the game prng state. Use [prng](#PRNG):get_pair() instead. ### force_dark_level @@ -3356,7 +3356,7 @@ Set level flag 18 on post room generation instead, to properly force every level > Search script examples for [get_entities](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_entities) -#### array<int> get_entities() +#### vector<int> get_entities() Use `get_entities_by(0, MASK.ANY, LAYER.BOTH)` instead @@ -3365,7 +3365,7 @@ Use `get_entities_by(0, MASK.ANY, LAYER.BOTH)` instead > Search script examples for [get_entities_by_mask](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_entities_by_mask) -#### array<int> get_entities_by_mask(int mask) +#### vector<int> get_entities_by_mask(int mask) Use `get_entities_by(0, mask, LAYER.BOTH)` instead @@ -3374,7 +3374,7 @@ Use `get_entities_by(0, mask, LAYER.BOTH)` instead > Search script examples for [get_entities_by_layer](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_entities_by_layer) -#### array<int> get_entities_by_layer([LAYER](#LAYER) layer) +#### vector<int> get_entities_by_layer([LAYER](#LAYER) layer) Use `get_entities_by(0, MASK.ANY, layer)` instead @@ -3383,9 +3383,9 @@ Use `get_entities_by(0, MASK.ANY, layer)` instead > Search script examples for [get_entities_overlapping](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_entities_overlapping) -#### array<int> get_entities_overlapping(array<[ENT_TYPE](#ENT_TYPE)> entity_types, int mask, float sx, float sy, float sx2, float sy2, [LAYER](#LAYER) layer) +#### vector<int> get_entities_overlapping(vector<[ENT_TYPE](#ENT_TYPE)> entity_types, int mask, float sx, float sy, float sx2, float sy2, [LAYER](#LAYER) layer) -#### array<int> get_entities_overlapping([ENT_TYPE](#ENT_TYPE) entity_type, int mask, float sx, float sy, float sx2, float sy2, [LAYER](#LAYER) layer) +#### vector<int> get_entities_overlapping([ENT_TYPE](#ENT_TYPE) entity_type, int mask, float sx, float sy, float sx2, float sy2, [LAYER](#LAYER) layer) Use `get_entities_overlapping_hitbox` instead diff --git a/docs/src/includes/_types.md b/docs/src/includes/_types.md index 97a195b46..114b571dc 100644 --- a/docs/src/includes/_types.md +++ b/docs/src/includes/_types.md @@ -180,8 +180,8 @@ nil | [draw_rect_filled(float left, float top, float right, float bottom, float nil | [draw_rect_filled(AABB rect, float rounding, uColor color)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_rect_filled) | Draws a filled rectangle on screen from top-left to bottom-right. nil | [draw_triangle(Vec2 p1, Vec2 p2, Vec2 p3, float thickness, uColor color)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_triangle) | Draws a triangle on screen. nil | [draw_triangle_filled(Vec2 p1, Vec2 p2, Vec2 p3, uColor color)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_triangle_filled) | Draws a filled triangle on screen. -nil | [draw_poly(array points, float thickness, uColor color)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_poly) | Draws a polyline on screen. -nil | [draw_poly_filled(array points, uColor color)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_poly_filled) | Draws a filled convex polyline on screen. +nil | [draw_poly(vector points, float thickness, uColor color)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_poly) | Draws a polyline on screen. +nil | [draw_poly_filled(vector points, uColor color)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_poly_filled) | Draws a filled convex polyline on screen. nil | [draw_bezier_cubic(Vec2 p1, Vec2 p2, Vec2 p3, Vec2 p4, float thickness, uColor color)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_bezier_cubic) | Draws a cubic bezier curve on screen. nil | [draw_bezier_quadratic(Vec2 p1, Vec2 p2, Vec2 p3, float thickness, uColor color)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_bezier_quadratic) | Draws a quadratic bezier curve on screen. nil | [draw_circle(float x, float y, float radius, float thickness, uColor color)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_circle) | Draws a circle on screen @@ -252,7 +252,7 @@ Type | Name | Description ---- | ---- | ----------- optional<[SHORT_TILE_CODE](#Aliases)> | [get_short_tile_code(int tx, int ty, LAYER layer)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_short_tile_code) | Gets the tile code at the specified tile coordinate
Valid coordinates are `0 <= tx < CONST.ROOM_WIDTH`, `0 <= ty < CONST.ROOM_HEIGHT` and `layer` in `{LAYER.FRONT, LAYER.BACK}`
Also returns `nil` if `layer == LAYER.BACK` and the room does not have a back layer bool | [set_short_tile_code(int tx, int ty, LAYER layer, SHORT_TILE_CODE short_tile_code)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_short_tile_code) | Sets the tile code at the specified tile coordinate
Valid coordinates are `0 <= tx < CONST.ROOM_WIDTH`, `0 <= ty < CONST.ROOM_HEIGHT` and `layer` in `{LAYER.FRONT, LAYER.BACK, LAYER.BOTH}`
Also returns `false` if `layer == LAYER.BACK` and the room does not have a back layer -array<tuple<int, int, [LAYER](#LAYER)>> | [find_all_short_tile_codes(LAYER layer, SHORT_TILE_CODE short_tile_code)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=find_all_short_tile_codes) | Finds all places a short tile code is used in the room, `layer` must be in `{LAYER.FRONT, LAYER.BACK, LAYER.BOTH}`
Returns an empty list if `layer == LAYER.BACK` and the room does not have a back layer +vector<tuple<int, int, [LAYER](#LAYER)>> | [find_all_short_tile_codes(LAYER layer, SHORT_TILE_CODE short_tile_code)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=find_all_short_tile_codes) | Finds all places a short tile code is used in the room, `layer` must be in `{LAYER.FRONT, LAYER.BACK, LAYER.BOTH}`
Returns an empty list if `layer == LAYER.BACK` and the room does not have a back layer bool | [replace_short_tile_code(LAYER layer, SHORT_TILE_CODE short_tile_code, SHORT_TILE_CODE replacement_short_tile_code)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=replace_short_tile_code) | Replaces all instances of `short_tile_code` in the given layer with `replacement_short_tile_code`, `layer` must be in `{LAYER.FRONT, LAYER.BACK, LAYER.BOTH}`
Returns `false` if `layer == LAYER.BACK` and the room does not have a back layer bool | [has_back_layer()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=has_back_layer) | Check whether the room has a back layer nil | [add_empty_back_layer()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=add_empty_back_layer) | Add a back layer filled with all `0` if there is no back layer yet
Does nothing if there already is a backlayer @@ -264,8 +264,8 @@ Context received in [ON](#ON).PRE_LOAD_LEVEL_FILES, used for forcing specific `. Type | Name | Description ---- | ---- | ----------- -nil | [override_level_files(array levels)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=override_level_files) | Block all loading `.lvl` files and instead load the specified `.lvl` files. This includes `generic.lvl` so if you need it specify it here.
All `.lvl` files are loaded relative to `Data/Levels`, but they can be completely custom `.lvl` files that ship with your mod so long as they are in said folder.
Use at your own risk, some themes/levels expect a certain level file to be loaded. -nil | [add_level_files(array levels)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=add_level_files) | Load additional levels files other than the ones that would usually be loaded. Stacks with `override_level_files` if that was called first.
All `.lvl` files are loaded relative to `Data/Levels`, but they can be completely custom `.lvl` files that ship with your mod so long as they are in said folder. +nil | [override_level_files(vector levels)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=override_level_files) | Block all loading `.lvl` files and instead load the specified `.lvl` files. This includes `generic.lvl` so if you need it specify it here.
All `.lvl` files are loaded relative to `Data/Levels`, but they can be completely custom `.lvl` files that ship with your mod so long as they are in said folder.
Use at your own risk, some themes/levels expect a certain level file to be loaded. +nil | [add_level_files(vector levels)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=add_level_files) | Load additional levels files other than the ones that would usually be loaded. Stacks with `override_level_files` if that was called first.
All `.lvl` files are loaded relative to `Data/Levels`, but they can be completely custom `.lvl` files that ship with your mod so long as they are in said folder. ### SaveContext @@ -298,9 +298,9 @@ nil | [draw_screen_rect(AABB& rect, float thickness, Color color, optional angle, optional px, optional py)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_screen_rect_filled) | Draw filled rectangle in screen coordinates from top-left to bottom-right using the built-in renderer with optional `angle`.
`px`/`py` is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events nil | [draw_screen_triangle(Triangle& triangle, float thickness, Color color)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_screen_triangle) | Draw triangle in screen coordinates using the built-in renderer.
Use in combination with [ON](#ON).RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events nil | [draw_screen_triangle_filled(Triangle& triangle, Color color)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_screen_triangle_filled) | Draw filled triangle in screen coordinates using the built-in renderer.
Use in combination with [ON](#ON).RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events -nil | [draw_screen_poly(array points, float thickness, Color color, bool closed)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_screen_poly) | Draw a polyline on screen from points using the built-in renderer
Draws from the first to the last point, use `closed` to connect first and last as well
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events +nil | [draw_screen_poly(vector points, float thickness, Color color, bool closed)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_screen_poly) | Draw a polyline on screen from points using the built-in renderer
Draws from the first to the last point, use `closed` to connect first and last as well
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events nil | [draw_screen_poly(Quad& points, float thickness, Color color, bool closed)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_screen_poly) | Draw quadrilateral in screen coordinates from top-left to bottom-right using the built-in renderer.
Use in combination with [ON](#ON).RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events -nil | [draw_screen_poly_filled(array points, Color color)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_screen_poly_filled) | Draw a convex polygon on screen from points using the built-in renderer
Can probably draw almost any polygon, but the convex one is guaranteed to look correct
Use in combination with [ON](#ON).RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events +nil | [draw_screen_poly_filled(vector points, Color color)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_screen_poly_filled) | Draw a convex polygon on screen from points using the built-in renderer
Can probably draw almost any polygon, but the convex one is guaranteed to look correct
Use in combination with [ON](#ON).RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events nil | [draw_screen_poly_filled(Quad& points, Color color)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_screen_poly_filled) | Draw filled quadrilateral in screen coordinates from top-left to bottom-right using the built-in renderer.
Use in combination with [ON](#ON).RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events nil | [draw_world_texture(TEXTURE texture_id, int row, int column, float left, float top, float right, float bottom, Color color)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_world_texture) | Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer
Use in combination with [ON](#ON).RENDER_PRE_DRAW_DEPTH event
For more control use the version taking a [Quad](#Quad) instead nil | [draw_world_texture(TEXTURE texture_id, int row, int column, AABB& dest, Color color)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_world_texture) | Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer
Use in combination with [ON](#ON).RENDER_PRE_DRAW_DEPTH event
For more control use the version taking a [Quad](#Quad) instead @@ -314,9 +314,9 @@ nil | [draw_world_rect(AABB& rect, float thickness, Color color, optional nil | [draw_world_rect_filled(AABB& rect, Color color, optional angle, optional px, optional py)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_world_rect_filled) | Draw rectangle in world coordinates from top-left to bottom-right using the built-in renderer with optional `angle`.
`px`/`py` is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event nil | [draw_world_triangle(Triangle& triangle, float thickness, Color color)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_world_triangle) | Draw triangle in world coordinates using the built-in renderer.
Use in combination with [ON](#ON).RENDER_PRE_DRAW_DEPTH event nil | [draw_world_triangle_filled(Triangle& triangle, Color color)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_world_triangle_filled) | Draw filled triangle in world coordinates using the built-in renderer.
Use in combination with [ON](#ON).RENDER_PRE_DRAW_DEPTH event -nil | [draw_world_poly(array points, float thickness, Color color, bool closed)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_world_poly) | Draw a polyline in world coordinates from points using the built-in renderer
Draws from the first to the last point, use `closed` to connect first and last as well
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event +nil | [draw_world_poly(vector points, float thickness, Color color, bool closed)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_world_poly) | Draw a polyline in world coordinates from points using the built-in renderer
Draws from the first to the last point, use `closed` to connect first and last as well
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event nil | [draw_world_poly(Quad& points, float thickness, Color color, bool closed)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_world_poly) | Draw quadrilateral in world coordinates from top-left to bottom-right using the built-in renderer.
Use in combination with [ON](#ON).RENDER_PRE_DRAW_DEPTH event -nil | [draw_world_poly_filled(array points, Color color)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_world_poly_filled) | Draw a convex polygon in world coordinates from points using the built-in renderer
Can probably draw almost any polygon, but the convex one is guaranteed to look correct
Use in combination with [ON](#ON).RENDER_PRE_DRAW_DEPTH event +nil | [draw_world_poly_filled(vector points, Color color)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_world_poly_filled) | Draw a convex polygon in world coordinates from points using the built-in renderer
Can probably draw almost any polygon, but the convex one is guaranteed to look correct
Use in combination with [ON](#ON).RENDER_PRE_DRAW_DEPTH event nil | [draw_world_poly_filled(Quad& points, Color color)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=draw_world_poly_filled) | Draw filled quadrilateral in world coordinates from top-left to bottom-right using the built-in renderer.
Use in combination with [ON](#ON).RENDER_PRE_DRAW_DEPTH event [AABB](#AABB) | [bounding_box](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=bounding_box) | | [render_draw_depth](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=render_draw_depth) | @@ -523,7 +523,7 @@ Axis-Aligned-Bounding-Box, represents for example a hitbox of an entity or the s Type | Name | Description ---- | ---- | ----------- [AABB](#AABB) | [new()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=AABB) | Create a new axis aligned bounding box - defaults to all zeroes -[AABB](#AABB) | [new(AABB& aabb&)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=AABB) | Copy an axis aligned bounding box +[AABB](#AABB) | [new(AABB&)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=AABB) | Copy an axis aligned bounding box [AABB](#AABB) | [new(Vec2& top_left, Vec2& bottom_right)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=AABB) | [AABB](#AABB) | [new(float left_, float top_, float right_, float bottom_)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=AABB) | Create a new axis aligned bounding box by specifying its values float | [left](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=left) | @@ -583,28 +583,29 @@ prinspect(string.format("%x"), color:get_ucolor()) -- 800000ff Type | Name | Description ---- | ---- | ----------- [Color](#Color) | [new()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=Color) | Create a new color - defaults to black -[Color](#Color) | [new(Color& color&)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=Color) | +[Color](#Color) | [new(Color&)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=Color) | +[Color](#Color) | [new(Color&& color&&)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=Color) | [Color](#Color) | [new(float r_, float g_, float b_, float a_)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=Color) | Create a new color by specifying its values float | [r](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=r) | float | [g](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=g) | float | [b](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=b) | float | [a](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=a) | -[Color](#Color) | [white()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=white) | -[Color](#Color) | [silver()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=silver) | -[Color](#Color) | [gray()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=gray) | -[Color](#Color) | [black()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=black) | -[Color](#Color) | [red()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=red) | -[Color](#Color) | [maroon()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=maroon) | -[Color](#Color) | [yellow()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=yellow) | -[Color](#Color) | [olive()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=olive) | -[Color](#Color) | [lime()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=lime) | -[Color](#Color) | [green()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=green) | -[Color](#Color) | [aqua()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=aqua) | -[Color](#Color) | [teal()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=teal) | -[Color](#Color) | [blue()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=blue) | -[Color](#Color) | [navy()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=navy) | -[Color](#Color) | [fuchsia()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=fuchsia) | -[Color](#Color) | [purple()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=purple) | + [Color](#Color) | [white()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=white) | + [Color](#Color) | [silver()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=silver) | + [Color](#Color) | [gray()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=gray) | + [Color](#Color) | [black()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=black) | + [Color](#Color) | [red()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=red) | + [Color](#Color) | [maroon()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=maroon) | + [Color](#Color) | [yellow()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=yellow) | + [Color](#Color) | [olive()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=olive) | + [Color](#Color) | [lime()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=lime) | + [Color](#Color) | [green()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=green) | + [Color](#Color) | [aqua()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=aqua) | + [Color](#Color) | [teal()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=teal) | + [Color](#Color) | [blue()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=blue) | + [Color](#Color) | [navy()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=navy) | + [Color](#Color) | [fuchsia()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=fuchsia) | + [Color](#Color) | [purple()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=purple) | tuple<int, int, int, int> | [get_rgba()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_rgba) | Returns RGBA colors in 0..255 range [Color](#Color)& | [set_rgba(int red, int green, int blue, int alpha)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_rgba) | Changes color based on given RGBA colors in 0..255 range [uColor](#Aliases) | [get_ucolor()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_ucolor) | Returns the `uColor` used in `GuiDrawContext` drawing functions @@ -753,7 +754,7 @@ nil | [set_pair(PRNG_CLASS type, int first, int second)](https://github.com/spel Type | Name | Description ---- | ---- | ----------- [Quad](#Quad) | [new()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=Quad) | -[Quad](#Quad) | [new(Quad& quad&)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=Quad) | +[Quad](#Quad) | [new(Quad&)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=Quad) | [Quad](#Quad) | [new(Vec2& bottom_left_, Vec2& bottom_right_, Vec2& top_right_, Vec2& top_left_)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=Quad) | [Quad](#Quad) | [new(float _bottom_left_x, float _bottom_left_y, float _bottom_right_x, float _bottom_right_y, float _top_right_x, float _top_right_y, float _top_left_x, float _top_left_y)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=Quad) | [Quad](#Quad) | [new(AABB& aabb)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=Quad) | @@ -836,7 +837,7 @@ Used in [StateMemory](#StateMemory) Type | Name | Description ---- | ---- | ----------- map<int, [ItemOwnerDetails](#ItemOwnerDetails)> | [owned_items](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=owned_items) | key/index is the uid of an item -array<[RoomOwnerDetails](#RoomOwnerDetails)> | [owned_rooms](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=owned_rooms) | +vector<[RoomOwnerDetails](#RoomOwnerDetails)> | [owned_rooms](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=owned_rooms) | ### ShortTileCodeDef @@ -862,7 +863,7 @@ int | [row](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=row) | Type | Name | Description ---- | ---- | ----------- [Triangle](#Triangle) | [new()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=Triangle) | -[Triangle](#Triangle) | [new(Triangle& triangle&)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=Triangle) | +[Triangle](#Triangle) | [new(Triangle&)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=Triangle) | [Triangle](#Triangle) | [new(Vec2& _a, Vec2& _b, Vec2& _c)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=Triangle) | [Triangle](#Triangle) | [new(float ax, float ay, float bx, float by, float cx, float cy)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=Triangle) | [Vec2](#Vec2) | [A](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=A) | @@ -886,7 +887,7 @@ Simple object to hold pair of coordinates Type | Name | Description ---- | ---- | ----------- [Vec2](#Vec2) | [new()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=Vec2) | -[Vec2](#Vec2) | [new(Vec2& vec2&)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=Vec2) | +[Vec2](#Vec2) | [new(Vec2&)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=Vec2) | [Vec2](#Vec2) | [new(float x_, float y_)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=Vec2) | 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) | @@ -1205,7 +1206,7 @@ float | [spawn_x](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=spawn float | [spawn_y](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=spawn_y) | int | [spawn_room_x](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=spawn_room_x) | int | [spawn_room_y](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=spawn_room_y) | -array<[Vec2](#Vec2)> | [exit_doors](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=exit_doors) | +vector<[Vec2](#Vec2)> | [exit_doors](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=exit_doors) | [ThemeInfo](#ThemeInfo) | [themes[18]](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=themes) | ## Lighting types @@ -1344,7 +1345,7 @@ Derived from [Logic](#Logic) Type | Name | Description ---- | ---- | ----------- -array<[MagmamanSpawnPosition](#MagmamanSpawnPosition)> | [magmaman_positions](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=magmaman_positions) | +vector<[MagmamanSpawnPosition](#MagmamanSpawnPosition)> | [magmaman_positions](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=magmaman_positions) | ### LogicOlmecCutscene @@ -1618,7 +1619,7 @@ int | [max_page_count](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q= int | [page_timer](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=page_timer) | int | [fade_timer](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=fade_timer) | int | [opacity](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=opacity) | -array<[JournalPage](#JournalPage)> | [pages](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=pages) | Stores pages loaded into memeory. It's not cleared after the journal is closed or when you go back to the main (menu) page.
Use `:get_type()` to chcek page type and cast it correctly (see ON.[RENDER_POST_DRAW_DEPTH](#ON-RENDER_PRE_JOURNAL_PAGE)) +vector<[JournalPage](#JournalPage)> | [pages](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=pages) | Stores pages loaded into memeory. It's not cleared after the journal is closed or when you go back to the main (menu) page.
Use `:get_type()` to chcek page type and cast it correctly (see ON.[RENDER_POST_DRAW_DEPTH](#ON-RENDER_PRE_JOURNAL_PAGE)) ### OnlineLobbyScreenPlayer @@ -2399,7 +2400,7 @@ Type | Name | Description [PlayingSound](#PlayingSound) | [play()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=play) | [PlayingSound](#PlayingSound) | [play(bool paused)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=play) | [PlayingSound](#PlayingSound) | [play(bool paused, SOUND_TYPE sound_type)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=play) | -map<[VANILLA_SOUND_PARAM](#VANILLA_SOUND_PARAM), string> | [get_parameters()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_parameters) | +map<[VANILLA_SOUND_PARAM](#VANILLA_SOUND_PARAM), char> | [get_parameters()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_parameters) | ### PlayingSound @@ -2417,7 +2418,7 @@ bool | [set_pan(float pan)](https://github.com/spelunky-fyi/overlunky/search?l=L bool | [set_volume(float volume)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_volume) | bool | [set_looping(SOUND_LOOP_MODE loop_mode)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_looping) | bool | [set_callback(function callback)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_callback) | -map<[VANILLA_SOUND_PARAM](#VANILLA_SOUND_PARAM), string> | [get_parameters()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_parameters) | +map<[VANILLA_SOUND_PARAM](#VANILLA_SOUND_PARAM), char> | [get_parameters()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_parameters) | optional<float> | [get_parameter(VANILLA_SOUND_PARAM parameter_index)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_parameter) | bool | [set_parameter(VANILLA_SOUND_PARAM parameter_index, float value)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_parameter) | @@ -2718,7 +2719,7 @@ tuple<float, float> | [text_size()](https://github.com/spelunky-fyi/overlu nil | [rotate(float angle, optional px, optional py)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=rotate) | Rotates the text around the pivot point (default 0), pivot is relative to the text position (x, y), use px and py to offset it nil | [set_text(string text, float scale_x, float scale_y, VANILLA_TEXT_ALIGNMENT alignment, VANILLA_FONT_STYLE fontstyle)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_text) | Changes the text, only position stays the same, everything else (like rotation) is reset or set according to the parameters [TEXTURE](#TEXTURE) | [get_font()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_font) | -nil | [set_font(TEXTURE id)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_font) | +bool | [set_font(TEXTURE id)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_font) | ### TextureDefinition @@ -2850,7 +2851,7 @@ nil | [spawn_transition()](https://github.com/spelunky-fyi/overlunky/search?l=Lu nil | [post_transition()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=post_transition) | nil | [spawn_players()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=spawn_players) | nil | [spawn_effects()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=spawn_effects) | -string | [get_level_file()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_level_file) | +char | [get_level_file()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_level_file) | int | [get_theme_id()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_theme_id) | int | [get_base_id()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_base_id) | int | [get_floor_spreading_type()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_floor_spreading_type) | @@ -2949,7 +2950,7 @@ nil | [spawn_transition()](https://github.com/spelunky-fyi/overlunky/search?l=Lu nil | [post_transition()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=post_transition) | Handles loading the next level screen from a transition screen nil | [spawn_players()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=spawn_players) | Spawns the players with inventory at `state.level_gen.spawn_x/y`. Also shop and kali background and probably other stuff for some stupid reason. nil | [spawn_effects()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=spawn_effects) | Sets the camera bounds and position. Spawns jelly and orbs and the flag in coop. Sets timers/conditions for more jellies and ghosts. Enables the special fog/ember/ice etc particle effects. -string | [get_level_file()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_level_file) | Returns: The .lvl file to load (e.g. dwelling = dwellingarea.lvl except when level == 4 (cavebossarea.lvl)) +char | [get_level_file()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_level_file) | Returns: The .lvl file to load (e.g. dwelling = dwellingarea.lvl except when level == 4 (cavebossarea.lvl)) int | [get_theme_id()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_theme_id) | Returns: [THEME](#THEME), or subtheme in CO int | [get_base_id()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_base_id) | Returns: [THEME](#THEME), or logical base [THEME](#THEME) for special levels (Abzu->Tide Pool etc) int | [get_floor_spreading_type()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_floor_spreading_type) | Returns: [ENT_TYPE](#ENT_TYPE) used for floor spreading (generic or one of the styled floors) @@ -4996,7 +4997,7 @@ Type | Name | Description nil | [remove_powerup(ENT_TYPE powerup_type)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=remove_powerup) | Removes a currently applied powerup. Specify `ENT_TYPE.ITEM_POWERUP_xxx`, not `ENT_TYPE.ITEM_PICKUP_xxx`! Removing the Eggplant crown does not seem to undo the throwing of eggplants, the other powerups seem to work. nil | [give_powerup(ENT_TYPE powerup_type)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=give_powerup) | Gives the player/monster the specified powerup. Specify `ENT_TYPE.ITEM_POWERUP_xxx`, not `ENT_TYPE.ITEM_PICKUP_xxx`! Giving true crown to a monster crashes the game. bool | [has_powerup(ENT_TYPE powerup_type)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=has_powerup) | Checks whether the player/monster has a certain powerup -array<[ENT_TYPE](#ENT_TYPE)> | [get_powerups()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_powerups) | Return all powerups that the entity has +vector<[ENT_TYPE](#ENT_TYPE)> | [get_powerups()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_powerups) | Return all powerups that the entity has nil | [unequip_backitem()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=unequip_backitem) | Unequips the currently worn backitem int | [worn_backitem()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=worn_backitem) | Returns the uid of the currently worn backitem, or -1 if wearing nothing @@ -6440,7 +6441,7 @@ bool | [can_jump()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=can nil | [add_money(int money)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=add_money) | Adds or subtracts the specified amount of money to the movable's (player's) inventory. Shows the calculation animation in the HUD. bool | [is_on_fire()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=is_on_fire) | bool | [damage(int damage_dealer_uid, int damage_amount, int stun_time, float velocity_x, float velocity_y, int iframes)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=damage) | Damage the movable by the specified amount, stuns and gives it invincibility for the specified amount of frames and applies the velocities
Returns: true if entity was affected, damage_dealer should break etc. false if the event should be ignored by damage_dealer? -array<int> | [get_all_behaviors()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_all_behaviors) | Get all avaible behavior ids +vector<int> | [get_all_behaviors()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_all_behaviors) | Get all avaible behavior ids bool | [set_behavior(int behavior_id)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_behavior) | Set behavior, this is more than just state as it's an active function, for example climbing ladder is a behavior and it doesn't actually need ladder/rope entity
Returns false if entity doesn't have this behavior id int | [get_behavior()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_behavior) | Get the current behavior id nil | [set_gravity(float gravity)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_gravity) | Force the gravity for this entity. Will override anything set by special states like swimming too, unless you reset it. Default 1.0 diff --git a/docs/validator.py b/docs/validator.py index b21aed633..f4fcc9b77 100644 --- a/docs/validator.py +++ b/docs/validator.py @@ -14,14 +14,14 @@ "int64_t": "int", "ImU32": "int", "in_port_t": "int", - "custom_vector<": "array<", - "vector<": "array<", + "size_t": "int", + "custom_vector<": "vector<", "span<": "array<", "unordered_map<": "map<", "game_map<": "map<", "custom_map<": "map<", ", identity_hasher<>": "", - "const char*": "string", + "char": "string", "wstring": "string", "u16string": "string", "string_view": "string", @@ -31,13 +31,13 @@ "sol::": "", "void": "", "constexpr": "", - "const": "", + "const ": "", "static": "", - "variadic_args va": "int, int...", + "variadic_args va": "ENT_TYPE, ENT_TYPE...", "EmittedParticlesInfo": "array", "ImVec2": "Vec2", "SoundCallbackFunction": "function", - "object": "any", + "object ": "any ", } def replace_all(text): diff --git a/src/game_api/render_api.hpp b/src/game_api/render_api.hpp index ad7430a73..4c8267d80 100644 --- a/src/game_api/render_api.hpp +++ b/src/game_api/render_api.hpp @@ -151,9 +151,14 @@ struct TextRenderingInfo else return 0; } - void set_font(TEXTURE id) + bool set_font(TEXTURE id) { - font = get_texture(id); + if (auto* texture = get_texture(id)) + { + font = get_texture(id); + return true; + } + return false; } /// Rotates the text around the pivot point (default 0), pivot is relative to the text position (x, y), use px and py to offset it void rotate(float angle, std::optional px, std::optional py);