Skip to content
Snippets Groups Projects
Commit fbd3c309 authored by Hachem_Muche's avatar Hachem_Muche
Browse files

Octopus map generator: Updates the room_map appropriately. Added some code...

Octopus map generator: Updates the room_map appropriately.  Added some code comments re: parameters.
ToME: Updated room_map info for Grid tooltips.
parent a3b1c313
No related branches found
No related tags found
No related merge requests found
......@@ -24,16 +24,17 @@ require "engine.generator.map.Roomer"
--- @classmod engine.generator.map.Octopus
module(..., package.seeall, class.inherit(engine.generator.map.Roomer))
-- Creates a space (Pod room) at center of map, with a number of 'arms' (Pod rooms) around it connected by tunnels
function _M:init(zone, map, level, data)
engine.generator.map.Roomer.init(self, zone, map, level, data)
self.spots = {}
self.nb_rooms = data.nb_rooms or {5, 10}
self.nb_rooms = data.nb_rooms or {5, 10} -- number of Pod rooms around center
self.base_breakpoint = data.base_breakpoint or 0.4
self.arms_range = data.arms_range or {0.5, 0.7}
self.arms_radius = data.arms_radius or {0.2, 0.3}
self.main_radius = data.main_radius or {0.3, 0.5}
self.arms_range = data.arms_range or {0.5, 0.7} -- fraction dist from map center to map edge for each Pod room
self.arms_radius = data.arms_radius or {0.2, 0.3} -- *(map.w + map.h)/4 ==> radius of each Pod room
self.main_radius = data.main_radius or {0.3, 0.5} -- *(map.w + map.h)/4 ==> radius of Pod at map center
self.noise = data.noise or "fbm_perlin"
self.zoom = data.zoom or 5
......@@ -48,15 +49,16 @@ function _M:generate(lev, old_lev)
end end
local spots = self.spots
local rooms = {}
self.map.room_map.rooms = rooms
-- Main center room
local cx, cy = math.floor(self.map.w / 2), math.floor(self.map.h / 2)
self:makePod(cx, cy, rng.float(self.main_radius[1], self.main_radius[2]) * ((self.map.w / 2) + (self.map.h / 2)) / 2, 1, self)
rooms[#rooms+1] = self:makePod(cx, cy, rng.float(self.main_radius[1], self.main_radius[2]) * ((self.map.w / 2) + (self.map.h / 2)) / 2, 1, self)
spots[#spots+1] = {x=cx, y=cy, type="room", subtype="main"}
-- Rooms around it
local nb_rooms = rng.range(self.nb_rooms[1], self.nb_rooms[2])
local rooms = {}
for i = 0, nb_rooms - 1 do
local angle = math.rad(i * 360 / nb_rooms)
......
......@@ -222,8 +222,9 @@ function _M:tooltip(x, y)
-- debugging info
if game.level.map.room_map then
local data = game.level.map.room_map[x][y]
local room = table.get(game.level.map.room_map.rooms, data.room, "room")
tstr:add(true, {"color", "PINK"}, ("room_map: rm:%s(%s), spec:%s, c/o:%s, bor:%s, tun:%s, rtun:%s"):format(data.room, room and room.name, data.special, data.can_open, data.border, data.tunnel, data.real_tunnel))
local room_base = table.get(game.level.map.room_map.rooms, data.room)
local room = room_base and room_base.room
tstr:add(true, {"color", "PINK"}, ("room_map:rm:%s(id:%s,name:%s), spec:%s, c/o:%s, bor:%s, tun:%s, rtun:%s"):format(data.room, room_base and room_base.id, room and room.name, data.special, data.can_open, data.border, data.tunnel, data.real_tunnel))
end
local attrs = game.level.map.attrs[x+y*game.level.map.w]
if attrs then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment