From 0370d64b3bd7914be55358817e52bbc8a529a7d3 Mon Sep 17 00:00:00 2001 From: Alexander M Pickering Date: Tue, 21 Jan 2025 16:02:51 -0600 Subject: work --- src/prefab/hall.moon | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/prefab/hall.moon (limited to 'src/prefab/hall.moon') diff --git a/src/prefab/hall.moon b/src/prefab/hall.moon new file mode 100644 index 0000000..59dbea0 --- /dev/null +++ b/src/prefab/hall.moon @@ -0,0 +1,21 @@ +util = require("util") + +-- Halls run from one point to another, the start and end points are in the +-- middle of the hallway. +-- "floor_gen" can be a string (the sprites texture to use)a +-- or a function (passed the "Hall" object to generate the texture for that segment. +class Hall + new: (tbl) => + util.typecheck(tbl, + "startx", "number", + "starty", "number", + "endx", "number", + "endy", "number", + "width", "number" + ) + assert(tbl.floor_gen, "Hall requires a 'floor_gen' attribute") + if type(tbl.floor_gen) == "function" + @floor_gen = tbl.floor_gen + elseif type(tbl.floor_gen) == "string" + @floor_gen = () => + tbl.floor_gen -- cgit v1.2.3-70-g09d2