diff --git a/docs/game_data/spel2.lua b/docs/game_data/spel2.lua index df80f26f8..69d8acd54 100644 --- a/docs/game_data/spel2.lua +++ b/docs/game_data/spel2.lua @@ -1167,6 +1167,37 @@ function list_char_mods() end ---@param index integer ---@return AABB function get_hud_position(index) end +---@param enable boolean +---@return nil +function set_olmec_cutscene_enabled(enable) end +---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 +---@param enable boolean +---@return nil +function set_tiamat_cutscene_enabled(enable) end +---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 entity, recommending `set_post_entity_spawn` +---default game values are: attack_x = 17.5 attack_y = 62.5 +---@param activate boolean +---@return nil +function activate_tiamat_position_hack(activate) end +---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 entity, recommending `set_post_entity_spawn` +---default game values are: speed = 0.0125, y_limit = 98.5 +---@param activate boolean +---@return nil +function activate_crush_elevator_hack(activate) end +---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 entity, recommending `set_post_entity_spawn` +---default game value is: y_limit = 98.5, bird_head_spawn_y = 55, snake_head_spawn_y = 71 +---@param activate boolean +---@return nil +function activate_hundun_hack(activate) end +---Allows you to disable the control over the door for Hundun and Tiamat +---This will also prevent game crashing when there is no exit door when they are in level +---@param enable boolean +---@return nil +function set_boss_door_control_enabled(enable) end ---@return boolean function toast_visible() end ---@return boolean @@ -2699,6 +2730,10 @@ function Movable:generic_update_world(move, sprint_factor, disable_gravity, on_r ---@class TimedPowderkeg : PushBlock ---@field timer integer @timer till explosion, -1 = pause, counts down +---@class CrushElevator : Movable + ---@field y_limit number @This is custom variable, you need [activate_crush_elevator_hack](#activate_crush_elevator_hack) to use it + ---@field speed number @This is custom variable, you need [activate_crush_elevator_hack](#activate_crush_elevator_hack) to use it + ---@class Mount : PowerupCapable ---@field rider_uid integer ---@field sound SoundMeta @@ -3112,6 +3147,8 @@ function Movable:generic_update_world(move, sprint_factor, disable_gravity, on_r ---@field tail_radian number ---@field tail_move_speed number ---@field right_arm_angle number + ---@field attack_x number @This is custom variable, you need [activate_tiamat_position_hack](#activate_tiamat_position_hack) to use it + ---@field attack_y number @This is custom variable, you need [activate_tiamat_position_hack](#activate_tiamat_position_hack) to use it ---@class GiantFrog : Monster ---@field door_front_layer Entity @@ -3177,12 +3214,15 @@ function Movable:generic_update_world(move, sprint_factor, disable_gravity, on_r ---@field applied_ver_velocity number ---@field birdhead_entity_uid integer ---@field snakehead_entity_uid integer - ---@field y_level number + ---@field y_level number @current floor level ---@field bounce_timer integer ---@field fireball_timer integer ---@field birdhead_defeated boolean ---@field snakehead_defeated boolean ---@field hundun_flags integer @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 + ---@field y_limit number @This is custom variable, you need [activate_hundun_hack](#activate_hundun_hack) to use it + ---@field bird_head_spawn_y number @This is custom variable, you need [activate_hundun_hack](#activate_hundun_hack) to use it + ---@field snake_head_spawn_y number @This is custom variable, you need [activate_hundun_hack](#activate_hundun_hack) to use it ---@class HundunHead : Monster ---@field attack_position_x number @Posiotion where the head will move on attack @@ -3425,8 +3465,8 @@ function Movable:generic_update_world(move, sprint_factor, disable_gravity, on_r ---@field size_multiply number @0.0 when not on screen ---@field next_size number @width and height will be set to `next_size size_multiply` next frame ---@field size_change_timer integer @very short timer before next size change, giving a pulsing effect - ---@field speed number @This is cusome variable, you need [activate_sparktraps_hack](#activate_sparktraps_hack) to use it - ---@field distance number @This is cusome variable, you need [activate_sparktraps_hack](#activate_sparktraps_hack) to use it + ---@field speed number @This is custom variable, you need [activate_sparktraps_hack](#activate_sparktraps_hack) to use it + ---@field distance number @This is custom variable, you need [activate_sparktraps_hack](#activate_sparktraps_hack) to use it ---@class TiamatShot : LightEmitter ---@field sound SoundMeta diff --git a/docs/src/includes/_casting.md b/docs/src/includes/_casting.md index 044191d2c..4510c3e12 100644 --- a/docs/src/includes/_casting.md +++ b/docs/src/includes/_casting.md @@ -83,6 +83,7 @@ For reference, the available `as_` functions are listed below: - as_crittersnail - as_crocman - as_crossbeam +- as_crushelevator - as_crushtrap - as_cursedeffect - as_cursedpot diff --git a/docs/src/includes/_globals.md b/docs/src/includes/_globals.md index 8f97e451a..bf9d51d61 100644 --- a/docs/src/includes/_globals.md +++ b/docs/src/includes/_globals.md @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/docs/src/includes/_types.md b/docs/src/includes/_types.md index 86f4bc148..0bc7bc56d 100644 --- a/docs/src/includes/_types.md +++ b/docs/src/includes/_types.md @@ -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 @@ -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 @@ -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) @@ -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 diff --git a/src/game_api/state.cpp b/src/game_api/state.cpp index 876e8f594..3d773134c 100644 --- a/src/game_api/state.cpp +++ b/src/game_api/state.cpp @@ -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;