Skip to content

Commit

Permalink
Merge pull request #342 from Mr-Auto/stuff
Browse files Browse the repository at this point in the history
Some random things that i can't think of single name for
  • Loading branch information
Dregu authored Oct 17, 2023
2 parents abf1343 + 741a732 commit 7080921
Show file tree
Hide file tree
Showing 43 changed files with 1,112 additions and 452 deletions.
78 changes: 74 additions & 4 deletions docs/game_data/spel2.lua

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

1 change: 1 addition & 0 deletions docs/parse_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
header_files = [
"../src/game_api/math.hpp",
"../src/game_api/rpc.hpp",
"../src/game_api/entity_lookup.hpp",
"../src/game_api/drops.hpp",
"../src/game_api/spawn_api.hpp",
"../src/game_api/script.hpp",
Expand Down
13 changes: 13 additions & 0 deletions docs/src/includes/_enums.md
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,19 @@ Name | Data | Description
[STAR_CHALLENGE_SPAWNED](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=QUEST_FLAG.STAR_CHALLENGE_SPAWNED) | 26 |
[SUN_CHALLENGE_SPAWNED](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=QUEST_FLAG.SUN_CHALLENGE_SPAWNED) | 27 |

## RECURSIVE_MODE


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


Name | Data | Description
---- | ---- | -----------
[EXCLUSIVE](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=RECURSIVE_MODE.EXCLUSIVE) | RECURSIVE_MODE::EXCLUSIVE | In this mode the provided [ENT_TYPE](#ENT_TYPE) and [MASK](#MASK) will not be affected nor will entities attached to them<br/>
[INCLUSIVE](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=RECURSIVE_MODE.INCLUSIVE) | RECURSIVE_MODE::INCLUSIVE | In this mode the provided [ENT_TYPE](#ENT_TYPE) and [MASK](#MASK) will be the only affected entities, anything outside of the specified mask or type will not be touched including entities attached to them<br/>For this mode you have to specify at least one mask or [ENT_TYPE](#ENT_TYPE), otherwise nothing will be affected<br/>
[NONE](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=RECURSIVE_MODE.NONE) | RECURSIVE_MODE::NONE | Ignores provided [ENT_TYPE](#ENT_TYPE) and [MASK](#MASK) and affects all the entities<br/>

## RENDER_INFO_OVERRIDE


Expand Down
62 changes: 62 additions & 0 deletions docs/src/includes/_globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,18 @@ end
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

### get_entities_by_draw_depth


> Search script examples for [get_entities_by_draw_depth](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_entities_by_draw_depth)
#### array&lt;int&gt; get_entities_by_draw_depth(int draw_depth, [LAYER](#LAYER) l)

#### array&lt;int&gt; get_entities_by_draw_depth(array<int> draw_depths, [LAYER](#LAYER) l)

Get uids of entities by draw_depth. Can also use table of draw_depths.
You can later use [filter_entities](#filter_entities) if you want specific entity

### get_entities_by_type


Expand Down Expand Up @@ -1167,6 +1179,38 @@ Activate custom variables for y coordinate limit for hundun and spawn of it's he
note: because those variables are custom and game does not initiate them, you need to do it yourself for each [Hundun](#Hundun) entity, recommending set_post_entity_spawn
default game value are: y_limit = 98.5, rising_speed_x = 0, rising_speed_y = 0.0125, bird_head_spawn_y = 55, snake_head_spawn_y = 71

### add_custom_type


> Search script examples for [add_custom_type](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=add_custom_type)
#### [ENT_TYPE](#ENT_TYPE) add_custom_type(array<[ENT_TYPE](#ENT_TYPE)> types)

#### [ENT_TYPE](#ENT_TYPE) add_custom_type()

Adds new custom type (group of ENT_TYPE) that can be later used in functions like get_entities_by or set_(pre/post)_entity_spawn
Use empty array or no parameter to get new uniqe [ENT_TYPE](#ENT_TYPE) that can be used for custom [EntityDB](#EntityDB)

### add_money


> Search script examples for [add_money](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=add_money)
#### int add_money(int amount, optional<int> display_time)

Adds money to the state.money_shop_total and displays the effect on the HUD for money change
Can be negative, default display_time = 60 (about 2s). Returns the current money after the transaction

### add_money_slot


> Search script examples for [add_money_slot](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=add_money_slot)
#### int add_money_slot(int amount, int player_slot, optional<int> display_time)

Adds money to the state.items.player_inventory[player_slot].money and displays the effect on the HUD for money change
Can be negative, default display_time = 60 (about 2s). Returns the current money after the transaction

### change_poison_timer


Expand Down Expand Up @@ -1307,6 +1351,16 @@ Get the current adventure seed pair

Same as `Player.get_heart_color`

### get_current_money


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

Just convenient way of getting the current amount of money
short for state->money_shop_total + loop[inventory.money + inventory.collected_money_total]

### get_frame


Expand Down Expand Up @@ -1334,6 +1388,14 @@ Get engine target frametime (1/framerate, default 1/60).

Get engine target frametime when game is unfocused (1/framerate, default 1/33).

### get_hud


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


### get_id


Expand Down
19 changes: 14 additions & 5 deletions docs/src/includes/_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,10 @@ float | [spawn_y](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=spawn
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) |
custom_array&lt;[Vec2](#Vec2)&gt; | [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) |
array&lt;[ThemeInfo](#ThemeInfo), 18&gt; | [themes](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=themes) |
int | [flags](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=flags) |
int | [flags2](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=flags2) |
int | [flags3](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=flags3) |

## Lighting types

Expand Down Expand Up @@ -2620,8 +2623,8 @@ Type | Name | Description
---- | ---- | -----------
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) |
array&lt;float, 38&gt; | [left_channel](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=left_channel) |
array&lt;float, 38&gt; | [right_channel](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=right_channel) |
array&lt;float, 38&gt; | [left_channel](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=left_channel) | Use [VANILLA_SOUND_PARAM](#VANILLA_SOUND_PARAM) as index, warning: special case with first index at 0, loop using pairs will get you all results but the key/index will be wrong, ipairs will have correct key/index but will skip the first element
array&lt;float, 38&gt; | [right_channel](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=right_channel) | Use [VANILLA_SOUND_PARAM](#VANILLA_SOUND_PARAM) as index warning: special case with first index at 0, loop using pairs will get you all results but the key/index will be wrong, ipairs will have correct key/index but will skip the first element
bool | [start_over](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=start_over) | when false, current track starts from the beginning, is immediately set back to true
bool | [playing](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=playing) | set to false to turn off

Expand Down Expand Up @@ -2679,6 +2682,7 @@ Type | Name | Description
[PauseUI](#PauseUI) | [pause_ui](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=pause_ui) |
[JournalUI](#JournalUI) | [journal_ui](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=journal_ui) |
[SaveRelated](#SaveRelated) | [save_related](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=save_related) |
[BackgroundSound](#BackgroundSound) | [main_menu_music](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=main_menu_music) |

### GameProps

Expand All @@ -2700,8 +2704,9 @@ array&lt;[ENT_TYPE](#ENT_TYPE), 4&gt; | [saved_pets](https://github.com/spelunky
array&lt;bool, 4&gt; | [is_pet_cursed](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=is_pet_cursed) |
array&lt;bool, 4&gt; | [is_pet_poisoned](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=is_pet_poisoned) |
int | [leader](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=leader) | Index of leader player in coop
array&lt;[Inventory](#Inventory), MAX_PLAYERS&gt; | [player_inventory](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=player_inventory) |
array&lt;[SelectPlayerSlot](#SelectPlayerSlot), MAX_PLAYERS&gt; | [player_select](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=player_select) |
array&lt;[Inventory](#Inventory), MAX_PLAYERS&gt; | [player_inventory](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=player_inventory) |
array&lt;[Player](#Player), MAX_PLAYERS&gt; | [players](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=players) | Table of players, also keeps the dead body until they are destroyed (necromancer revive also destroys the old body)

### JournalProgressStainSlot

Expand Down Expand Up @@ -4001,6 +4006,10 @@ nil | [set_invisible(bool value)](https://github.com/spelunky-fyi/overlunky/sear
array&lt;int&gt; | [get_items()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_items) |
bool | [is_in_liquid()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=is_in_liquid) | Returns true if entity is in water/lava
bool | [is_cursed()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=is_cursed) |
nil | [kill_recursive(bool destroy_corpse, Entity responsible, optional<int> mask, const array<ENT_TYPE> ent_types, RECURSIVE_MODE rec_mode)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=kill_recursive) | Kill entity along with all entities attached to it. Be aware that for example killing push block with this function will also kill anything on top of it, any items, players, monsters etc.<br/>To a that, you can inclusively or exclusively limit certain [MASK](#MASK) and [ENT_TYPE](#ENT_TYPE). Note: the function will first check mask, if the entity doesn't match, it will look in the provided [ENT_TYPE](#ENT_TYPE)'s<br/>destroy_corpse and responsible are the standard parameters for the kill funciton
nil | [kill_recursive(bool destroy_corpse, Entity responsible)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=kill_recursive) | Short for using [RECURSIVE_MODE](#RECURSIVE_MODE).NONE
nil | [destroy_recursive(optional<int> mask, const array<ENT_TYPE> ent_types, RECURSIVE_MODE rec_mode)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=destroy_recursive) | Destroy entity along with all entities attached to it. Be aware that for example destroying push block with this function will also destroy anything on top of it, any items, players, monsters etc.<br/>To a that, you can inclusively or exclusively limit certain [MASK](#MASK) and [ENT_TYPE](#ENT_TYPE). Note: the function will first check the mask, if the entity doesn't match, it will look in the provided [ENT_TYPE](#ENT_TYPE)'s
nil | [destroy_recursive()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=destroy_recursive) | Short for using [RECURSIVE_MODE](#RECURSIVE_MODE).NONE
[CallbackId](#Aliases) | [set_pre_virtual(ENTITY_OVERRIDE entry, function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_virtual) | Hooks before the virtual function at index `entry`.
[CallbackId](#Aliases) | [set_post_virtual(ENTITY_OVERRIDE entry, function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_virtual) | Hooks after the virtual function at index `entry`.
nil | [clear_virtual(CallbackId callback_id)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=clear_virtual) | Clears the hook given by `callback_id`, alternatively use `clear_callback()` inside the hook.
Expand Down Expand Up @@ -5882,7 +5891,7 @@ Type | Name | Description
[SoundMeta](#SoundMeta) | [sound1](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=sound1) |
[SoundMeta](#SoundMeta) | [sound2](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=sound2) |
[Entity](#Entity) | [top_chain_piece](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=top_chain_piece) |
nil | [trigger()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=trigger) |
nil | [trigger(optional<bool> play_sound_effect)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=trigger) |

### DummyPurchasableEntity

Expand Down
Loading

0 comments on commit 7080921

Please sign in to comment.