Added colored blocks and bricks.
|
@ -1,3 +1,6 @@
|
|||
color = {}
|
||||
dofile(minetest.get_modpath('color')..'/stair_functions.lua')
|
||||
|
||||
local function register_color(name)
|
||||
minetest.register_node('color:'..name, {
|
||||
description = name,
|
||||
|
@ -8,3 +11,89 @@ end
|
|||
|
||||
register_color('black')
|
||||
register_color('white')
|
||||
|
||||
color.make_darker = function(pos, node, puncher, pointed_thing)
|
||||
local player = puncher:get_player_name()
|
||||
local wield = puncher:get_wielded_item()
|
||||
local wield_name = wield:get_name()
|
||||
if minetest.is_protected(pos, player) and not minetest.check_player_privs(puncher, 'protection_bypass') or wield_name == 'creative:tool_breaking' then
|
||||
return
|
||||
end
|
||||
minetest.swap_node(pos, {name = node.name, param2 = node.param2+32})
|
||||
end
|
||||
|
||||
color.make_lighter = function(pos, node, clicker)
|
||||
local player = clicker:get_player_name()
|
||||
if minetest.is_protected(pos, player) and not minetest.check_player_privs(clicker, 'protection_bypass') then
|
||||
return
|
||||
end
|
||||
minetest.swap_node(pos, {name = node.name, param2 = node.param2-32})
|
||||
end
|
||||
|
||||
local colors = { -- description, node name, hex color
|
||||
{'Red', 'red', '#ff6666'},
|
||||
{'Orange', 'orange', '#ffb366'},
|
||||
{'Yellow', 'yellow', '#ffff66'},
|
||||
{'Green', 'green', '#66ff66'},
|
||||
{'Blue', 'blue', '#6666ff'},
|
||||
{'Violet', 'violet', '#bc66ff'},
|
||||
{'Grey', 'grey', '#929292'}
|
||||
}
|
||||
|
||||
for i in ipairs(colors) do
|
||||
local desc = colors[i][1]
|
||||
local name = colors[i][2]
|
||||
local hex = colors[i][3]
|
||||
|
||||
minetest.register_node('color:'..name, {
|
||||
description = desc,
|
||||
tiles = {{name='color_speckled.png', align_style='world', scale=4}},
|
||||
paramtype2 = 'colorfacedir',
|
||||
palette = 'color_'..name..'.png',
|
||||
color = hex,
|
||||
groups = {breakable=1},
|
||||
on_punch = color.make_darker,
|
||||
on_rightclick = color.make_lighter,
|
||||
})
|
||||
|
||||
color.register_stair_and_slab(name,
|
||||
{{name='color_speckled.png', align_style='world', scale=4}},
|
||||
'color_'..name..'.png',
|
||||
hex,
|
||||
true)
|
||||
|
||||
minetest.register_node('color:'..name..'_blocks', {
|
||||
description = desc..' Blocks',
|
||||
tiles = {{name='color_blocks.png', align_style='world', scale=4}},
|
||||
paramtype2 = 'colorfacedir',
|
||||
palette = 'color_'..name..'.png',
|
||||
color = hex,
|
||||
groups = {breakable=1},
|
||||
on_punch = color.make_darker,
|
||||
on_rightclick = color.make_lighter,
|
||||
})
|
||||
|
||||
color.register_stair_and_slab(name..'_blocks',
|
||||
{{name='color_blocks.png', align_style='world', scale=4}},
|
||||
'color_'..name..'.png',
|
||||
hex,
|
||||
true)
|
||||
|
||||
minetest.register_node('color:'..name..'_bricks', {
|
||||
description = desc..' Bricks',
|
||||
tiles = {{name='color_bricks.png', align_style='world', scale=4}},
|
||||
paramtype2 = 'colorfacedir',
|
||||
palette = 'color_'..name..'.png',
|
||||
color = hex,
|
||||
groups = {breakable=1},
|
||||
on_punch = color.make_darker,
|
||||
on_rightclick = color.make_lighter,
|
||||
})
|
||||
|
||||
color.register_stair_and_slab(name..'_bricks',
|
||||
{{name='color_bricks.png', align_style='world', scale=4}},
|
||||
'color_'..name..'.png',
|
||||
hex,
|
||||
true)
|
||||
|
||||
end
|
||||
|
|
|
@ -0,0 +1,278 @@
|
|||
--Copied from MTG. Required as own file for color related changes.
|
||||
-- Load support for MT game translation.
|
||||
|
||||
local function rotate_and_place(itemstack, placer, pointed_thing)
|
||||
local p0 = pointed_thing.under
|
||||
local p1 = pointed_thing.above
|
||||
local param2 = 0
|
||||
|
||||
if placer then
|
||||
local placer_pos = placer:get_pos()
|
||||
if placer_pos then
|
||||
param2 = minetest.dir_to_facedir(vector.subtract(p1, placer_pos))
|
||||
end
|
||||
|
||||
local finepos = minetest.pointed_thing_to_face_pos(placer, pointed_thing)
|
||||
local fpos = finepos.y % 1
|
||||
|
||||
if p0.y - 1 == p1.y or (fpos > 0 and fpos < 0.5)
|
||||
or (fpos < -0.5 and fpos > -0.999999999) then
|
||||
param2 = param2 + 20
|
||||
if param2 == 21 then
|
||||
param2 = 23
|
||||
elseif param2 == 23 then
|
||||
param2 = 21
|
||||
end
|
||||
end
|
||||
end
|
||||
return minetest.item_place(itemstack, placer, pointed_thing, param2)
|
||||
end
|
||||
|
||||
-- Register stair
|
||||
-- Node will be called stairs:stair_<subname>
|
||||
|
||||
function color.register_stair(subname, images, palette, hex, worldaligntex)
|
||||
-- Set backface culling and world-aligned textures
|
||||
local stair_images = {}
|
||||
for i, image in ipairs(images) do
|
||||
if type(image) == 'string' then
|
||||
stair_images[i] = {
|
||||
name = image,
|
||||
backface_culling = true,
|
||||
}
|
||||
if worldaligntex then
|
||||
stair_images[i].align_style = 'world'
|
||||
end
|
||||
else
|
||||
stair_images[i] = table.copy(image)
|
||||
if stair_images[i].backface_culling == nil then
|
||||
stair_images[i].backface_culling = true
|
||||
end
|
||||
if worldaligntex and stair_images[i].align_style == nil then
|
||||
stair_images[i].align_style = 'world'
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.register_node(':stairs:stair_' .. subname, {
|
||||
description = subname..' stair',
|
||||
drawtype = 'nodebox',
|
||||
tiles = stair_images,
|
||||
palette = palette,
|
||||
color = hex,
|
||||
paramtype = 'light',
|
||||
paramtype2 = 'colorfacedir',
|
||||
is_ground_content = false,
|
||||
groups = {breakable=1},
|
||||
node_box = {
|
||||
type = 'fixed',
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0.0, 0.5},
|
||||
{-0.5, 0.0, 0.0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type ~= 'node' then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
return rotate_and_place(itemstack, placer, pointed_thing)
|
||||
end,
|
||||
on_punch = color.make_darker,
|
||||
on_rightclick = color.make_lighter,
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
-- Register slab
|
||||
-- Node will be called stairs:slab_<subname>
|
||||
|
||||
function color.register_slab(subname, images, palette, hex, worldaligntex)
|
||||
-- Set world-aligned textures
|
||||
local slab_images = {}
|
||||
for i, image in ipairs(images) do
|
||||
if type(image) == 'string' then
|
||||
slab_images[i] = {
|
||||
name = image,
|
||||
}
|
||||
if worldaligntex then
|
||||
slab_images[i].align_style = 'world'
|
||||
end
|
||||
else
|
||||
slab_images[i] = table.copy(image)
|
||||
if worldaligntex and image.align_style == nil then
|
||||
slab_images[i].align_style = 'world'
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.register_node(':stairs:slab_' .. subname, {
|
||||
description = subname..' slab',
|
||||
drawtype = 'nodebox',
|
||||
tiles = slab_images,
|
||||
palette = palette,
|
||||
color = hex,
|
||||
paramtype = 'light',
|
||||
paramtype2 = 'colorfacedir',
|
||||
is_ground_content = false,
|
||||
groups = {breakable=1},
|
||||
node_box = {
|
||||
type = 'fixed',
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local under = minetest.get_node(pointed_thing.under)
|
||||
local wield_item = itemstack:get_name()
|
||||
local player_name = placer and placer:get_player_name() or ''
|
||||
local creative_enabled = (creative and creative.is_enabled_for
|
||||
and creative.is_enabled_for(player_name))
|
||||
|
||||
if under and under.name:find('^stairs:slab_') then
|
||||
-- place slab using under node orientation
|
||||
local dir = minetest.dir_to_colorfacedir(vector.subtract(
|
||||
pointed_thing.above, pointed_thing.under), true)
|
||||
|
||||
local p2 = under.param2
|
||||
|
||||
-- Placing a slab on an upside down slab should make it right-side up.
|
||||
if p2 >= 20 and dir == 8 then
|
||||
p2 = p2 - 20
|
||||
-- same for the opposite case: slab below normal slab
|
||||
elseif p2 <= 3 and dir == 4 then
|
||||
p2 = p2 + 20
|
||||
end
|
||||
|
||||
-- else attempt to place node with proper param2
|
||||
minetest.item_place_node(ItemStack(wield_item), placer, pointed_thing, p2)
|
||||
if not creative_enabled then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
else
|
||||
return rotate_and_place(itemstack, placer, pointed_thing)
|
||||
end
|
||||
end,
|
||||
on_punch = color.make_darker,
|
||||
on_rightclick = color.make_lighter,
|
||||
})
|
||||
end
|
||||
|
||||
-- Register inner stair
|
||||
-- Node will be called stairs:stair_inner_<subname>
|
||||
|
||||
function color.register_stair_inner(subname, images, palette, hex, worldaligntex)
|
||||
-- Set backface culling and world-aligned textures
|
||||
local stair_images = {}
|
||||
for i, image in ipairs(images) do
|
||||
if type(image) == 'string' then
|
||||
stair_images[i] = {
|
||||
name = image,
|
||||
backface_culling = true,
|
||||
}
|
||||
if worldaligntex then
|
||||
stair_images[i].align_style = 'world'
|
||||
end
|
||||
else
|
||||
stair_images[i] = table.copy(image)
|
||||
if stair_images[i].backface_culling == nil then
|
||||
stair_images[i].backface_culling = true
|
||||
end
|
||||
if worldaligntex and stair_images[i].align_style == nil then
|
||||
stair_images[i].align_style = 'world'
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.register_node(':stairs:stair_inner_' .. subname, {
|
||||
description = subname..' inner stair',
|
||||
drawtype = 'nodebox',
|
||||
tiles = stair_images,
|
||||
palette = palette,
|
||||
color = hex,
|
||||
paramtype = 'light',
|
||||
paramtype2 = 'colorfacedir',
|
||||
is_ground_content = false,
|
||||
groups = {breakable=1},
|
||||
sounds = sounds,
|
||||
node_box = {
|
||||
type = 'fixed',
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0.0, 0.5},
|
||||
{-0.5, 0.0, 0.0, 0.5, 0.5, 0.5},
|
||||
{-0.5, 0.0, -0.5, 0.0, 0.5, 0.0},
|
||||
},
|
||||
},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type ~= 'node' then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
return rotate_and_place(itemstack, placer, pointed_thing)
|
||||
end,
|
||||
on_punch = color.make_darker,
|
||||
on_rightclick = color.make_lighter,
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
-- Register outer stair
|
||||
-- Node will be called stairs:stair_outer_<subname>
|
||||
|
||||
function color.register_stair_outer(subname, images, palette, hex, worldaligntex)
|
||||
-- Set backface culling and world-aligned textures
|
||||
local stair_images = {}
|
||||
for i, image in ipairs(images) do
|
||||
if type(image) == 'string' then
|
||||
stair_images[i] = {
|
||||
name = image,
|
||||
backface_culling = true,
|
||||
}
|
||||
if worldaligntex then
|
||||
stair_images[i].align_style = 'world'
|
||||
end
|
||||
else
|
||||
stair_images[i] = table.copy(image)
|
||||
if stair_images[i].backface_culling == nil then
|
||||
stair_images[i].backface_culling = true
|
||||
end
|
||||
if worldaligntex and stair_images[i].align_style == nil then
|
||||
stair_images[i].align_style = 'world'
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.register_node(':stairs:stair_outer_' .. subname, {
|
||||
description = subname..' outer stair',
|
||||
drawtype = 'nodebox',
|
||||
tiles = stair_images,
|
||||
palette = palette,
|
||||
color = hex,
|
||||
paramtype = 'light',
|
||||
paramtype2 = 'colorfacedir',
|
||||
is_ground_content = false,
|
||||
groups = {breakable=1},
|
||||
node_box = {
|
||||
type = 'fixed',
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0.0, 0.5},
|
||||
{-0.5, 0.0, 0.0, 0.0, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type ~= 'node' then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
return rotate_and_place(itemstack, placer, pointed_thing)
|
||||
end,
|
||||
on_punch = color.make_darker,
|
||||
on_rightclick = color.make_lighter,
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
-- Stair/slab registration function.
|
||||
-- Nodes will be called stairs:{stair,slab}_<subname>
|
||||
|
||||
function color.register_stair_and_slab(subname, images, palette, hex, worldaligntex)
|
||||
color.register_stair(subname, images, palette, hex, worldaligntex)
|
||||
color.register_stair_inner(subname, images, palette, hex, worldaligntex)
|
||||
color.register_stair_outer(subname, images, palette, hex, worldaligntex)
|
||||
color.register_slab(subname, images, palette, hex, worldaligntex)
|
||||
end
|
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 5.4 KiB |
|
@ -2,10 +2,12 @@ decals = {}
|
|||
|
||||
decals.on_punch = function(pos, node, puncher, pointed_thing)
|
||||
local player = puncher:get_player_name()
|
||||
if minetest.is_protected(pos, player) and not minetest.check_player_privs(puncher, 'protection_bypass') then
|
||||
local wield = puncher:get_wielded_item()
|
||||
local wield_name = wield:get_name()
|
||||
if minetest.is_protected(pos, player) and not minetest.check_player_privs(puncher, 'protection_bypass') or wield_name == 'creative:tool_breaking' then
|
||||
return
|
||||
end
|
||||
minetest.swap_node(pos, {name = node.name, param2 = node.param2-32})
|
||||
minetest.swap_node(pos, {name = node.name, param2 = node.param2+32})
|
||||
end
|
||||
|
||||
decals.on_rightclick = function(pos, node, clicker)
|
||||
|
@ -13,7 +15,7 @@ decals.on_rightclick = function(pos, node, clicker)
|
|||
if minetest.is_protected(pos, player) and not minetest.check_player_privs(clicker, 'protection_bypass') then
|
||||
return
|
||||
end
|
||||
minetest.swap_node(pos, {name = node.name, param2 = node.param2+32})
|
||||
minetest.swap_node(pos, {name = node.name, param2 = node.param2-32})
|
||||
end
|
||||
|
||||
function decals.register_decal(name, desc)
|
||||
|
|
|
@ -21,10 +21,12 @@ furniture.dyes = {
|
|||
|
||||
furniture.dye_more = function(pos, node, puncher, pointed_thing)
|
||||
local player = puncher:get_player_name()
|
||||
if minetest.is_protected(pos, player) and not minetest.check_player_privs(puncher, 'protection_bypass') then
|
||||
local wield = puncher:get_wielded_item()
|
||||
local wield_name = wield:get_name()
|
||||
if minetest.is_protected(pos, player) and not minetest.check_player_privs(puncher, 'protection_bypass') or wield_name == 'creative:tool_breaking' then
|
||||
return
|
||||
end
|
||||
minetest.swap_node(pos, {name = node.name, param2 = node.param2-32})
|
||||
minetest.swap_node(pos, {name = node.name, param2 = node.param2+32})
|
||||
end
|
||||
|
||||
furniture.dye_less = function(pos, node, clicker)
|
||||
|
@ -32,7 +34,7 @@ furniture.dye_less = function(pos, node, clicker)
|
|||
if minetest.is_protected(pos, player) and not minetest.check_player_privs(clicker, 'protection_bypass') then
|
||||
return
|
||||
end
|
||||
minetest.swap_node(pos, {name = node.name, param2 = node.param2+32})
|
||||
minetest.swap_node(pos, {name = node.name, param2 = node.param2-32})
|
||||
end
|
||||
|
||||
dofile(minetest.get_modpath('furniture')..'/bedroom.lua') --Things you'd find in a bedroom.
|
||||
|
|
|
@ -11,4 +11,5 @@ dofile(minetest.get_modpath('tasks')..'/engine_0.lua')
|
|||
dofile(minetest.get_modpath('tasks')..'/engine_1.lua')
|
||||
dofile(minetest.get_modpath('tasks')..'/example.lua')
|
||||
dofile(minetest.get_modpath('tasks')..'/items.lua')
|
||||
dofile(minetest.get_modpath('tasks')..'/rubbish.lua')
|
||||
dofile(minetest.get_modpath('tasks')..'/storage_locker.lua')
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg width="64" height="64" viewBox="0 0 64 64"
|
||||
xmlns="http://www.w3.org/2000/svg" version="1.1">
|
||||
<desc>models.blend, (Blender 2.91.2)</desc>
|
||||
<polygon stroke="black" stroke-width="1" fill="rgb(204, 204, 204)" fill-opacity="0.25" points="0.000,64.000 0.000,36.000 20.000,36.000 20.000,64.000 " />
|
||||
<polygon stroke="black" stroke-width="1" fill="rgb(204, 204, 204)" fill-opacity="0.25" points="22.000,64.000 22.000,36.000 50.000,36.000 50.000,64.000 " />
|
||||
<polygon stroke="black" stroke-width="1" fill="rgb(204, 204, 204)" fill-opacity="0.25" points="20.000,64.000 20.000,36.000 0.000,36.000 0.000,64.000 " />
|
||||
<polygon stroke="black" stroke-width="1" fill="rgb(204, 204, 204)" fill-opacity="0.25" points="50.000,64.000 50.000,36.000 22.000,36.000 22.000,64.000 " />
|
||||
<polygon stroke="black" stroke-width="1" fill="rgb(204, 204, 204)" fill-opacity="0.25" points="28.000,20.000 28.000,0.000 26.000,2.000 26.000,18.000 " />
|
||||
<polygon stroke="black" stroke-width="1" fill="rgb(204, 204, 204)" fill-opacity="0.25" points="24.000,20.000 40.000,20.000 40.000,36.000 24.000,36.000 " />
|
||||
<polygon stroke="black" stroke-width="1" fill="rgb(204, 204, 204)" fill-opacity="0.25" points="0.000,0.000 0.000,20.000 2.000,18.000 2.000,2.000 " />
|
||||
<polygon stroke="black" stroke-width="1" fill="rgb(204, 204, 204)" fill-opacity="0.25" points="0.000,20.000 28.000,20.000 26.000,18.000 2.000,18.000 " />
|
||||
<polygon stroke="black" stroke-width="1" fill="rgb(204, 204, 204)" fill-opacity="0.25" points="28.000,0.000 0.000,0.000 2.000,2.000 26.000,2.000 " />
|
||||
<polygon stroke="black" stroke-width="1" fill="rgb(204, 204, 204)" fill-opacity="0.25" points="26.000,2.000 2.000,2.000 2.000,18.000 26.000,18.000 " />
|
||||
<polygon stroke="black" stroke-width="1" fill="rgb(204, 204, 204)" fill-opacity="0.25" points="40.000,20.000 24.000,20.000 24.000,36.000 40.000,36.000 " />
|
||||
<polygon stroke="black" stroke-width="1" fill="rgb(204, 204, 204)" fill-opacity="0.25" points="40.000,20.000 64.000,20.000 64.000,36.000 40.000,36.000 " />
|
||||
<polygon stroke="black" stroke-width="1" fill="rgb(204, 204, 204)" fill-opacity="0.25" points="64.000,20.000 40.000,20.000 40.000,36.000 64.000,36.000 " />
|
||||
|
||||
</svg>
|
After Width: | Height: | Size: 2.2 KiB |
|
@ -0,0 +1,80 @@
|
|||
# Blender v2.91.2 OBJ File: 'models.blend'
|
||||
# www.blender.org
|
||||
o Trash_Bin_Cube.002
|
||||
v -0.437500 -0.500000 0.312500
|
||||
v -0.437500 0.375000 0.312500
|
||||
v -0.437500 -0.500000 -0.312500
|
||||
v -0.437500 0.375000 -0.312500
|
||||
v 0.437500 -0.500000 0.312500
|
||||
v 0.437500 0.375000 0.312500
|
||||
v 0.437500 -0.500000 -0.312500
|
||||
v 0.437500 0.375000 -0.312500
|
||||
v -0.375000 0.375000 0.250000
|
||||
v -0.375000 0.375000 -0.250000
|
||||
v 0.375000 0.375000 -0.250000
|
||||
v 0.375000 0.375000 0.250000
|
||||
v -0.375000 -0.125000 0.250000
|
||||
v -0.375000 -0.125000 -0.250000
|
||||
v 0.375000 -0.125000 -0.250000
|
||||
v 0.375000 -0.125000 0.250000
|
||||
vt 0.000000 0.000000
|
||||
vt 0.000000 0.437500
|
||||
vt 0.312500 0.437500
|
||||
vt 0.312500 0.000000
|
||||
vt 0.343750 0.000000
|
||||
vt 0.343750 0.437500
|
||||
vt 0.781250 0.437500
|
||||
vt 0.781250 0.000000
|
||||
vt 0.312500 0.000000
|
||||
vt 0.312500 0.437500
|
||||
vt 0.000000 0.437500
|
||||
vt 0.000000 0.000000
|
||||
vt 0.781250 0.000000
|
||||
vt 0.781250 0.437500
|
||||
vt 0.343750 0.437500
|
||||
vt 0.343750 0.000000
|
||||
vt 0.437500 0.687500
|
||||
vt 0.437500 1.000000
|
||||
vt 0.406250 0.968750
|
||||
vt 0.406250 0.718750
|
||||
vt 0.375000 0.687500
|
||||
vt 0.625000 0.687500
|
||||
vt 0.625000 0.437500
|
||||
vt 0.375000 0.437500
|
||||
vt 0.000000 1.000000
|
||||
vt 0.000000 0.687500
|
||||
vt 0.031250 0.718750
|
||||
vt 0.031250 0.968750
|
||||
vt 0.406250 0.968750
|
||||
vt 0.031250 0.968750
|
||||
vt 0.031250 0.718750
|
||||
vt 0.406250 0.718750
|
||||
vt 0.625000 0.687500
|
||||
vt 0.375000 0.687500
|
||||
vt 0.375000 0.437500
|
||||
vt 0.625000 0.437500
|
||||
vt 0.625000 0.687500
|
||||
vt 1.000000 0.687500
|
||||
vt 1.000000 0.437500
|
||||
vt 0.625000 0.437500
|
||||
vt 1.000000 0.687500
|
||||
vt 1.000000 0.437500
|
||||
vn -1.0000 0.0000 0.0000
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
vn 1.0000 0.0000 0.0000
|
||||
vn 0.0000 0.0000 1.0000
|
||||
vn 0.0000 1.0000 0.0000
|
||||
s off
|
||||
f 1/1/1 2/2/1 4/3/1 3/4/1
|
||||
f 3/5/2 4/6/2 8/7/2 7/8/2
|
||||
f 7/9/3 8/10/3 6/11/3 5/12/3
|
||||
f 5/13/4 6/14/4 2/15/4 1/16/4
|
||||
f 6/17/5 8/18/5 11/19/5 12/20/5
|
||||
f 12/21/1 11/22/1 15/23/1 16/24/1
|
||||
f 4/25/5 2/26/5 9/27/5 10/28/5
|
||||
f 2/26/5 6/17/5 12/20/5 9/27/5
|
||||
f 8/18/5 4/25/5 10/28/5 11/19/5
|
||||
f 15/29/5 14/30/5 13/31/5 16/32/5
|
||||
f 10/33/3 9/34/3 13/35/3 14/36/3
|
||||
f 9/37/2 12/38/2 16/39/2 13/40/2
|
||||
f 11/41/4 10/33/4 14/36/4 15/42/4
|
|
@ -0,0 +1,119 @@
|
|||
local trash_bin_setup =
|
||||
'size[6,3]'..
|
||||
'label[.5,.25;How much XP should be given for picking up trash?]'..
|
||||
'field[1,1.5;5,1;input;;]'..
|
||||
'button_exit[2,2;2,1;save;Submit]'
|
||||
|
||||
local trash_bin_formspec =
|
||||
'size[8,6]'..
|
||||
'textarea[.5,;5,2;;;Put trash in its place]' ..
|
||||
'list[current_name;trash;6,1;1,1;]'..
|
||||
'list[current_player;main;0,3;8,3;]'
|
||||
|
||||
minetest.register_node('tasks:trash_bin', { --This is the node that can be placed.
|
||||
description = 'Trash Bin',
|
||||
drawtype = 'mesh',
|
||||
mesh = 'tasks_trash_bin.obj',
|
||||
tiles = {'tasks_trash_bin.png'},
|
||||
paramtype2 = 'facedir',
|
||||
groups = {breakable=1},
|
||||
selection_box = {
|
||||
type = 'fixed',
|
||||
fixed = {{-.4, -.5, -.3, .4, .35, .3}}
|
||||
},
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size('trash', 1)
|
||||
meta:set_string('infotext', 'Unconfigured trash bin')
|
||||
meta:set_string('formspec', trash_bin_setup)
|
||||
meta:set_string('xp', '')
|
||||
end,
|
||||
on_receive_fields = function(pos, forname, fields, sender)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if fields ['save'] then
|
||||
if not fields.input or fields.input == "" then
|
||||
return
|
||||
end
|
||||
if tasks.is_integer(fields.input) then
|
||||
meta:set_string('xp', fields.input)
|
||||
meta:set_string('infotext', 'Trash Bin')
|
||||
meta:set_string('formspec', trash_bin_formspec)
|
||||
else
|
||||
minetest.chat_send_player(sender:get_player_name(), 'Double check your input please.')
|
||||
end
|
||||
end
|
||||
end,
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
if listname == 'trash' then
|
||||
local item = string.sub(stack:get_name(), -7, -3)
|
||||
if item == 'trash' then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
end
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local name = player:get_player_name()
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local xp = tonumber(meta:get_string('xp'))
|
||||
inv:set_stack(listname, index, nil)
|
||||
tasks.only_add_xp(xp, name)
|
||||
minetest.chat_send_player(name, 'Thanks for doing your part!')
|
||||
end,
|
||||
})
|
||||
|
||||
for i = 1,2 do
|
||||
|
||||
minetest.register_node('tasks:trash_'..i, {
|
||||
description = 'Rubbish',
|
||||
drawtype = 'mesh',
|
||||
mesh = 'decals_mesh.obj',
|
||||
tiles = {'tasks_trash_'..i..'.png'},
|
||||
use_texture_alpha = 'clip',
|
||||
inventory_image = 'tasks_trash_'..i..'.png',
|
||||
wield_image = 'tasks_trash_'..i..'.png',
|
||||
paramtype = 'light',
|
||||
paramtype2 = 'facedir',
|
||||
walkable = false,
|
||||
sunlight_propagates = true,
|
||||
stack_max = 1,
|
||||
groups = {breakable=1},
|
||||
selection_box = {
|
||||
type = 'fixed',
|
||||
fixed = {{-.4, -.5, -.4, .4, -.45, .4}}
|
||||
},
|
||||
on_drop = lobby.no_drop,
|
||||
on_punch = function(pos, node, puncher, pointed_thing)
|
||||
local player_inv = puncher:get_inventory()
|
||||
if not player_inv:contains_item('main', {name='tasks:trash_'..i, count = 1}) then
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
player_inv:add_item('main', 'tasks:trash_'..i)
|
||||
minetest.set_node(pos, {name = 'tasks:trash', param2 = 1})
|
||||
local time = math.random(30,600)
|
||||
timer:start(time)
|
||||
else
|
||||
minetest.chat_send_player(puncher:get_player_name(), 'You can only carry one piece of trash at a time.')
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_node('tasks:trash', {
|
||||
description = 'Invisible Rubbish',
|
||||
drawtype = 'airlike',
|
||||
paramtype = 'light',
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
sunlight_propagates = true,
|
||||
groups = {not_in_creative_inventory=1, breakable=1},
|
||||
on_timer = function(pos)
|
||||
local ran_param2 = math.random(0,3)
|
||||
local trash_ran = math.random(1,2)
|
||||
minetest.set_node(pos, {name = 'tasks:trash_'..trash_ran, param2 = ran_param2})
|
||||
end,
|
||||
})
|
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 4.7 KiB |