diff --git a/kingdoms_meta/init.lua b/kingdoms_meta/init.lua index 9b7cf6a..0cc467c 100644 --- a/kingdoms_meta/init.lua +++ b/kingdoms_meta/init.lua @@ -12,8 +12,10 @@ end domodfile("config.lua") local mod_ready_registry = {} +local has_loaded = {} function kingdoms.mod_ready(mod) + has_loaded[mod] = true if mod_ready_registry[mod] then for _,f in ipairs(mod_ready_registry[mod]) do if f.params then @@ -26,6 +28,9 @@ function kingdoms.mod_ready(mod) end function kingdoms.at_mod_load(mod, func, ...) + if has_loaded[mod] then + return func(...) + end mod_ready_registry[mod] = mod_ready_registry[mod] or {} table.insert(mod_ready_registry[mod], { func = func, diff --git a/magic/init.lua b/magic/init.lua index 0fd5b70..b03e391 100644 --- a/magic/init.lua +++ b/magic/init.lua @@ -31,5 +31,9 @@ domodfile("spells/attack.lua") domodfile("spells/defense.lua") domodfile("spells/teleportation.lua") +if rawget(_G, "ancient_world") then + domodfile("structures.lua") +end + magic.log("action", "Loaded.") kingdoms.mod_ready("magic") diff --git a/magic/schematics/magic_hovel_1.mts b/magic/schematics/magic_hovel_1.mts new file mode 100644 index 0000000..03a178a Binary files /dev/null and b/magic/schematics/magic_hovel_1.mts differ diff --git a/magic/schematics/magic_hovel_2.mts b/magic/schematics/magic_hovel_2.mts new file mode 100644 index 0000000..e317c83 Binary files /dev/null and b/magic/schematics/magic_hovel_2.mts differ diff --git a/magic/schematics/underground_lab_1.mts b/magic/schematics/underground_lab_1.mts new file mode 100644 index 0000000..2f431eb Binary files /dev/null and b/magic/schematics/underground_lab_1.mts differ diff --git a/magic/structures.lua b/magic/structures.lua new file mode 100644 index 0000000..f0a09ad --- /dev/null +++ b/magic/structures.lua @@ -0,0 +1,47 @@ +ancient_world.register("magic:magic_hovel_1", { + schematic = minetest.get_modpath("magic") .. "/schematics/magic_hovel_1.mts", + type = "decoration", + limit_y = { + max = -1024, + min = -31000, + }, + on = {"default:stone"}, + random_replacements = { + ["ancient_world:placeholder_1"] = {"magic:nightcall", "magic:daypull"}, + }, +}) + +ancient_world.register("magic:magic_hovel_2", { + schematic = minetest.get_modpath("magic") .. "/schematics/magic_hovel_2.mts", + type = "decoration", + on = {"default:dirt_with_grass"}, + offset = { + x = 0, + y = -3, + z = 0, + }, + random_replacements = { + ["ancient_world:placeholder_1"] = true, + }, +}) + +ancient_world.register("magic:underground_lab_1", { + schematic = minetest.get_modpath("magic") .. "/schematics/underground_lab_1.mts", + type = "decoration", + limit_y = { + max = -512, + min = -31000, + }, + offset = { + x = 0, + y = -16, + z = 0, + }, + on = {"default:stone"}, + replacements = { + ["ancient_world:placeholder_2"] = "air", + }, + random_replacements = { + ["ancient_world:placeholder_1"] = true, + }, +})