Skip to content

Commit

Permalink
fix floor spreading again, and one rando crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Dregu committed Feb 25, 2024
1 parent dd5ec74 commit 8c6c3bc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
15 changes: 13 additions & 2 deletions examples/randomizer2.lua
Original file line number Diff line number Diff line change
@@ -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]]
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/game_api/spawn_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 8c6c3bc

Please sign in to comment.