deco.lua 8.17 KB
Newer Older
Duane Robertson's avatar
Duane Robertson committed
1 2 3 4
-- Underworlds deco.lua
-- Copyright Duane Robertson (duane@duanerobertson.com), 2017
-- Distributed under the LGPLv2.1 (https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html)

Milan's avatar
Milan committed
5
minetest.register_alias("underworlds:hot_cobble", "caverealms:hot_cobble")
Duane Robertson's avatar
Duane Robertson committed
6 7 8 9 10

local newnode
local light_max = default.light_max or 10


Duane Robertson's avatar
Duane Robertson committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
local spel = {
  {type1="stalactite", type2="stalagmite", tile="default_stone.png"},
  {type1="stalactite_slimy", type2="stalagmite_slimy", tile="default_stone.png^underworlds_algae.png"},
  {type1="stalactite_mossy", type2="stalagmite_mossy", tile="default_stone.png^underworlds_moss.png"},
  {type1="icicle_down", type2="icicle_up", desc="Icicle", tile="caverealms_thin_ice.png", drop="default:ice"},
}

-- Speleothems can be made into cobblestone, to get them out of inventory.
minetest.register_craft({
  output = "default:cobble",
  recipe = {
    {"", "", ""},
    {"underworlds:stalactite", "underworlds:stalactite", ""},
    {"underworlds:stalactite", "underworlds:stalactite", ""},
  },
})

minetest.register_craft({
  output = "default:cobble",
  recipe = {
    {"", "", ""},
    {"underworlds:stalagmite", "underworlds:stalagmite", ""},
    {"underworlds:stalagmite", "underworlds:stalagmite", ""},
  },
})

-- What's a cave without speleothems?
for _, desc in pairs(spel) do
  minetest.register_node("underworlds:"..desc.type1, {
    description = (desc.desc or "Stalactite"),
    tiles = {desc.tile},
Duane Robertson's avatar
Duane Robertson committed
42
    is_ground_content = true,
Duane Robertson's avatar
Duane Robertson committed
43 44 45 46 47 48 49 50 51 52 53
    walkable = false,
    paramtype = "light",
    drop = (desc.drop or "underworlds:stalactite"),
    drawtype = "nodebox",
    node_box = { type = "fixed", 
    fixed = {
      {-0.07, 0.0, -0.07, 0.07, 0.5, 0.07}, 
      {-0.04, -0.25, -0.04, 0.04, 0.0, 0.04}, 
      {-0.02, -0.5, -0.02, 0.02, 0.25, 0.02}, 
    } },
    groups = {rock=1, cracky=3},
Duane Robertson's avatar
Duane Robertson committed
54 55 56
    sounds = default.node_sound_stone_defaults(),
  })

Duane Robertson's avatar
Duane Robertson committed
57 58 59 60 61
  minetest.register_node("underworlds:"..desc.type2, {
    description = (desc.desc or "Stalagmite"),
    tiles = {desc.tile},
    is_ground_content = true,
    walkable = false,
Duane Robertson's avatar
Duane Robertson committed
62
    paramtype = "light",
Duane Robertson's avatar
Duane Robertson committed
63 64 65 66 67 68 69 70 71 72
    drop = "underworlds:stalagmite",
    drawtype = "nodebox",
    node_box = { type = "fixed", 
    fixed = {
      {-0.07, -0.5, -0.07, 0.07, 0.0, 0.07}, 
      {-0.04, 0.0, -0.04, 0.04, 0.25, 0.04}, 
      {-0.02, 0.25, -0.02, 0.02, 0.5, 0.02}, 
    } },
    groups = {rock=1, cracky=3},
    sounds = default.node_sound_stone_defaults(),
Duane Robertson's avatar
Duane Robertson committed
73 74 75
  })
end

Duane Robertson's avatar
Duane Robertson committed
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
-- stone, hot
minetest.register_node("underworlds:hot_stone", {
  description = "Hot Stone",
  tiles = {"default_desert_stone.png^[colorize:#FF0000:150"},
  is_ground_content = true,
  groups = {crumbly=2, surface_hot=3},
  light_source = light_max - 5,
  damage_per_second = 1,
  sounds = default.node_sound_stone_defaults({
    footstep = {name="default_stone_footstep", gain=0.25},
  }),
})

-- Glowing fungal stone provides an eerie light.
minetest.register_node("underworlds:glowing_fungal_stone", {
  description = "Glowing Fungal Stone",
  tiles = {"default_stone.png^vmg_glowing_fungal.png",},
  is_ground_content = true,
  light_source = light_max - 4,
  groups = {cracky=3, stone=1},
  drop = {items={ {items={"default:cobble"},}, {items={"underworlds:glowing_fungus",},},},},
  sounds = default.node_sound_stone_defaults(),
})

-- Glowing fungus grows underground.
minetest.register_craftitem("underworlds:glowing_fungus", {
  description = "Glowing Fungus",
  drawtype = "plantlike",
  paramtype = "light",
  tiles = {"vmg_glowing_fungus.png"},
  inventory_image = "vmg_glowing_fungus.png",
  groups = {dig_immediate = 3},
})

-- black (oily) sand
local newnode = underworlds_mod.clone_node("default:sand")
newnode.description = "Black Sand"
newnode.tiles = {"underworlds_black_sand.png"}
newnode.groups['falling_node'] = 0
minetest.register_node("underworlds:black_sand", newnode)

