Factored out hydroponics and multinode, and moved seasons into the nature mod. Uses the new port builtin to convert old blocks as
they are activated.master
10
crafts.lua
|
@ -426,16 +426,6 @@ minetest.register_craft({ output = 'madblocks:signs_cafe 1', recipe = {
|
|||
{'','default:sign_wall',''},
|
||||
{'','default:torch',''},
|
||||
}})
|
||||
minetest.register_craft({ output = 'madblocks:signs_drpepper 1', recipe = {
|
||||
{'','madblocks:dye_black',''},
|
||||
{'','default:sign_wall',''},
|
||||
{'','madblocks:dye_red',''},
|
||||
}})
|
||||
minetest.register_craft({ output = 'madblocks:signs_enjoycoke 1', recipe = {
|
||||
{'','madblocks:sheetmetal',''},
|
||||
{'','default:sign_wall',''},
|
||||
{'','madblocks:dye_red',''},
|
||||
}})
|
||||
minetest.register_craft({ output = 'madblocks:signs_hucksfoodfuel 1', recipe = {
|
||||
{'','madblocks:dye_red',''},
|
||||
{'','default:sign_wall',''},
|
||||
|
|
|
@ -218,7 +218,7 @@ end
|
|||
-- WILD PLANTS/SEEDS GENERATING
|
||||
minetest.register_abm({
|
||||
nodenames = { "default:dirt_with_grass" },
|
||||
interval = NATURE_GROWSPEED,
|
||||
interval = NATURE_GROW_INTERVAL,
|
||||
chance = 80,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local air = { x=pos.x, y=pos.y+1,z=pos.z }
|
||||
|
@ -233,7 +233,7 @@ minetest.register_abm({
|
|||
})
|
||||
minetest.register_abm({
|
||||
nodenames = get_wildplants,
|
||||
interval = NATURE_GROWSPEED,
|
||||
interval = NATURE_GROW_INTERVAL,
|
||||
chance = 2,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.env:remove_node({x=pos.x,y=pos.y,z=pos.z})
|
||||
|
|
30
init.lua
|
@ -1,38 +1,16 @@
|
|||
local madblocks_modpath = minetest.get_modpath("madblocks")
|
||||
math.randomseed(os.time())
|
||||
|
||||
SEASON_LENGTH = 1500 -- max tested 1500
|
||||
WEATHER_CHANGE_INTERVAL = 60
|
||||
NATURE_GROW_INTERVAL = 700
|
||||
HYDRO_GROW_INTERVAL = 100
|
||||
BIRDS = false--true
|
||||
|
||||
NATURE_PLANTS = { 'madblocks:hydroponics_cyanflower','madblocks:hydroponics_magentaflower','madblocks:hydroponics_yellowflower',
|
||||
'madblocks:dandylions','madblocks:mushroom'}
|
||||
HYDROPONICS_PLANTS = {
|
||||
tomato = {name='tomato',growtype='growtall'},
|
||||
peas = {name='peas',growtype='growtall'},
|
||||
habanero = {name='habanero',growtype='growtall'},
|
||||
cyanflower = {name='cyanflower',growtype='growtall'},
|
||||
magentaflower = {name='magentaflower',growtype='growtall'},
|
||||
yellowflower = {name='yellowflower',growtype='growtall'},
|
||||
rubberplant = {name='rubberplant',growtype='growshort', give_on_harvest='madblocks:rubber'},
|
||||
grapes = {name='grapes',growtype='permaculture'},
|
||||
coffee = {name='coffee',growtype='permaculture'},
|
||||
roses = {name='roses',growtype='growtall',give_on_harvest='madblocks:rosebush'}
|
||||
}
|
||||
|
||||
-- fixed git-120603
|
||||
dofile (madblocks_modpath .. "/items.lua")
|
||||
dofile (madblocks_modpath .. "/lights.lua")
|
||||
dofile (madblocks_modpath .. "/nature.lua")
|
||||
dofile (madblocks_modpath .. "/hydroponics.lua")
|
||||
dofile (madblocks_modpath .. "/misc.lua")
|
||||
dofile (madblocks_modpath .. "/crafts.lua")
|
||||
dofile (madblocks_modpath .. "/bookmarks.lua")
|
||||
dofile (madblocks_modpath .. "/multinode.lua")
|
||||
dofile (madblocks_modpath .. "/nocrafts.lua") -- new stuff, look in file for giveme names
|
||||
dofile (madblocks_modpath .. "/nocrafts.lua")
|
||||
minetest.require("madblocks","portSeasons")
|
||||
minetest.require("madblocks","portHydroponics")
|
||||
|
||||
print('mAdBlOcKs 12.6.12 loaded')
|
||||
|
||||
--next: get rid of rubber, rubberplant (5 or 6 nodes), fix crafts
|
||||
--next: get rid of rubber, rubberplant (5 or 6 nodes), fix crafts
|
209
items.lua
|
@ -1,156 +1,67 @@
|
|||
-- ***********************************************************************************
|
||||
-- FUNCTIONS **************************************************
|
||||
-- ***********************************************************************************
|
||||
BRICKLIKE = function(nodeid, nodename)
|
||||
minetest.register_node("madblocks:"..nodeid, {
|
||||
description = nodename,
|
||||
tile_images = {"madblocks_"..nodeid..'.png'},
|
||||
inventory_image = minetest.inventorycube("madblocks_"..nodeid..'.png'),
|
||||
is_ground_content = true,
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
end
|
||||
WOODLIKE = function(nodeid, nodename,fence)
|
||||
minetest.register_node("madblocks:"..nodeid, {
|
||||
description = nodename,
|
||||
tile_images = {"madblocks_"..nodeid..".png"},
|
||||
inventory_image = minetest.inventorycube("madblocks_"..nodeid..".png"),
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
if fence == true then
|
||||
minetest.register_node("madblocks:"..nodeid.."_fence", {
|
||||
description = nodename.." Fence",
|
||||
drawtype = "fencelike",
|
||||
tile_images = {"madblocks_"..nodeid..".png"},
|
||||
inventory_image = "madblocks_"..nodeid.."_fence.png",
|
||||
wield_image = "madblocks_"..nodeid.."_fence.png",
|
||||
paramtype = "light",
|
||||
is_ground_content = true,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
|
||||
},
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
end
|
||||
end
|
||||
SIGNLIKE = function(nodeid, light)
|
||||
light = light or 0
|
||||
minetest.register_node("madblocks:signs_"..nodeid, {
|
||||
description = "Sign",
|
||||
drawtype = "signlike",
|
||||
tile_images = {"madblocks_signs_"..nodeid..".png"},
|
||||
inventory_image = "madblocks_signs_"..nodeid..".png",
|
||||
wield_image = "madblocks_signs_"..nodeid..".png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
is_ground_content = true,
|
||||
walkable = false,
|
||||
climbable = false,
|
||||
selection_box = {
|
||||
type = "wallmounted",
|
||||
},
|
||||
light_source = light ,
|
||||
light_propagates = true,
|
||||
sunlight_propagates = true,
|
||||
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3,flammable=2},
|
||||
legacy_wallmounted = true,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
end
|
||||
PLANTLIKE = function(nodeid, nodename,type,option)
|
||||
if option == nil then option = false end
|
||||
|
||||
local params ={ description = nodename, drawtype = "plantlike", tile_images = {"madblocks_"..nodeid..'.png'},
|
||||
inventory_image = "madblocks_"..nodeid..'.png', wield_image = "madblocks_"..nodeid..'.png', paramtype = "light", }
|
||||
|
||||
if type == 'veg' then
|
||||
params.groups = {snappy=2,dig_immediate=3,flammable=2}
|
||||
params.sounds = default.node_sound_leaves_defaults()
|
||||
if option == false then params.walkable = false end
|
||||
elseif type == 'met' then -- metallic
|
||||
params.groups = {cracky=3}
|
||||
params.sounds = default.node_sound_stone_defaults()
|
||||
elseif type == 'cri' then -- craft items
|
||||
params.groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3}
|
||||
params.sounds = default.node_sound_wood_defaults()
|
||||
if option == false then params.walkable = false end
|
||||
elseif type == 'eat' then -- edible
|
||||
params.groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3}
|
||||
params.sounds = default.node_sound_wood_defaults()
|
||||
params.walkable = false
|
||||
params.on_use = minetest.item_eat(option)
|
||||
end
|
||||
minetest.register_node("madblocks:"..nodeid, params)
|
||||
end
|
||||
local like = minetest.require("madblocks","like")("madblocks")
|
||||
|
||||
-- ***********************************************************************************
|
||||
-- STANDARD DEFS **************************************************
|
||||
-- ***********************************************************************************
|
||||
BRICKLIKE('bluecyanbrick', 'Blue-Cyan Odd Brick')
|
||||
BRICKLIKE('magentabrick','Magenta Brick')
|
||||
BRICKLIKE('greenbrick','Green Brick')
|
||||
BRICKLIKE('blackbrick','Black Brick')
|
||||
BRICKLIKE('bluebrick','Blue Brick')
|
||||
BRICKLIKE('yellowbrick','Yellow Brick')
|
||||
BRICKLIKE('brownbrick','Brown Brick')
|
||||
BRICKLIKE('cyanbrick','Cyan Brick')
|
||||
BRICKLIKE('oddbrick','Oddly Coloured Brick')
|
||||
BRICKLIKE('mossystonebrick','Mossy Stone Brick')
|
||||
BRICKLIKE('culturedstone','Cultured Stone')
|
||||
BRICKLIKE('marblestonebrick','Marble Stone Brick')
|
||||
BRICKLIKE('shinystonebrick','Sand-Blasted Stone Brick')
|
||||
BRICKLIKE('cinderblock','Cinderblock')
|
||||
BRICKLIKE('blackstonebrick','Black Stonebrick')
|
||||
BRICKLIKE('roundstonebrick','Round Stonebrick')
|
||||
BRICKLIKE('slimstonebrick','Slim Stonebrick')
|
||||
BRICKLIKE('greystonebrick','Grey Stonebrick')
|
||||
BRICKLIKE('medistonebrick','Mediterranean Stonebrick')
|
||||
BRICKLIKE('whitestonebrick','White Stonebrick')
|
||||
BRICKLIKE('cement','Cement')
|
||||
BRICKLIKE('countrystonebrick','Country Stonebrick')
|
||||
BRICKLIKE('asphalte','Asphalte')
|
||||
WOODLIKE('woodshingles','Wood Shingles')
|
||||
WOODLIKE('magentawood','Magenta Stained Wood',true)
|
||||
WOODLIKE('bluewood','Blue Stained Wood',true)
|
||||
WOODLIKE('blackwood','Black Stained Wood',true)
|
||||
WOODLIKE('yellowwood','Yellow Stained Wood',true)
|
||||
WOODLIKE('cyanwood','Cyan Stained Wood',true)
|
||||
WOODLIKE('greenwood','Green Stained Wood',true)
|
||||
WOODLIKE('redwood','Red Stained Wood',true)
|
||||
WOODLIKE('dye_cyan','Cyan Dye')
|
||||
WOODLIKE('dye_magenta','Magenta Dye')
|
||||
WOODLIKE('dye_yellow','Yellow Dye')
|
||||
WOODLIKE('dye_red','Red Dye')
|
||||
WOODLIKE('dye_blue','Blue Dye')
|
||||
WOODLIKE('dye_green','Green Dye')
|
||||
WOODLIKE('dye_black','Black Dye')
|
||||
SIGNLIKE('park')
|
||||
SIGNLIKE('cliff')
|
||||
SIGNLIKE('interdit')
|
||||
SIGNLIKE('montreal')
|
||||
SIGNLIKE('420')
|
||||
SIGNLIKE('chicken')
|
||||
SIGNLIKE('obscene')
|
||||
SIGNLIKE('cafe',7)
|
||||
SIGNLIKE('drpepper')
|
||||
SIGNLIKE('dangermines')
|
||||
SIGNLIKE('hucksfoodfuel')
|
||||
SIGNLIKE('enjoycoke')
|
||||
PLANTLIKE('flowers1','Flower Arrangement #1','veg')
|
||||
PLANTLIKE('flowers2','Flower Arrangement #2','veg')
|
||||
PLANTLIKE('hangingflowers','Hanging Flower Basket','cri')
|
||||
PLANTLIKE('stool','Bar Stool','cri',true)
|
||||
PLANTLIKE('gnome','Garden Gnome','cri')
|
||||
PLANTLIKE('statue','Statuette','cri')
|
||||
PLANTLIKE('gargoyle','Gargoyle','cri')
|
||||
PLANTLIKE('wine','Wine Bottle','eat',1)
|
||||
PLANTLIKE('coffeecup','Coffee Cup','eat',2)
|
||||
like.brick('bluecyanbrick', 'Blue-Cyan Odd Brick')
|
||||
like.brick('magentabrick','Magenta Brick')
|
||||
like.brick('greenbrick','Green Brick')
|
||||
like.brick('blackbrick','Black Brick')
|
||||
like.brick('bluebrick','Blue Brick')
|
||||
like.brick('yellowbrick','Yellow Brick')
|
||||
like.brick('brownbrick','Brown Brick')
|
||||
like.brick('cyanbrick','Cyan Brick')
|
||||
like.brick('oddbrick','Oddly Coloured Brick')
|
||||
like.brick('mossystonebrick','Mossy Stone Brick')
|
||||
like.brick('culturedstone','Cultured Stone')
|
||||
like.brick('marblestonebrick','Marble Stone Brick')
|
||||
like.brick('shinystonebrick','Sand-Blasted Stone Brick')
|
||||
like.brick('cinderblock','Cinderblock')
|
||||
like.brick('blackstonebrick','Black Stonebrick')
|
||||
like.brick('roundstonebrick','Round Stonebrick')
|
||||
like.brick('slimstonebrick','Slim Stonebrick')
|
||||
like.brick('greystonebrick','Grey Stonebrick')
|
||||
like.brick('medistonebrick','Mediterranean Stonebrick')
|
||||
like.brick('whitestonebrick','White Stonebrick')
|
||||
like.brick('cement','Cement')
|
||||
like.brick('countrystonebrick','Country Stonebrick')
|
||||
like.brick('asphalte','Asphalte')
|
||||
like.wood('woodshingles','Wood Shingles')
|
||||
like.wood('magentawood','Magenta Stained Wood',true)
|
||||
like.wood('bluewood','Blue Stained Wood',true)
|
||||
like.wood('blackwood','Black Stained Wood',true)
|
||||
like.wood('yellowwood','Yellow Stained Wood',true)
|
||||
like.wood('cyanwood','Cyan Stained Wood',true)
|
||||
like.wood('greenwood','Green Stained Wood',true)
|
||||
like.wood('redwood','Red Stained Wood',true)
|
||||
like.wood('dye_cyan','Cyan Dye')
|
||||
like.wood('dye_magenta','Magenta Dye')
|
||||
like.wood('dye_yellow','Yellow Dye')
|
||||
like.wood('dye_red','Red Dye')
|
||||
like.wood('dye_blue','Blue Dye')
|
||||
like.wood('dye_green','Green Dye')
|
||||
like.wood('dye_black','Black Dye')
|
||||
like.sign('park')
|
||||
like.sign('cliff')
|
||||
like.sign('interdit')
|
||||
like.sign('montreal')
|
||||
like.sign('420')
|
||||
like.sign('chicken')
|
||||
like.sign('obscene')
|
||||
like.sign('cafe',{light=7})
|
||||
like.sign('drpepper')
|
||||
like.sign('dangermines')
|
||||
like.sign('hucksfoodfuel')
|
||||
like.sign('enjoycoke')
|
||||
like.plant('flowers1','Flower Arrangement #1','veg')
|
||||
like.plant('flowers2','Flower Arrangement #2','veg')
|
||||
like.plant('hangingflowers','Hanging Flower Basket','cri')
|
||||
like.plant('stool','Bar Stool','cri',true)
|
||||
like.plant('gnome','Garden Gnome','cri')
|
||||
like.plant('statue','Statuette','cri')
|
||||
like.plant('gargoyle','Gargoyle','cri')
|
||||
like.plant('wine','Wine Bottle','eat',1)
|
||||
like.plant('coffeecup','Coffee Cup','eat',2)
|
||||
|
||||
-- ***********************************************************************************
|
||||
-- ASSORTED DEFS **************************************************
|
||||
|
|
35
lights.lua
|
@ -1,3 +1,5 @@
|
|||
local like = minetest.require("madblocks","like")("madblocks")
|
||||
|
||||
-- ***********************************************************************************
|
||||
-- FUNCTIONS **************************************************
|
||||
-- ***********************************************************************************
|
||||
|
@ -73,37 +75,16 @@ spotlight_off = function(pos,node)
|
|||
end
|
||||
end
|
||||
|
||||
GLOWLIKE = function(nodeid,nodename,drawtype)
|
||||
if drawtype == nil then
|
||||
drawtype = 'glasslike'
|
||||
inv_image = minetest.inventorycube("madblocks_"..nodeid..".png")
|
||||
else
|
||||
inv_image = "madblocks_"..nodeid..".png"
|
||||
end
|
||||
minetest.register_node("madblocks:"..nodeid, {
|
||||
description = nodename,
|
||||
drawtype = drawtype,
|
||||
tile_images = {"madblocks_"..nodeid..".png"},
|
||||
inventory_image = inv_image,
|
||||
light_propagates = true,
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
light_source = 15 ,
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
end
|
||||
|
||||
-- ***********************************************************************************
|
||||
-- DEFS **************************************************
|
||||
-- ***********************************************************************************
|
||||
GLOWLIKE('glowyellow','Yellow Glow Glass')
|
||||
GLOWLIKE('glowgreen','Green Glow Glass')
|
||||
GLOWLIKE('glowblue','Blue Glow Glass')
|
||||
GLOWLIKE('glowred','Red Glow Glass')
|
||||
GLOWLIKE('glowtron','Tron Glow Glass')
|
||||
GLOWLIKE('fancylamp','Fancy Lamp','plantlike')
|
||||
like.glow('glowyellow','Yellow Glow Glass')
|
||||
like.glow('glowgreen','Green Glow Glass')
|
||||
like.glow('glowblue','Blue Glow Glass')
|
||||
like.glow('glowred','Red Glow Glass')
|
||||
like.glow('glowtron','Tron Glow Glass')
|
||||
like.glow('fancylamp','Fancy Lamp','plantlike')
|
||||
|
||||
minetest.register_node("madblocks:light", {
|
||||
drawtype = "glasslike",
|
||||
|
|
|
@ -0,0 +1,165 @@
|
|||
local function normalize(nodeid,nodename)
|
||||
if nodename == nil then
|
||||
nodename = nodeid[1]:upper()..nodeid:sub(2)
|
||||
end
|
||||
return nodename
|
||||
end
|
||||
|
||||
local function moduleSpecific(module)
|
||||
local function fence(nodeid,nodename)
|
||||
nodename = normalize(nodeid,nodename)
|
||||
minetest.register_node(
|
||||
module..":"..nodeid.."_fence", {
|
||||
description = nodename.." Fence",
|
||||
drawtype = "fencelike",
|
||||
tile_images = {module.."_"..nodeid..".png"},
|
||||
inventory_image = module.."_"..nodeid.."_fence.png",
|
||||
wield_image = module.."_"..nodeid.."_fence.png",
|
||||
paramtype = "light",
|
||||
is_ground_content = true,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
|
||||
},
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
end
|
||||
|
||||
local function metal(nodeid, nodename,hasFence)
|
||||
nodename = normalize(nodeid,nodename)
|
||||
minetest.register_node(
|
||||
module..":"..nodeid, {
|
||||
description = nodename,
|
||||
tile_images = {module.."_"..nodeid..".png"},
|
||||
inventory_image = minetest.inventorycube(module.."_"..nodeid..".png"),
|
||||
is_ground_content = true,
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
if hasFence == true then
|
||||
fence(nodeid,nodename)
|
||||
end
|
||||
end
|
||||
local function glow(nodeid,nodename,drawtype)
|
||||
nodename = normalize(nodeid,nodename)
|
||||
if drawtype == nil then
|
||||
drawtype = 'glasslike'
|
||||
inv_image = minetest.inventorycube(module.."_"..nodeid..".png")
|
||||
else
|
||||
inv_image = module.."_"..nodeid..".png"
|
||||
end
|
||||
minetest.register_node(
|
||||
module..":"..nodeid,
|
||||
{
|
||||
description = nodename,
|
||||
drawtype = drawtype,
|
||||
tile_images = {module.."_"..nodeid..".png"},
|
||||
inventory_image = inv_image,
|
||||
light_propagates = true,
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
light_source = 15 ,
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
end
|
||||
local function brick (nodeid, nodename)
|
||||
nodename = normalize(nodeid,nodename)
|
||||
minetest.register_node(
|
||||
module..":"..nodeid,
|
||||
{
|
||||
description = nodename,
|
||||
tile_images = {module.."_"..nodeid..'.png'},
|
||||
inventory_image = minetest.inventorycube(module.."_"..nodeid..'.png'),
|
||||
is_ground_content = true,
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
end
|
||||
local function wood (nodeid, nodename,hasFence)
|
||||
nodename = normalize(nodeid,nodename)
|
||||
minetest.register_node(
|
||||
module..":"..nodeid,
|
||||
{
|
||||
description = nodename,
|
||||
tile_images = {module.."_"..nodeid..".png"},
|
||||
inventory_image = minetest.inventorycube(module.."_"..nodeid..".png"),
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
if hasFence == true then
|
||||
fence(nodeid,nodename)
|
||||
end
|
||||
end
|
||||
local function sign (nodeid, arg)
|
||||
if arg == nil then arg = {} end
|
||||
local light = arg['light'] or 0
|
||||
local infix = arg['infix'] or "signs_"
|
||||
minetest.register_node(
|
||||
module..":"..infix..nodeid,
|
||||
{
|
||||
description = arg['description'] or "Sign",
|
||||
drawtype = "signlike",
|
||||
tile_images = {module.."_"..infix..nodeid..".png"},
|
||||
inventory_image = module.."_"..infix..nodeid..".png",
|
||||
wield_image = module.."_"..infix..nodeid..".png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
is_ground_content = true,
|
||||
walkable = false,
|
||||
climbable = false,
|
||||
selection_box = {
|
||||
type = "wallmounted",
|
||||
},
|
||||
light_source = light ,
|
||||
light_propagates = true,
|
||||
sunlight_propagates = true,
|
||||
on_punch = arg['on_punch'],
|
||||
after_dig_node = arg['after_dig_node'],
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3,flammable=2},
|
||||
legacy_wallmounted = true,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
end
|
||||
local function plant (nodeid, nodename, type, option, arg)
|
||||
|
||||
if option == nil then option = false end
|
||||
if arg == nil then arg = {} end
|
||||
|
||||
local params ={ description = nodename,
|
||||
drawtype = "plantlike",
|
||||
tile_images = {module.."_"..nodeid..'.png'},
|
||||
inventory_image = module.."_"..nodeid..'.png',
|
||||
wield_image = module.."_"..nodeid..'.png',
|
||||
paramtype = "light",
|
||||
on_punch = arg['on_punch'],
|
||||
after_dig_node = arg['after_dig_node']
|
||||
}
|
||||
|
||||
if type == 'veg' then
|
||||
params.groups = {snappy=2,dig_immediate=3,flammable=2}
|
||||
params.sounds = default.node_sound_leaves_defaults()
|
||||
if option == false then params.walkable = false end
|
||||
elseif type == 'met' then -- metallic
|
||||
params.groups = {cracky=3}
|
||||
params.sounds = default.node_sound_stone_defaults()
|
||||
elseif type == 'cri' then -- craft items
|
||||
params.groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3}
|
||||
params.sounds = default.node_sound_wood_defaults()
|
||||
if option == false then params.walkable = false end
|
||||
elseif type == 'eat' then -- edible
|
||||
params.groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3}
|
||||
params.sounds = default.node_sound_wood_defaults()
|
||||
params.walkable = false
|
||||
params.on_use = minetest.item_eat(option)
|
||||
end
|
||||
minetest.register_node(module..":"..nodeid, params)
|
||||
end
|
||||
|
||||
return {fence=fence,metal=metal,glow=glow,brick=brick,wood=wood,sign=sign,plant=plant}
|
||||
end
|
||||
|
||||
return moduleSpecific
|
68
misc.lua
|
@ -1,73 +1,11 @@
|
|||
-- ***********************************************************************************
|
||||
-- SOUND NODES **************************************************
|
||||
-- ***********************************************************************************
|
||||
SOUNDS = {}
|
||||
SOUNDNODE = function(nodeid, nodename,drawtype)
|
||||
SOUNDS[nodeid] = {}
|
||||
SOUNDS[nodeid].sounds = {}
|
||||
local on_punch = function(pos,node)
|
||||
local sound = SOUNDS[nodeid].sounds[minetest.hash_node_position(pos)]
|
||||
if sound == nil then
|
||||
local wanted_sound = {name=nodeid, gain=1.5}
|
||||
SOUNDS[nodeid].sounds[minetest.hash_node_position(pos)] = { handle = minetest.sound_play(wanted_sound, {pos=pos, loop=true}), name = wanted_sound.name, }
|
||||
|
||||
else
|
||||
minetest.sound_stop(sound.handle)
|
||||
SOUNDS[nodeid].sounds[minetest.hash_node_position(pos)] = nil
|
||||
end
|
||||
local soundNode = minetest.require("madblocks","sound")("madblocks")
|
||||
|
||||
end
|
||||
after_dig_node = function(pos,node)
|
||||
local sound = SOUNDS[nodeid].sounds[minetest.hash_node_position(pos)]
|
||||
if sound ~= nil then
|
||||
minetest.sound_stop(sound.handle)
|
||||
SOUNDS[nodeid].sounds[minetest.hash_node_position(pos)] = nil
|
||||
nodeupdate(pos)
|
||||
end
|
||||
end
|
||||
if drawtype == 'signlike' then
|
||||
minetest.register_node("madblocks:"..nodeid, {
|
||||
description = nodename,
|
||||
drawtype = "signlike",
|
||||
tile_images = {"madblocks_"..nodeid..'.png'},
|
||||
inventory_image = "madblocks_"..nodeid..'.png',
|
||||
wield_image = "madblocks_"..nodeid..'.png',
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
metadata_name = "sign",
|
||||
selection_box = {
|
||||
type = "wallmounted",
|
||||
--wall_top = <default>
|
||||
--wall_bottom = <default>
|
||||
--wall_side = <default>
|
||||
},
|
||||
groups = {choppy=2,dig_immediate=2},
|
||||
legacy_wallmounted = true,
|
||||
sounds = default.node_sound_defaults(),
|
||||
on_punch = on_punch,
|
||||
after_dig_node = after_dig_node,
|
||||
})
|
||||
elseif drawtype == '' then
|
||||
minetest.register_node("madblocks:"..nodeid, {
|
||||
description = nodename,
|
||||
drawtype = 'plantlike',
|
||||
tile_images = {"madblocks_"..nodeid..'.png'},
|
||||
inventory_image = "madblocks_"..nodeid..'.png',
|
||||
wield_image = "madblocks_"..nodeid..'.png',
|
||||
paramtype = "light",
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_punch = on_punch,
|
||||
after_dig_node = after_dig_node,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
SOUNDNODE('siren','Loud Siren')
|
||||
SOUNDNODE('churchbells','Church Bells')
|
||||
soundNode('siren','Loud Siren')
|
||||
soundNode('churchbells','Church Bells')
|
||||
|
||||
local bigben = {}
|
||||
bigben.sounds = {}
|
||||
|
|
399
multinode.lua
|
@ -1,399 +0,0 @@
|
|||
MN1 = {}
|
||||
MN2 = {}
|
||||
MN1CACHE = {}
|
||||
MN2CACHE = {}
|
||||
COPY = {}
|
||||
COPYREF = {}
|
||||
PASTEREF ={}
|
||||
REPLACE = {}
|
||||
WITH = {}
|
||||
|
||||
ACTIONNODE = function(nodeid, nodename,onplace,ondig)
|
||||
local params = {
|
||||
description = nodename,
|
||||
tile_images = {"madblocks_"..nodeid..".png"},
|
||||
inventory_image = minetest.inventorycube("madblocks_"..nodeid..".png"),
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
}
|
||||
if onplace ~= nil then params.after_place_node = onplace end
|
||||
if ondig ~= nil then params.after_dig_node = ondig end
|
||||
minetest.register_node("madblocks:"..nodeid, params)
|
||||
end
|
||||
ACTIONNODE('m1','Multinode Marker 1', function(pos,placer)
|
||||
local player = placer:get_player_name()-- or ""
|
||||
if player == '' then print('errorm1') end
|
||||
if MN1[player] == nil then MN1[player] = {} end
|
||||
table.insert(MN1[player], pos)
|
||||
minetest.chat_send_player(player, "marker 1 set")
|
||||
end)
|
||||
ACTIONNODE('m2','Multinode Marker 2', function(pos,placer)
|
||||
local player = placer:get_player_name()-- or ""
|
||||
if player == '' then print('errorm2') end
|
||||
if MN2[player] == nil then MN2[player] = {} end
|
||||
table.insert(MN2[player], pos)
|
||||
minetest.chat_send_player(player, "marker 2 set")
|
||||
end)
|
||||
ACTIONNODE('pasteref','Paste Reference Marker', function(pos,placer)
|
||||
local player = placer:get_player_name()-- or ""
|
||||
if player == '' then print('errorm2') end
|
||||
PASTEREF[player] = pos
|
||||
minetest.chat_send_player(player, "paste reference set")
|
||||
end)
|
||||
|
||||
-- ***********************************************************************************
|
||||
-- FUNCTIONS **************************************************
|
||||
-- ***********************************************************************************
|
||||
compare = function(p1,p2)
|
||||
result = {}
|
||||
if p1 > p2 then
|
||||
result.high = p1
|
||||
result.low = p2
|
||||
result.diff = p1 - p2
|
||||
elseif p2 > p1 then
|
||||
result.high = p2
|
||||
result.low = p1
|
||||
result.diff = p2 - p1
|
||||
else
|
||||
result.high = p2
|
||||
result.low = p1
|
||||
result.diff = 0
|
||||
end
|
||||
if result.diff < 0 then
|
||||
result.diff = -result.diff
|
||||
result.mul = -1
|
||||
else result.mul = 1 end
|
||||
return result
|
||||
end
|
||||
|
||||
local fixlight = function(p)
|
||||
local no = minetest.env:get_node(p)
|
||||
no.param1 = 13
|
||||
minetest.env:add_node(p, no)
|
||||
end
|
||||
local fillnode = function(pos,param)
|
||||
if param == '-light' then
|
||||
fixlight(pos)
|
||||
else
|
||||
minetest.env:add_node(pos,{type="node",name=param})
|
||||
end
|
||||
end
|
||||
local removenode = function(pos,param)
|
||||
if param == '-a' then
|
||||
minetest.env:remove_node(pos)
|
||||
else
|
||||
local node = minetest.env:get_node_or_nil(pos)
|
||||
if node and node.name == param then minetest.env:remove_node(pos) end
|
||||
end
|
||||
end
|
||||
local copynode = function(pos,param)
|
||||
local node = minetest.env:get_node_or_nil(pos)
|
||||
if node then table.insert(COPY[param],{pos=pos,name=node.name}) end
|
||||
end
|
||||
local replacenode = function(pos,param)
|
||||
local node = minetest.env:get_node_or_nil(pos)
|
||||
if node and node.name == REPLACE[param] then minetest.env:add_node(pos,{type="node",name=WITH[param]}) end
|
||||
end
|
||||
|
||||
local multinode = function(p1,p2,mutation,param)
|
||||
local xdif = compare(p1.x,p2.x)
|
||||
local ydif = compare(p1.y,p2.y)
|
||||
local zdif = compare(p1.z,p2.z)
|
||||
if mutation == copynode then COPYREF[param] = p1 end
|
||||
|
||||
if xdif.diff > 0 then
|
||||
for q =0,xdif.diff,1 do
|
||||
mutation({x=xdif.high-q*xdif.mul,y=ydif.high,z=zdif.high},param)
|
||||
if ydif.diff > 0 then
|
||||
for m =0,ydif.diff,1 do
|
||||
mutation({x=xdif.high-q*xdif.mul,y=ydif.high-m*ydif.mul,z=zdif.high},param)
|
||||
if zdif.diff > 0 then
|
||||
for i =0,zdif.diff,1 do
|
||||
mutation({x=xdif.high-q*xdif.mul,y=ydif.high-m*ydif.mul,z=zdif.high-i*zdif.mul},param)
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif zdif.diff > 0 then
|
||||
for i =0,zdif.diff,1 do
|
||||
mutation({x=xdif.high-q*xdif.mul,y=ydif.high,z=zdif.high-i*zdif.mul},param)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
elseif ydif.diff > 0 then
|
||||
for m =0,ydif.diff,1 do
|
||||
mutation({x=xdif.high,y=ydif.high-m*ydif.mul,z=zdif.high},param)
|
||||
if zdif.diff > 0 then
|
||||
for i =0,zdif.diff,1 do
|
||||
mutation({x=xdif.high,y=ydif.high-m*ydif.mul,z=zdif.high-i*zdif.mul},param)
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif zdif.diff > 0 then
|
||||
for i =0,zdif.diff,1 do
|
||||
mutation({x=xdif.high,y=ydif.high,z=zdif.high-i*zdif.mul},param)
|
||||
end
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- ***********************************************************************************
|
||||
-- CHATCOMMANDS **************************************************
|
||||
-- ***********************************************************************************
|
||||
minetest.register_chatcommand("reload", {
|
||||
params = "<none>",
|
||||
description = "restore last multinode list",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
MN1[name] = MN1CACHE[name]
|
||||
MN2[name] = MN2CACHE[name]
|
||||
end,
|
||||
})
|
||||
minetest.register_chatcommand("clear", {
|
||||
params = "<none>",
|
||||
description = "clear",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
COPY[name] = {}
|
||||
COPYREF[name] = {}
|
||||
PASTEREF[name] = {}
|
||||
REPLACE[name] = {}
|
||||
WITH[name] = {}
|
||||
MN1[name] = {}
|
||||
MN2[name] = {}
|
||||
end,
|
||||
})
|
||||
minetest.register_chatcommand("p1", {
|
||||
params = "<X>,<Y>,<Z>",
|
||||
description = "first corner",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
if MN1[name] == nil then MN1[name] = {} end
|
||||
local p = {}
|
||||
p.x, p.y, p.z = string.match(param, "^([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)$")
|
||||
if p.x and p.y and p.z then
|
||||
table.insert(MN1[name], p)
|
||||
minetest.chat_send_player(name, "p1 set")
|
||||
return
|
||||
else
|
||||
local target = minetest.env:get_player_by_name(name)
|
||||
if target then
|
||||
table.insert(MN1[name],target:getpos())
|
||||
minetest.chat_send_player(name, "p1 set")
|
||||
return
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
minetest.register_chatcommand("p2", {
|
||||
params = "<X>,<Y>,<Z>",
|
||||
description = "opposite corner",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
if MN2[name] == nil then MN2[name] = {} end
|
||||
local p = {}
|
||||
p.x, p.y, p.z = string.match(param, "^([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)$")
|
||||
if p.x and p.y and p.z then
|
||||
table.insert(MN2[name], p)
|
||||
minetest.chat_send_player(name, "p2 set")
|
||||
return
|
||||
else
|
||||
local target = minetest.env:get_player_by_name(name)
|
||||
if target then
|
||||
table.insert(MN2[name], target:getpos())
|
||||
minetest.chat_send_player(name, "p2 set")
|
||||
return
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("fill", {
|
||||
params = "<nodename>",
|
||||
description = "fill with given node",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
if table.getn(MN1[name]) == 0 or table.getn(MN2[name]) == 0 or param == nil then
|
||||
print('failed check 1')
|
||||
return end
|
||||
MN1CACHE[name] = MN1[name]--LASTFILL1 = FILL1
|
||||
MN2CACHE[name] = MN2[name]--LASTFILL2 = FILL2
|
||||
MN1[name] = {}
|
||||
MN2[name] = {}
|
||||
for a = 1,table.getn(MN1CACHE[name]),1 do
|
||||
if MN1CACHE[name][a] == nil or MN2CACHE[name][a] == nil then print('failed check 2') return end
|
||||
if multinode(MN1CACHE[name][a],MN2CACHE[name][a],fillnode,param) == false then minetest.chat_send_player(name, "there is no fill only zuul") end
|
||||
end
|
||||
end,
|
||||
})
|
||||
minetest.register_chatcommand("remove", {
|
||||
params = "<nodename>",
|
||||
description = "to remove specific node or use flag '-a'",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
if table.getn(MN1[name]) == 0 or table.getn(MN2[name]) == 0 or param == nil then
|
||||
print('failed check 1')
|
||||
return end
|
||||
MN1CACHE[name] = MN1[name]--LASTFILL1 = FILL1
|
||||
MN2CACHE[name] = MN2[name]--LASTFILL2 = FILL2
|
||||
MN1[name] = {}
|
||||
MN2[name] = {}
|
||||
for a = 1,table.getn(MN1CACHE[name]),1 do
|
||||
if MN1CACHE[name][a] == nil or MN2CACHE[name][a] == nil then print('failed check 2') return end
|
||||
if multinode(MN1CACHE[name][a],MN2CACHE[name][a],removenode,param) == false then minetest.chat_send_player(name, "there is no remove only zuul") end
|
||||
end
|
||||
end,
|
||||
})
|
||||
minetest.register_chatcommand("copy", {
|
||||
params = "<none>",
|
||||
description = "copy",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
if MN1[name] == nil or MN2[name] == nil then minetest.chat_send_player(name, "a klingon that kills without showing his face, has no honor") return end
|
||||
if table.getn(MN1[name]) == 0 or table.getn(MN2[name]) == 0 or param == nil then
|
||||
print('failed check 1')
|
||||
return end
|
||||
MN1CACHE[name] = MN1[name]
|
||||
MN2CACHE[name] = MN2[name]
|
||||
MN1[name] = {}
|
||||
MN2[name] = {}
|
||||
if COPY[name] == nil then COPY[name] = {} end
|
||||
if COPYREF[name] == nil then COPYREF[name] = {} end
|
||||
for a = 1,table.getn(MN1CACHE[name]),1 do
|
||||
if MN1CACHE[name][a] == nil or MN2CACHE[name][a] == nil then print('failed check 2') return end
|
||||
if multinode(MN1CACHE[name][a],MN2CACHE[name][a],copynode,name) == false then minetest.chat_send_player(name, "there is no copy only zuul") end
|
||||
end
|
||||
end,
|
||||
})
|
||||
minetest.register_chatcommand("paste", {
|
||||
params = "<none>",
|
||||
description = "paste",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
if PASTEREF[name] then
|
||||
newpos = PASTEREF[name]
|
||||
else
|
||||
local target = minetest.env:get_player_by_name(name)
|
||||
if target then
|
||||
newpos = target:getpos()
|
||||
end
|
||||
end
|
||||
|
||||
difx = COPYREF[name].x - newpos.x
|
||||
dify = COPYREF[name].y - newpos.y
|
||||
difz = COPYREF[name].z - newpos.z
|
||||
|
||||
for a = 1,table.getn(COPY[name]),1 do
|
||||
if param ~= '+90' and param ~= '-90' and param ~= '+180' then
|
||||
pastepos = {x=COPY[name][a].pos.x-difx,y=COPY[name][a].pos.y-dify,z=COPY[name][a].pos.z-difz}
|
||||
else
|
||||
local x = COPY[name][a].pos.x -COPYREF[name].x
|
||||
local y = COPY[name][a].pos.y
|
||||
local z = COPY[name][a].pos.z -COPYREF[name].z
|
||||
local newx,newz = nil
|
||||
if param == '+90' then
|
||||
newx = z
|
||||
newz = -(x)
|
||||
elseif param == '-90' then
|
||||
newx = -(z)
|
||||
newz = x
|
||||
elseif param == '+180' then
|
||||
newx = -(x)
|
||||
newz = -(z)
|
||||
else
|
||||
return
|
||||
end
|
||||
x = newx + COPYREF[name].x
|
||||
z = newz + COPYREF[name].z
|
||||
pastepos = {x=x-difx,y=y-dify,z=z-difz}
|
||||
end
|
||||
minetest.env:add_node(pastepos,{type="node",name=COPY[name][a].name})
|
||||
end
|
||||
PASTEREF[name] = nil
|
||||
end,
|
||||
})
|
||||
minetest.register_chatcommand("replace", {
|
||||
params = "<none>",
|
||||
description = "clear",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
REPLACE[name] = param
|
||||
end,
|
||||
})
|
||||
minetest.register_chatcommand("with", {
|
||||
params = "<none>",
|
||||
description = "clear",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
WITH[name] = param
|
||||
end,
|
||||
})
|
||||
minetest.register_chatcommand("doit", {
|
||||
params = "<none>",
|
||||
description = "clear",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
if table.getn(MN1[name]) == 0 or table.getn(MN2[name]) == 0 then
|
||||
print('failed check 1')
|
||||
return end
|
||||
MN1CACHE[name] = MN1[name]
|
||||
MN2CACHE[name] = MN2[name]
|
||||
MN1[name] = {}
|
||||
MN2[name] = {}
|
||||
for a = 1,table.getn(MN1CACHE[name]),1 do
|
||||
if MN1CACHE[name][a] == nil or MN2CACHE[name][a] == nil then print('failed check 2') return end
|
||||
if multinode(MN1CACHE[name][a],MN2CACHE[name][a],replacenode,name) == false then minetest.chat_send_player(name, "there is no replace only zuul") end
|
||||
end
|
||||
REPLACE[name] = nil
|
||||
WITH[name] = nil
|
||||
end,
|
||||
})
|
||||
minetest.register_chatcommand("saveas", {
|
||||
params = "<bldname>",
|
||||
description = "paste",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
if COPY[name] == nil then minetest.chat_send_player(name, "a klingon that kills without showing his face, has no honor") return end
|
||||
|
||||
local output = '' -- WRITE CHANGES TO FILE
|
||||
local f = io.open(minetest.get_modpath('madblocks')..'/buildings/'..param..'.bld', "w")
|
||||
if f == nil then minetest.chat_send_player(name, "a klingon that kills without showing his face, has no honor") return end
|
||||
for a = 1,table.getn(COPY[name]),1 do
|
||||
local x = COPY[name][a].pos.x -COPYREF[name].x
|
||||
local y = COPY[name][a].pos.y -COPYREF[name].y
|
||||
local z = COPY[name][a].pos.z -COPYREF[name].z
|
||||
output = output..COPY[name][a].name..'~'..x..','..y..','..z..';'
|
||||
end
|
||||
f:write(output)
|
||||
io.close(f)
|
||||
minetest.chat_send_player(name, param.." saved")
|
||||
|
||||
end,
|
||||
})
|
||||
minetest.register_chatcommand("load", {
|
||||
params = "<bldname>",
|
||||
description = "paste",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
local bldfile = io.open(minetest.get_modpath('madblocks')..'/buildings/'..param..'.bld', "r")
|
||||
if bldfile then
|
||||
COPY[name] = {}
|
||||
COPYREF[name] = {x=0,y=0,z=0}
|
||||
local contents = bldfile:read()
|
||||
io.close(bldfile)
|
||||
if contents ~= nil then
|
||||
local entries = contents:split(";")
|
||||
for i,entry in pairs(entries) do
|
||||
local nodename, coords = unpack(entry:split("~"))
|
||||
local p = {}
|
||||
p.x, p.y, p.z = string.match(coords, "^([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)$")
|
||||
if p.x and p.y and p.z then
|
||||
table.insert(COPY[name],{name = nodename, pos = {x = tonumber(p.x),y= tonumber(p.y),z = tonumber(p.z)}})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
413
nature.lua
|
@ -1,413 +0,0 @@
|
|||
|
||||
-- ***********************************************************************************
|
||||
-- SEASONAL CHANGES **************************************************
|
||||
-- ***********************************************************************************
|
||||
SEASON_FILE = minetest.get_worldpath()..'/madblocks.season'
|
||||
|
||||
local function set_season(t)
|
||||
CURRENT_SEASON = t
|
||||
-- write to file
|
||||
local f = io.open(SEASON_FILE, "w")
|
||||
f:write(CURRENT_SEASON)
|
||||
io.close(f)
|
||||
end
|
||||
|
||||
local f = io.open(SEASON_FILE, "r")
|
||||
if f ~= nil then
|
||||
CURRENT_SEASON = f:read("*n")
|
||||
io.close(f)
|
||||
else
|
||||
print('could not find season file, creating one (setting winter).')
|
||||
set_season(1)
|
||||
|
||||
end
|
||||
|
||||
switch_seasons = function()
|
||||
if CURRENT_SEASON == 1 then
|
||||
set_season(2) -- set to spring
|
||||
print('changing to spring')
|
||||
minetest.after(SEASON_LENGTH,switch_seasons)
|
||||
elseif CURRENT_SEASON == 2 then
|
||||
set_season(3) -- set to summer
|
||||
print('changing to summer')
|
||||
minetest.after(SEASON_LENGTH,switch_seasons)
|
||||
elseif CURRENT_SEASON == 3 then
|
||||
set_season(4) -- set to autumn
|
||||
print('changing to autumn')
|
||||
minetest.after(SEASON_LENGTH,switch_seasons)
|
||||
elseif CURRENT_SEASON == 4 then
|
||||
set_season(1) -- set to winter
|
||||
print('changing to winter')
|
||||
minetest.after(SEASON_LENGTH,switch_seasons)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
minetest.after(SEASON_LENGTH,switch_seasons)
|
||||
|
||||
minetest.register_chatcommand("season", {
|
||||
params = "<season>",
|
||||
description = "set the season",
|
||||
func = function(name, param)
|
||||
if param == 'winter' or param == 'Winter' then set_season(1)
|
||||
elseif param == 'spring' or param == 'Spring' then set_season(2)
|
||||
elseif param == 'summer' or param == 'Summer' then set_season(3)
|
||||
elseif param == 'fall' or param == 'Fall' then set_season(4)
|
||||
elseif param == 'pause' or param == 'Pause' then set_season(0)
|
||||
minetest.chat_send_player(name, "Season paused.")
|
||||
return
|
||||
else
|
||||
minetest.chat_send_player(name, "Invalid paramater '"..param.."', try 'winter','spring','summer' or 'fall'.")
|
||||
return
|
||||
end
|
||||
minetest.chat_send_player(name, "Season changed.")
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = { "default:dirt_with_grass","madblocks:grass_autumn",'madblocks:grass_winter',"madblocks:grass_spring",
|
||||
'default:leaves','madblocks:leaves_autumn','madblocks:leaves_winter','madblocks:leaves_spring',
|
||||
"default:water_source","default:water_flowing", "default:cactus","default:desert_sand","default:sand","madblocks:desertsand_winter", "madblocks:sand_winter","madblocks:cactus_winter",'madblocks:ice_source','madblocks:ice_flowing' },
|
||||
interval = WEATHER_CHANGE_INTERVAL,
|
||||
chance = 6,
|
||||
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
if CURRENT_SEASON == 1 then
|
||||
if node.name == 'madblocks:grass_autumn' or node.name == 'default:dirt_with_grass' or node.name == 'madblocks:grass_spring' then
|
||||
minetest.env:add_node(pos,{type="node",name='madblocks:grass_winter'})
|
||||
elseif node.name == 'madblocks:leaves_autumn' or node.name == 'default:leaves' or node.name == 'madblocks:leaves_spring' then
|
||||
minetest.env:add_node(pos,{type="node",name='madblocks:leaves_winter'})
|
||||
|
||||
elseif node.name == 'default:desert_sand' then
|
||||
above = minetest.env:get_node_or_nil({x=pos.x,y=pos.y+1,z=pos.z})
|
||||
if above ~= nil and above.name == 'air' then
|
||||
minetest.env:add_node(pos,{type="node",name='madblocks:desertsand_winter'})
|
||||
end
|
||||
elseif node.name == 'default:sand' then
|
||||
above = minetest.env:get_node_or_nil({x=pos.x,y=pos.y+1,z=pos.z})
|
||||
if above ~= nil and above.name == 'air' then
|
||||
minetest.env:add_node(pos,{type="node",name='madblocks:sand_winter'})
|
||||
end
|
||||
elseif node.name == 'default:cactus' then
|
||||
above = minetest.env:get_node_or_nil({x=pos.x,y=pos.y+1,z=pos.z})
|
||||
if above ~= nil and above.name == 'air' then
|
||||
minetest.env:add_node(pos,{type="node",name='madblocks:cactus_winter'})
|
||||
end
|
||||
elseif node.name == 'default:water_source' then
|
||||
above = minetest.env:get_node_or_nil({x=pos.x,y=pos.y+1,z=pos.z})
|
||||
if above ~= nil and above.name == 'air' then
|
||||
minetest.env:add_node(pos,{type="node",name='madblocks:ice_source'})
|
||||
end
|
||||
elseif node.name == 'default:water_flowing' then
|
||||
above = minetest.env:get_node_or_nil({x=pos.x,y=pos.y+1,z=pos.z})
|
||||
if above ~= nil and above.name == 'air' then
|
||||
minetest.env:add_node(pos,{type="node",name='madblocks:ice_flowing'})
|
||||
end
|
||||
end
|
||||
elseif CURRENT_SEASON == 2 then
|
||||
if node.name == 'madblocks:grass_winter' or node.name == 'madblocks:grass_autumn' or node.name == 'default:dirt_with_grass' then
|
||||
minetest.env:add_node(pos,{type="node",name='madblocks:grass_spring'})
|
||||
elseif node.name == 'madblocks:leaves_winter' or node.name == 'madblocks:leaves_autumn' or node.name == 'default:leaves' then
|
||||
minetest.env:add_node(pos,{type="node",name='madblocks:leaves_spring'})
|
||||
elseif node.name == 'madblocks:desertsand_winter' then
|
||||
minetest.env:add_node(pos,{type="node",name='default:desert_sand'})
|
||||
elseif node.name == 'madblocks:sand_winter' then
|
||||
minetest.env:add_node(pos,{type="node",name='default:sand'})
|
||||
elseif node.name == 'madblocks:cactus_winter' then
|
||||
minetest.env:add_node(pos,{type="node",name='default:cactus'})
|
||||
elseif node.name == 'madblocks:ice_source' then
|
||||
minetest.env:add_node(pos,{type="node",name='default:water_source'})
|
||||
elseif node.name == 'madblocks:ice_flowing' then
|
||||
minetest.env:add_node(pos,{type="node",name='default:water_flowing'})
|
||||
end
|
||||
elseif CURRENT_SEASON == 3 then
|
||||
if node.name == 'madblocks:leaves_spring' or node.name == 'madblocks:leaves_winter' or node.name == 'madblocks:leaves_autumn' then
|
||||
minetest.env:add_node(pos,{type="node",name='default:leaves'})
|
||||
elseif node.name == 'madblocks:grass_spring' or node.name == 'madblocks:grass_winter' or node.name == 'madblocks:grass_autumn' then
|
||||
minetest.env:add_node(pos,{type="node",name='default:dirt_with_grass'})
|
||||
elseif node.name == 'madblocks:desertsand_winter' then
|
||||
minetest.env:add_node(pos,{type="node",name='default:desert_sand'})
|
||||
elseif node.name == 'madblocks:sand_winter' then
|
||||
minetest.env:add_node(pos,{type="node",name='default:sand'})
|
||||
elseif node.name == 'madblocks:cactus_winter' then
|
||||
minetest.env:add_node(pos,{type="node",name='default:cactus'})
|
||||
elseif node.name == 'madblocks:ice_source' then
|
||||
minetest.env:add_node(pos,{type="node",name='default:water_source'})
|
||||
elseif node.name == 'madblocks:ice_flowing' then
|
||||
minetest.env:add_node(pos,{type="node",name='default:water_flowing'})
|
||||
end
|
||||
elseif CURRENT_SEASON == 4 then
|
||||
if node.name == 'default:leaves' or node.name == 'madblocks:leaves_spring' or node.name == 'madblocks:leaves_winter' then
|
||||
minetest.env:add_node(pos,{type="node",name='madblocks:leaves_autumn'})
|
||||
elseif node.name == 'default:dirt_with_grass' or node.name == 'madblocks:grass_spring' or node.name == 'madblocks:grass_winter' then
|
||||
minetest.env:add_node(pos,{type="node",name='madblocks:grass_autumn'})
|
||||
elseif node.name == 'madblocks:desertsand_winter' then
|
||||
minetest.env:add_node(pos,{type="node",name='default:desert_sand'})
|
||||
elseif node.name == 'madblocks:sand_winter' then
|
||||
minetest.env:add_node(pos,{type="node",name='default:sand'})
|
||||
elseif node.name == 'madblocks:cactus_winter' then
|
||||
minetest.env:add_node(pos,{type="node",name='default:cactus'})
|
||||
elseif node.name == 'madblocks:ice_source' then
|
||||
minetest.env:add_node(pos,{type="node",name='default:water_source'})
|
||||
elseif node.name == 'madblocks:ice_flowing' then
|
||||
minetest.env:add_node(pos,{type="node",name='default:water_flowing'})
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
-- ***********************************************************************************
|
||||
-- BIRDS SPRING/SUMMER **************************************************
|
||||
-- ***********************************************************************************
|
||||
if BIRDS == true then
|
||||
local bird = {}
|
||||
bird.sounds = {}
|
||||
bird_sound = function(p)
|
||||
local wanted_sound = {name="bird", gain=0.6}
|
||||
bird.sounds[minetest.hash_node_position(p)] = {
|
||||
handle = minetest.sound_play(wanted_sound, {pos=p, loop=true}),
|
||||
name = wanted_sound.name, }
|
||||
end
|
||||
|
||||
bird_stop = function(p)
|
||||
local sound = bird.sounds[minetest.hash_node_position(p)]
|
||||
if sound ~= nil then
|
||||
minetest.sound_stop(sound.handle)
|
||||
bird.sounds[minetest.hash_node_position(p)] = nil
|
||||
end
|
||||
end
|
||||
minetest.register_on_dignode(function(p, node)
|
||||
if node.name == "madblocks:bird" then
|
||||
bird_stop(p)
|
||||
|
||||
end
|
||||
end)
|
||||
minetest.register_abm({
|
||||
nodenames = { "madblocks:leaves_spring",'default:leaves' },
|
||||
interval = NATURE_GROW_INTERVAL,
|
||||
chance = 200,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local air = { x=pos.x, y=pos.y+1,z=pos.z }
|
||||
local is_air = minetest.env:get_node_or_nil(air)
|
||||
if is_air ~= nil and is_air.name == 'air' then
|
||||
minetest.env:add_node(air,{type="node",name='madblocks:bird'})
|
||||
bird_sound(air)
|
||||
end
|
||||
end
|
||||
})
|
||||
minetest.register_abm({
|
||||
nodenames = {'madblocks:bird' },
|
||||
interval = NATURE_GROW_INTERVAL,
|
||||
chance = 2,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.env:remove_node(pos)
|
||||
bird_stop(pos)
|
||||
end
|
||||
})
|
||||
end
|
||||
-- ***********************************************************************************
|
||||
-- NATURE_GROW **************************************************
|
||||
-- ***********************************************************************************
|
||||
minetest.register_abm({
|
||||
nodenames = { "default:dirt_with_grass",'madblocks:grass_spring' },
|
||||
interval = NATURE_GROW_INTERVAL,
|
||||
chance = 200,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local air = { x=pos.x, y=pos.y+1,z=pos.z }
|
||||
local is_air = minetest.env:get_node_or_nil(air)
|
||||
if is_air ~= nil and is_air.name == 'air' then
|
||||
local count = table.getn(NATURE_PLANTS)
|
||||
local random_plant = math.random(1,count)
|
||||
minetest.env:add_node({x=pos.x,y=pos.y+1,z=pos.z},{type="node",name=NATURE_PLANTS[random_plant]})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = NATURE_PLANTS,
|
||||
interval = NATURE_GROW_INTERVAL,
|
||||
chance = 2,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.env:remove_node({x=pos.x,y=pos.y,z=pos.z})
|
||||
end
|
||||
})
|
||||
|
||||
-- ***********************************************************************************
|
||||
-- SLIMTREES **************************************************
|
||||
-- ***********************************************************************************
|
||||
minetest.register_abm({
|
||||
nodenames = { "madblocks:slimtree" },
|
||||
interval = 60,
|
||||
chance = 1,
|
||||
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.env:add_node({x=pos.x,y=pos.y,z=pos.z},{type="node",name="madblocks:slimtree_wood"})
|
||||
minetest.env:add_node({x=pos.x,y=pos.y+1,z=pos.z},{type="node",name="madblocks:slimtree_wood"})
|
||||
minetest.env:add_node({x=pos.x,y=pos.y+2,z=pos.z},{type="node",name="madblocks:slimtree_wood"})
|
||||
|
||||
minetest.env:add_node({x=pos.x,y=pos.y+3,z=pos.z},{type="node",name="madblocks:slimtree_wood"})
|
||||
minetest.env:add_node({x=pos.x+1,y=pos.y+3,z=pos.z},{type="node",name="default:leaves"})
|
||||
minetest.env:add_node({x=pos.x-1,y=pos.y+3,z=pos.z},{type="node",name="default:leaves"})
|
||||
minetest.env:add_node({x=pos.x,y=pos.y+3,z=pos.z+1},{type="node",name="default:leaves"})
|
||||
minetest.env:add_node({x=pos.x,y=pos.y+3,z=pos.z-1},{type="node",name="default:leaves"})
|
||||
|
||||
|
||||
minetest.env:add_node({x=pos.x,y=pos.y+4,z=pos.z},{type="node",name="default:leaves"})
|
||||
minetest.env:add_node({x=pos.x+1,y=pos.y+4,z=pos.z},{type="node",name="default:leaves"})
|
||||
minetest.env:add_node({x=pos.x-1,y=pos.y+4,z=pos.z},{type="node",name="default:leaves"})
|
||||
minetest.env:add_node({x=pos.x,y=pos.y+4,z=pos.z+1},{type="node",name="default:leaves"})
|
||||
minetest.env:add_node({x=pos.x,y=pos.y+4,z=pos.z-1},{type="node",name="default:leaves"})
|
||||
|
||||
|
||||
minetest.env:add_node({x=pos.x,y=pos.y+5,z=pos.z},{type="node",name="default:leaves"})
|
||||
minetest.env:add_node({x=pos.x+1,y=pos.y+5,z=pos.z},{type="node",name="default:leaves"})
|
||||
minetest.env:add_node({x=pos.x-1,y=pos.y+5,z=pos.z},{type="node",name="default:leaves"})
|
||||
minetest.env:add_node({x=pos.x,y=pos.y+5,z=pos.z+1},{type="node",name="default:leaves"})
|
||||
minetest.env:add_node({x=pos.x,y=pos.y+5,z=pos.z-1},{type="node",name="default:leaves"})
|
||||
|
||||
minetest.env:add_node({x=pos.x,y=pos.y+6,z=pos.z},{type="node",name="default:leaves"})
|
||||
minetest.env:add_node({x=pos.x+1,y=pos.y+6,z=pos.z},{type="node",name="default:leaves"})
|
||||
minetest.env:add_node({x=pos.x-1,y=pos.y+6,z=pos.z},{type="node",name="default:leaves"})
|
||||
minetest.env:add_node({x=pos.x,y=pos.y+6,z=pos.z+1},{type="node",name="default:leaves"})
|
||||
minetest.env:add_node({x=pos.x,y=pos.y+6,z=pos.z-1},{type="node",name="default:leaves"})
|
||||
end
|
||||
})
|
||||
|
||||
-- ***********************************************************************************
|
||||
-- NODES **************************************************
|
||||
-- ***********************************************************************************
|
||||
PLANTLIKE('slimtree','Slimtree Sapling','veg')
|
||||
PLANTLIKE('bird','Bird','veg')
|
||||
PLANTLIKE('dandylions','Dandylions','veg')
|
||||
PLANTLIKE('mushroom','Wild Mushroom','veg')
|
||||
minetest.register_node("madblocks:slimtree_wood", {
|
||||
description = "Slimtree",
|
||||
drawtype = "fencelike",
|
||||
tile_images = {"madblocks_tree.png"},
|
||||
inventory_image = "madblocks_tree.png",
|
||||
wield_image = "madblocks_tree.png",
|
||||
paramtype = "light",
|
||||
is_ground_content = true,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
|
||||
},
|
||||
groups = {tree=1,snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
drop = 'default:fence_wood',
|
||||
})
|
||||
minetest.register_node("madblocks:ice_source", {
|
||||
description = "Ice",
|
||||
tile_images = {"madblocks_ice.png"},
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,choppy=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
minetest.register_node("madblocks:ice_flowing", {
|
||||
description = "Ice",
|
||||
tile_images = {"madblocks_ice.png"},
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,choppy=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
minetest.register_node("madblocks:leaves_autumn", {
|
||||
description = "Leaves",
|
||||
drawtype = "allfaces_optional",
|
||||
visual_scale = 1.3,
|
||||
tile_images = {"madblocks_leaves_autumn.png"},
|
||||
paramtype = "light",
|
||||
groups = {snappy=3, leafdecay=3, flammable=2},
|
||||
drop = {
|
||||
max_items = 1, items = {
|
||||
{items = {'default:sapling'}, rarity = 20,},
|
||||
{items = {'madblocks:leaves_autumn'},}
|
||||
}},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
minetest.register_node("madblocks:leaves_spring", {
|
||||
description = "Leaves",
|
||||
drawtype = "allfaces_optional",
|
||||
visual_scale = 1.3,
|
||||
tile_images = {"madblocks_leaves_spring.png"},
|
||||
paramtype = "light",
|
||||
groups = {snappy=3, leafdecay=3, flammable=2},
|
||||
drop = {
|
||||
max_items = 1, items = {
|
||||
{items = {'default:sapling'}, rarity = 20,},
|
||||
{items = {'madblocks:leaves_spring'},}
|
||||
}},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
minetest.register_node("madblocks:grass_spring", {
|
||||
description = "Dirt with snow",
|
||||
tile_images = {"madblocks_grass_spring.png", "default_dirt.png", "default_dirt.png^madblocks_grass_spring_side.png"},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3},
|
||||
drop = 'default:dirt',
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_grass_footstep", gain=0.4},
|
||||
}),
|
||||
})
|
||||
minetest.register_node("madblocks:grass_autumn", {
|
||||
description = "Dirt with snow",
|
||||
tile_images = {"madblocks_grass_autumn.png", "default_dirt.png", "default_dirt.png^madblocks_grass_autumn_side.png"},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3},
|
||||
drop = 'default:dirt',
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_grass_footstep", gain=0.4},
|
||||
}),
|
||||
})
|
||||
minetest.register_node("madblocks:grass_winter", {
|
||||
description = "Dirt with snow",
|
||||
tile_images = {"madblocks_snow.png", "default_dirt.png", "default_dirt.png^madblocks_grass_w_snow_side.png"},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3},
|
||||
drop = 'default:dirt',
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_grass_footstep", gain=0.4},
|
||||
}),
|
||||
})
|
||||
minetest.register_node("madblocks:leaves_winter", {
|
||||
description = "Leaves",
|
||||
drawtype = "allfaces_optional",
|
||||
visual_scale = 1.3,
|
||||
tile_images = {"madblocks_leaves_with_snow.png"},
|
||||
paramtype = "light",
|
||||
groups = {snappy=3, leafdecay=3, flammable=2},
|
||||
drop = {
|
||||
max_items = 1, items = {
|
||||
{items = {'default:sapling'}, rarity = 20,},
|
||||
{items = {'madblocks:leaves_winter'},}
|
||||
}},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
minetest.register_node("madblocks:cactus_winter", {
|
||||
description = "Cactus",
|
||||
tile_images = {"madblocks_cactus_wsnow_top.png", "madblocks_cactus_wsnow_top.png", "madblocks_cactus_wsnow_side.png"},
|
||||
is_ground_content = true,
|
||||
groups = {snappy=2,choppy=3,flammable=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
minetest.register_node("madblocks:sand_winter", {
|
||||
description = "Sand with snow",
|
||||
tile_images = {"madblocks_snow.png", "default_sand.png", "default_sand.png^madblocks_sand_w_snow_side.png"},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3},
|
||||
drop = 'default:sand',
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_grass_footstep", gain=0.4},
|
||||
}),
|
||||
})
|
||||
minetest.register_node("madblocks:desertsand_winter", {
|
||||
description = "Desert Sand with snow",
|
||||
tile_images = {"madblocks_snow.png", "default_desert_sand.png", "default_desert_sand.png^madblocks_desertsand_w_snow_side.png"},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3},
|
||||
drop = 'default:desert_sand',
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_grass_footstep", gain=0.4},
|
||||
}),
|
||||
})
|
||||
|
67
nocrafts.lua
|
@ -1,58 +1,33 @@
|
|||
METALLIKE = function(nodeid, nodename,fence)
|
||||
minetest.register_node("madblocks:"..nodeid, {
|
||||
description = nodename,
|
||||
tile_images = {"madblocks_"..nodeid..".png"},
|
||||
inventory_image = minetest.inventorycube("madblocks_"..nodeid..".png"),
|
||||
is_ground_content = true,
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
if fence == true then
|
||||
minetest.register_node("madblocks:"..nodeid.."_fence", {
|
||||
description = nodename.." Fence",
|
||||
drawtype = "fencelike",
|
||||
tile_images = {"madblocks_"..nodeid..".png"},
|
||||
inventory_image = "madblocks_"..nodeid.."_fence.png",
|
||||
wield_image = "madblocks_"..nodeid.."_fence.png",
|
||||
paramtype = "light",
|
||||
is_ground_content = true,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
|
||||
},
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
end
|
||||
end
|
||||
local like = minetest.require("madblocks","like")("madblocks")
|
||||
local soundNode = minetest.require("madblocks","sound")("madblocks")
|
||||
|
||||
-- ***********************************************************************************
|
||||
-- NEW METALLIC ITEMS **************************************************
|
||||
-- ***********************************************************************************
|
||||
|
||||
METALLIKE('brushedmetal','Brushed Metal',true)
|
||||
METALLIKE('yellow_rustedmetal','Yellow Painted Rusted Metal',true)
|
||||
METALLIKE('texturedmetal','Textured Metal')
|
||||
METALLIKE('metalbulkhead','Metal Bulkhead')
|
||||
METALLIKE('stripedmetal','Caution Striped Metal')
|
||||
BRICKLIKE('brownmedistonebrick','Mediterranean Stonebrick (Brown Tones)')
|
||||
like.metal('brushedmetal','Brushed Metal',true)
|
||||
like.metal('yellow_rustedmetal','Yellow Painted Rusted Metal',true)
|
||||
like.metal('texturedmetal','Textured Metal')
|
||||
like.metal('metalbulkhead','Metal Bulkhead')
|
||||
like.metal('stripedmetal','Caution Striped Metal')
|
||||
like.brick('brownmedistonebrick','Mediterranean Stonebrick (Brown Tones)')
|
||||
|
||||
-- ***********************************************************************************
|
||||
-- RIVEN/MYST (DECO) NODES **************************************************
|
||||
-- ***********************************************************************************
|
||||
|
||||
SOUNDNODE('riven1','Riven Art (1)','signlike')
|
||||
SOUNDNODE('riven2','Riven Art (2)','signlike')
|
||||
SOUNDNODE('riven3','Riven Art (3)','signlike')
|
||||
METALLIKE('rivenwood','Riven Wood')
|
||||
METALLIKE('rivenwoodblue','Riven Wood (Blue)')
|
||||
METALLIKE('rivenstone1','Riven Stone (1)')
|
||||
METALLIKE('rivenstone2','Riven Stone (2)')
|
||||
METALLIKE('rivenstoneblue','Riven Stone (Blue)')
|
||||
METALLIKE('rivenmetal','Riven Rusted Metal')
|
||||
METALLIKE('rivenbulkhead','Riven Metal Bulkhead')
|
||||
METALLIKE('rivengoldstone1','Riven Gold Stone (1)')
|
||||
METALLIKE('rivengoldstone2','Riven Gold Stone (2)')
|
||||
soundNode('riven1','Riven Art (1)','signlike')
|
||||
soundNode('riven2','Riven Art (2)','signlike')
|
||||
soundNode('riven3','Riven Art (3)','signlike')
|
||||
like.metal('rivenwood','Riven Wood')
|
||||
like.metal('rivenwoodblue','Riven Wood (Blue)')
|
||||
like.metal('rivenstone1','Riven Stone (1)')
|
||||
like.metal('rivenstone2','Riven Stone (2)')
|
||||
like.metal('rivenstoneblue','Riven Stone (Blue)')
|
||||
like.metal('rivenmetal','Riven Rusted Metal')
|
||||
like.metal('rivenbulkhead','Riven Metal Bulkhead')
|
||||
like.metal('rivengoldstone1','Riven Gold Stone (1)')
|
||||
like.metal('rivengoldstone2','Riven Gold Stone (2)')
|
||||
|
||||
minetest.register_node("madblocks:rivenbeetle", {
|
||||
description = "Sign",
|
||||
|
@ -300,7 +275,7 @@ minetest.register_node("madblocks:palmleaves", {
|
|||
},
|
||||
groups = {bendy=2,snappy=1,dig_immediate=2},
|
||||
})
|
||||
PLANTLIKE('palmtree','Palmtree Sapling','veg')
|
||||
like.plant('palmtree','Palmtree Sapling','veg')
|
||||
minetest.register_abm({
|
||||
nodenames = { "madblocks:palmtree" },
|
||||
interval = 120,
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
local port = minetest.require("__builtin","port")
|
||||
|
||||
local plants = {
|
||||
tomato = {},
|
||||
peas = {},
|
||||
habanero = {},
|
||||
cyanflower = {},
|
||||
magentaflower = {},
|
||||
yellowflower = {},
|
||||
rubberplant = {short=true, give_on_harvest='hydroponics:rubber'},
|
||||
grapes = {permaculture=true},
|
||||
coffee = {permaculture=true},
|
||||
roses = {give_on_harvest='hydroponics:rosebush'}
|
||||
}
|
||||
|
||||
local stages = {
|
||||
"seeds",
|
||||
"seedlings",
|
||||
"sproutlings",
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4
|
||||
}
|
||||
|
||||
for plant,eh in pairs(plants) do
|
||||
port("madblocks","hydroponics","hydroponics_"..plant,plant)
|
||||
port("madblocks","hydroponics","hydroponics_wild_"..plant,"wild_"..plant)
|
||||
for i,stage in ipairs(stages) do
|
||||
local name = "hydroponics"
|
||||
local n = tonumber(stage)
|
||||
if n ~= nil then
|
||||
name = name .. '_' .. plant .. stage
|
||||
else
|
||||
name = name .. '_' .. stage .. '_' .. plant
|
||||
end
|
||||
local toname = plant..'_'..stage
|
||||
port("madblocks","hydroponics",name,toname)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,20 @@
|
|||
local port = minetest.require("__builtin","port")
|
||||
-- sigh...
|
||||
local seasons = {
|
||||
[1]= "winter",
|
||||
[2]= "spring",
|
||||
[3]= "summer",
|
||||
[4]= "autumn"
|
||||
}
|
||||
for season = 1,4,1 do
|
||||
if season ~= 3 then
|
||||
port("madblocks","nature","grass_"..seasons[season])
|
||||
port("madblocks","nature","leaves_"..seasons[season])
|
||||
end
|
||||
end
|
||||
port("madblocks","nature","cactus_winter")
|
||||
port("madblocks","nature","ice_flowing")
|
||||
port("madblocks","nature","ice_source")
|
||||
port("madblocks","nature","dandylions")
|
||||
port("madblocks","nature","mushroom")
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
local like = minetest.require("madblocks","like")("madblocks")
|
||||
|
||||
-- ***********************************************************************************
|
||||
-- SOUND NODES **************************************************
|
||||
-- ***********************************************************************************
|
||||
|
||||
local function moduleSpecific(module)
|
||||
local SOUNDS = {}
|
||||
function register(nodeid, nodename,drawtype)
|
||||
SOUNDS[nodeid] = {}
|
||||
SOUNDS[nodeid].sounds = {}
|
||||
local function on_punch(pos,node)
|
||||
local sound = SOUNDS[nodeid].sounds[minetest.hash_node_position(pos)]
|
||||
if sound == nil then
|
||||
local wanted_sound = {name=nodeid, gain=1.5}
|
||||
SOUNDS[nodeid].sounds[minetest.hash_node_position(pos)] = { handle = minetest.sound_play(wanted_sound, {pos=pos, loop=true}), name = wanted_sound.name, }
|
||||
|
||||
else
|
||||
minetest.sound_stop(sound.handle)
|
||||
SOUNDS[nodeid].sounds[minetest.hash_node_position(pos)] = nil
|
||||
end
|
||||
|
||||
end
|
||||
local function after_dig_node(pos,node)
|
||||
local sound = SOUNDS[nodeid].sounds[minetest.hash_node_position(pos)]
|
||||
if sound ~= nil then
|
||||
minetest.sound_stop(sound.handle)
|
||||
SOUNDS[nodeid].sounds[minetest.hash_node_position(pos)] = nil
|
||||
nodeupdate(pos)
|
||||
end
|
||||
end
|
||||
if drawtype == 'signlike' then
|
||||
like.sign(nodeid,{
|
||||
description=nodename,
|
||||
on_punch = on_punch,
|
||||
after_dig_node = after_dig_node,
|
||||
})
|
||||
elseif drawtype == nil or drawtype == '' then
|
||||
like.plant(nodeid,nodename,"met",true,{
|
||||
on_punch = on_punch,
|
||||
after_dig_node = after_dig_node
|
||||
})
|
||||
end
|
||||
|
||||
end
|
||||
return register
|
||||
end
|
||||
|
||||
return moduleSpecific
|
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 451 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 234 B |
Before Width: | Height: | Size: 249 B |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 358 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 706 B |