Skip to content

Commit

Permalink
do stuff, break some probably
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Auto committed Oct 4, 2023
1 parent 06e6467 commit aa3da51
Show file tree
Hide file tree
Showing 7 changed files with 204 additions and 197 deletions.
238 changes: 119 additions & 119 deletions docs/game_data/spel2.lua

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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<",
Expand All @@ -40,7 +40,7 @@
"constexpr": "",
"const ": "",
"static": "",
"variadic_args va": "int, int...",
"variadic_args va": "ENT_TYPE, ENT_TYPE...",
"EmittedParticlesInfo": "array<Particle>",
"ImVec2": "Vec2",
"SoundCallbackFunction": "function",
Expand Down
7 changes: 4 additions & 3 deletions docs/parse_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand All @@ -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})"
Expand Down
46 changes: 23 additions & 23 deletions docs/src/includes/_globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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:<br/>
{ITEM_PICKUP_COMPASS, ITEM_CHEST, ITEM_KEY}<br/>
Expand Down Expand Up @@ -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&lt;int&gt; entity_get_items_by(int uid, array<[ENT_TYPE](#ENT_TYPE)> entity_types, int mask)
#### vector&lt;int&gt; entity_get_items_by(int uid, vector<[ENT_TYPE](#ENT_TYPE)> entity_types, int mask)

#### array&lt;int&gt; entity_get_items_by(int uid, [ENT_TYPE](#ENT_TYPE) entity_type, int mask)
#### vector&lt;int&gt; 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.

Expand All @@ -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)

Expand Down Expand Up @@ -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&lt;int&gt; filter_entities(array<int> entities, function predicate)
#### vector&lt;int&gt; filter_entities(vector<int> entities, function predicate)

Returns a list of all uids in `entities` for which `predicate(get_entity(uid))` returns true

Expand Down Expand Up @@ -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&lt;int&gt; get_entities_at(array<[ENT_TYPE](#ENT_TYPE)> entity_types, int mask, float x, float y, [LAYER](#LAYER) layer, float radius)
#### vector&lt;int&gt; get_entities_at(vector<[ENT_TYPE](#ENT_TYPE)> entity_types, int mask, float x, float y, [LAYER](#LAYER) layer, float radius)

#### array&lt;int&gt; get_entities_at([ENT_TYPE](#ENT_TYPE) entity_type, int mask, float x, float y, [LAYER](#LAYER) layer, float radius)
#### vector&lt;int&gt; 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
Expand All @@ -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&lt;int&gt; get_entities_by(array<[ENT_TYPE](#ENT_TYPE)> entity_types, int mask, [LAYER](#LAYER) layer)
#### vector&lt;int&gt; get_entities_by(vector<[ENT_TYPE](#ENT_TYPE)> entity_types, int mask, [LAYER](#LAYER) layer)

#### array&lt;int&gt; get_entities_by([ENT_TYPE](#ENT_TYPE) entity_type, int mask, [LAYER](#LAYER) layer)
#### vector&lt;int&gt; 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
Expand All @@ -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&lt;int&gt; get_entities_by_type(int, int...)
#### vector&lt;int&gt; 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!
Expand All @@ -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&lt;int&gt; get_entities_overlapping_hitbox(array<[ENT_TYPE](#ENT_TYPE)> entity_types, int mask, [AABB](#AABB) hitbox, [LAYER](#LAYER) layer)
#### vector&lt;int&gt; get_entities_overlapping_hitbox(vector<[ENT_TYPE](#ENT_TYPE)> entity_types, int mask, [AABB](#AABB) hitbox, [LAYER](#LAYER) layer)

#### array&lt;int&gt; get_entities_overlapping_hitbox([ENT_TYPE](#ENT_TYPE) entity_type, int mask, [AABB](#AABB) hitbox, [LAYER](#LAYER) layer)
#### vector&lt;int&gt; 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

Expand Down Expand Up @@ -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:<br/>
{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,
Expand Down Expand Up @@ -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:<br/>
{MONS_BAT, MONS_BEE, MONS_SPIDER, MONS_JIANGSHI, MONS_FEMALE_JIANGSHI, MONS_VAMPIRE}<br/>
Expand All @@ -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:<br/>
{MONS_WITCHDOCTOR, MONS_VAMPIRE, MONS_SORCERESS, MONS_NECROMANCER}<br/>
Expand Down Expand Up @@ -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<int> read_prng()`<br/>
`vector<int> read_prng()`<br/>
Read the game prng state. Use [prng](#PRNG):get_pair() instead.

### force_dark_level
Expand All @@ -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&lt;int&gt; get_entities()
#### vector&lt;int&gt; get_entities()

Use `get_entities_by(0, MASK.ANY, LAYER.BOTH)` instead

Expand All @@ -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&lt;int&gt; get_entities_by_mask(int mask)
#### vector&lt;int&gt; get_entities_by_mask(int mask)

Use `get_entities_by(0, mask, LAYER.BOTH)` instead

Expand All @@ -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&lt;int&gt; get_entities_by_layer([LAYER](#LAYER) layer)
#### vector&lt;int&gt; get_entities_by_layer([LAYER](#LAYER) layer)

Use `get_entities_by(0, MASK.ANY, layer)` instead

Expand All @@ -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&lt;int&gt; get_entities_overlapping(array<[ENT_TYPE](#ENT_TYPE)> entity_types, int mask, float sx, float sy, float sx2, float sy2, [LAYER](#LAYER) layer)
#### vector&lt;int&gt; get_entities_overlapping(vector<[ENT_TYPE](#ENT_TYPE)> entity_types, int mask, float sx, float sy, float sx2, float sy2, [LAYER](#LAYER) layer)

#### array&lt;int&gt; get_entities_overlapping([ENT_TYPE](#ENT_TYPE) entity_type, int mask, float sx, float sy, float sx2, float sy2, [LAYER](#LAYER) layer)
#### vector&lt;int&gt; 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

Expand Down
Loading

0 comments on commit aa3da51

Please sign in to comment.