tweak and tidy code
This commit is contained in:
parent
1d088aa858
commit
aaebf80afa
@ -1,3 +1,6 @@
|
||||
|
||||
-- register craft recipes when enabled
|
||||
|
||||
if otherworlds.settings.crafting.enable then
|
||||
|
||||
minetest.register_craft({
|
||||
|
52
crystals.lua
52
crystals.lua
@ -1,52 +0,0 @@
|
||||
|
||||
local sbox = {
|
||||
type = "fixed",
|
||||
fixed = {-5/16, -8/16, -6/16, 5/16, -1/32, 5/16}
|
||||
}
|
||||
|
||||
local crystal_list = {
|
||||
{"ghost_crystal", "ghost_crystal.png"},
|
||||
{"red_crystal", "red_crystal.png"},
|
||||
{"rose_quartz", "rose_quartz.png"}
|
||||
}
|
||||
|
||||
|
||||
for i in ipairs(crystal_list) do
|
||||
|
||||
local name = crystal_list[i][1]
|
||||
local texture = crystal_list[i][2]
|
||||
|
||||
minetest.register_node(":crystals:" .. name .. "_1", {
|
||||
description = "Glowing Crystal",
|
||||
drawtype = "mesh",
|
||||
mesh = "crystal_shape01.obj",
|
||||
tiles = {"crystals_" .. texture},
|
||||
wield_scale = {x = 7, y = 7, z = 7},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
selection_box = sbox,
|
||||
walkable = false,
|
||||
light_source = 10,
|
||||
use_texture_alpha = "blend",
|
||||
visual_scale = 10,
|
||||
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3},
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node(":crystals:" .. name .. "_2", {
|
||||
description = "Glowing Crystal",
|
||||
drawtype = "mesh",
|
||||
mesh = "crystal_shape02.obj",
|
||||
tiles = {"crystals_" .. texture},
|
||||
wield_scale = {x = 7, y = 7, z = 7},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
selection_box = sbox,
|
||||
walkable = false,
|
||||
light_source = 10,
|
||||
use_texture_alpha = "blend",
|
||||
visual_scale = 10,
|
||||
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3},
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
end
|
13
init.lua
13
init.lua
@ -1,15 +1,17 @@
|
||||
local modpath = minetest.get_modpath("other_worlds") .. DIR_DELIM
|
||||
|
||||
-- global, mod path and load mod sections
|
||||
|
||||
otherworlds = {}
|
||||
|
||||
local modpath = minetest.get_modpath("other_worlds") .. "/"
|
||||
|
||||
dofile(modpath .. "settings.lua")
|
||||
dofile(modpath .. "mars_plants.lua")
|
||||
dofile(modpath .. "crystals.lua")
|
||||
dofile(modpath .. "space_nodes.lua")
|
||||
dofile(modpath .. "nodes.lua")
|
||||
dofile(modpath .. "crafting.lua")
|
||||
dofile(modpath .. "skybox.lua")
|
||||
|
||||
-- required helpers for mapgen options below
|
||||
|
||||
dofile(modpath .. "asteroid_layer_helpers.lua")
|
||||
|
||||
if otherworlds.settings.space_asteroids.enable then
|
||||
@ -19,3 +21,6 @@ end
|
||||
if otherworlds.settings.redsky_asteroids.enable then
|
||||
dofile(modpath .. "redsky_asteroids.lua")
|
||||
end
|
||||
|
||||
|
||||
print("[MOD] Other Worlds loaded")
|
||||
|
@ -16,7 +16,6 @@ Skybox texture:
|
||||
License: CC BY-SA 3.0 (https://creativecommons.org/licenses/by/3.0/)
|
||||
Attribution: Ulukai (available from http://opengameart.org/content/ulukais-space-skyboxes)
|
||||
|
||||
|
||||
---
|
||||
|
||||
Recoloured textures from various mods:
|
||||
@ -24,7 +23,6 @@ Grass textures based on default mod in minetest_game (WTFPL).
|
||||
Redgrass texture based on junglegrass texture in default mod in minetest_game (assumed to be CC BY-SA 3.0).
|
||||
Red versions of asteroid textures (CC BY-SA 3.0).
|
||||
|
||||
|
||||
---
|
||||
|
||||
Textures created for this mod:
|
||||
|
118
mars_plants.lua
118
mars_plants.lua
@ -1,118 +0,0 @@
|
||||
minetest.register_node(":mars:redgrass", {
|
||||
description = "Red Grass",
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
visual_scale = 1.3,
|
||||
tiles = {"mars_redgrass.png"},
|
||||
inventory_image = "mars_redgrass.png",
|
||||
wield_image = "mars_redgrass.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
groups = {snappy = 3, flora = 1, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node(":mars:redweed", {
|
||||
description = "Red Weed",
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
visual_scale = 1.3,
|
||||
tiles = {"mars_redweed.png"},
|
||||
inventory_image = "mars_redweed.png",
|
||||
wield_image = "mars_redweed.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
groups = {snappy = 3, flora = 1, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node(":mars:moss", {
|
||||
description = "Martian Moss",
|
||||
drawtype = "nodebox",
|
||||
tiles = {"mars_moss.png"},
|
||||
inventory_image = "mars_moss.png",
|
||||
wield_image = "mars_moss.png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
use_texture_alpha = "clip",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-1/2, -1/2, -1/2, 1/2, -15/32, 1/2},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-1/2, -1/2, -1/2, 1/2, -15/32, 1/2},
|
||||
},
|
||||
groups = {snappy = 3, flora = 1, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults()
|
||||
})
|
||||
|
||||
--mars grass
|
||||
minetest.register_node(":mars:grass_1", {
|
||||
description = "Martian Grass",
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
tiles = {"mars_grass_1.png"},
|
||||
inventory_image = "mars_grass_3.png",
|
||||
wield_image = "mars_grass_3.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
groups = {snappy = 3, flora = 1, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
|
||||
},
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
|
||||
-- place a random grass node
|
||||
local stack = ItemStack("mars:grass_" .. math.random(5))
|
||||
local ret = minetest.item_place(stack, placer, pointed_thing)
|
||||
|
||||
return ItemStack("mars:grass_1 "
|
||||
.. itemstack:get_count() - (1 - ret:get_count()))
|
||||
end
|
||||
})
|
||||
|
||||
for i = 2, 5 do
|
||||
|
||||
minetest.register_node(":mars:grass_" .. i, {
|
||||
description = "Martian Grass",
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
tiles = {"mars_grass_" .. i .. ".png"},
|
||||
inventory_image = "mars_grass_" .. i .. ".png",
|
||||
wield_image = "mars_grass_" .. i .. ".png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "mars:grass_1",
|
||||
groups = {
|
||||
snappy = 3, flora = 1, attached_node = 1,
|
||||
not_in_creative_inventory = 1
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
|
||||
}
|
||||
})
|
||||
end
|
311
nodes.lua
Normal file
311
nodes.lua
Normal file
@ -0,0 +1,311 @@
|
||||
|
||||
-- Asteroid nodes
|
||||
|
||||
minetest.register_node(":asteroid:stone", {
|
||||
description = "Asteroid Stone",
|
||||
tiles = {"default_stone.png"},
|
||||
is_ground_content = false,
|
||||
drop = 'asteroid:cobble',
|
||||
groups = {cracky = 3, stone = 1, not_in_creative_inventory = 1},
|
||||
sounds = default.node_sound_stone_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:redstone", {
|
||||
description = "Asteroid Stone",
|
||||
tiles = {"asteroid_redstone.png"},
|
||||
is_ground_content = false,
|
||||
drop = 'asteroid:redcobble',
|
||||
groups = {cracky = 3, stone = 1},
|
||||
sounds = default.node_sound_stone_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:cobble", {
|
||||
description = "Asteroid Cobble",
|
||||
tiles = {"asteroid_cobble.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 3, stone = 2},
|
||||
sounds = default.node_sound_stone_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:redcobble", {
|
||||
description = "Asteroid Cobble",
|
||||
tiles = {"asteroid_redcobble.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 3, stone = 2},
|
||||
sounds = default.node_sound_stone_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:gravel", {
|
||||
description = "Asteroid Gravel",
|
||||
tiles = {"asteroid_gravel.png"},
|
||||
is_ground_content = false,
|
||||
groups = {crumbly = 2},
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name = "default_gravel_footstep", gain = 0.2}
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:redgravel", {
|
||||
description = "Asteroid Gravel",
|
||||
tiles = {"asteroid_redgravel.png"},
|
||||
is_ground_content = false,
|
||||
groups = {crumbly = 2},
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name = "default_gravel_footstep", gain = 0.2}
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:dust", {
|
||||
description = "Asteroid Dust",
|
||||
tiles = {"asteroid_dust.png"},
|
||||
is_ground_content = false,
|
||||
groups = {crumbly = 3},
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name = "default_gravel_footstep", gain = 0.1}
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:reddust", {
|
||||
description = "Asteroid Dust",
|
||||
tiles = {"asteroid_reddust.png"},
|
||||
is_ground_content = false,
|
||||
groups = {crumbly = 3},
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name = "default_gravel_footstep", gain = 0.1}
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:ironore", {
|
||||
description = "Asteroid Iron Ore",
|
||||
tiles = {"asteroid_redstone.png^default_mineral_iron.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 2},
|
||||
drop = "default:iron_lump",
|
||||
sounds = default.node_sound_stone_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:copperore", {
|
||||
description = "Asteroid Copper Ore",
|
||||
tiles = {"asteroid_redstone.png^default_mineral_copper.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 2},
|
||||
drop = "default:copper_lump",
|
||||
sounds = default.node_sound_stone_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:goldore", {
|
||||
description = "Asteroid Gold Ore",
|
||||
tiles = {"asteroid_redstone.png^default_mineral_gold.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 2},
|
||||
drop = "default:gold_lump",
|
||||
sounds = default.node_sound_stone_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:diamondore", {
|
||||
description = "Asteroid Diamond Ore",
|
||||
tiles = {"asteroid_redstone.png^default_mineral_diamond.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 1},
|
||||
drop = "default:diamond",
|
||||
sounds = default.node_sound_stone_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:meseore", {
|
||||
description = "Asteroid Mese Ore",
|
||||
tiles = {"asteroid_redstone.png^default_mineral_mese.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 1},
|
||||
drop = "default:mese_crystal",
|
||||
sounds = default.node_sound_stone_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:atmos", {
|
||||
description = "Comet Atmosphere",
|
||||
drawtype = "glasslike",
|
||||
tiles = {"asteroid_atmos.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
use_texture_alpha = "blend",
|
||||
post_effect_color = {a = 31, r = 241, g = 248, b = 255},
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
drop = {}
|
||||
})
|
||||
|
||||
-- Redsky plant nodes
|
||||
|
||||
minetest.register_node(":mars:redgrass", {
|
||||
description = "Red Grass",
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
visual_scale = 1.3,
|
||||
tiles = {"mars_redgrass.png"},
|
||||
inventory_image = "mars_redgrass.png",
|
||||
wield_image = "mars_redgrass.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
groups = {snappy = 3, flora = 1, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node(":mars:redweed", {
|
||||
description = "Red Weed",
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
visual_scale = 1.3,
|
||||
tiles = {"mars_redweed.png"},
|
||||
inventory_image = "mars_redweed.png",
|
||||
wield_image = "mars_redweed.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
groups = {snappy = 3, flora = 1, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node(":mars:moss", {
|
||||
description = "Martian Moss",
|
||||
drawtype = "nodebox",
|
||||
tiles = {"mars_moss.png"},
|
||||
inventory_image = "mars_moss.png",
|
||||
wield_image = "mars_moss.png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
use_texture_alpha = "clip",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-1/2, -1/2, -1/2, 1/2, -15/32, 1/2},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-1/2, -1/2, -1/2, 1/2, -15/32, 1/2},
|
||||
},
|
||||
groups = {snappy = 3, flora = 1, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults()
|
||||
})
|
||||
|
||||
-- mars grass
|
||||
|
||||
minetest.register_node(":mars:grass_1", {
|
||||
description = "Martian Grass",
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
tiles = {"mars_grass_1.png"},
|
||||
inventory_image = "mars_grass_3.png",
|
||||
wield_image = "mars_grass_3.png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
groups = {snappy = 3, flora = 1, attached_node = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
|
||||
},
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
|
||||
-- place a random grass node
|
||||
local stack = ItemStack("mars:grass_" .. math.random(5))
|
||||
local ret = minetest.item_place(stack, placer, pointed_thing)
|
||||
|
||||
return ItemStack("mars:grass_1 "
|
||||
.. itemstack:get_count() - (1 - ret:get_count()))
|
||||
end
|
||||
})
|
||||
|
||||
for i = 2, 5 do
|
||||
|
||||
minetest.register_node(":mars:grass_" .. i, {
|
||||
description = "Martian Grass",
|
||||
drawtype = "plantlike",
|
||||
waving = 1,
|
||||
tiles = {"mars_grass_" .. i .. ".png"},
|
||||
inventory_image = "mars_grass_" .. i .. ".png",
|
||||
wield_image = "mars_grass_" .. i .. ".png",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
drop = "mars:grass_1",
|
||||
groups = {
|
||||
snappy = 3, flora = 1, attached_node = 1,
|
||||
not_in_creative_inventory = 1
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
-- Crystals
|
||||
|
||||
local sbox = {
|
||||
type = "fixed",
|
||||
fixed = {-5/16, -8/16, -6/16, 5/16, -1/32, 5/16}}
|
||||
|
||||
local crystal_list = {
|
||||
{"ghost_crystal", "ghost_crystal.png"},
|
||||
{"red_crystal", "red_crystal.png"},
|
||||
{"rose_quartz", "rose_quartz.png"}}
|
||||
|
||||
for i = 1, #crystal_list do -- in ipairs(crystal_list) do
|
||||
|
||||
local name = crystal_list[i][1]
|
||||
local texture = crystal_list[i][2]
|
||||
|
||||
minetest.register_node(":crystals:" .. name .. "_1", {
|
||||
description = "Glowing Crystal",
|
||||
drawtype = "mesh",
|
||||
mesh = "crystal_shape01.obj",
|
||||
tiles = {"crystals_" .. texture},
|
||||
wield_scale = {x = 7, y = 7, z = 7},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
selection_box = sbox,
|
||||
walkable = false,
|
||||
light_source = 10,
|
||||
use_texture_alpha = "blend",
|
||||
visual_scale = 10,
|
||||
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3},
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node(":crystals:" .. name .. "_2", {
|
||||
description = "Glowing Crystal",
|
||||
drawtype = "mesh",
|
||||
mesh = "crystal_shape02.obj",
|
||||
tiles = {"crystals_" .. texture},
|
||||
wield_scale = {x = 7, y = 7, z = 7},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
selection_box = sbox,
|
||||
walkable = false,
|
||||
light_source = 10,
|
||||
use_texture_alpha = "blend",
|
||||
visual_scale = 10,
|
||||
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3},
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
end
|
@ -1,9 +1,11 @@
|
||||
|
||||
-- Approximate realm limits
|
||||
|
||||
local YMIN = otherworlds.settings.redsky_asteroids.YMIN or 6000
|
||||
local YMAX = otherworlds.settings.redsky_asteroids.YMAX or 7000
|
||||
|
||||
|
||||
-- Register on_generated function for this layer
|
||||
|
||||
minetest.register_on_generated(
|
||||
otherworlds.asteroids.create_on_generated(YMIN, YMAX, {
|
||||
|
||||
@ -23,39 +25,30 @@ minetest.register_on_generated(
|
||||
c_snowblock = minetest.get_content_id("default:snowblock")
|
||||
}))
|
||||
|
||||
|
||||
-- Deco code for grass and crystal
|
||||
|
||||
-- how often surface decoration appears on top of asteroid cobble
|
||||
local TOPDECO = 500
|
||||
local TOPDECO = 500 -- how often deco appears on top of asteroid cobble
|
||||
|
||||
local grass = {
|
||||
"mars:grass_1", "mars:grass_2", "mars:grass_3", "mars:grass_4", "mars:grass_5"
|
||||
}
|
||||
"mars:grass_1", "mars:grass_2", "mars:grass_3", "mars:grass_4", "mars:grass_5"}
|
||||
|
||||
local flower = {
|
||||
"mars:moss", "mars:redweed", "mars:redgrass"
|
||||
}
|
||||
local flower = {"mars:moss", "mars:redweed", "mars:redgrass"}
|
||||
|
||||
local crystal = {
|
||||
"crystals:ghost_crystal_1", "crystals:ghost_crystal_2",
|
||||
"crystals:red_crystal_1", "crystals:red_crystal_2",
|
||||
"crystals:rose_quartz_1", "crystals:rose_quartz_2"
|
||||
}
|
||||
"crystals:rose_quartz_1", "crystals:rose_quartz_2"}
|
||||
|
||||
local random = math.random
|
||||
|
||||
|
||||
-- Add surface decoration
|
||||
minetest.register_on_generated(function(minp, maxp)
|
||||
|
||||
if minp.y < YMIN or maxp.y > YMAX then
|
||||
return
|
||||
end
|
||||
local function generate(vm, minp, maxp)
|
||||
|
||||
if minp.y < YMIN or maxp.y > YMAX then return end
|
||||
|
||||
local bpos, ran
|
||||
local coal = minetest.find_nodes_in_area_under_air(minp, maxp,
|
||||
{"asteroid:redgravel"})
|
||||
local coal = minetest.find_nodes_in_area_under_air(minp, maxp, {"asteroid:redgravel"})
|
||||
|
||||
for n = 1, #coal do
|
||||
|
||||
@ -76,4 +69,14 @@ minetest.register_on_generated(function(minp, maxp)
|
||||
minetest.swap_node(bpos, {name = crystal[random(#crystal)]})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if minetest.save_gen_notify ~= nil then -- async env (5.9+)
|
||||
minetest.register_on_generated(function(vm, minp, maxp, blockseed)
|
||||
generate(vm, minp, maxp)
|
||||
end)
|
||||
else -- main thread (5.8 and earlier)
|
||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||
generate(minetest.get_mapgen_object("voxelmanip"), minp, maxp)
|
||||
end)
|
||||
end
|
||||
|
10
settings.lua
10
settings.lua
@ -1,13 +1,15 @@
|
||||
|
||||
otherworlds.settings = {}
|
||||
|
||||
|
||||
-- general
|
||||
|
||||
otherworlds.settings.crafting = {
|
||||
-- set to false to remove crafting recipes
|
||||
enable = minetest.settings:get_bool("otherworlds.crafting", true)
|
||||
}
|
||||
|
||||
-- space_asteroids
|
||||
|
||||
otherworlds.settings.space_asteroids = {
|
||||
-- set to false to prevent space mapgen
|
||||
enable = minetest.settings:get_bool("otherworlds.space", true),
|
||||
@ -17,8 +19,8 @@ otherworlds.settings.space_asteroids = {
|
||||
YMAX = tonumber(minetest.settings:get("otherworlds.space.ymax") or 6000)
|
||||
}
|
||||
|
||||
|
||||
-- redsky_asteroids
|
||||
|
||||
otherworlds.settings.redsky_asteroids = {
|
||||
-- set to false to prevent redsky mapgen
|
||||
enable = minetest.settings:get_bool("otherworlds.redsky", true),
|
||||
@ -28,15 +30,15 @@ otherworlds.settings.redsky_asteroids = {
|
||||
YMAX = tonumber(minetest.settings:get("otherworlds.redsky.ymax") or 7000)
|
||||
}
|
||||
|
||||
|
||||
-- gravity
|
||||
|
||||
otherworlds.settings.gravity = {
|
||||
-- set to true to enable gravity
|
||||
enable = minetest.settings:get_bool("otherworlds.gravity", false)
|
||||
}
|
||||
|
||||
|
||||
-- increase or decrease change of ores appearing in asteroids
|
||||
|
||||
otherworlds.settings.ore_chance = {
|
||||
-- default ore chance is multiplied by following value
|
||||
value = tonumber(minetest.settings:get("otherworlds.ore_chance") or 27)
|
||||
|
73
skybox.lua
73
skybox.lua
@ -1,7 +1,10 @@
|
||||
|
||||
-- Nether check for Xanadu server
|
||||
|
||||
local nether_mod = minetest.get_modpath("nether") and minetest.get_modpath("xanadu")
|
||||
|
||||
-- Heights for skyboxes
|
||||
|
||||
local underground_low = nether_mod and -28000 or -31000
|
||||
local underground_high = -50
|
||||
local space_low = 5000
|
||||
@ -10,44 +13,47 @@ local redsky_low = 6000
|
||||
local redsky_high = 6999
|
||||
|
||||
-- Holds name of skybox showing for each player
|
||||
|
||||
local player_list = {}
|
||||
|
||||
-- Outerspace skybox
|
||||
|
||||
local spaceskybox = {
|
||||
"sky_pos_z.png",
|
||||
"sky_neg_z.png^[transformR180",
|
||||
"sky_neg_y.png^[transformR270",
|
||||
"sky_pos_y.png^[transformR270",
|
||||
"sky_pos_x.png^[transformR270",
|
||||
"sky_neg_x.png^[transformR90"
|
||||
}
|
||||
"sky_neg_x.png^[transformR90"}
|
||||
|
||||
-- Redsky skybox
|
||||
|
||||
local redskybox = {
|
||||
"sky_pos_z.png^[colorize:#99000050",
|
||||
"sky_neg_z.png^[transformR180^[colorize:#99000050",
|
||||
"sky_neg_y.png^[transformR270^[colorize:#99000050",
|
||||
"sky_pos_y.png^[transformR270^[colorize:#99000050",
|
||||
"sky_pos_x.png^[transformR270^[colorize:#99000050",
|
||||
"sky_neg_x.png^[transformR90^[colorize:#99000050"
|
||||
}
|
||||
"sky_neg_x.png^[transformR90^[colorize:#99000050"}
|
||||
|
||||
-- Darkest space skybox
|
||||
|
||||
local darkskybox = {
|
||||
"sky_pos_z.png^[colorize:#00005070",
|
||||
"sky_neg_z.png^[transformR180^[colorize:#00005070",
|
||||
"sky_neg_y.png^[transformR270^[colorize:#00005070",
|
||||
"sky_pos_y.png^[transformR270^[colorize:#00005070",
|
||||
"sky_pos_x.png^[transformR270^[colorize:#00005070",
|
||||
"sky_neg_x.png^[transformR90^[colorize:#00005070"
|
||||
}
|
||||
"sky_neg_x.png^[transformR90^[colorize:#00005070"}
|
||||
|
||||
|
||||
-- check for active pova mod
|
||||
|
||||
local pova = minetest.get_modpath("pova")
|
||||
|
||||
-- gravity helper function
|
||||
local set_gravity = function(player, grav)
|
||||
|
||||
local function set_gravity(player, grav)
|
||||
|
||||
if pova then
|
||||
pova.add_override(player:get_player_name(), "default", {gravity = grav})
|
||||
@ -56,18 +62,13 @@ local set_gravity = function(player, grav)
|
||||
end
|
||||
end
|
||||
|
||||
-- globalstep function runs every 2 seconds to show appropriate skybox
|
||||
|
||||
local timer = 0
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
|
||||
timer = timer + dtime
|
||||
|
||||
if timer < 2 then
|
||||
return
|
||||
end
|
||||
|
||||
timer = 0
|
||||
timer = timer + dtime ; if timer < 2 then return end ; timer = 0
|
||||
|
||||
local name, pos, current
|
||||
|
||||
@ -78,6 +79,7 @@ minetest.register_globalstep(function(dtime)
|
||||
current = player_list[name] or ""
|
||||
|
||||
-- this just adds nether background for xanadu server
|
||||
|
||||
if nether_mod and pos.y < underground_low and current ~= "nether" then
|
||||
|
||||
player:set_sky({
|
||||
@ -107,15 +109,11 @@ minetest.register_globalstep(function(dtime)
|
||||
end
|
||||
|
||||
-- Underground (above Nether limit)
|
||||
|
||||
elseif pos.y >= underground_low and pos.y <= underground_high
|
||||
and current ~= "underground" then
|
||||
|
||||
player:set_sky({
|
||||
type = "plain",
|
||||
clouds = false,
|
||||
base_color = "#101010"
|
||||
})
|
||||
|
||||
player:set_sky({type = "plain", clouds = false, base_color = "#101010"})
|
||||
player:set_moon({visible = false})
|
||||
player:set_stars({visible = false})
|
||||
player:set_sun({visible = false, sunrise_visible = false})
|
||||
@ -127,14 +125,11 @@ minetest.register_globalstep(function(dtime)
|
||||
end
|
||||
|
||||
-- Earth
|
||||
|
||||
elseif pos.y > underground_high and pos.y < space_low
|
||||
and current ~= "earth" then
|
||||
|
||||
player:set_sky({
|
||||
type = "regular",
|
||||
clouds = true
|
||||
})
|
||||
|
||||
player:set_sky({type = "regular", clouds = true})
|
||||
player:set_moon({visible = true})
|
||||
player:set_stars({visible = true})
|
||||
player:set_sun({visible = true, scale = 1.0, sunrise_visible = true})
|
||||
@ -146,15 +141,11 @@ minetest.register_globalstep(function(dtime)
|
||||
end
|
||||
|
||||
-- Outerspace
|
||||
|
||||
elseif pos.y >= space_low and pos.y <= space_high
|
||||
and current ~= "space" then
|
||||
|
||||
player:set_sky({
|
||||
type = "skybox",
|
||||
textures = spaceskybox,
|
||||
clouds = false
|
||||
})
|
||||
|
||||
player:set_sky({type = "skybox", textures = spaceskybox, clouds = false})
|
||||
player:set_moon({visible = false})
|
||||
player:set_stars({visible = false})
|
||||
player:set_sun({visible = true, scale = 1.0, sunrise_visible = false})
|
||||
@ -166,15 +157,11 @@ minetest.register_globalstep(function(dtime)
|
||||
end
|
||||
|
||||
-- Redsky
|
||||
|
||||
elseif pos.y >= redsky_low and pos.y <= redsky_high
|
||||
and current ~= "redsky" then
|
||||
|
||||
player:set_sky({
|
||||
type = "skybox",
|
||||
textures = redskybox,
|
||||
clouds = false
|
||||
})
|
||||
|
||||
player:set_sky({type = "skybox", textures = redskybox, clouds = false})
|
||||
player:set_moon({visible = false})
|
||||
player:set_stars({visible = false})
|
||||
player:set_sun({visible = true, scale = 0.5, sunrise_visible = false})
|
||||
@ -186,14 +173,10 @@ minetest.register_globalstep(function(dtime)
|
||||
end
|
||||
|
||||
-- Everything else above (the blackness)
|
||||
|
||||
elseif pos.y > redsky_high and current ~= "blackness" then
|
||||
|
||||
player:set_sky({
|
||||
type = "skybox",
|
||||
textures = darkskybox,
|
||||
clouds = false
|
||||
})
|
||||
|
||||
player:set_sky({type = "skybox", textures = darkskybox, clouds = false})
|
||||
player:set_moon({visible = false})
|
||||
player:set_stars({visible = true})
|
||||
player:set_sun({visible = true, scale = 0.1})
|
||||
@ -207,10 +190,8 @@ minetest.register_globalstep(function(dtime)
|
||||
end
|
||||
end)
|
||||
|
||||
-- remove player from list when they leave
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
player_list[player:get_player_name()] = nil
|
||||
end)
|
||||
|
||||
|
||||
print("[MOD] Other Worlds loaded")
|
||||
|
@ -1,8 +1,11 @@
|
||||
|
||||
-- Approximate realm limits
|
||||
|
||||
local YMIN = otherworlds.settings.space_asteroids.YMIN or 5000
|
||||
local YMAX = otherworlds.settings.space_asteroids.YMAX or 6000
|
||||
|
||||
-- Register on_generated function for this layer
|
||||
|
||||
minetest.register_on_generated(
|
||||
otherworlds.asteroids.create_on_generated(YMIN, YMAX, {
|
||||
|
||||
|
137
space_nodes.lua
137
space_nodes.lua
@ -1,137 +0,0 @@
|
||||
-- Nodes
|
||||
|
||||
minetest.register_node(":asteroid:stone", {
|
||||
description = "Asteroid Stone",
|
||||
tiles = {"default_stone.png"},
|
||||
is_ground_content = false,
|
||||
drop = 'asteroid:cobble',
|
||||
groups = {cracky = 3, stone = 1, not_in_creative_inventory = 1},
|
||||
sounds = default.node_sound_stone_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:redstone", {
|
||||
description = "Asteroid Stone",
|
||||
tiles = {"asteroid_redstone.png"},
|
||||
is_ground_content = false,
|
||||
drop = 'asteroid:redcobble',
|
||||
groups = {cracky = 3, stone = 1},
|
||||
sounds = default.node_sound_stone_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:cobble", {
|
||||
description = "Asteroid Cobble",
|
||||
tiles = {"asteroid_cobble.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 3, stone = 2},
|
||||
sounds = default.node_sound_stone_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:redcobble", {
|
||||
description = "Asteroid Cobble",
|
||||
tiles = {"asteroid_redcobble.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 3, stone = 2},
|
||||
sounds = default.node_sound_stone_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:gravel", {
|
||||
description = "Asteroid Gravel",
|
||||
tiles = {"asteroid_gravel.png"},
|
||||
is_ground_content = false,
|
||||
groups = {crumbly = 2},
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name = "default_gravel_footstep", gain = 0.2}
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:redgravel", {
|
||||
description = "Asteroid Gravel",
|
||||
tiles = {"asteroid_redgravel.png"},
|
||||
is_ground_content = false,
|
||||
groups = {crumbly = 2},
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name = "default_gravel_footstep", gain = 0.2}
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:dust", {
|
||||
description = "Asteroid Dust",
|
||||
tiles = {"asteroid_dust.png"},
|
||||
is_ground_content = false,
|
||||
groups = {crumbly = 3},
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name = "default_gravel_footstep", gain = 0.1}
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:reddust", {
|
||||
description = "Asteroid Dust",
|
||||
tiles = {"asteroid_reddust.png"},
|
||||
is_ground_content = false,
|
||||
groups = {crumbly = 3},
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name = "default_gravel_footstep", gain = 0.1}
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:ironore", {
|
||||
description = "Asteroid Iron Ore",
|
||||
tiles = {"asteroid_redstone.png^default_mineral_iron.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 2},
|
||||
drop = "default:iron_lump",
|
||||
sounds = default.node_sound_stone_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:copperore", {
|
||||
description = "Asteroid Copper Ore",
|
||||
tiles = {"asteroid_redstone.png^default_mineral_copper.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 2},
|
||||
drop = "default:copper_lump",
|
||||
sounds = default.node_sound_stone_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:goldore", {
|
||||
description = "Asteroid Gold Ore",
|
||||
tiles = {"asteroid_redstone.png^default_mineral_gold.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 2},
|
||||
drop = "default:gold_lump",
|
||||
sounds = default.node_sound_stone_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:diamondore", {
|
||||
description = "Asteroid Diamond Ore",
|
||||
tiles = {"asteroid_redstone.png^default_mineral_diamond.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 1},
|
||||
drop = "default:diamond",
|
||||
sounds = default.node_sound_stone_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:meseore", {
|
||||
description = "Asteroid Mese Ore",
|
||||
tiles = {"asteroid_redstone.png^default_mineral_mese.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 1},
|
||||
drop = "default:mese_crystal",
|
||||
sounds = default.node_sound_stone_defaults()
|
||||
})
|
||||
|
||||
minetest.register_node(":asteroid:atmos", {
|
||||
description = "Comet Atmosphere",
|
||||
drawtype = "glasslike",
|
||||
tiles = {"asteroid_atmos.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
use_texture_alpha = "blend",--true,
|
||||
post_effect_color = {a = 31, r = 241, g = 248, b = 255},
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
drop = {}
|
||||
})
|
Loading…
x
Reference in New Issue
Block a user