Changed to light version with setting to make full

This commit is contained in:
DonBatman 2016-03-18 18:19:30 -07:00
parent 868ce1e7de
commit 769070e4a8
9 changed files with 424 additions and 62 deletions

View File

@ -2,6 +2,16 @@ mycorners
========
Put decorative corners on blocks.
There is a setting in the init.lua file.
If you want the full version then please change line 2 from false to true
If all_colors is true then all dye colors are supported and many more nodes can accept corners.
the issue is that it generates a lot of nodes and makes the game load slow.
I all_colors is false only 4 dye colors are supported.
Less options but loads fast and good for server use.
mycorners lets you add corners to nodes to add style to your buildings.
You will need to make a corner machine.

View File

@ -1,5 +1,15 @@
Put decorative corners on blocks.
There is a setting in the init.lua file.
If you want the full version then please change line 2 from false to true
If all_colors is true then all dye colors are supported and many more nodes can accept corners.
the issue is that it generates a lot of nodes and makes the game load slow.
I all_colors is false only 4 dye colors are supported.
Less options but loads fast and good for server use.
mycorners lets you add corners to nodes to add style to your buildings.
You will need to make a corner machine.

View File

@ -1,13 +1,24 @@
--Change this to true is you want all the colors and false for 4 colors
local all_colors = false
mycorners = {}
dofile(minetest.get_modpath("mycorners").."/cornertool.lua")
dofile(minetest.get_modpath("mycorners").."/nodes.lua")
dofile(minetest.get_modpath("mycorners").."/machine.lua")
dofile(minetest.get_modpath("mycorners").."/register.lua")
if all_colors == true then
dofile(minetest.get_modpath("mycorners").."/nodes.lua")
dofile(minetest.get_modpath("mycorners").."/machine.lua")
dofile(minetest.get_modpath("mycorners").."/register.lua")
else
dofile(minetest.get_modpath("mycorners").."/nodes_light.lua")
dofile(minetest.get_modpath("mycorners").."/machine_light.lua")
dofile(minetest.get_modpath("mycorners").."/register_light.lua")
end

View File