117
--[[
Duane Robertson's avatar
Duane Robertson committed
118 119 120 121 122 123 124
newnode = underworlds_mod.clone_node("default:water_source")
newnode.description = "Poisonous Water"
newnode.groups.poison = 3
newnode.light_source = 6
newnode.liquid_alternative_flowing = "underworlds:water_poison_flowing"
newnode.liquid_alternative_source = "underworlds:water_poison_source"
newnode.post_effect_color = {a = 103, r = 108, g = 128, b = 64}
125 126
newnode.special_tiles = "underworlds_water_poison_source_animated.png"
newnode.tiles = "underworlds_water_poison_source_animated.png"
Duane Robertson's avatar
Duane Robertson committed
127 128 129 130 131 132 133 134 135
minetest.register_node("underworlds:water_poison_source", newnode)

newnode = underworlds_mod.clone_node("default:water_flowing")
newnode.description = "Poisonous Water"
newnode.groups.poison = 3
newnode.light_source = 6
newnode.liquid_alternative_flowing = "underworlds:water_poison_flowing"
newnode.liquid_alternative_source = "underworlds:water_poison_source"
newnode.post_effect_color = {a = 103, r = 108, g = 128, b = 64}
136 137
newnode.special_tiles = "underworlds_water_poison_flowing_animated.png"
newnode.tiles = "underworlds_water_poison.png"
Duane Robertson's avatar
Duane Robertson committed
138
minetest.register_node("underworlds:water_poison_flowing", newnode)
139 140 141
]]
minetest.register_alias("underworlds:water_poison_source", "loud_walking:water_poison_source")
minetest.register_alias("underworlds:water_poison_flowing", "loud_walking:water_poison_flowing")
Duane Robertson's avatar
Duane Robertson committed
142

Duane Robertson's avatar
Duane Robertson committed
143 144 145 146 147 148 149 150 151 152 153 154 155 156
-- ice, thin -- transparent
minetest.register_node("underworlds:thin_ice", {
  description = "Thin Ice",
  tiles = {"caverealms_thin_ice.png"},
  is_ground_content = true,
  groups = {cracky=3},
  sounds = default.node_sound_glass_defaults(),
  use_texture_alpha = true,
  light_source = 1,
  drawtype = "glasslike",
  sunlight_propagates = true,
  freezemelt = "default:water_source",
  paramtype = "light",
})
Duane Robertson's avatar
Duane Robertson committed
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193

-- Iron, hot
newnode = underworlds_mod.clone_node("default:steelblock")
newnode.description = "Hot Iron Block"
newnode.tiles = {"default_steel_block.png^[colorize:#FF3000:150"}
newnode.groups.surface_hot=3
newnode.light_source = 3
minetest.register_node("underworlds:hot_iron", newnode)

-- Brass, hot
newnode = underworlds_mod.clone_node("default:steelblock")
newnode.description = "Hot Brass Block"
newnode.tiles = {"default_steel_block.png^[colorize:#FFBF00:150"}
newnode.groups.surface_hot=3
newnode.light_source = 2
minetest.register_node("underworlds:hot_brass", newnode)

-- Polluted dirt
newnode = underworlds_mod.clone_node("default:dirt")
newnode.description = "Polluted Dirt"
newnode.tiles = {"default_dirt.png^[colorize:#100020:100"}
newnode.groups.soil = 0
minetest.register_node("underworlds:polluted_dirt", newnode)

-- Bare branches
minetest.register_node('underworlds:sticks_default', {
	description = 'Sticks',
	drawtype = 'allfaces_optional',
	waving = 1,
	visual_scale = 1.3,
	tiles = {'underworlds_dry_twigs.png'},
	paramtype = 'light',
	is_ground_content = false,
	drop = 'default:stick 2',
	groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
})

194
--[[ Black leaves
Duane Robertson's avatar
Duane Robertson committed
195 196 197 198 199 200
newnode = underworlds_mod.clone_node("default:leaves")
newnode.description = "Blackened Leaves"
newnode.tiles = {"default_leaves.png^[colorize:#100020:200"}
newnode.special_tiles = {"default_leaves_simple.png^[colorize:#100020:200"}
newnode.groups = {snappy = 3, flammable = 2}
minetest.register_node("underworlds:leaves_black", newnode)
201 202
]]
minetest.register_alias("underworlds:leaves_black", "loud_walking:leaves_black")
Duane Robertson's avatar
Duane Robertson committed
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248

underworlds_mod.schematics = {}
do
	local w, h, d = 5, 8, 5
	local s = underworlds_mod.schematic_array(w, h, d)

	for y = 0, math.floor(h/2)-1 do
		s.data[2*d*h + y*d + 2 + 1].name = 'default:tree'
		s.data[2*d*h + y*d + 2 + 1].param1 = 255
	end

	for z = 0, d-1 do
		for y = math.floor(h/2), h-1 do
			for x = 0, w-1 do
				if y < h - 1 or (x ~= 0 and x ~= w-1 and z ~= 0 and z ~= d-1) then
					if math.random(2) == 1 then
						s.data[z*d*h + y*d + x + 1].name = 'underworlds:leaves_black'
					else
						s.data[z*d*h + y*d + x + 1].name = 'underworlds:sticks_default'
					end

					if y == h-1 or x == 0 or x == w-1 or z == 0 or z == d-1 then
						s.data[z*d*h + y*d + x + 1].param1 = 150
					else
						s.data[z*d*h + y*d + x + 1].param1 = 225
					end
				end
			end
		end
	end

	for z = math.floor(d/2)-1, math.floor(d/2)+1, 2 do
		for x = math.floor(w/2)-1, math.floor(w/2)+1, 2 do
			s.data[z*d*h + math.floor(h/2)*d + x + 1].name = 'default:tree'
			s.data[z*d*h + math.floor(h/2)*d + x + 1].param1 = 150
		end
	end

	for y = 0, h-1 do
		if y / 3 == math.floor(y / 3) then
			s.yslice_prob[#s.yslice_prob+1] = {ypos=y,prob=170}
		end
	end

	underworlds_mod.schematics['decaying_tree'] = s
end