From 8c6c3bc08288eb428291059937a265b87f29e905 Mon Sep 17 00:00:00 2001 From: Dregu Date: Sun, 25 Feb 2024 03:44:15 +0200 Subject: [PATCH] fix floor spreading again, and one rando crash --- examples/randomizer2.lua | 15 +++++++++++++-- src/game_api/spawn_api.cpp | 4 +++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/examples/randomizer2.lua b/examples/randomizer2.lua index 656e49892..b31351eef 100644 --- a/examples/randomizer2.lua +++ b/examples/randomizer2.lua @@ -1,6 +1,6 @@ meta.name = "Randomizer Two" meta.description = [[Unless some horrible game breaking glitches emerge, this is the final version of Randomizer. I have tried to make it more chaotic, more balanced, easier, harder, shorter, longer, but the main problem seems to be any changes to anything. Just disable the settings you don't like or unsubscribe.]] -meta.version = "2.9z" +meta.version = "2.9zz" meta.author = "Dregu" --[[OPTIONS]] @@ -2021,7 +2021,18 @@ set_post_entity_spawn(function(ent) ent.level = 1 ent.world = 1 ent.theme = 1 -end, SPAWN_TYPE.SYSTEMIC, 0, ENT_TYPE.LOGICAL_PORTAL) + if state.theme == THEME.TIAMAT then + ent:set_post_update_state_machine(function(ent) + if ent.timer > 240 then + spawn_critical(ENT_TYPE.FX_MODERNEXPLOSION, ent.x, ent.y, ent.layer, 0, 0) + for _,v in pairs(get_entities_by_type(ENT_TYPE.FX_PORTAL)) do + get_entity(v):destroy() + end + ent:destroy() + end + end) + end +end, SPAWN_TYPE.ANY, 0, ENT_TYPE.LOGICAL_PORTAL) set_post_entity_spawn(function(ent) if prng:random() < options.pot_chance/100 then diff --git a/src/game_api/spawn_api.cpp b/src/game_api/spawn_api.cpp index dae2e2297..63f7e06b2 100644 --- a/src/game_api/spawn_api.cpp +++ b/src/game_api/spawn_api.cpp @@ -621,9 +621,11 @@ Entity* spawn_entity(EntityFactory* entity_factory, std::uint32_t entity_type, f // TODO: This still might not work very well and corner fill isn't actually floor spreading per level config definition, and should have a different SPAWN_TYPE (corner fill still happens when floor spreading chance is set to 0) // const auto theme_floor = State::get().ptr_local()->current_theme->get_floor_spreading_type(); // const auto theme_floor2 = State::get().ptr_local()->current_theme->get_floor_spreading_type2(); + static const auto border_octo = to_id("ENT_TYPE_FLOOR_BORDERTILE_OCTOPUS"); + static const auto border_dust = to_id("ENT_TYPE_FLOOR_DUSTWALL"); const bool is_decorated = (entity_factory->types[entity_type].properties_flags & 0x1) == 0x1; const bool is_styled = (entity_factory->types[entity_type].properties_flags & 0x2) == 0x2; - const bool is_border = entity_type < 4; + const bool is_border = entity_type <= border_octo || entity_type == border_dust; const bool is_floor_spreading = (is_decorated || is_styled) && !is_border && (g_SpawnTypeFlags & SPAWN_TYPE_LEVEL_GEN) && !(g_SpawnTypeFlags & SPAWN_TYPE_LEVEL_GEN_TILE_CODE); if (is_floor_spreading) {