Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some random things that i can't think of single name for #342

Merged
merged 37 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
623e699
small `get_proper_types` optimisation
Mr-Auto Oct 6, 2023
04a75a2
change `custom_type_names` to vector, since we only iterate thru it
Mr-Auto Oct 6, 2023
ec00a21
add `add_custom_type` function for creating CUSTOM_TYPE
Mr-Auto Oct 6, 2023
a0dfec5
move entity lookups to a separate file to deuce the rpc size a bit
Mr-Auto Oct 6, 2023
5a08dbe
add `get_entities_by_draw_depth`
Mr-Auto Oct 7, 2023
fa792bc
add `kill_recursive` and `destroy_recursive`, update doc
Mr-Auto Oct 7, 2023
241198e
add special code for the mega jellyfish
Mr-Auto Oct 7, 2023
1410ab2
test code before pushing?
Mr-Auto Oct 7, 2023
120ad5f
make `kill_recursive` and `destroy_recursive` always affect the main …
Mr-Auto Oct 7, 2023
7d8b67e
merge main
Mr-Auto Oct 7, 2023
b60a026
update doc
Mr-Auto Oct 7, 2023
2b00768
add `get_current_money` and `add_money_hud` functions
Mr-Auto Oct 8, 2023
480881f
update doc
Mr-Auto Oct 8, 2023
7d33935
expose `get_hud`
Mr-Auto Oct 8, 2023
4f5649f
change the `add_money_hud`
Mr-Auto Oct 8, 2023
099d40b
support custom types in `kill_recursive` and `destroy_recursive`
Mr-Auto Oct 8, 2023
3a98f9c
add `enter_closed_door_crash`
Mr-Auto Oct 8, 2023
fea192f
expose `main_menu_music`, fix `LevelGenSystem` in doc
Mr-Auto Oct 8, 2023
ceaf70f
so, not needed anymore
Mr-Auto Oct 8, 2023
19a3a95
add info about the return of add_money
Mr-Auto Oct 8, 2023
e0cdc3c
fix `drill:trigger()` not making any noise and add optional bool for …
Mr-Auto Oct 9, 2023
2cf2582
add helper function `get_nop`
Mr-Auto Oct 9, 2023
f6d1b33
expose `items.players` (why not), also no need for `std::ref`
Mr-Auto Oct 10, 2023
de6f8ed
merge main
Mr-Auto Oct 11, 2023
e957c11
add rpc back
Mr-Auto Oct 11, 2023
2841c05
comm
Mr-Auto Oct 11, 2023
fdc09bb
merge main, again
Mr-Auto Oct 12, 2023
ac41ad0
a little bit screen stuff
Mr-Auto Oct 14, 2023
242c30c
expose sound channels params
Mr-Auto Oct 14, 2023
3eca33e
merge main
Mr-Auto Oct 14, 2023
9cd1bdf
update doc
Mr-Auto Oct 14, 2023
3559c03
this works, for me at leats
Mr-Auto Oct 14, 2023
2b79d82
just comment
Mr-Auto Oct 15, 2023
33db1fd
fix `vlad_flying` tilecode
Mr-Auto Oct 16, 2023
ac7cc6a
empty add_custom_type
Mr-Auto Oct 16, 2023
38dc6f7
acutally fix the `vlad_flying`
Mr-Auto Oct 16, 2023
741a732
`vampire_flying` the same thing
Mr-Auto Oct 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -588,6 +588,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 @@ -1158,6 +1170,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 @@ -1298,6 +1342,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 @@ -1325,6 +1379,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
Dregu marked this conversation as resolved.
Show resolved Hide resolved
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
Loading