Combined Stairs and Workbench

master
MoNTE48 2019-06-26 21:31:42 +02:00
parent 9781d89b82
commit 829dce4089
11 changed files with 191 additions and 861 deletions

View File

@ -488,17 +488,18 @@ minetest.register_abm({
local moss_correspondences = {
["default:cobble"] = "default:mossycobble",
-- ["stairs:slab_cobble"] = "stairs:slab_mossycobble",
-- ["stairs:stair_cobble"] = "stairs:stair_mossycobble",
-- ["stairs:stair_inner_cobble"] = "stairs:stair_inner_mossycobble",
-- ["stairs:stair_outer_cobble"] = "stairs:stair_outer_mossycobble",
["stairs:slab_cobble"] = "stairs:slab_mossycobble",
["stairs:stair_cobble"] = "stairs:stair_mossycobble",
["stairs:stair_innerstair_cobble"] = "stairs:stair_innerstair_mossycobble",
["stairs:stair_outerstair_cobble"] = "stairs:stair_outerstair_mossycobble",
-- ["walls:cobble"] = "walls:mossycobble",
}
minetest.register_abm({
label = "Moss growth",
nodenames = {"default:cobble"--[[, "stairs:slab_cobble", "stairs:stair_cobble",
"stairs:stair_inner_cobble", "stairs:stair_outer_cobble",
"walls:cobble"]]},
nodenames = {"default:cobble", "stairs:slab_cobble", "stairs:stair_cobble",
"stairs:stair_innerstair_cobble", "stairs:stair_outerstair_cobble",
-- "walls:cobble"
},
neighbors = {"group:water"},
interval = 16,
chance = 200,

View File

@ -34,10 +34,10 @@ minetest.register_alias("mapgen_pine_needles", "default:pine_needles")
-- Dungeons
minetest.register_alias("mapgen_cobble", "default:cobble")
minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble")
minetest.register_alias("mapgen_stair_cobble", "stairs:stair_default_cobble")
minetest.register_alias("mapgen_mossycobble", "default:mossycobble")
minetest.register_alias("mapgen_sandstonebrick", "default:sandstone")
minetest.register_alias("mapgen_stair_sandstonebrick", "stairs:stair_sandstone")
minetest.register_alias("mapgen_stair_sandstonebrick", "stairs:stair_default_sandstone")
--
-- Register bedrock for Mgv6

View File

@ -1,27 +0,0 @@
MultiCraft Game mod: stairs
Stairs Redo based on Minetest 0.4 mod: stairs
License of source code:
-----------------------
Copyright (C) 2011-2012 Kahrl <kahrl@gmx.net>
Copyright (C) 2011-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3.0 of the License, or
(at your option) any later version.
http://www.gnu.org/licenses/lgpl-3.0.html
License of media (textures and sounds)
--------------------------------------
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
Authors of media files
-----------------------
Everything not listed in here:
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
Note: This mod has been changed by TenPlus1 to include other blocks from different mods as well as corner stairs and slopes... Holding sneak when placing will copy the rotation of the block pointed at to the newly placed stair.

View File

@ -1 +0,0 @@
default

View File

@ -1,601 +0,0 @@
stairs = {}
stairs.mod = "redo"
--[[stairs.wood = default.node_sound_wood_defaults()
stairs.dirt = default.node_sound_dirt_defaults()
stairs.stone = default.node_sound_stone_defaults()
stairs.glass = default.node_sound_glass_defaults()
stairs.leaves = default.node_sound_leaves_defaults()
stairs.metal = default.node_sound_metal_defaults()
stairs.wool = default.node_sound_wool_defaults()]]
-- cache creative
local creative = minetest.settings:get_bool("creative_mode")
function is_creative_enabled_for(name)
if creative or minetest.check_player_privs(name, {creative = true}) then
return true
end
return false
end
-- process textures
local set_textures = function(images)
local stair_images = {}
for i, image in ipairs(images) do
if type(image) == "string" then
stair_images[i] = {
name = image,
backface_culling = true,
align_style = "world",
}
elseif image.backface_culling == nil then -- override using any other value
if stair_images[i].backface_culling == nil then
stair_images[i].backface_culling = true
end
if stair_images[i].align_style == nil then
stair_images[i].align_style = "world"
end
end
end
return stair_images
end
-- placement helper
local stair_place = function(itemstack, placer, pointed_thing, stair_node)
-- if sneak pressed then use param2 in node pointed at when placing
if placer:is_player() and placer:get_player_control().sneak then
local name = placer:get_player_name()
local pos_a = pointed_thing.above
local node_a = minetest.get_node(pos_a)
local def_a = minetest.registered_nodes[node_a.name]
if not def_a.buildable_to
or minetest.is_protected(pos_a, name) then
return itemstack
end
local pos_u = pointed_thing.under
local node_u = minetest.get_node(pos_u)
if minetest.get_item_group(node_u.name, "stair") > 0
or minetest.get_item_group(node_u.name, "slab") > 0 then
minetest.set_node(pos_a, {name = stair_node, param2 = node_u.param2})
if not (creative and creative.is_enabled_for and
creative.is_enabled_for(name)) then
itemstack:take_item()
end
return itemstack
end
end
core.rotate_and_place(itemstack, placer, pointed_thing,
is_creative_enabled_for(placer:get_player_name()),
{invert_wall = placer:get_player_control().sneak})
return itemstack
end
-- Node will be called stairs:stair_<subname>
--[[function stairs.register_stair(subname, recipeitem, groups, images, description, snds, alpha)
local stair_images = set_textures(images)
local new_groups = table.copy(groups)
new_groups.stair = 1
minetest.register_node(":stairs:stair_" .. subname, {
description = description.." Stair",
drawtype = "nodebox",
tiles = stair_images,
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
use_texture_alpha = alpha,
groups = new_groups,
sounds = snds,
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
{-0.5, 0, 0, 0.5, 0.5, 0.5},
},
},
on_place = function(itemstack, placer, pointed_thing)
return stair_place(itemstack, placer, pointed_thing,
"stairs:stair_" .. subname)
end,
})
-- if no recipe item provided then skip craft recipes
if not recipeitem then
return
end
-- stair recipes
minetest.register_craft({
output = "stairs:stair_" .. subname .. " 6",
recipe = {
{recipeitem, "", ""},
{recipeitem, recipeitem, ""},
{recipeitem, recipeitem, recipeitem},
},
})
-- stair to original material recipe
minetest.register_craft({
output = recipeitem .. " 3",
recipe = {
{"stairs:stair_" .. subname, "stairs:stair_" .. subname},
{"stairs:stair_" .. subname, "stairs:stair_" .. subname},
},
})
end]]
-- Node will be called stairs:slab_<subname>
--[[function stairs.register_slab(subname, recipeitem, groups, images, description, snds, alpha)
local slab_images = set_textures(images)
local new_groups = table.copy(groups)
new_groups.slab = 1
minetest.register_node(":stairs:slab_" .. subname, {
description = description.." Slab",
drawtype = "nodebox",
tiles = slab_images,
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
use_texture_alpha = alpha,
groups = new_groups,
sounds = snds,
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
},
on_place = function(itemstack, placer, pointed_thing)
return stair_place(itemstack, placer, pointed_thing,
"stairs:slab_" .. subname)
end,
})
-- if no recipe item provided then skip craft recipes
if not recipeitem then
return
end
-- slab recipe
minetest.register_craft({
output = "stairs:slab_" .. subname .. " 6",
recipe = {
{recipeitem, recipeitem, recipeitem},
},
})
-- slab to original material recipe
minetest.register_craft({
output = recipeitem,
recipe = {
{"stairs:slab_" .. subname},
{"stairs:slab_" .. subname},
},
})
end]]
-- Node will be called stairs:stair_outer_<subname>
function stairs.register_stair_outer(subname, recipeitem, groups, images, description, snds, alpha)
local stair_images = set_textures(images)
local new_groups = table.copy(groups)
new_groups.stair = 1
minetest.register_node(":stairs:stair_outer_" .. subname, {
description = "Outer " .. description .. " Stair",
drawtype = "nodebox",
tiles = stair_images,
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
use_texture_alpha = alpha,
groups = new_groups,
sounds = snds,
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
{-0.5, 0, 0, 0, 0.5, 0.5},
},
},
on_place = function(itemstack, placer, pointed_thing)
return stair_place(itemstack, placer, pointed_thing,
"stairs:stair_outer_" .. subname)
end,
})
-- add alias for old stairs redo name
minetest.register_alias("stairs:corner_" .. subname, "stairs:stair_outer_" .. subname)
-- if no recipe item provided then skip craft recipes
--[[if not recipeitem then
return
end
-- corner stair recipe
minetest.register_craft({
output = "stairs:stair_outer_" .. subname .. " 6",
recipe = {
{"", "", ""},
{"", recipeitem, ""},
{recipeitem, recipeitem, recipeitem},
},
})
-- corner stair to original material recipe
minetest.register_craft({
output = recipeitem .. " 2",
recipe = {
{"stairs:stair_outer_" .. subname, "stairs:stair_outer_" .. subname},
{"stairs:stair_outer_" .. subname, "stairs:stair_outer_" .. subname},
},
})]]
end
-- compatibility function for previous stairs:corner_<subname>
--[[function stairs.register_corner(subname, recipeitem, groups, images, description, snds, alpha)
stairs.register_stair_outer(subname, recipeitem, groups, images, description, snds, alpha)
end]]
-- Node will be called stairs:stair_inner_<subname>
--[[function stairs.register_stair_inner(subname, recipeitem, groups, images, description, snds, alpha)
local stair_images = set_textures(images)
local new_groups = table.copy(groups)
new_groups.stair = 1
minetest.register_node(":stairs:stair_inner_" .. subname, {
description = "Inner " .. description .. " Stair",
drawtype = "nodebox",
tiles = stair_images,
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
use_texture_alpha = alpha,
groups = new_groups,
sounds = snds,
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
{-0.5, 0, 0, 0.5, 0.5, 0.5},
{-0.5, 0, -0.5, 0, 0.5, 0},
},
},
on_place = function(itemstack, placer, pointed_thing)
return stair_place(itemstack, placer, pointed_thing,
"stairs:stair_inner_" .. subname)
end,
})
-- add alias for old stairs redo name
minetest.register_alias("stairs:invcorner_" .. subname, "stairs:stair_inner_" .. subname)
-- if no recipe item provided then skip craft recipes
if not recipeitem then
return
end
-- inside corner stair recipe
minetest.register_craft({
output = "stairs:stair_inner_" .. subname .. " 9",
recipe = {
{recipeitem, recipeitem, ""},
{recipeitem, recipeitem, recipeitem},
{recipeitem, recipeitem, recipeitem},
},
})
-- inside corner stair to original material recipe
minetest.register_craft({
output = recipeitem .. " 3",
recipe = {
{"stairs:stair_inner_" .. subname, "stairs:stair_inner_" .. subname},
{"stairs:stair_inner_" .. subname, "stairs:stair_inner_" .. subname},
},
})
end]]
-- compatibility function for previous stairs:invcorner_<subname>
--[[function stairs.register_invcorner(subname, recipeitem, groups, images, description, snds, alpha)
stairs.register_stair_inner(subname, recipeitem, groups, images, description, snds, alpha)
end]]
-- Node will be called stairs:slope_<subname>
function stairs.register_slope(subname, recipeitem, groups, images, description, snds, alpha)
local stair_images = set_textures(images)
local new_groups = table.copy(groups)
new_groups.stair = 1
minetest.register_node(":stairs:slope_" .. subname, {
description = description .. " Slope",
drawtype = "mesh",
mesh = "stairs_slope.obj",
tiles = stair_images,
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
use_texture_alpha = alpha,
groups = new_groups,
sounds = snds,
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
{-0.5, 0, 0, 0.5, 0.5, 0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
{-0.5, 0, 0, 0.5, 0.5, 0.5},
},
},
on_place = function(itemstack, placer, pointed_thing)
return stair_place(itemstack, placer, pointed_thing,
"stairs:slope_" .. subname)
end,
})
-- slope recipe
--[[minetest.register_craft({
output = "stairs:slope_" .. subname .. " 6",
recipe = {
{recipeitem, "", ""},
{recipeitem, recipeitem, ""},
},
})
-- slope to original material recipe
minetest.register_craft({
output = recipeitem,
recipe = {
{"stairs:slope_" .. subname, "stairs:slope_" .. subname},
},
})]]
end
-- Nodes will be called stairs:{stair,slab}_<subname>
function stairs.register_stair_and_slab(subname, recipeitem, groups, images,
desc_stair, desc_slab, sounds, alpha)
-- stairs.register_stair(subname, recipeitem, groups, images, desc_stair, sounds, alpha)
-- stairs.register_slab(subname, recipeitem, groups, images, desc_slab, sounds, alpha)
stairs.register_slope(subname, recipeitem, groups, images, desc_stair, sounds, alpha)
end
-- Nodes will be called stairs:{stair,slab,corner,invcorner,slope}_<subname>
--[[function stairs.register_all(subname, recipeitem, groups, images, desc, snds, alpha)
stairs.register_stair(subname, recipeitem, groups, images, desc, snds, alpha)
stairs.register_slab(subname, recipeitem, groups, images, desc, snds, alpha)
stairs.register_corner(subname, recipeitem, groups, images, desc, snds, alpha)
stairs.register_invcorner(subname, recipeitem, groups, images, desc, snds, alpha)
stairs.register_slope(subname, recipeitem, groups, images, desc, snds, alpha)
end]]
--[[
local grp = {} -- Helper
--= Default
-- Wood types
stairs.register_all("wood", "default:wood",
{choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
{"default_wood.png"},
"Wooden",
stairs.wood)
stairs.register_all("junglewood", "default:junglewood",
{choppy = 2, oddly_breakable_by_hand = 2, flammable = 3},
{"default_junglewood.png"},
"Jungle Wood",
stairs.wood)
stairs.register_all("pine_wood", "default:pinewood",
{choppy = 2, oddly_breakable_by_hand = 1, flammable = 3},
{"default_pine_wood.png"},
"Pine Wood",
stairs.wood)
stairs.register_all("acacia_wood", "default:acacia_wood",
{choppy = 2, oddly_breakable_by_hand = 1, flammable = 3},
{"default_acacia_wood.png"},
"Acacia Wood",
stairs.wood)
-- Stone types
stairs.register_all("stone", "default:stone",
{cracky = 3, stone=1},
{"default_stone.png"},
"Stone",
stairs.stone)
stairs.register_all("stonebrick", "default:stonebrick",
{cracky = 2},
{"default_stone_brick.png"},
"Stone Brick",
stairs.stone)
stairs.register_all("cobble", "default:cobble",
{cracky = 3},
{"default_cobble.png"},
"Cobble",
stairs.stone)
stairs.register_all("mossycobble", "default:mossycobble",
{cracky = 3},
{"default_mossycobble.png"},
"Mossy Cobble",
stairs.stone)
minetest.register_alias("stairs:mossy_cobble", "stairs:stair_mossycobble")
-- Sandstone types
stairs.register_all("sandstone", "default:sandstone",
{crumbly = 1, cracky = 3},
{"default_sandstone_normal.png"},
"Sandstone",
stairs.stone)
-- Obsidian
stairs.register_all("obsidian", "default:obsidian",
{cracky = 1, level = 2},
{"default_obsidian.png"},
"Obsidian",
stairs.stone)
-- Ores
stairs.register_all("coal", "default:coalblock",
{cracky = 3},
{"default_coal_block.png"},
"Coal",
stairs.stone)
stairs.register_all("steelblock", "default:steelblock",
{cracky = 1, level = 2},
{"default_steel_block.png"},
"Steel",
stairs.metal)
minetest.register_alias("stairs:stair_steel", "stairs:stair_steelblock")
minetest.register_alias("stairs:slab_steel", "stairs:slab_steelblock")
minetest.register_alias("stairs:corner_steel", "stairs:corner_steelblock")
stairs.register_all("goldblock", "default:goldblock",
{cracky = 1},
{"default_gold_block.png"},
"Gold",
stairs.metal)
minetest.register_alias("stairs:stair_gold", "stairs:stair_goldblock")
minetest.register_alias("stairs:slab_gold", "stairs:slab_goldblock")
minetest.register_alias("stairs:corner_gold", "stairs:corner_goldblock")
stairs.register_all("diamondblock", "default:diamondblock",
{cracky = 1, level = 3},
{"default_diamond_block.png"},
"Diamond",
stairs.stone)
minetest.register_alias("stairs:stair_diamond", "stairs:stair_diamondblock")
minetest.register_alias("stairs:slab_diamond", "stairs:slab_diamondblock")
minetest.register_alias("stairs:corner_diamond", "stairs:corner_diamondblock")
-- Glass types
stairs.register_all("glass", "default:glass",
{cracky = 3, oddly_breakable_by_hand = 3},
{"default_glass.png"},
"Glass",
stairs.glass)
-- Brick, Snow and Ice
stairs.register_all("brick", "default:brick",
{cracky = 3},
{"default_brick.png"},
"Brick",
stairs.stone)
stairs.register_all("snowblock", "default:snowblock",
{crumbly = 3, puts_out_fire = 1, cools_lava = 1, snowy = 1},
{"default_snow.png"},
"Snow Block",
default.node_sound_snow_defaults())
stairs.register_all("ice", "default:ice",
{cracky = 3, puts_out_fire = 1, cools_lava = 1},
{"default_ice.png"},
"Ice",
default.node_sound_glass_defaults())
local colours = {
{"black", "Black", "#000000b0"},
{"blue", "Blue", "#015dbb70"},
{"brown", "Brown", "#a78c4570"},
{"cyan", "Cyan", "#01ffd870"},
{"dark_green", "Dark Green", "#005b0770"},
{"dark_grey", "Dark Grey", "#303030b0"},
{"green", "Green", "#61ff0170"},
{"grey", "Grey", "#5b5b5bb0"},
{"magenta", "Magenta", "#ff05bb70"},
{"orange", "Orange", "#ff840170"},
{"pink", "Pink", "#ff65b570"},
{"red", "Red", "#ff000070"},
{"violet", "Violet", "#2000c970"},
{"white", "White", "#abababc0"},
{"yellow", "Yellow", "#e3ff0070"},
}
--= Farming
if minetest.get_modpath("farming") then
stairs.register_all("straw", "farming:straw",
{snappy = 3, flammable = 4},
{"farming_straw_side.png"},
"Straw",
stairs.leaves)
end
--= Mobs
if minetest.registered_nodes["mobs:cheeseblock"] then
grp = {crumbly = 3, flammable = 2}
stairs.register_all("cheeseblock", "mobs:cheeseblock",
grp,
{"mobs_cheeseblock.png"},
"Cheese Block",
stairs.dirt)
end
--= Lapis
stairs.register_all("lapis_block", "lapis:lapis_block",
{cracky = 3},
{"default_lapis_block.png"},
"Lapis",
stairs.stone)
minetest.register_alias("stairs:lapis", "stairs:lapis_block")
minetest.register_alias("stairs:lapisblock", "stairs:lapis_block")
--= Wool
if minetest.get_modpath("wool") then
for i = 1, #colours, 1 do
stairs.register_all("wool_" .. colours[i][1], "wool:" .. colours[i][1],
{snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, flammable = 3},
{"wool_" .. colours[i][1] .. ".png"},
colours[i][2] .. " Wool",
stairs.wool)
end
end]]

View File

@ -1,71 +0,0 @@
# Blender v2.76 (sub 0) OBJ File: ''
# www.blender.org
mtllib simplyslope_slope.mtl
o stairs_top
v -0.5 0.5 0.5
v 0.5 0.5 0.5
o stairs_right
v -0.5 -0.5 -0.5
v -0.5 -0.5 0.5
v -0.5 0.5 0.5
v -0.5 0.0 0.0
vt 0.0 0.0
vt 1.0 0.0
vt 1.0 1.0
vn -1.0 0.0 0.0
usemtl None
s 1
f 3/1/1 4/2/1 5/3/1
o front
v -0.5 -0.5 -0.5
v -0.5 0.5 0.5
v 0.5 0.5 0.5
v 0.5 -0.5 -0.5
vt 1.0 0.0
vt 1.0 0.999938
vt 0.0 0.999938
vt 0.0 0.0
vn 0.0 0.707100 -0.707100
usemtl None
s 1
f 7/4/2 8/5/2 9/6/2 10/7/2
o left
v 0.5 -0.5 -0.5
v 0.5 0.5 0.5
v 0.5 -0.5 0.5
v 0.5 0.0 0.0
vt 1.0 0.0
vt 0.0 1.0
vt 0.0 0.0
vn 1.0 0.0 0.0
usemtl None
s 1
f 11/8/3 12/9/3 13/10/3
l 14 11
l 14 12
o bottom
v -0.5 -0.5 0.5
v -0.5 -0.5 -0.5
v 0.5 -0.5 -0.5
v 0.5 -0.5 0.5
vt 1.0 0.0
vt 1.0 1.0
vt 0.0 1.0
vt 0.0 0.0
vn 0.0 -1.0 -0.0
usemtl None
s 1
f 15/11/4 16/12/4 17/13/4 18/14/4
o back
v 0.5 -0.5 0.5
v 0.5 0.5 0.5
v -0.5 0.5 0.5
v -0.5 -0.5 0.5
vt 1.0 0.0
vt 1.0 1.0
vt 0.0 1.0
vt 0.0 0.0
vn 0.0 -0.0 1.0
usemtl None
s 1
f 19/15/5 20/16/5 21/17/5 22/18/5

View File

@ -1,64 +0,0 @@
+-----------------------------------------------------------------------+
| Copyright (c) 2015-2017 kilbith <jeanpatrick.guerrero@gmail.com> |
| |
| Code: LGPL version 3.0 |
| Textures: WTFPL (credits: Gambit) |
+-----------------------------------------------------------------------+
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, “this License” refers to version 3 of the GNU Lesser General Public License, and the “GNU GPL” refers to version 3 of the GNU General Public License.
“The Library” refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.
An “Application” is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.
A “Combined Work” is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the “Linked Version”.
The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.
The “Corresponding Application Code” for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:
a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:
a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.

View File

@ -1,9 +1,24 @@
## Work Bench ##
MultiCraft Game mod: workbench
==============================
##### A mod adding a Work Bench to Minetest. #####
##### The Work Bench can cut up to 12 shapes, repair your tools, craft items and store. #####
##### A mod adding a Workbench and Stairs to MultiCraft. #####
##### The Workbench can cut up to 12 shapes, repair your tools, craft items and store. #####
##### This mod is originating from [X-Decor](https://github.com/kilbith/xdecor). #####
![Preview](http://i.imgur.com/Pqg3G92.png)
![Preview2](http://i.imgur.com/cCR4FJc.png)
License of source code:
-----------------------
Copyright (C) 2015-2017 kilbith <jeanpatrick.guerrero@gmail.com>
Copyright (C) 2019 MultiCraft Development Team
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3.0 of the License, or
(at your option) any later version.
http://www.gnu.org/licenses/lgpl-3.0.html
All 16x16 textures: WTFPL (credits: Gambit)
workbench_slope.obj from Calinou moreblocks mod (https://github.com/minetest-mods/moreblocks/) licensed under CC BY-SA 3.0 Unported.

View File

@ -1,3 +1,2 @@
default
stairs
xdecor?
wool

View File

@ -1,39 +1,25 @@
local workbench = {}
WB = {}
local min, ceil = math.min, math.ceil
-- Nodes allowed to be cut
-- Only the regular, solid blocks without metas or explosivity can be cut
local nodes = {}
for node, def in pairs(minetest.registered_nodes) do
if (def.drawtype == "normal" or def.drawtype:sub(1,5) == "glass") and
--(def.groups.crumbly or def.groups.cracky or def.groups.snappy or def.groups.choppy) and // ToDo!!!
(def.groups.cracky or def.groups.snappy or def.groups.choppy) and
if (def.drawtype == "normal" or def.drawtype:sub(1,5) == "glass" or def.drawtype:sub(1,8) == "allfaces") and
(def.tiles and type(def.tiles[1]) == "string") and
not def.on_construct and
not def.after_place_node and
not def.on_rightclick and
not def.on_blast and
not def.allow_metadata_inventory_take and
not (def.groups.not_in_creative_inventory == 1) and
not (def.groups.not_cuttable == 1) and
--not def.groups.wool and
not def.groups.colorglass and
(def.tiles and type(def.tiles[1]) == "string" and not
def.tiles[1]:find("default_mineral")) and
not def.mesecons and
def.description and
def.description ~= "" and
def.light_source == 0
not def.mesecons
then
nodes[#nodes+1] = node
end
end
-- Optionally, you can register custom cuttable nodes in the workbench
WB.custom_nodes_register = {
-- "default:leaves",
}
setmetatable(nodes, {
__concat = function(t1, t2)
for i=1, #t2 do
@ -43,12 +29,9 @@ setmetatable(nodes, {
end
})
nodes = nodes..WB.custom_nodes_register
-- Nodeboxes definitions
workbench.defs = {
-- Name Yield X Y Z W H L
-- {"nanoslab", 8, { 0, 0, 0, 8, 1, 8 }},
{"micropanel", 8, { 0, 0, 0, 16, 1, 8 }},
{"microslab", 4, { 0, 0, 0, 16, 1, 16 }},
{"thinstair", 4, { 0, 7, 0, 16, 1, 8 },
@ -83,8 +66,7 @@ function workbench:get_output(inv, input, name)
local output = {}
for _, n in pairs(self.defs) do
local count = min(n[2] * input:get_count(), input:get_stack_max())
local item = name.."_"..n[1]
if not n[3] then item = "stairs:"..n[1].."_"..name:match(":(.*)") end
local item = "stairs:"..n[1].."_"..name:gsub(":", "_")
output[#output+1] = item.." "..count
end
inv:set_list("forms", output)
@ -130,19 +112,6 @@ local formspecs = {
list[context;hammer;4.06,1.50;1,1;] ]],
}
local split_inv = minetest.create_detached_inventory("split", {
allow_move = function(_, _, _, _, _, count, _)
return count
end,
allow_put = function(_, _, _, stack, _)
return stack:get_count() / 2
end,
allow_take = function(_, _, _, stack, _)
return stack:get_count()
end,
})
split_inv:set_size("main", 1)
function workbench:set_formspec(meta, id)
meta:set_string("formspec", "size[9,8.75;]"..
"background[-0.2,-0.26;9.41,9.49;formspec_inventory.png]" ..
@ -199,12 +168,6 @@ function workbench.fields(pos, _, fields, sender)
end
end
function workbench.dig(pos)
local inv = minetest.get_meta(pos):get_inventory()
return inv:is_empty("input") and inv:is_empty("hammer") and
inv:is_empty("tool") and inv:is_empty("storage")
end
function workbench.timer(pos)
local timer = minetest.get_node_timer(pos)
local inv = minetest.get_meta(pos):get_inventory()
@ -228,10 +191,10 @@ end
function workbench.put(_, listname, _, stack)
local stackname = stack:get_name()
if (listname == "tool" and stack:get_wear() > 0 and
workbench:repairable(stackname)) or
workbench:repairable(stackname)) or
(listname == "input" and minetest.registered_nodes[stackname.."_cube"]) or
(listname == "hammer" and stackname == "workbench:hammer") or
listname == "storage" then
listname == "storage" then
return stack:get_count()
end
return 0
@ -258,8 +221,8 @@ function workbench.on_take(pos, listname, index, stack, player)
local inputname = input:get_name()
local stackname = stack:get_name()
if listname == "input" then
if stackname == inputname and minetest.registered_nodes[inputname.."_cube"] then
if stackname == inputname and minetest.registered_nodes[inputname.."_cube"] then
if stackname == inputname then
workbench:get_output(inv, input, stackname)
else
inv:set_list("forms", {})
@ -288,7 +251,6 @@ minetest.register_node("workbench:workbench", {
tiles = {"workbench_top.png", "workbench_top.png",
"workbench_sides.png", "workbench_sides.png",
"workbench_front.png", "workbench_front.png"},
can_dig = workbench.dig,
on_timer = workbench.timer,
on_construct = workbench.construct,
on_receive_fields = workbench.fields,
@ -299,54 +261,115 @@ minetest.register_node("workbench:workbench", {
})
for _, d in pairs(workbench.defs) do
for i=1, #nodes do
local node = nodes[i]
local def = minetest.registered_nodes[node]
for i=1, #nodes do
local node = nodes[i]
local def = minetest.registered_nodes[node]
if d[3] then
local groups = {stairs = 1}
local tiles
--groups.not_in_creative_inventory = 1
if d[3] then
local groups = {}
local tiles
groups.stairs = 1
for k, v in pairs(def.groups) do
if k ~= "wood" and k ~= "stone" and k ~= "level" then
groups[k] = v
for k, v in pairs(def.groups) do
if k ~= "wood" and k ~= "stone" and k ~= "level" then
groups[k] = v
end
end
end
if def.tiles then
if #def.tiles > 1 and (def.drawtype:sub(1,5) ~= "glass") then
tiles = def.tiles
if def.tiles then
if #def.tiles > 1 and (def.drawtype:sub(1,5) ~= "glass") then
tiles = def.tiles
else
tiles = {def.tiles[1]}
end
else
tiles = {def.tiles[1]}
end
else
tiles = {def.tile_images[1]}
end
if not minetest.registered_nodes["stairs:slab_"..node:match(":(.*)")] then
stairs.register_stair_and_slab(node:match(":(.*)"), node,
groups, tiles, def.description.." Stair",
def.description, def.sounds)
end
minetest.register_node(":stairs:"..d[1].."_"..node:gsub(":", "_"), {
description = def.description.." "..d[1]:gsub("^%l", string.upper),
paramtype = "light",
paramtype2 = "facedir",
drawtype = "nodebox",
sounds = def.sounds,
tiles = tiles,
groups = groups,
light_source = def.light_source / 2,
-- `unpack` has been changed to `table.unpack` in newest Lua versions
node_box = workbench:pixelbox(16, {unpack(d, 3)}),
sunlight_propagates = true,
is_ground_content = false,
on_place = minetest.rotate_node
})
minetest.register_node(":"..node.."_"..d[1], {
description = def.description.." "..d[1]:gsub("^%l", string.upper),
paramtype = "light",
paramtype2 = "facedir",
drawtype = "nodebox",
sounds = def.sounds,
tiles = tiles,
groups = groups,
-- `unpack` has been changed to `table.unpack` in newest Lua versions
node_box = workbench:pixelbox(16, {unpack(d, 3)}),
sunlight_propagates = true,
on_place = minetest.rotate_node
})
minetest.register_node(":stairs:slope_" .. node:gsub(":", "_"), {
description = def.description .. " Slope",
paramtype = "light",
paramtype2 = "facedir",
drawtype = "mesh",
mesh = "workbench_slope.obj",
sounds = def.sounds,
tiles = def.tiles,
groups = groups,
light_source = def.light_source / 2,
sunlight_propagates = true,
is_ground_content = false,
use_texture_alpha = def.use_texture_alpha,
on_place = minetest.rotate_node,
collision_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.1875, 0.5},
{-0.5, -0.1875, -0.1875, 0.5, 0.1875, 0.5},
{-0.5, 0.1875, 0.1875, 0.5, 0.5, 0.5},
},
},
})
end
end
end
-- Aliases. A lot of aliases...
local stairs_aliases = {
{"corner", "outerstair"},
{"invcorner", "outerstair"},
{"stair_outer", "innerstair"},
{"stair_inner", "innerstair"}
}
for i=1, #nodes do
local node = nodes[i]
for _, d in pairs(workbench.defs) do
minetest.register_alias("stairs:"..d[1].."_"..node:match(":(.*)"), "stairs:"..d[1].."_"..node:gsub(":", "_"))
end
for _, e in pairs(stairs_aliases) do
minetest.register_alias("stairs:"..e[1].."_"..node:match(":(.*)"), "stairs:"..e[2].."_"..node:gsub(":", "_"))
minetest.register_alias("stairs:"..e[1].."_"..node:gsub(":", "_"), "stairs:"..e[2].."_"..node:gsub(":", "_"))
end
end
for _, d in pairs(workbench.defs) do
minetest.register_alias("stairs:"..d[1].."_coal", "stairs:"..d[1].."_default_coalblock")
end
for _, e in pairs(stairs_aliases) do
minetest.register_alias("stairs:"..e[1].."_coal", "stairs:"..e[2].."_default_coalblock")
end
minetest.register_alias("stairs:stair_steel", "stairs:stair_default_steelblock")
minetest.register_alias("stairs:slab_steel", "stairs:slab_default_steelblock")
minetest.register_alias("stairs:corner_steel", "stairs:corner_default_steelblock")
minetest.register_alias("stairs:stair_gold", "stairs:stair_default_goldblock")
minetest.register_alias("stairs:slab_gold", "stairs:slab_default_goldblock")
minetest.register_alias("stairs:corner_gold", "stairs:corner_default_goldblock")
minetest.register_alias("stairs:stair_diamond", "stairs:stair_default_diamondblock")
minetest.register_alias("stairs:slab_diamond", "stairs:slab_default_diamondblock")
minetest.register_alias("stairs:corner_diamond", "stairs:corner_default_diamondblock")
-- Craft items
minetest.register_craftitem("workbench:hammer", {

View File

@ -0,0 +1,56 @@
g top
v 0.500000 0.500000 0.500000
v -0.500000 0.500000 0.500000
v -0.500000 -0.500000 -0.500000
v 0.500000 -0.500000 -0.500000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vn 0.0000 0.7071 -0.7071
s off
f 2/1/1 1/2/1 4/3/1 3/4/1
g bottom
v -0.500000 -0.500000 0.500000
v 0.500000 -0.500000 0.500000
v -0.500000 -0.500000 -0.500000
v 0.500000 -0.500000 -0.500000
vt 0.0000 0.0000
vt 1.0000 0.0000
vt 1.0000 1.0000
vt 0.0000 1.0000
vn 0.0000 -1.0000 -0.0000
s off
f 6/5/2 5/6/2 7/7/2 8/8/2
g right
v -0.500000 0.500000 0.500000
v -0.500000 -0.500000 0.500000
v -0.500000 -0.500000 -0.500000
vt 1.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vn -1.0000 0.0000 0.0000
s off
f 9/9/3 11/10/3 10/11/3
g left
v 0.500000 0.500000 0.500000
v 0.500000 -0.500000 0.500000
v 0.500000 -0.500000 -0.500000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vn 1.0000 0.0000 0.0000
s off
f 12/12/4 13/13/4 14/14/4
g back
v 0.500000 0.500000 0.500000
v -0.500000 0.500000 0.500000
v -0.500000 -0.500000 0.500000
v 0.500000 -0.500000 0.500000
vt 1.0000 1.0000
vt 0.0000 1.0000
vt 0.0000 0.0000
vt 1.0000 0.0000
vn 0.0000 -0.0000 1.0000
s off
f 15/15/5 16/16/5 17/17/5 18/18/5