@ -6,7 +6,9 @@ local shape2 = {}
local make_ok = 0
local anzahl = {}
local anzahlz = {}
local dye_colors = {
dye_colors = {
{"dye:black","black"},
{"dye:blue","blue"},
{"dye:brown","brown"},
@ -23,63 +25,7 @@ local dye_colors = {
{"dye:white","white"},
{"dye:yellow","yellow"},
}
local nodes_of_corners = {
{"default:brick","default_brick"},
{"default:bronzeblock","default_bronze_block"},
{"default:cactus","default_cactus"},
{"default:clay","default_clay"},
{"default:coalblock","default_coal_block"},
{"default:cobble","default_cobble"},
{"default:copperblock","default_copper_block"},
{"default:desert_cobble","default_desert_cobble"},
{"default:desert_sand","default_desert_sand"},
{"default:desert_stone","default_desert_stone"},
{"default:diamondblock","default_diamond_block"},
{"default:dirt","default_dirt"},
{"default:glass","default_glass"},
{"default:goldblock","default_gold_block"},
{"default:gravel","default_gravel"},
{"default:ice","default_ice"},
{"default:jungletree","default_jungletree"},
{"default:junglewood","default_junglewood"},
{"default:lava_source","default_lava"},
{"default:mese","default_mese"},
{"default:mossycobble","default_mossycobble"},
{"default:obsidian","default_obsidian"},
{"default:obsidian_glass","default_obsidian_glass"},
{"default:obsidianbrick","default_obsidian_brick"},
{"default:pine_tree","default_pine_tree"},
{"default:pine_wood","default_pine_wood"},
{"default:acacia_tree","default_acacia_tree"},
{"default:acacia_wood","default_acacia_wood"},
{"default:sand","default_sand"},
{"default:sandstone","default_sandstone"},
{"default:sandstonebrick","default_sandstone_brick"},
{"default:snowblock","default_snow"},
{"default:steelblock","default_steel_block"},
{"default:stone","default_stone"},
{"default:stonebrick","default_stone_brick"},
{"default:tree","default_tree"},
{"default:water_source","default_water"},
{"default:wood","default_wood"},
{"farming:straw","farming_straw"},
{"wool:black","wool_black"},
{"wool:blue","wool_blue"},
{"wool:brown","wool_brown"},
{"wool:cyan","wool_cyan"},
{"wool:dark_green","wool_dark_green"},
{"wool:dark_grey","wool_dark_grey"},
{"wool:green","wool_green"},
{"wool:grey","wool_grey"},
{"wool:magenta","wool_magenta"},
{"wool:orange","wool_orange"},
{"wool:pink","wool_pink"},
{"wool:red","wool_red"},
{"wool:violet","wool_violet"},
{"wool:white","wool_white"},
{"wool:yellow","wool_yellow"},
}
local corner_items = {
corner_items = {
{"_wood_black"},
{"_wood_blue"},
{"_wood_brown"},
@ -127,6 +73,64 @@ local corner_items = {
{"_stonebrick_yellow"},
}
local nodes_of_corners = {
{"default:brick","default_brick"},
--{"default:bronzeblock","default_bronze_block"},
--{"default:cactus","default_cactus"},
{"default:clay","default_clay"},
--{"default:coalblock","default_coal_block"},
{"default:cobble","default_cobble"},
--{"default:copperblock","default_copper_block"},
{"default:desert_cobble","default_desert_cobble"},
--{"default:desert_sand","default_desert_sand"},
{"default:desert_stone","default_desert_stone"},
--{"default:diamondblock","default_diamond_block"},
--{"default:dirt","default_dirt"},
--{"default:glass","default_glass"},
--{"default:goldblock","default_gold_block"},
--{"default:gravel","default_gravel"},
--{"default:ice","default_ice"},
--{"default:jungletree","default_jungletree"},
{"default:junglewood","default_junglewood"},
--{"default:lava_source","default_lava"},
--{"default:mese","default_mese"},
{"default:mossycobble","default_mossycobble"},
--{"default:obsidian","default_obsidian"},
--{"default:obsidian_glass","default_obsidian_glass"},
--{"default:obsidianbrick","default_obsidian_brick"},
--{"default:pine_tree","default_pine_tree"},
{"default:pine_wood","default_pine_wood"},
--{"default:acacia_tree","default_acacia_tree"},
{"default:acacia_wood","default_acacia_wood"},
--{"default:sand","default_sand"},
{"default:sandstone","default_sandstone"},
{"default:sandstonebrick","default_sandstone_brick"},
--{"default:snowblock","default_snow"},
{"default:steelblock","default_steel_block"},
{"default:stone","default_stone"},
{"default:stonebrick","default_stone_brick"},
--{"default:tree","default_tree"},
--{"default:water_source","default_water"},
{"default:wood","default_wood"},
--{"farming:straw","farming_straw"},
--{"wool:black","wool_black"},
--{"wool:blue","wool_blue"},
--{"wool:brown","wool_brown"},
--{"wool:cyan","wool_cyan"},
--{"wool:dark_green","wool_dark_green"},
--{"wool:dark_grey","wool_dark_grey"},
--{"wool:green","wool_green"},
--{"wool:grey","wool_grey"},
--{"wool:magenta","wool_magenta"},
--{"wool:orange","wool_orange"},
--{"wool:pink","wool_pink"},
--{"wool:red","wool_red"},
--{"wool:violet","wool_violet"},
--{"wool:white","wool_white"},
--{"wool:yellow","wool_yellow"},
}
minetest.register_alias("mycorners:machine_installer", "mycorners:machine_corner")
minetest.register_node("mycorners:machine_corner", {
description = "Corner Machine",

234
machine_light.lua Normal file
View File

@ -0,0 +1,234 @@
local material = {}
local matr = {}
local matr2 = {}
local shape = {}
local shape2 = {}
local make_ok = 0
local anzahl = {}
local anzahlz = {}
local dye_colors = {
{"dye:black","black"},
{"dye:brown","brown"},
{"dye:dark_green","dark_green"},
{"dye:grey","grey"},
}
local corner_items = {
{"_wood_black"},
{"_wood_brown"},
{"_wood_dark_green"},
{"_wood_grey"},
{"_stone_black"},
{"_stone_brown"},
{"_stone_dark_green"},
{"_stone_grey"},
{"_stonebrick_black"},
{"_stonebrick_brown"},
{"_stonebrick_dark_green"},
{"_stonebrick_grey"},
}
local nodes_of_corners = {
{"default:brick","default_brick"},
{"default:cobble","default_cobble"},
{"default:desert_stone","default_desert_stone"},
{"default:junglewood","default_junglewood"},
{"default:pine_tree","default_pine_tree"},
{"default:pine_wood","default_pine_wood"},
{"default:acacia_tree","default_acacia_tree"},
{"default:acacia_wood","default_acacia_wood"},
{"default:sandstone","default_sandstone"},
{"default:stone","default_stone"},
{"default:wood","default_wood"},
}
minetest.register_alias("mycorners:machine_installer", "mycorners:machine_corner")
minetest.register_node("mycorners:machine_corner", {
description = "Corner Machine",
tiles = {
"mycorners_machine_top.png",
"mycorners_machine_bottom.png",
"mycorners_machine_sider.png",
"mycorners_machine_sidel.png",
"mycorners_machine_back.png",
"mycorners_machine_front.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky=2},
node_box = {
type = "fixed",
fixed = {
{0.3125, -0.5, -0.5, 0.5, -0.1875, -0.3125},
{0.3125, -0.5, 0.3125, 0.5, -0.1875, 0.5},
{-0.5, -0.5, 0.3125, -0.3125, -0.1875, 0.5},
{-0.5, -0.5, -0.5, -0.3125, -0.1875, -0.3125},
{-0.5, -0.1875, -0.5, 0.5, -0.0625, 0.5},
{-0.0625, -0.0625, -0.25, 0, 0.0625, -0.1875},
{-0.1875, -0.4375, -0.3125, 0.125, -0.1875, -0.125},
{-0.125, -0.4375, -0.375, 0.0625, -0.1875, -0.0625},
{-0.25, -0.0625, -0.1875, 0.1875, 0.125, 0.0625},
{-0.4375, -0.0625, 0.125, 0.4375, 0.0625, 0.25},
{-0.4375, -0.0625, -0, 0.4375, 0.1875, 0.125},
{-0.1875, -0.25, -0.375, 0.125, -0.1875, -0.0625},
}
},
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos);
meta:set_string("owner", (placer:get_player_name() or ""));
meta:set_string("infotext", "Corner Machine (owned by " .. (placer:get_player_name() or "") .. ")");
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
if not inv:is_empty("matblock") then
return false
elseif not inv:is_empty("dye") then
return false
elseif not inv:is_empty("res") then
return false
end
return true
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "invsize[10,11;]"..
"background[-0.15,-0.25;10.40,11.75;mycorners_background.png]"..
"label[0,0;Corner Machine]"..
"label[1.5,0.5;Material:]"..
"list[current_name;matblock;1.5,1;1,1;]"..
"label[3,0.5;Dye:]"..
"list[current_name;dye;3,1;1,1;]"..
"button[4.5,1;1,1;make;Make]"..
"label[6,0.5;Output:]"..
"list[current_name;res;6,1;1,1;]"..
"label[1,2;Material can only be wood, stone or stone brick]"..
"label[7,1;Black, Brown, Dark Green]"..
"label[7.5,1.5;and Grey Dyes Only]"..
"label[1.5,3;Material]"..
"list[current_name;mat;1.5,3.5;1,1; ]"..
"list[current_name;corner1;1.5,4.5;1,1; ]"..
"list[current_name;corner2;2.5,3.5;1,1; ]"..
"button[4.5,3.5;1,1;make2;Make]"..
"label[6,3;Output:]"..
"list[current_name;res2;6,3.5;1,1;]"..
"label[1,5.5;Add a block to the top left and corner items in the other 2]"..
"list[current_player;main;1,7;8,4;]")
meta:set_string("infotext", "Corner Machine")
local inv = meta:get_inventory()
inv:set_size("matblock", 1)
inv:set_size("dye", 1)
inv:set_size("res", 1)
inv:set_size("mat", 1)
inv:set_size("corner1", 1)
inv:set_size("corner2", 1)
inv:set_size("res2", 1)
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if fields["make"]
then
make_ok = 0
anzahl = 4
shape = "mycorners:corner_"
if inv:is_empty("matblock") or
inv:is_empty("dye") then
return
end
local ingotstack1 = inv:get_stack("matblock", 1)
local ingotstack2 = inv:get_stack("dye", 1)
local resstack = inv:get_stack("res", 1)
----------------------------------------------------------------------------------
--register nodes
----------------------------------------------------------------------------------
for i in ipairs (dye_colors) do
local dyecol = dye_colors[i][1]
local color = dye_colors[i][2]
if ingotstack1:get_name()=="default:wood" and
ingotstack2:get_name()==dyecol then
material = "wood_"..color
make_ok = 1
end
if ingotstack1:get_name()=="default:stone" and
ingotstack2:get_name()==dyecol then
material = "stone_"..color
make_ok = 1
end
if ingotstack1:get_name()=="default:stonebrick" and
ingotstack2:get_name()==dyecol then
material = "stonebrick_"..color
make_ok = 1
end
end
----------------------------------------------------------------------
if make_ok == 1 then
local give = {}
for i = 0, anzahl-1 do
give[i+1]=inv:add_item("res",shape..material)
end
ingotstack1:take_item()
inv:set_stack("matblock",1,ingotstack1)
ingotstack2:take_item()
inv:set_stack("dye",1,ingotstack2)
end
end
------------------------------------------------------------------------
------------------------------------------------------------------------
if fields["make2"]
then
make_ok = 0
anzahlz = 1
shape2 = "mycorners:cornerblock_"
if inv:is_empty("mat") or
inv:is_empty("corner1") or
inv:is_empty("corner2") then
return
end
local ingotstack4 = inv:get_stack("mat", 1)
local ingotstack5 = inv:get_stack("corner1", 1)
local ingotstack6 = inv:get_stack("corner2", 1)
local resstack2 = inv:get_stack("res2", 1)
----------------------------------------------------------------------------------
--register nodes
----------------------------------------------------------------------------------
for i in ipairs (nodes_of_corners) do
local nodeitem = nodes_of_corners[i][1]
local nodedesc = nodes_of_corners[i][2]
for i in ipairs (corner_items) do
local ctype = corner_items[i][1]
if ingotstack4:get_name()== nodeitem and
ingotstack5:get_name()=="mycorners:corner"..ctype and
ingotstack6:get_name()=="mycorners:corner"..ctype then
matr = nodedesc..ctype
make_ok = 1
end
end
end
----------------------------------------------------------------------
if make_ok == 1 then
local give = {}
for i = 0, anzahlz-1 do
give[i+1]=inv:add_item("res2",shape2..matr)
end
ingotstack4:take_item()
inv:set_stack("mat",1,ingotstack4)
ingotstack5:take_item()
inv:set_stack("corner1",1,ingotstack5)
ingotstack6:take_item()
inv:set_stack("corner2",1,ingotstack6)
end
end
end
})
--Craft
minetest.register_craft({
output = 'mycorners:machine_corner',
recipe = {
{'', '', ''},
{'group:wood', 'default:steel_ingot', 'group:wood'},
{'default:steelblock', "default:steelblock", 'default:steelblock"'},
},
})

10
mysiding.lua Normal file
View File

@ -0,0 +1,10 @@
mycorners.register_all(
"wide_default_sandstone",
"Sandstone Siding",
"default_sandstone.png^mysiding_pattern1.png",
{crumbly=2, cracky = 3, not_in_creative_inventory=1},
"mysiding:wide_default_sandstone",
"normal"
)

60
nodes_light.lua Normal file
View File

@ -0,0 +1,60 @@
function mycorners.register_all(material, descr, image, groupss, itm)
local cornerblock = {
{"wood_black", "corners_wood_black.png", "Black Wood"},
{"wood_brown", "corners_wood_brown.png", "Brown Wood"},
{"wood_dark_green", "corners_wood_dark_green.png", "Dark Green Wood"},
{"wood_grey", "corners_wood_grey.png", "Grey Wood"},
{"stone_black", "corners_stone_black.png", "Black Stone"},
{"stone_brown", "corners_stone_brown.png", "Brown Stone"},
{"stone_dark_green", "corners_stone_dark_green.png", "Dark Green Stone"},
{"stone_grey", "corners_stone_grey.png", "Grey Stone"},
{"stonebrick_black", "corners_stonebrick_black.png", "Black Stone Brick"},
{"stonebrick_brown", "corners_stonebrick_brown.png", "Brown Stone Brick"},
{"stonebrick_dark_green", "corners_stonebrick_dark_green.png", "Dark Green Stone Brick"},
{"stonebrick_grey", "corners_stonebrick_grey.png", "Grey Stone Brick"},
}
for i in ipairs(cornerblock) do
local mat = cornerblock[i][1]
local img = cornerblock[i][2]
local desc = cornerblock[i][3]
--Makes the craft item corner
minetest.register_craftitem("mycorners:corner_"..mat, {
description = desc.." Corner",
inventory_image = img,
groups = {not_in_creative_inventory=1},
})
local other_images = {
{"top","bottom"},
}
for i in ipairs (other_images) do
local top = other_images[i][1]
local bottom = other_images[i][2]
minetest.register_node("mycorners:cornerblock_"..material.."_"..mat, {
description = descr.."_Corner"..desc,
drawtype = "normal",
tiles = {
image.."^corners_"..mat.."_"..top..".png",
image.."^corners_"..mat.."_"..bottom..".png",
image,
image.."^"..img.."^[transformFX",
image,
image.."^"..img,
},
paramtype = "light",
paramtype2 = "facedir",
groups = groupss,
drop = {
max_items = 3,
items = {
{
items = {itm},
},
{
items = {"mycorners:corner_"..mat.." 2"},
},
}
},
})
end
end
end

View File

@ -300,11 +300,11 @@ mycorners.register_all(
--]]
--[[
mycorners.register_all(
"default_pinetree",
"default_pine_tree",
"Pine Tree",
"default_pinetree.png",
{choppy=2,oddly_breakable_by_hand=2,flammable=2,not_in_creative_inventory=1},
"default:pinetree",
"default:pine_tree",
"normal"
)
--]]

23
register_light.lua Normal file
View File

@ -0,0 +1,23 @@
mycorners.register_all("default_sandstone", "Sandstone", "default_sandstone.png",
{crumbly=2, cracky = 3, not_in_creative_inventory=1},"default:sandstone","normal")
mycorners.register_all("default_cobble", "Cobble", "default_cobble.png",
{cracky = 3, not_in_creative_inventory=1},"default:cobble","normal")
mycorners.register_all("default_stone", "Stone", "default_stone.png",
{cracky = 3,not_in_creative_inventory=1},"default:stone","normal")
mycorners.register_all("default_desert_stone", "Desert Stone", "default_desert_stone.png",
{cracky = 3,not_in_creative_inventory=1},"default:desert_stone","normal")
mycorners.register_all("default_wood", "Wood", "default_wood.png",
{choppy = 3,not_in_creative_inventory=1},"default:wood","normal")
mycorners.register_all("default_pine_wood", "Pine Wood", "default_pine_wood.png",
{choppy = 3,not_in_creative_inventory=1},"default:pine_wood","normal")
mycorners.register_all("default_acacia_wood", "Acacia Wood", "default_acacia_wood.png",
{choppy = 3,not_in_creative_inventory=1},"default:pine_acacia","normal")
mycorners.register_all("default_brick", "Brick", "default_brick.png",
{cracky = 2,not_in_creative_inventory=1},"default:brick","normal")