spelunky-fyi / overlunky

An overlay for Spelunky 2 to help you with modding, exploring the depths of the game and practicing with tools like spawning arbitrary items, warping to levels and teleporting.
MIT License
86 stars 32 forks source link

Populate and expose object for volcana magmaman spawning logic's data. #320

Closed jaythebusinessgoose closed 1 year ago

Dregu commented 1 year ago

Hmm if I add some lava in dwelling and then call spawn_effects from volcana to start the magmaman logic, it works great and the current lava tiles are added to magmaman_positions automatically, but if I start the logic first, then spawn some lava and add the MagmamanSpawnPositions manually, the game crashes when I unload the level.

Dregu commented 1 year ago

So this would also benefit from a MagmamanSpawnPosition(x, y) constructor that sets the timer to a random number using whatever limits and prng the game uses, or maybe even a function to create and add a spawn position to the vector and start the logic automatically in different themes.

Dregu commented 1 year ago

We don't currently have another way to start this logic anywhere, but this works

if not state.logic.magmaman_spawn then
  state.level_gen.themes[THEME.VOLCANA]:spawn_effects()
end
local x, y = math.floor(state.level_gen.spawn_x), math.floor(state.level_gen.spawn_y)
spawn_liquid(ENT_TYPE.LIQUID_LAVA, x, y)
table.insert(state.logic.magmaman_spawn.magmaman_positions, MagmamanSpawnPosition:new(x, y))
Mr-Auto commented 1 year ago

Does table.remove also work?

Dregu commented 1 year ago

Oh yeah or clearing the whole table to stop the spawns.