homedecor_modpack/homedecor/exterior.lua

357 lines
10 KiB
Lua
Raw Normal View History

2015-02-25 10:35:29 +01:00
local S = homedecor.gettext
2015-03-29 08:53:23 +02:00
local bbq_cbox = {
type = "fixed",
fixed = { -0.5, -0.5, -0.3125, 0.5, 0.53125, 0.3125 }
}
2015-02-25 10:35:29 +01:00
homedecor.register("barbecue", {
description = "Barbecue",
2015-03-29 08:53:23 +02:00
mesh = "homedecor_barbecue.obj",
2015-02-25 10:35:29 +01:00
tiles = {
"homedecor_generic_metal_black.png",
2015-03-29 08:53:23 +02:00
{ name="homedecor_embers.png",
animation={
type="vertical_frames",
aspect_w=16,
aspect_h=16,
length=2
}
},
"homedecor_barbecue_meat.png",
2015-02-25 10:35:29 +01:00
},
groups = { snappy=3 },
light_source = 9,
2015-03-29 08:53:23 +02:00
selection_box = bbq_cbox,
collision_box = bbq_cbox,
2015-04-29 14:14:36 +02:00
sounds = default.node_sound_stone_defaults(),
2015-03-29 08:53:23 +02:00
expand = { top="air" },
2015-02-25 10:35:29 +01:00
})
2015-03-29 08:53:23 +02:00
minetest.register_alias("homedecor:barbecue_meat", "air")
2015-02-25 10:35:29 +01:00
2015-04-30 23:52:23 +02:00
local bl1_sbox = {
2015-04-15 15:05:12 +02:00
type = "fixed",
fixed = { -0.5, -0.5, -0.25, 1.5, 0.5, 0.5 }
}
2015-02-25 10:35:29 +01:00
2015-04-30 23:52:23 +02:00
local bl1_cbox = {
type = "fixed",
fixed = {
2015-04-30 23:52:23 +02:00
{-0.5, -0.5, -0.25, 1.5, 0, 0.5 },
{-0.5, -0.5, 0.45, 1.5, 0.5, 0.5 },
}
}
2015-04-15 15:05:12 +02:00
homedecor.register("bench_large_1", {
mesh = "homedecor_bench_large_1.obj",
2015-02-25 10:35:29 +01:00
tiles = {
"homedecor_generic_wood_old.png",
"homedecor_generic_metal_wrought_iron.png"
2015-02-25 10:35:29 +01:00
},
2015-04-15 15:05:12 +02:00
description = "Garden Bench (style 1)",
inventory_image = "homedecor_bench_large_1_inv.png",
groups = { snappy = 3 },
expand = { right="air" },
sounds = default.node_sound_wood_defaults(),
2015-04-30 23:52:23 +02:00
selection_box = bl1_sbox,
node_box = bl1_cbox,
on_rotate = screwdriver.disallow
2015-02-25 10:35:29 +01:00
})
2015-04-15 15:05:12 +02:00
minetest.register_alias("homedecor:bench_large_1_left", "homedecor:bench_large_1")
minetest.register_alias("homedecor:bench_large_1_right", "air")
2015-02-25 10:35:29 +01:00
2015-04-30 23:52:23 +02:00
local bl2_sbox = {
2015-04-15 21:28:52 +02:00
type = "fixed",
fixed = { -0.5, -0.5, -0.25, 1.5, 0.5, 0.5 }
}
2015-04-30 23:52:23 +02:00
local bl2_cbox = {
type = "fixed",
fixed = {
2015-04-30 23:52:23 +02:00
{-0.5, -0.5, -0.25, 1.5, 0, 0.5 },
{-0.5, -0.5, 0.45, 1.5, 0.5, 0.5 },
}
}
2015-04-15 21:28:52 +02:00
homedecor.register("bench_large_2", {
2015-02-25 10:35:29 +01:00
description = "Garden Bench (style 2)",
2015-04-15 21:28:52 +02:00
mesh = "homedecor_bench_large_2.obj",
tiles = { "homedecor_generic_wood_old.png" },
2015-02-25 10:35:29 +01:00
inventory_image = "homedecor_bench_large_2_inv.png",
groups = {snappy=3},
2015-04-30 23:52:23 +02:00
selection_box = bl2_sbox,
node_box = bl2_cbox,
2015-04-15 21:28:52 +02:00
expand = { right="air" },
2015-04-29 14:14:36 +02:00
sounds = default.node_sound_wood_defaults(),
on_rotate = screwdriver.disallow
2015-02-25 10:35:29 +01:00
})
2015-04-15 21:28:52 +02:00
minetest.register_alias("homedecor:bench_large_2_left", "homedecor:bench_large_2")
minetest.register_alias("homedecor:bench_large_2_right", "air")
2015-02-25 10:35:29 +01:00
2015-04-09 15:00:29 +02:00
local dc_cbox = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 1 }
}
2015-02-25 10:35:29 +01:00
2015-04-09 15:00:29 +02:00
homedecor.register("deckchair", {
mesh = "homedecor_deckchair.obj",
tiles = {"homedecor_deckchair.png"},
description = "Deck Chair",
2015-02-25 10:35:29 +01:00
groups = { snappy = 3 },
2015-04-09 15:00:29 +02:00
expand = { forward="air" },
sounds = default.node_sound_wood_defaults(),
selection_box = dc_cbox,
collision_box = dc_cbox,
on_rotate = screwdriver.disallow
2015-02-25 10:35:29 +01:00
})
2015-04-09 15:00:29 +02:00
minetest.register_alias("homedecor:deckchair_foot", "homedecor:deckchair")
minetest.register_alias("homedecor:deckchair_head", "air")
homedecor.register("deckchair_striped_blue", {
mesh = "homedecor_deckchair.obj",
tiles = {"homedecor_deckchair_striped_blue.png"},
description = "Deck Chair",
groups = { snappy = 3 },
expand = { forward="air" },
sounds = default.node_sound_wood_defaults(),
selection_box = dc_cbox,
collision_box = dc_cbox,
on_rotate = screwdriver.disallow
})
2015-03-21 03:01:37 +01:00
homedecor.register("doghouse", {
mesh = "homedecor_doghouse.obj",
2015-02-25 10:35:29 +01:00
tiles = {
2015-03-21 03:01:37 +01:00
"homedecor_shingles_terracotta.png",
"default_wood.png",
"building_blocks_towel.png"
2015-02-25 10:35:29 +01:00
},
description = "Doghouse",
inventory_image = "homedecor_doghouse_inv.png",
selection_box = homedecor.nodebox.slab_y(1.5),
2015-03-21 03:01:37 +01:00
collision_box = homedecor.nodebox.slab_y(1.5),
2015-02-25 10:35:29 +01:00
groups = {snappy=3},
2015-03-21 03:01:37 +01:00
expand = { top="air" },
2015-04-29 14:14:36 +02:00
sounds = default.node_sound_wood_defaults(),
on_rotate = screwdriver.rotate_simple
2015-02-25 10:35:29 +01:00
})
2015-03-21 03:01:37 +01:00
minetest.register_alias("homedecor:doghouse_roof", "air")
minetest.register_alias("homedecor:doghouse_base", "homedecor:doghouse")
2015-02-25 10:35:29 +01:00
homedecor.register("simple_bench", {
tiles = { "homedecor_generic_wood_old.png" },
2015-02-25 10:35:29 +01:00
description = "Simple Bench",
groups = {snappy=3},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.15, 0, 0.5, -0.05, 0.4},
{-0.4, -0.5, 0.1, -0.3, -0.15, 0.3},
{ 0.3, -0.5, 0.1, 0.4, -0.15, 0.3},
}
},
2015-04-29 14:14:36 +02:00
sounds = default.node_sound_wood_defaults(),
2015-02-25 10:35:29 +01:00
})
homedecor.register("stonepath", {
description = "Garden stone path",
tiles = {
"default_stone.png"
},
inventory_image = "homedecor_stonepath_inv.png",
groups = { snappy=3 },
node_box = {
type = "fixed",
fixed = {
{-0.4375, -0.5, 0.3125, -0.3125, -0.48, 0.4375}, -- NodeBox1
{-0.25, -0.5, 0.125, 0, -0.48, 0.375}, -- NodeBox2
{0.125, -0.5, 0.125, 0.4375, -0.48, 0.4375}, -- NodeBox3
{-0.4375, -0.5, -0.125, -0.25, -0.48, 0.0625}, -- NodeBox4
{-0.0625, -0.5, -0.25, 0.25, -0.48, 0.0625}, -- NodeBox5
{0.3125, -0.5, -0.25, 0.4375, -0.48, -0.125}, -- NodeBox6
{-0.3125, -0.5, -0.375, -0.125, -0.48, -0.1875}, -- NodeBox7
{0.125, -0.5, -0.4375, 0.25, -0.48, -0.3125}, -- NodeBox8
}
},
selection_box = {
type = "fixed",
fixed = { -0.4375, -0.5, -0.4375, 0.4375, -0.4, 0.4375 }
2015-04-29 14:14:36 +02:00
},
sounds = default.node_sound_stone_defaults(),
2015-02-25 10:35:29 +01:00
})
2015-05-12 16:44:16 +02:00
local lattice_colors = {
{"wood", ".png^[colorize:#704214:180"},
{"white_wood", ".png"},
{"wood_vegetal", ".png^[colorize:#704214:180^homedecor_lattice_vegetal.png"},
{"white_wood_vegetal", ".png^homedecor_lattice_vegetal.png"},
}
for _, m in ipairs(lattice_colors) do
homedecor.register("lattice_"..m[1], {
description = "Garden Lattice ("..m[1]..")",
tiles = {"homedecor_lattice"..m[2]},
inventory_image = "homedecor_lattice"..m[2],
groups = { snappy=3 },
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0.47, 0.5, 0.5, 0.47}, -- NodeBox1
2015-05-13 00:03:02 +02:00
{-0.5, 0.421875, 0.44, 0.5, 0.5, 0.5}, -- NodeBox2
{-0.5, -0.5, 0.44, 0.5, -0.421875, 0.5}, -- NodeBox3
{0.421875, -0.5, 0.44, 0.5, 0.5, 0.5}, -- NodeBox4
{-0.5, -0.5, 0.44, -0.421875, 0.5, 0.5} -- NodeBox5
2015-05-12 16:44:16 +02:00
}
},
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0.44, 0.5, 0.5, 0.5}
},
sounds = default.node_sound_wood_defaults(),
})
end
2015-02-25 10:35:29 +01:00
homedecor.register("swing", {
description = "Tree's swing",
tiles = {
"homedecor_swing_top.png",
"homedecor_swing_top.png^[transformR180",
"homedecor_swing_top.png"
},
inventory_image = "homedecor_swing_inv.png",
groups = { snappy=3, oddly_breakable_by_hand=3 },
2015-04-29 14:14:36 +02:00
sounds = default.node_sound_wood_defaults(),
walkable = false,
on_rotate = screwdriver.disallow,
2015-02-25 10:35:29 +01:00
node_box = {
type = "fixed",
fixed = {
{-0.3125, 0.33, -0.125, 0.3125, 0.376, 0.1875}, -- NodeBox1
{-0.3125, 0.376, 0.025, -0.3, 0.5, 0.0375}, -- NodeBox2
{ 0.3, 0.376, 0.025, 0.3125, 0.5, 0.0375}, -- NodeBox3
}
},
selection_box = {
type = "fixed",
fixed = { -0.3125, 0.33, -0.125, 0.3125, 0.5, 0.1875 }
},
on_place = function(itemstack, placer, pointed_thing)
isceiling, pos = homedecor.find_ceiling(itemstack, placer, pointed_thing)
if isceiling then
local height = 0
for i = 0, 4 do -- search up to 5 spaces downward from the ceiling for the first non-buildable-to node...
height = i
local testpos = { x=pos.x, y=pos.y-i-1, z=pos.z }
local testnode = minetest.get_node(testpos)
local testreg = core.registered_nodes[testnode.name]
if not testreg.buildable_to then
if i < 1 then
minetest.chat_send_player(placer:get_player_name(), "No room under there to hang a swing.")
return
else
break
end
end
end
for j = 0, height do -- then fill that space with ropes...
local testpos = { x=pos.x, y=pos.y-j, z=pos.z }
local testnode = minetest.get_node(testpos)
local testreg = core.registered_nodes[testnode.name]
minetest.set_node(testpos, { name = "homedecor:swing_rope", param2 = fdir })
end
minetest.set_node({ x=pos.x, y=pos.y-height, z=pos.z }, { name = "homedecor:swing", param2 = fdir })
if not homedecor.expect_infinite_stacks then
itemstack:take_item()
return itemstack
end
else
minetest.chat_send_player(placer:get_player_name(), "You have to point at the bottom side of an overhanging object to place a swing.")
end
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
for i = 0, 4 do
local testpos = { x=pos.x, y=pos.y+i+1, z=pos.z }
if minetest.get_node(testpos).name == "homedecor:swing_rope" then
minetest.remove_node(testpos)
else
return
end
end
end
})
homedecor.register("swing_rope", {
tiles = {
"homedecor_swingrope_sides.png"
},
groups = { not_in_creative_inventory=1 },
2015-04-29 14:14:36 +02:00
walkable = false,
2015-02-25 10:35:29 +01:00
node_box = {
type = "fixed",
fixed = {
{-0.3125, -0.5, 0.025, -0.3, 0.5, 0.0375}, -- NodeBox1
{0.3, -0.5, 0.025, 0.3125, 0.5, 0.0375}, -- NodeBox2
}
},
selection_box = homedecor.nodebox.null
})
homedecor.register("well", {
mesh = "homedecor_well.obj",
2015-02-25 10:35:29 +01:00
tiles = {
"homedecor_rope_texture.png",
"homedecor_generic_metal_black.png^[brighten",
"default_water.png",
"default_cobble.png",
"default_wood.png",
"homedecor_shingles_wood.png"
2015-02-25 10:35:29 +01:00
},
inventory_image = "homedecor_well_inv.png",
description = "Water well",
groups = { snappy = 3 },
selection_box = homedecor.nodebox.slab_y(2),
collision_box = homedecor.nodebox.slab_y(2),
expand = { top="air" },
2015-04-29 14:14:36 +02:00
sounds = default.node_sound_stone_defaults(),
on_rotate = screwdriver.rotate_simple
2015-02-25 10:35:29 +01:00
})
2015-05-13 23:59:10 +02:00
if minetest.get_modpath("bucket") then
local original_bucket_on_use = minetest.registered_items["bucket:bucket_empty"].on_use
2015-05-13 23:59:10 +02:00
minetest.override_item("bucket:bucket_empty", {
on_use = function(itemstack, user, pointed_thing)
local wielditem = user:get_wielded_item()
local wieldname = itemstack:get_name()
local inv = user:get_inventory()
2015-05-13 23:59:10 +02:00
if pointed_thing.type == "node" and minetest.get_node(pointed_thing.under).name == "homedecor:well" then
if inv:room_for_item("main", "bucket:bucket_water 1") then
wielditem:take_item()
user:set_wielded_item(wielditem)
inv:add_item("main", "bucket:bucket_water 1")
else
minetest.chat_send_player(user:get_player_name(), "No room in your inventory to add a filled bucket!")
end
return wielditem
2015-05-22 22:51:17 +02:00
else if original_bucket_on_use then
original_bucket_on_use(itemstack, user, pointed_thing)
else return end
end
2015-05-22 22:51:17 +02:00
end
2015-05-13 23:59:10 +02:00
})
end
minetest.register_alias("homedecor:well_top", "air")
2015-03-22 18:42:42 +01:00
minetest.register_alias("homedecor:well_base", "homedecor:well")