SussyCraft/mods/amogus_generator/init.lua

561 lines
15 KiB
Lua
Raw Normal View History

2023-01-31 05:45:15 +01:00
minetest.register_alias("mapgen_stone", "amogus_blocks:stone")
minetest.register_alias("mapgen_dirt", "amogus_blocks:dirt")
minetest.register_alias("mapgen_water_source", "amogus_blocks:water_source")
minetest.register_alias("mapgen_river_water_source", "amogus_blocks:water_source")
-- I need to register alias of amogus_blocks:water that doesn't even exist in any of the mods to air because Minetest is f****d up and tries to use "water" by default
minetest.register_alias("amogus_blocks:water", "air")
2023-01-26 13:52:37 +01:00
minetest.register_biome({
name = "amogus_beach",
node_top = "amogus_blocks:sand",
depth_top = 1,
node_filler = "amogus_blocks:sand",
depth_filler = 3,
node_stone = "amogus_blocks:stone",
node_water = "amogus_blocks:water_source",
2023-01-26 13:52:37 +01:00
y_max = 6,
y_min = -5,
heat_point = 50,
humidity_point = 50,
})
minetest.register_biome({
2023-01-31 05:45:15 +01:00
name = "amogus_green_biome",
node_top = "amogus_blocks:grass_green",
depth_top = 1,
node_filler = "amogus_blocks:dirt",
depth_filler = 1,
node_stone = "amogus_blocks:stone",
node_water = "amogus_blocks:water_source",
y_max = 31000,
y_min = 1,
2023-01-31 05:45:15 +01:00
heat_point = 100,
humidity_point = 100,
})
2023-01-24 22:22:14 +01:00
minetest.register_biome({
2023-01-31 05:45:15 +01:00
name = "amogus_biome",
node_top = "amogus_blocks:grass",
2023-01-24 22:22:14 +01:00
depth_top = 1,
node_filler = "amogus_blocks:dirt",
depth_filler = 1,
node_stone = "amogus_blocks:stone",
node_water = "amogus_blocks:water_source",
2023-01-24 22:22:14 +01:00
y_max = 31000,
y_min = 1,
2023-01-31 05:45:15 +01:00
heat_point = 50,
humidity_point = 50,
2023-01-24 22:22:14 +01:00
})
2023-01-31 05:45:15 +01:00
minetest.register_ore({
ore_type = "scatter",
ore = "amogus_blocks:sussium_ore",
wherein = "amogus_blocks:stone",
clust_scarcity = 8 * 8 * 8,
clust_num_ores = 1,
clust_size = 1,
y_max = 31000,
y_min = -31000,
})
minetest.register_ore({
ore_type = "scatter",
ore = "amogus_blocks:gold_ore",
wherein = "amogus_blocks:stone",
clust_scarcity = 8 * 8 * 8,
2023-01-30 07:24:03 +01:00
clust_num_ores = 1,
clust_size = 1,
y_max = 31000,
y_min = -31000,
})
minetest.register_ore({
2023-01-30 07:24:03 +01:00
ore_type = "scatter",
ore = "amogus_blocks:obsusian",
wherein = "amogus_blocks:stone",
clust_scarcity = 8 * 8 * 8,
clust_num_ores = 1,
clust_size = 1,
y_max = 31000,
y_min = -31000,
})
minetest.register_ore({
2023-02-04 16:17:05 +01:00
ore_type = "scatter",
ore = "amogus_blocks:iron_ore",
wherein = "amogus_blocks:stone",
clust_scarcity = 8 * 8 * 8,
clust_num_ores = 1,
clust_size = 1,
y_max = 31000,
y_min = -31000,
})
2023-02-04 16:17:05 +01:00
minetest.register_decoration({
deco_type = "simple",
place_on = {"amogus_blocks:grass"},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.0001,
spread = {x = 100, y = 100, z = 100},
seed = 1234,
octaves = 3,
persist = 0.6
},
biomes = {"amogus_biome"},
y_max = 31000,
y_min = 1,
decoration = "amogus_blocks:lucky_block",
2023-01-27 13:07:56 +01:00
})minetest.register_decoration({
deco_type = "simple",
2023-01-28 11:04:13 +01:00
place_on = {"amogus_blocks:grass_green"},
2023-01-27 13:07:56 +01:00
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.0001,
spread = {x = 100, y = 100, z = 100},
seed = 1234,
octaves = 3,
persist = 0.6
},
biomes = {"green_biome"},
y_max = 31000,
y_min = 1,
decoration = "amogus_blocks:lucky_block",
})
2023-01-28 11:04:13 +01:00
minetest.register_decoration({
deco_type = "simple",
place_on = {"amogus_blocks:grass_green"},
sidelen = 16,
fill_ratio = 0.01,
biomes = {"green_biome"},
y_max = 31000,
y_min = 1,
decoration = "amogus_blocks:amogflower",
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"amogus_blocks:grass_green"},
sidelen = 16,
fill_ratio = 0.10,
biomes = {"green_biome"},
y_max = 31000,
y_min = 1,
decoration = "amogus_blocks:grass_tall",
})minetest.register_decoration({
deco_type = "simple",
place_on = {"amogus_blocks:grass"},
sidelen = 16,
fill_ratio = 0.10,
biomes = {"amogus_biome"},
y_max = 31000,
y_min = 1,
decoration = "amogus_blocks:purple_grass_tall",
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"amogus_blocks:grass"},
sidelen = 16,
fill_ratio = 0.01,
biomes = {"amogus_biome"},
y_max = 31000,
y_min = 1,
decoration = "amogus_blocks:amogflower",
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"amogus_blocks:grass_green"},
sidelen = 16,
fill_ratio = 0.01,
biomes = {"green_biome"},
y_max = 31000,
y_min = 1,
decoration = "amogus_blocks:redflower",
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"amogus_blocks:grass_green"},
sidelen = 16,
fill_ratio = 0.01,
biomes = {"green_biome"},
y_max = 31000,
y_min = 1,
decoration = "amogus_blocks:yellowflower",
})
minetest.register_decoration({
2023-01-12 22:51:29 +01:00
deco_type = "simple",
place_on = {"amogus_blocks:grass"},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.0001,
spread = {x = 100, y = 100, z = 100},
seed = 4321,
octaves = 3,
persist = 0.6
},
biomes = {"amogus_biome"},
y_max = 31000,
y_min = 1,
decoration = "amogus_blocks:tv",
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"amogus_blocks:grass"},
sidelen = 16,
fill_ratio = 0.01,
biomes = {"amogus_biome"},
y_max = 31000,
y_min = 1,
2023-02-12 17:34:01 +01:00
schematic = minetest.get_modpath("amogus_generator") .. "/schematics/tree.mts",
flags = "place_center_x, place_center_z",
rotation = "random",
})
2023-01-12 22:51:29 +01:00
minetest.register_decoration({
deco_type = "schematic",
2023-01-26 13:42:13 +01:00
place_on = {"amogus_blocks:grass_green"},
2023-01-12 22:51:29 +01:00
sidelen = 16,
fill_ratio = 0.01,
2023-01-26 13:42:13 +01:00
biomes = {"green__biome"},
y_max = 31000,
y_min = 1,
2023-02-12 17:34:01 +01:00
schematic = minetest.get_modpath("amogus_generator") .. "/schematics/green_tree.mts",
2023-01-26 13:42:13 +01:00
flags = "place_center_x, place_center_z",
rotation = "random",
})
2023-01-27 13:07:56 +01:00
minetest.register_decoration({
deco_type = "schematic",
place_on = {"amogus_blocks:grass_green"},
sidelen = 16,
fill_ratio = 0.01,
biomes = {"green__biome"},
y_max = 31000,
y_min = 1,
2023-02-12 17:34:01 +01:00
schematic = minetest.get_modpath("amogus_generator") .. "/schematics/green_tree_tall.mts",
2023-01-27 13:07:56 +01:00
flags = "place_center_x, place_center_z",
rotation = "random",
})
2023-01-26 13:42:13 +01:00
minetest.register_decoration({
deco_type = "schematic",
place_on = {"amogus_blocks:grass","amogus_blocks:grass_green"},
sidelen = 16,
fill_ratio = 0.01,
biomes = {"amogus_biome","green_biome"},
2023-01-12 22:51:29 +01:00
y_max = 31000,
y_min = 1,
2023-02-12 17:34:01 +01:00
schematic = minetest.get_modpath("amogus_generator") .. "/schematics/fallen.mts",
2023-01-12 22:51:29 +01:00
flags = "place_center_x, place_center_z",
rotation = "random",
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"amogus_blocks:grass"},
sidelen = 16,
fill_ratio = 0.01,
biomes = {"amogus_biome"},
y_max = 31000,
y_min = 1,
2023-02-12 17:34:01 +01:00
schematic = minetest.get_modpath("amogus_generator") .. "/schematics/treer.mts",
2023-01-12 22:51:29 +01:00
flags = "place_center_x, place_center_z",
rotation = "random",
})minetest.register_decoration({
deco_type = "schematic",
2023-01-22 18:26:41 +01:00
place_on = {"amogus_blocks:grass"},
2023-01-12 22:51:29 +01:00
sidelen = 16,
2023-01-22 18:26:41 +01:00
noise_params = {
offset = 0,
scale = 0.0001,
spread = {x = 100, y = 100, z = 100},
seed = 4321,
octaves = 3,
persist = 0.6
},
2023-01-12 22:51:29 +01:00
biomes = {"amogus_biome"},
y_max = 31000,
y_min = 1,
2023-02-12 17:34:01 +01:00
schematic = minetest.get_modpath("amogus_generator") .. "/schematics/minihouse.mts",
2023-01-12 22:51:29 +01:00
flags = "place_center_x, place_center_z",
rotation = "random",
})
2023-01-26 13:42:13 +01:00
minetest.register_decoration({
deco_type = "schematic",
place_on = {"amogus_blocks:grass"},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.0001,
spread = {x = 100, y = 100, z = 100},
seed = 4321,
octaves = 3,
persist = 0.6
},
biomes = {"amogus_biome"},
y_max = 31000,
y_min = 1,
2023-02-12 17:34:01 +01:00
schematic = minetest.get_modpath("amogus_generator") .. "/schematics/amogus_statue.mts",
2023-01-26 13:42:13 +01:00
flags = "place_center_x, place_center_z",
rotation = "random",
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"amogus_blocks:grass"},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.0001,
spread = {x = 100, y = 100, z = 100},
seed = 1234,
octaves = 3,
persist = 0.6
},
biomes = {"amogus_biome"},
y_max = 31000,
y_min = 1,
2023-02-12 17:34:01 +01:00
schematic = minetest.get_modpath("amogus_generator") .. "/schematics/lucky_tree_2.mts",
2023-01-26 13:42:13 +01:00
flags = "place_center_x, place_center_z",
rotation = "random",
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"amogus_blocks:grass"},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.0001,
spread = {x = 100, y = 100, z = 100},
seed = 1234,
octaves = 3,
persist = 0.6
},
biomes = {"amogus_biome"},
y_max = 31000,
y_min = 1,
2023-02-12 17:34:01 +01:00
schematic = minetest.get_modpath("amogus_generator") .. "/schematics/lucky_tree_1.mts",
2023-01-26 13:42:13 +01:00
flags = "place_center_x, place_center_z",
rotation = "random",
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"amogus_blocks:grass_green"},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.0001,
spread = {x = 100, y = 100, z = 100},
seed = 1234,
octaves = 3,
persist = 0.6
},
biomes = {"green_biome"},
y_max = 31000,
y_min = 1,
2023-02-12 17:34:01 +01:00
schematic = minetest.get_modpath("amogus_generator") .. "/schematics/lucky_tree_2.mts",
2023-01-26 13:42:13 +01:00
flags = "place_center_x, place_center_z",
rotation = "random",
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"amogus_blocks:grass_green"},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.0001,
spread = {x = 100, y = 100, z = 100},
seed = 1234,
octaves = 3,
persist = 0.6
},
biomes = {"green_biome"},
y_max = 31000,
y_min = 1,
2023-02-12 17:34:01 +01:00
schematic = minetest.get_modpath("amogus_generator") .. "/schematics/lucky_tree_1.mts",
2023-01-26 13:42:13 +01:00
flags = "place_center_x, place_center_z",
rotation = "random",
})
2023-01-27 13:07:56 +01:00
minetest.register_decoration({
deco_type = "schematic",
place_on = {"amogus_blocks:grass_green"},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.0001,
spread = {x = 100, y = 100, z = 100},
seed = 1234,
octaves = 3,
persist = 0.6
},
biomes = {"green_biome"},
y_max = 31000,
y_min = 1,
2023-02-12 17:34:01 +01:00
schematic = minetest.get_modpath("amogus_generator") .. "/schematics/STONE1.mts",
2023-01-27 13:07:56 +01:00
flags = "place_center_x, place_center_z",
rotation = "random",
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"amogus_blocks:grass_green"},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.0001,
spread = {x = 100, y = 100, z = 100},
seed = 1234,
octaves = 3,
persist = 0.6
},
biomes = {"green_biome"},
y_max = 31000,
y_min = 1,
2023-02-12 17:34:01 +01:00
schematic = minetest.get_modpath("amogus_generator") .. "/schematics/STONE2.mts",
2023-01-27 13:07:56 +01:00
flags = "place_center_x, place_center_z",
rotation = "random",
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"amogus_blocks:grass_green"},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.0001,
spread = {x = 100, y = 100, z = 100},
seed = 1234,
octaves = 3,
persist = 0.6
},
biomes = {"green_biome"},
y_max = 31000,
y_min = 1,
2023-02-12 17:34:01 +01:00
schematic = minetest.get_modpath("amogus_generator") .. "/schematics/STONE3.mts",
2023-01-27 13:07:56 +01:00
flags = "place_center_x, place_center_z",
rotation = "random",
})
amogus_spawn_random_spread = 2
minetest.register_on_generated(function(minp, maxp, seed)
if math.random(0, 100) < 75 then -- percentage chance of spawning group of amoguses in a chunk
-- spawn random amount of amoguses around random point in chunk
local spawn_position = {x = minp.x + math.random(0, 79), y = minp.y + math.random(0, 10), z = minp.z + math.random(0, 79)}
for i = 1, math.random(5, 15) do
math.randomseed(seed + i)
minetest.add_entity({
x = spawn_position.x + math.random(-amogus_spawn_random_spread, amogus_spawn_random_spread),
y = spawn_position.y + math.random(-amogus_spawn_random_spread, amogus_spawn_random_spread),
z = spawn_position.z + math.random(-amogus_spawn_random_spread, amogus_spawn_random_spread)
}, "amogus_entities:amogus")
end
end
2023-01-31 05:45:15 +01:00
end)
minetest.register_decoration({
deco_type = "schematic",
place_on = {"amogus_blocks:sand"},
sidelen = 16,
fill_ratio = 0.0001,
y_max = 31000,
y_min = 1,
biomes = {"amogus_beach"},
2023-02-12 17:34:01 +01:00
schematic = minetest.get_modpath("amogus_generator") .. "/schematics/sand_house_1.mts",
2023-01-31 05:45:15 +01:00
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"amogus_blocks:sand"},
sidelen = 16,
fill_ratio = 0.0001,
y_max = 31000,
y_min = 1,
biomes = {"amogus_beach"},
2023-02-12 17:34:01 +01:00
schematic = minetest.get_modpath("amogus_generator") .. "/schematics/sand_house_2.mts",
2023-01-31 05:45:15 +01:00
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"amogus_blocks:sand"},
sidelen = 16,
fill_ratio = 0.0001,
y_max = 31000,
y_min = 1,
biomes = {"amogus_beach"},
2023-02-12 17:34:01 +01:00
schematic = minetest.get_modpath("amogus_generator") .. "/schematics/sand_house_3.mts",
2023-01-31 05:45:15 +01:00
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"amogus_blocks:grass_green"},
sidelen = 16,
fill_ratio = 0.0001,
y_max = 31000,
y_min = 1,
biomes = {"green_biome"},
2023-02-12 17:34:01 +01:00
schematic = minetest.get_modpath("amogus_generator") .. "/schematics/STATUE_GIANT.mts",
2023-01-31 05:45:15 +01:00
})
-- DEBUG
--imposters_spawned = 0
2023-02-06 05:22:35 +01:00
minetest.register_abm({
label = "Spawn Imposter",
nodenames = {"air"},
neighbors = {"group:stone"},
interval = 10,
-- IMPORTANT !! spawning chance is actualy interpreted as 1 / chance so the bigger the number the lower the actual chance of imposter being spawned
chance = 200,
2023-02-06 05:22:35 +01:00
action = function(pos)
-- DEBUG
--imposters_spawned = imposters_spawned + 1
--minetest.chat_send_all("Imposters spawned: " .. imposters_spawned)
-- only spawn on solid blocks AND in the dark
if minetest.registered_nodes[minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z}).name].walkable and minetest.get_node_light(pos) < 10 then
-- do not spawn if there is already an sussy imposter nearby
local nearby_entities = minetest.get_objects_inside_radius(pos, 10)
local imposter_nearby = false
for _, entity in pairs(nearby_entities) do
if (entity:get_luaentity() and entity:get_luaentity().name or "") == "amogus_entities:sussy_imposter" then
imposter_nearby = true
break
end
end
2023-01-31 05:45:15 +01:00
if not imposter_nearby then
minetest.add_entity(pos, "amogus_entities:sussy_imposter")
end
end
end
})