Skip to content

Commit

Permalink
increase the upper limit for fix_liquid_out_of_bounds, update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Auto committed Sep 24, 2023
1 parent 328b443 commit b4f9712
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 10 deletions.
46 changes: 43 additions & 3 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/src/includes/_casting.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ For reference, the available `as_<typename>` functions are listed below:
- as_crittersnail
- as_crocman
- as_crossbeam
- as_crushelevator
- as_crushtrap
- as_cursedeffect
- as_cursedpot
Expand Down
74 changes: 74 additions & 0 deletions docs/src/includes/_globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,16 @@ Poisons entity, to cure poison set [Movable](#Movable).`poison_tick_timer` to -1
Changes a particular drop, e.g. what Van Horsing throws at you (use e.g. replace_drop([DROP](#DROP).VAN_HORSING_DIAMOND, [ENT_TYPE](#ENT_TYPE).ITEM_PLASMACANNON))
Use `0` as type to reset this drop to default, use `-1` as drop_id to reset all to default

### set_boss_door_control_enabled


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

Allows you to disable the control over the door for [Hundun](#Hundun) and [Tiamat](#Tiamat)
This will also prevent game crashing when there is no exit door when they are in level

### set_contents


Expand Down Expand Up @@ -874,6 +884,14 @@ If you set a Kapala treshold greater than 7, make sure to set the hud icon in th

Sets the maximum length of a thrown rope (anchor segment not included). Unfortunately, setting this higher than default (6) creates visual glitches in the rope, even though it is fully functional.

### set_olmec_cutscene_enabled


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


### set_olmec_phase_y_level


Expand Down Expand Up @@ -1117,6 +1135,28 @@ Returns true if the nth bit is set in the number.
## Generic functions


### activate_crush_elevator_hack


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

Activate custom variables for speed and y coordinate limit for crushing elevator
note: because those variables are custom and game does not initiate them, you need to do it yourself for each [CrushElevator](#CrushElevator) entity, recommending `set_post_entity_spawn`
default game values are: speed = 0.0125, y_limit = 98.5

### activate_hundun_hack


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

Activate custom variables for y coordinate limit for hundun and spawn of it's heads
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 is: y_limit = 98.5, bird_head_spawn_y = 55, snake_head_spawn_y = 71

### change_poison_timer


Expand Down Expand Up @@ -1634,6 +1674,16 @@ end, "waddler")

Set layer to search for storage items on

### set_tiamat_cutscene_enabled


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

[Tiamat](#Tiamat) cutscene is also responsible for locking the exit door
So you may need to close it yourself if you still want to be required to kill [Tiamat](#Tiamat)

### show_journal


Expand Down Expand Up @@ -2103,6 +2153,30 @@ Renders the particles to the screen. Only used with screen particle emitters. Se
## Position functions


### activate_tiamat_position_hack


```lua
activate_tiamat_position_hack(true);

set_post_entity_spawn(function(ent)

-- make them same as in the game, but relative to the tiamat entity
ent.attack_x = ent.x - 1
ent.attack_y = ent.y + 2

end, SPAWN_TYPE.ANY, 0, ENT_TYPE.MONS_TIAMAT)
```


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

Activate custom variables for position used for detecting the player (normally hardcoded)
note: because those variables are custom and game does not initiate them, you need to do it yourself for each [Tiamat](#Tiamat) entity, recommending `set_post_entity_spawn`
default game values are: attack_x = 17.5 attack_y = 62.5

### distance


Expand Down
21 changes: 18 additions & 3 deletions docs/src/includes/_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -4548,12 +4548,15 @@ float | [applied_hor_velocity](https://github.com/spelunky-fyi/overlunky/search?
float | [applied_ver_velocity](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=applied_ver_velocity) |
int | [birdhead_entity_uid](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=birdhead_entity_uid) |
int | [snakehead_entity_uid](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=snakehead_entity_uid) |
float | [y_level](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=y_level) |
float | [y_level](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=y_level) | current floor level
int | [bounce_timer](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=bounce_timer) |
int | [fireball_timer](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=fireball_timer) |
bool | [birdhead_defeated](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=birdhead_defeated) |
bool | [snakehead_defeated](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=snakehead_defeated) |
int | [hundun_flags](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=hundun_flags) | 1: Will move to the left, 2: Birdhead emerged, 3: Snakehead emerged, 4: Top level arena reached, 5: Birdhead shot last - to alternate the heads shooting fireballs
float | [y_limit](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=y_limit) | This is custom variable, you need [activate_hundun_hack](#activate_hundun_hack) to use it
float | [bird_head_spawn_y](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=bird_head_spawn_y) | This is custom variable, you need [activate_hundun_hack](#activate_hundun_hack) to use it
float | [snake_head_spawn_y](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=snake_head_spawn_y) | This is custom variable, you need [activate_hundun_hack](#activate_hundun_hack) to use it

### HundunHead

Expand Down Expand Up @@ -5104,6 +5107,8 @@ float | [tail_angle](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=ta
float | [tail_radian](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=tail_radian) |
float | [tail_move_speed](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=tail_move_speed) |
float | [right_arm_angle](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=right_arm_angle) |
float | [attack_x](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=attack_x) | This is custom variable, you need [activate_tiamat_position_hack](#activate_tiamat_position_hack) to use it
float | [attack_y](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=attack_y) | This is custom variable, you need [activate_tiamat_position_hack](#activate_tiamat_position_hack) to use it

### Tun

Expand Down Expand Up @@ -5542,6 +5547,16 @@ Type | Name | Description
[ParticleEmitterInfo](#ParticleEmitterInfo) | [particles_warp](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=particles_warp) |
[SoundMeta](#SoundMeta) | [sound](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=sound) |

### CrushElevator

Derived from [Entity](#Entity) [Movable](#Movable)


Type | Name | Description
---- | ---- | -----------
float | [y_limit](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=y_limit) | This is custom variable, you need [activate_crush_elevator_hack](#activate_crush_elevator_hack) to use it
float | [speed](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=speed) | This is custom variable, you need [activate_crush_elevator_hack](#activate_crush_elevator_hack) to use it

### Crushtrap

Derived from [Entity](#Entity) [Movable](#Movable)
Expand Down Expand Up @@ -6671,8 +6686,8 @@ float | [size](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=size) |
float | [size_multiply](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=size_multiply) | 0.0 when not on screen
float | [next_size](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=next_size) | width and height will be set to `next_size size_multiply` next frame
int | [size_change_timer](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=size_change_timer) | very short timer before next size change, giving a pulsing effect
float | [speed](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=speed) | This is cusome variable, you need [activate_sparktraps_hack](#activate_sparktraps_hack) to use it
float | [distance](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=distance) | This is cusome variable, you need [activate_sparktraps_hack](#activate_sparktraps_hack) to use it
float | [speed](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=speed) | This is custom variable, you need [activate_sparktraps_hack](#activate_sparktraps_hack) to use it
float | [distance](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=distance) | This is custom variable, you need [activate_sparktraps_hack](#activate_sparktraps_hack) to use it

### Spear

Expand Down
8 changes: 4 additions & 4 deletions src/game_api/state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ void fix_liquid_out_of_bounds()
for (uint32_t i = 0; i < it.physics_engine->entity_count; ++i)
{
auto liquid_coordinates = it.physics_engine->entity_coordinates + i;
if (liquid_coordinates->second < 0 // y < 0
|| liquid_coordinates->first < 0 // x < 0
|| liquid_coordinates->first > g_level_max_x // x > g_level_max_x
|| liquid_coordinates->second > g_level_max_y) // y > g_level_max_y
if (liquid_coordinates->second < 0 // y < 0
|| liquid_coordinates->first < 0 // x < 0
|| liquid_coordinates->first > g_level_max_x // x > g_level_max_x
|| liquid_coordinates->second > g_level_max_y + 16) // y > g_level_max_y
{
if (!*(it.physics_engine->unknown61 + i)) // just some bs
continue;
Expand Down

0 comments on commit b4f9712

Please sign in to comment.