Add files via upload
parent
a0fdca3885
commit
edc3e52128
61
README.md
61
README.md
|
@ -1,2 +1,61 @@
|
|||
# ma_pops_furniture
|
||||
A revamp of Ma & Pop's Furniture Mod
|
||||
|
||||
A revamp of Ma and Pop's Furniture Mod
|
||||
|
||||
================================================================
|
||||
|
||||
Credits:
|
||||
Radio Mod Code (Mihobre)
|
||||
BlockMen (Lots and lots) |For helping me alot with the code
|
||||
|Letting me experiment with his mod
|
||||
|Supporting me all the time
|
||||
|Encouraging me
|
||||
DanJohansen(Newgrounds) |All music used
|
||||
|
||||
Nathan.S Helped with a ton of the coding and models making this mod possible
|
||||
|
||||
Freezer Mod:
|
||||
https://forum.minetest.net/viewtopic.php?f=9&t=14925
|
||||
|
||||
Textures (c) 2016 Gabriel Pérez-Cerezo, WTFPL
|
||||
|
||||
This mod is based on the default furnace, license for the code below:
|
||||
|
||||
Copyright (C) 2011-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
Copyright (C) 2016 Gabriel Pérez-Cerezo <gabriel@gpcf.eu>
|
||||
|
||||
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 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
================================================================
|
||||
|
||||
Special thanks to:
|
||||
Wizzerine
|
||||
BillyS
|
||||
Noodlemire
|
||||
|
||||
For helping out with the microwave.
|
||||
|
||||
=================================================================
|
||||
|
||||
Each item used as tool and what it does:
|
||||
|
||||
Hammer: Rotates and/or changes the type of sofa and bookshelf.
|
||||
|
||||
Hammer1: Rotates and/or changes the type of counter and table.
|
||||
|
||||
Shears: "Trims" the hedges making it possible for different rotation and direction of hedge.
|
||||
|
||||
Saw: Used to turn a bookshelf into a wall bookshelf.
|
||||
|
||||
==================================================================
|
||||
License of source code and textures: WTFPL
|
||||
------------------------------------------------------------------
|
||||
This program is free software. It comes without any warranty, to
|
||||
the extent permitted by applicable law. You can redistribute it
|
||||
and/or modify it under the terms of the do whatever you want with it.
|
||||
To Public License, Version 2, as published by Sam Hocevar. See
|
||||
http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
==================================================================
|
|
@ -0,0 +1,54 @@
|
|||
minetest.register_abm({ -- Controls the contained fires.
|
||||
nodenames = {'ma_pops_furniture:fireplace', 'ma_pops_furniture:fireplace_on'},
|
||||
interval = 1.0,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
for i, name in ipairs({
|
||||
'fuel_totaltime',
|
||||
'fuel_time',
|
||||
}) do
|
||||
if meta:get_string(name) == '' then
|
||||
meta:set_float(name, 0.0)
|
||||
end
|
||||
end
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local was_active = false
|
||||
if meta:get_float('fuel_time') < meta:get_float('fuel_totaltime') then
|
||||
was_active = true
|
||||
meta:set_float('fuel_time', meta:get_float('fuel_time') + 0.25)
|
||||
end
|
||||
if meta:get_float('fuel_time') < meta:get_float('fuel_totaltime') then
|
||||
minetest.sound_play({name='fire_small'},{gain=0.07},
|
||||
{loop=true})
|
||||
local percent = math.floor(meta:get_float('fuel_time') /
|
||||
meta:get_float('fuel_totaltime') * 100)
|
||||
meta:set_string('infotext','Fireplace active: '..percent..'%')
|
||||
minetest.swap_node(pos, {name = 'ma_pops_furniture:fireplace_on', param2 = node.param2})
|
||||
meta:set_string('formspec', ma_pops_furniture.fireplace_formspec)
|
||||
return
|
||||
end
|
||||
local fuel = nil
|
||||
local fuellist = inv:get_list('fuel')
|
||||
if fuellist then
|
||||
fuel = minetest.get_craft_result({method = 'fuel', width = 1, items = fuellist})
|
||||
end
|
||||
if fuel.time <= 0 then
|
||||
local node = minetest.get_node(pos)
|
||||
if node.name == 'ma_pops_furniture:fireplace_on' then
|
||||
meta:set_string('infotext','Put more wood in the fireplace!')
|
||||
minetest.swap_node(pos, {name = 'ma_pops_furniture:fireplace', param2 = node.param2})
|
||||
meta:set_string('formspec', ma_pops_furniture.fireplace_formspec)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:start(190)
|
||||
end
|
||||
return
|
||||
end
|
||||
meta:set_string('fuel_totaltime', fuel.time)
|
||||
meta:set_string('fuel_time', 0)
|
||||
local stack = inv:get_stack('fuel', 1)
|
||||
stack:take_item()
|
||||
inv:set_stack('fuel', 1, stack)
|
||||
end,
|
||||
})
|
|
@ -0,0 +1,846 @@
|
|||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:smoke_detector',
|
||||
recipe = {
|
||||
{'default:stone','dye:white','default:stone',},
|
||||
{'default:stone','default:copper_ingot','default:stone',},
|
||||
{'default:stone','dye:red','default:stone',},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:ceiling_lamp',
|
||||
recipe = {
|
||||
{'default:stone', 'default:stone', 'default:stone'},
|
||||
{'default:stone', 'default:meselamp', 'default:stone'},
|
||||
{'default:stone', 'default:meselamp', 'default:stone'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:outdoor_lamp',
|
||||
recipe = {
|
||||
{'','','',},
|
||||
{'default:stone','default:stone','default:stone',},
|
||||
{'default:stone','default:meselamp','default:stone',},
|
||||
}
|
||||
})
|
||||
--changed bathroom_faucet to bath_faucet and added craft
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:bath_faucet',
|
||||
recipe = {
|
||||
{'default:steel_ingot','default:steel_ingot','default:steel_ingot',},
|
||||
{'default:steel_ingot','','bucket:bucket_water',},
|
||||
{'default:steel_ingot','','',},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:toilet_paper_roll_dispenser',
|
||||
recipe = {
|
||||
{'default:stone','default:stone','default:stone',},
|
||||
{'default:paper','default:water','default:paper',},
|
||||
{'','default:paper','',},
|
||||
}
|
||||
})
|
||||
--added craft
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:toilet_close',
|
||||
recipe = {
|
||||
{'','','default:steel_ingot',},
|
||||
{'default:steel_ingot','stairs:slab_wood','default:steel_ingot',},
|
||||
{'default:steel_ingot','bucket:bucket_water','default:steel_ingot',},
|
||||
}
|
||||
})
|
||||
--added craft
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:br_sink',
|
||||
recipe = {
|
||||
{'default:steel_ingot','','default:steel_ingot',},
|
||||
{'','default:steel_ingot','',},
|
||||
{'','default:steel_ingot','',},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:mirror_closed',
|
||||
recipe = {
|
||||
{'default:steel_ingot','default:steel_ingot','default:steel_ingot',},
|
||||
{'default:glass','default:glass','default:glass',},
|
||||
{'default:steel_ingot','default:steel_ingot','default:steel_ingot',},
|
||||
}
|
||||
})
|
||||
--added craft
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:shower_base',
|
||||
recipe = {
|
||||
{'','','',},
|
||||
{'','','',},
|
||||
{'default:steel_ingot','bucket:bucket_empty','default:steel_ingot',},
|
||||
}
|
||||
})
|
||||
--added craft
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:shower_top',
|
||||
recipe = {
|
||||
{'','default:steel_ingot','',},
|
||||
{'default:steel_ingot','bucket:bucket_water','default:steel_ingot',},
|
||||
{'default:steel_ingot','','default:steel_ingot',},
|
||||
}
|
||||
})
|
||||
|
||||
local night_table = { --name, material, invimg
|
||||
{'wood'},
|
||||
{'aspen_wood'},
|
||||
{'junglewood'},
|
||||
{'acacia_wood'},
|
||||
{'pine_wood'},
|
||||
{'cobble'}
|
||||
}
|
||||
|
||||
for i in ipairs (night_table) do
|
||||
local material = night_table[i][1]
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:nightstand_'..material,
|
||||
recipe = {
|
||||
{'default:'..material, 'default:'..material, 'default:'..material},
|
||||
{'default:'..material, 'default:chest', 'default:'..material},
|
||||
{'default:'..material, 'default:'..material, 'default:'..material}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
local chair = { --name, material, invimg
|
||||
{'wood'},
|
||||
{'aspen_wood'},
|
||||
{'junglewood'},
|
||||
{'acacia_wood'},
|
||||
{'pine_wood'},
|
||||
{'cobble'}
|
||||
}
|
||||
|
||||
for i in ipairs (chair) do
|
||||
local material = chair[i][1]
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:chair_'..material,
|
||||
recipe = {
|
||||
{'default:'..material, '', ''},
|
||||
{'default:'..material, 'default:'..material, 'default:'..material},
|
||||
{'default:'..material, '', 'default:'..material}
|
||||
}
|
||||
})
|
||||
end
|
||||
--added craft
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:dw',
|
||||
recipe = {
|
||||
{'default:steel_ingot','default:steel_ingot','default:steel_ingot',},
|
||||
{'default:steel_ingot','bucket:bucket_water','default:steel_ingot',},
|
||||
{'default:steel_ingot','default:mese_crystal','default:steel_ingot',},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:oven',
|
||||
recipe = {
|
||||
{'default:steel_ingot','default:steel_ingot','default:steel_ingot',},
|
||||
{'default:steel_ingot','default:furnace','default:steel_ingot',},
|
||||
{'default:steel_ingot','default:steel_ingot','default:steel_ingot',},
|
||||
}
|
||||
})
|
||||
--added craft
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:oven_overhead',
|
||||
recipe = {
|
||||
{'default:steel_ingot','default:mese_crystal_fragment','default:steel_ingot',},
|
||||
{'','','',},
|
||||
{'','','',},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:microwave',
|
||||
recipe = {
|
||||
{'','','',},
|
||||
{'default:steel_ingot','default:steel_ingot','default:steel_ingot',},
|
||||
{'default:steel_ingot','default:furnace','default:steel_ingot',},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:coffee_maker',
|
||||
recipe = {
|
||||
{'default:steel_ingot','default:steel_ingot','default:steel_ingot',},
|
||||
{'default:steel_ingot','default:copper_ingot','default:steel_ingot',},
|
||||
{'','default:glass','',},
|
||||
}
|
||||
})
|
||||
--added craft
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:toaster',
|
||||
recipe = {
|
||||
{'','','',},
|
||||
{'default:steel_ingot','default:mese_crystal','default:steel_ingot',},
|
||||
{'default:steel_ingot','default:steel_ingot','default:steel_ingot',},
|
||||
}
|
||||
})
|
||||
--added craft
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:sink',
|
||||
recipe = {
|
||||
{'default:steel_ingot','bucket:bucket_water','default:steel_ingot',},
|
||||
{'','default:steel_ingot','',},
|
||||
{'','default:steel_ingot','',},
|
||||
}
|
||||
})
|
||||
--added craft
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:kitchen_faucet',
|
||||
recipe = {
|
||||
{'default:steel_ingot','default:steel_ingot','default:steel_ingot',},
|
||||
{'default:steel_ingot','','default:steel_ingot',},
|
||||
{'default:steel_ingot','','',},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:cutting_board',
|
||||
recipe = {
|
||||
{'','','',},
|
||||
{'','','',},
|
||||
{'default:wood','default:wood','default:wood',},
|
||||
}
|
||||
})
|
||||
--added craft
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:counter',
|
||||
recipe = {
|
||||
{'group:wood','group:wood','group:wood',},
|
||||
{'group:wood','','group:wood',},
|
||||
{'group:wood','group:wood','group:wood',},
|
||||
}
|
||||
})
|
||||
--added craft
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:counter1',
|
||||
recipe = {
|
||||
{'group:wood','group:wood','group:wood',},
|
||||
{'group:wood','group:wood','group:wood',},
|
||||
{'group:wood','group:wood','group:wood',},
|
||||
}
|
||||
})
|
||||
--added craft
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:upcabinet',
|
||||
recipe = {
|
||||
{'group:wood','group:wood','group:wood',},
|
||||
{'group:wood','default:chest','group:wood',},
|
||||
{'group:wood','group:wood','group:wood',},
|
||||
}
|
||||
})
|
||||
--added craft
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:upcabinet_corner',
|
||||
recipe = {
|
||||
{'group:wood','group:wood','group:wood',},
|
||||
{'group:wood','group:wood','default:chest',},
|
||||
{'group:wood','','',},
|
||||
}
|
||||
})
|
||||
--added craft
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:fridge',
|
||||
recipe = {
|
||||
{'default:steel_ingot','default:steel_ingot','default:steel_ingot',},
|
||||
{'default:steel_ingot','default:snow','default:steel_ingot',},
|
||||
{'default:steel_ingot','default:steel_ingot','default:steel_ingot',},
|
||||
}
|
||||
})
|
||||
--added craft
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:freezer',
|
||||
recipe = {
|
||||
{'default:steel_ingot','default:mese_crystal','default:steel_ingot',},
|
||||
{'default:steel_ingot','default:ice','default:steel_ingot',},
|
||||
{'default:steel_ingot','default:mese_crystal','default:steel_ingot',},
|
||||
}
|
||||
})
|
||||
|
||||
local chair2_table = { --color
|
||||
{'black'},
|
||||
{'blue'},
|
||||
{'brown'},
|
||||
{'cyan'},
|
||||
{'dark_green'},
|
||||
{'dark_grey'},
|
||||
{'green'},
|
||||
{'grey'},
|
||||
{'magenta'},
|
||||
{'orange'},
|
||||
{'pink'},
|
||||
{'red'},
|
||||
{'violet'},
|
||||
{'yellow'},
|
||||
}
|
||||
|
||||
for i in ipairs (chair2_table) do
|
||||
local color = chair2_table[i][1]
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:chair2_'..color,
|
||||
recipe = {
|
||||
{'wool:'..color, 'wool:'..color, 'wool:'..color, },
|
||||
{'wool:'..color, 'wool:'..color, 'wool:'..color, },
|
||||
{'group:wood', '', 'group:wood', },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:chair2_'..color,
|
||||
recipe = {
|
||||
{'ma_pops_furniture:chair2_white', 'dye:'..color}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:chair2_white',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:chair2_'..color, 'dye:white'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:chair2_black',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:chair2_'..color, 'dye:black'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:chair2_blue',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:chair2_'..color, 'dye:blue'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:chair2_brown',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:chair2_'..color, 'dye:brown'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:chair2_cyan',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:chair2_'..color, 'dye:cyan'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:chair2_dark_grey',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:chair2_'..color, 'dye:dark_grey'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:chair2_grey',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:chair2_'..color, 'dye:grey'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:chair2_green',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:chair2_'..color, 'dye:green'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:chair2_magenta',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:chair2_'..color, 'dye:magenta'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:chair2_orange',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:chair2_'..color, 'dye:orange'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:chair2_pink',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:chair2_'..color, 'dye:pink'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:chair2_red',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:chair2_'..color, 'dye:red'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:chair2_violet',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:chair2_'..color, 'dye:violet'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:chair2_yellow',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:chair2_'..color, 'dye:yellow'}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:chair2_white',
|
||||
recipe = {
|
||||
{'wool:white', 'wool:white', 'wool:white', },
|
||||
{'wool:white', 'wool:white', 'wool:white', },
|
||||
{'group:wood', '', 'group:wood', },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:chair2_rainbow',
|
||||
recipe = {
|
||||
{'wool:black', '', '', },
|
||||
{'wool:blue', 'wool:yellow', 'wool:pink', },
|
||||
{'default: acacia_tree', '', 'default: acacia_tree', },
|
||||
}
|
||||
})
|
||||
|
||||
local sofa_table = { --color
|
||||
{'black'},
|
||||
{'blue'},
|
||||
{'brown'},
|
||||
{'cyan'},
|
||||
{'dark_green'},
|
||||
{'dark_grey'},
|
||||
{'green'},
|
||||
{'grey'},
|
||||
{'magenta'},
|
||||
{'orange'},
|
||||
{'pink'},
|
||||
{'red'},
|
||||
{'violet'},
|
||||
{'white'},
|
||||
{'yellow'},
|
||||
}
|
||||
|
||||
for i in ipairs (sofa_table) do
|
||||
local color = sofa_table[i][1]
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:sofa_'..color,
|
||||
recipe = {
|
||||
{'', '', '', },
|
||||
{'wool:'..color, 'wool:'..color, 'wool:'..color, },
|
||||
{'wool:'..color, 'wool:'..color, 'wool:'..color, },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:sofa_'..color,
|
||||
recipe = {
|
||||
{'ma_pops_furniture:sofa_white', 'dye:'..color}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
local fs_table = { --color
|
||||
{'black'},
|
||||
{'blue'},
|
||||
{'brown'},
|
||||
{'cyan'},
|
||||
{'dark_green'},
|
||||
{'dark_grey'},
|
||||
{'green'},
|
||||
{'grey'},
|
||||
{'magenta'},
|
||||
{'orange'},
|
||||
{'pink'},
|
||||
{'red'},
|
||||
{'violet'},
|
||||
{'yellow'},
|
||||
}
|
||||
|
||||
for i in ipairs (fs_table) do
|
||||
local color = fs_table[i][1]
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:fs_'..color,
|
||||
recipe = {
|
||||
{'wool:'..color, 'wool:'..color, 'wool:'..color, },
|
||||
{'group:wood', '', 'group:wood', },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:fs_'..color,
|
||||
recipe = {
|
||||
{'ma_pops_furniture:fs_white', 'dye:'..color}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:fs_white',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:fs_'..color, 'dye:white'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:fs_',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:fs_'..color, 'dye:'..color}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:fs_black',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:fs_'..color, 'dye:black'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:fs_blue',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:fs_'..color, 'dye:blue'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:fs_brown',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:fs_'..color, 'dye:brown'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:fs_cyan',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:fs_'..color, 'dye:cyan'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:fs_dark_grey',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:fs_'..color, 'dye:dark_grey'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:fs_grey',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:fs_'..color, 'dye:grey'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:fs_green',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:fs_'..color, 'dye:green'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:fs_magenta',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:fs_'..color, 'dye:magenta'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:fs_orange',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:fs_'..color, 'dye:orange'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:fs_pink',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:fs_'..color, 'dye:pink'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:fs_red',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:fs_'..color, 'dye:red'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:fs_violet',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:fs_'..color, 'dye:violet'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:fs_yellow',
|
||||
recipe = {
|
||||
{'ma_pops_furniture:fs_'..color, 'dye:yellow'}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:fs_white',
|
||||
recipe = {
|
||||
{'wool:white', 'wool:white', 'wool:white', },
|
||||
{'group:wood', '', 'group:wood', },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:fs_rainbow',
|
||||
recipe = {
|
||||
{'', '', '', },
|
||||
{'wool:blue', 'wool:yellow', 'wool:pink', },
|
||||
{'default: acacia_tree', '', 'default: acacia_tree', },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:vcr_off',
|
||||
recipe = {
|
||||
{'','','',},
|
||||
{'default:coalblock','default:coalblock','default:coalblock',},
|
||||
{'default:coalblock','default:mese_crystal','default:coalblock',},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:entertainment_unit',
|
||||
recipe = {
|
||||
{'default:wood','default:wood','default:wood',},
|
||||
{'default:wood','default:chest','default:wood',},
|
||||
{'default:wood','default:wood','default:wood',},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:fireplace',
|
||||
recipe = {
|
||||
{'default:brick', 'default:brick', 'default:brick'},
|
||||
{'default:brick', 'default:furnace', 'default:brick'},
|
||||
{'default:brick', 'default:brick', 'default:brick'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:lamp_off',
|
||||
recipe = {
|
||||
{'wool:white','wool:white', 'wool:white'},
|
||||
{'wool:white', 'default:torch', 'wool:white'},
|
||||
{'wool:red', 'wool:red', 'wool:red'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:curtains',
|
||||
recipe = {
|
||||
{'default:acacia_tree','default:acacia_tree', 'default:acacia_tree'},
|
||||
{'wool:red', '', 'wool:red'},
|
||||
{'wool:red', '', 'wool:red'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = 'ma_pops_furniture:curtains_2_tall',
|
||||
recipe =
|
||||
{'ma_pops_furniture:curtains', 'ma_pops_furniture:curtains'}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:blinds',
|
||||
recipe = {
|
||||
{'default:stick', 'default:stick', 'default:stick'},
|
||||
{'default:stick', 'dye:white', 'default:stick'},
|
||||
{'default:stick', 'default:stick', 'default:stick'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "ma_pops_furniture:stereo",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot", },
|
||||
{"default:steel_ingot", "default:chest", "default:steel_ingot", },
|
||||
{"default:stick", "", "default:stick", }
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:tv_off',
|
||||
recipe = {
|
||||
{'default:tree', 'default:tree', 'default:tree'},
|
||||
{'default:tree', 'wool:black', 'default:tree'},
|
||||
{'default:tree', 'default:tree', 'default:tree'}
|
||||
}
|
||||
})
|
||||
|
||||
local c_table = { --name, material, invimg
|
||||
{'wood'},
|
||||
{'aspen_wood'},
|
||||
{'junglewood'},
|
||||
{'acacia_wood'},
|
||||
{'pine_wood'},
|
||||
{'cobble'}
|
||||
}
|
||||
|
||||
for i in ipairs (c_table) do
|
||||
local material = c_table[i][1]
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:c_'..material,
|
||||
recipe = {
|
||||
{'', '', ''},
|
||||
{'default:'..material, 'default:'..material, 'default:'..material},
|
||||
{'default:'..material, '', 'default:'..material}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
local end_table = { --name, material, invimg
|
||||
{'wood'},
|
||||
{'aspen_wood'},
|
||||
{'junglewood'},
|
||||
{'acacia_wood'},
|
||||
{'pine_wood'},
|
||||
{'cobble'}
|
||||
}
|
||||
|
||||
for i in ipairs (end_table) do
|
||||
local material = end_table[i][1]
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:end_table_'..material,
|
||||
recipe = {
|
||||
{'default:'..material, 'default:'..material, 'default:'..material},
|
||||
{'default:'..material, '', 'default:'..material},
|
||||
{'default:'..material, '', 'default:'..material}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:computer',
|
||||
recipe = {
|
||||
{'default:stone','default:stone','default:stone',},
|
||||
{'default:stone','default:mese_crystal','default:stone',},
|
||||
{'default:stone','default:copper_lump','default:stone',},
|
||||
}
|
||||
})
|
||||
|
||||
local table = { --name, material, invimg
|
||||
{'wood'},
|
||||
{'aspen_wood'},
|
||||
{'junglewood'},
|
||||
{'acacia_wood'},
|
||||
{'pine_wood'},
|
||||
{'cobble'}
|
||||
}
|
||||
|
||||
for i in ipairs (table) do
|
||||
local material = table[i][1]
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:table_'..material,
|
||||
recipe = {
|
||||
{'default:'..material, 'default:'..material, 'default:'..material},
|
||||
{'', 'default:'..material, ''},
|
||||
{'', 'default:'..material, ''}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
local hedge_table = { --name, material, invimg
|
||||
{'leaves'},
|
||||
{'pine_needles'},
|
||||
{'jungleleaves'},
|
||||
{'acacia_leaves'},
|
||||
{'aspen_leaves'}
|
||||
}
|
||||
|
||||
for i in ipairs (hedge_table) do
|
||||
local material = hedge_table[i][1]
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:hedge_'..material,
|
||||
recipe = {
|
||||
{'', '', ''},
|
||||
{'default:'..material, 'default:'..material, 'default:'..material},
|
||||
{'default:'..material, 'default:'..material, 'default:'..material}
|
||||
}
|
||||
})
|
||||
end
|
||||
--added craft
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:birdbath',
|
||||
recipe = {
|
||||
{'','','',},
|
||||
{'default:steel_ingot','bucket:bucket_water','default:steel_ingot',},
|
||||
{'','default:steel_ingot','',},
|
||||
}
|
||||
})
|
||||
--added craft
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:doorbell 4',
|
||||
recipe = {
|
||||
{'','default:stone','',},
|
||||
{'','default:mese_crystal','',},
|
||||
{'','','',},
|
||||
}
|
||||
})
|
||||
--added craft
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:grill',
|
||||
recipe = {
|
||||
{'default:steel_ingot','default:steel_ingot','default:steel_ingot',},
|
||||
{'default:steel_ingot','default:steel_ingot','default:steel_ingot',},
|
||||
{'default:steel_ingot','','default:steel_ingot',},
|
||||
}
|
||||
})
|
||||
--added craft
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:stone_path_1 5',
|
||||
recipe = {
|
||||
{'default:stone','','default:stone',},
|
||||
{'','','',},
|
||||
{'default:stone','','default:stone',},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:hammer',
|
||||
recipe = {
|
||||
{'','default:steel_ingot', ''},
|
||||
{'', 'default:stick', 'default:steel_ingot'},
|
||||
{'default:stick', '', ''}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:shears',
|
||||
recipe = {
|
||||
{'','default:steel_ingot', ''},
|
||||
{'default:stick', '', 'default:steel_ingot'},
|
||||
{'', 'default:stick', ''}
|
||||
}
|
||||
})
|
|
@ -0,0 +1,6 @@
|
|||
default
|
||||
fire
|
||||
ethereal?
|
||||
mobs_mc?
|
||||
farming?
|
||||
unifieddyes?
|
|
@ -0,0 +1,9 @@
|
|||
ma_pops_furniture.fireplace_formspec =
|
||||
'size[8,6]'..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
'background[8,6;0,0;default_brick.png;true]'..
|
||||
'list[current_name;fuel;1,0;1,1;]'..
|
||||
'list[current_player;main;0,2.5;8,4;]'
|
||||
default.get_hotbar_bg(0,4.85)
|
|
@ -0,0 +1,227 @@
|
|||
--
|
||||
-- Freezer for mintest: a device which turns water (in buckets) into ice
|
||||
-- And does a couple of other tricks, discovering which is left as a pleasant
|
||||
-- surprise for the player.
|
||||
--
|
||||
|
||||
-- enable extra popsicle types provided there are both vessels and fruits/veggies available
|
||||
-- fruit + glass -> juice; juice @ freezer -> popsicle + empty glass
|
||||
|
||||
--
|
||||
-- Formspecs
|
||||
--
|
||||
|
||||
local function active_formspec(fuel_percent, item_percent)
|
||||
local formspec =
|
||||
"size[8,8.5]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"list[current_name;src;2.5,1;1,1;]"..
|
||||
"image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[lowpart:"..
|
||||
(item_percent)..":gui_furnace_arrow_fg.png^[transformR270]"..
|
||||
"list[current_name;dst;4.75,0.96;3,2;]"..
|
||||
"list[current_player;main;0,4.25;8,1;]"..
|
||||
"list[current_player;main;0,5.5;8,3;8]"..
|
||||
"listring[current_name;dst]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;src]"..
|
||||
"listring[current_player;main]"..
|
||||
default.get_hotbar_bg(0, 4.25)
|
||||
return formspec
|
||||
end
|
||||
|
||||
local inactive_formspec =
|
||||
"size[8,8.5]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"list[current_name;src;2.5,1.5;1,1;]"..
|
||||
"image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]"..
|
||||
"list[current_name;dst;4.75,0.96;3,2;]"..
|
||||
"list[current_player;main;0,4.25;8,1;]"..
|
||||
"list[current_player;main;0,5.5;8,3;8]"..
|
||||
"listring[current_name;dst]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[current_name;src]"..
|
||||
"listring[current_player;main]"..
|
||||
default.get_hotbar_bg(0, 4.25)
|
||||
|
||||
--
|
||||
-- Node callback functions that are the same for active and inactive freezer
|
||||
--
|
||||
|
||||
local function can_dig(pos, player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("dst") and inv:is_empty("src")
|
||||
end
|
||||
|
||||
|
||||
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if listname == "src" then
|
||||
return stack:get_count()
|
||||
elseif listname == "dst" then
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local stack = inv:get_stack(from_list, from_index)
|
||||
return allow_metadata_inventory_put(pos, to_list, to_index, stack, player)
|
||||
end
|
||||
|
||||
|
||||
local function allow_metadata_inventory_take(pos, listname, index, stack, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
return stack:get_count()
|
||||
end
|
||||
|
||||
|
||||
local function swap_node(pos, name)
|
||||
local node = minetest.get_node(pos)
|
||||
if node.name == name then
|
||||
return
|
||||
end
|
||||
node.name = name
|
||||
minetest.swap_node(pos, node)
|
||||
end
|
||||
|
||||
|
||||
local function freezer_node_timer(pos, elapsed)
|
||||
--
|
||||
-- Inizialize metadata
|
||||
--
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
||||
local src_time = meta:get_float("src_time") or 0
|
||||
|
||||
|
||||
local inv = meta:get_inventory()
|
||||
local srclist = inv:get_list("src")
|
||||
|
||||
local dstlist = inv:get_list("dst")
|
||||
|
||||
--
|
||||
-- Cooking
|
||||
--
|
||||
|
||||
-- takes both regular and river water
|
||||
if inv:contains_item("src", "bucket:bucket_water") or
|
||||
inv:contains_item("src", "bucket:bucket_river_water") then
|
||||
if inv:room_for_item("dst", "default:ice") then
|
||||
inv:remove_item("src", "bucket:bucket_water")
|
||||
inv:remove_item("src", "bucket:bucket_river_water")
|
||||
inv:add_item("dst", "default:ice")
|
||||
inv:add_item("dst", "bucket:bucket_empty")
|
||||
end
|
||||
end
|
||||
|
||||
-- Check if we have cookable content
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Node definitions
|
||||
--
|
||||
|
||||
minetest.register_node("ma_pops_furniture:freezer", {
|
||||
description = "Freezer",
|
||||
tiles = {
|
||||
"mp_froz_top.png",
|
||||
"mp_froz_bottom.png",
|
||||
"mp_froz_right.png",
|
||||
"mp_froz_left.png",
|
||||
"mp_froz_back.png",
|
||||
"mp_froz_front.png"
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 2, tubedevice = 1, tubedevice_receiver = 1},
|
||||
legacy_facedir_simple = true,
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.3125, 0.5, 0.5, 0.5}, -- NodeBox1
|
||||
{-0.5, -0.4375, -0.375, 0.4375, 0.5, -0.3125}, -- NodeBox2
|
||||
{0.3125, -0.25, -0.5, 0.375, 0.25, -0.4375}, -- NodeBox6
|
||||
{0.3125, -0.25, -0.4375, 0.375, -0.1875, -0.375}, -- NodeBox7
|
||||
{0.3125, 0.1875, -0.4375, 0.375, 0.25, -0.375}, -- NodeBox8
|
||||
}
|
||||
},
|
||||
tube = (function() if minetest.get_modpath("pipeworks") then return {
|
||||
-- using a different stack from defaut when inserting
|
||||
insert_object = function(pos, node, stack, direction)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
if not timer:is_started() then
|
||||
timer:start(1.0)
|
||||
end
|
||||
return inv:add_item("src", stack)
|
||||
end,
|
||||
can_insert = function(pos,node,stack,direction)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return inv:room_for_item("src", stack)
|
||||
end,
|
||||
-- the default stack, from which objects will be taken
|
||||
input_inventory = "dst",
|
||||
connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1}
|
||||
} end end)(),
|
||||
|
||||
can_dig = can_dig,
|
||||
|
||||
on_timer = freezer_node_timer,
|
||||
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec", inactive_formspec)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size('src', 1)
|
||||
inv:set_size('dst', 6)
|
||||
end,
|
||||
|
||||
on_metadata_inventory_move = function(pos)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:start(1.0)
|
||||
end,
|
||||
on_metadata_inventory_put = function(pos)
|
||||
-- start timer function, it will sort out whether freezer will work or not.
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:start(1.0)
|
||||
end,
|
||||
on_blast = function(pos)
|
||||
local drops = {}
|
||||
default.get_inventory_drops(pos, "src", drops)
|
||||
default.get_inventory_drops(pos, "dst", drops)
|
||||
drops[#drops+1] = "ma_pops_furniture:freezer"
|
||||
minetest.remove_node(pos)
|
||||
return drops
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "default:snowblock 3",
|
||||
type = "shapeless",
|
||||
recipe = {
|
||||
"default:ice"
|
||||
}
|
||||
})
|
|
@ -0,0 +1,58 @@
|
|||
function ma_pops_furniture.sit(pos, node, clicker)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local param2 = node.param2
|
||||
local name = clicker:get_player_name()
|
||||
|
||||
if name == meta:get_string("is_sit") then
|
||||
print 'player should be standing.'
|
||||
meta:set_string("is_sit", "")
|
||||
pos.y = pos.y-0.5
|
||||
clicker:setpos(pos)
|
||||
clicker:set_eye_offset({x=0,y=0,z=0}, {x=0,y=0,z=0})
|
||||
clicker:set_physics_override(1, 1, 1)
|
||||
default.player_attached[name] = false
|
||||
default.player_set_animation(clicker, "stand", 30)
|
||||
else
|
||||
meta:set_string("is_sit", clicker:get_player_name())
|
||||
print 'player should be sitting.'
|
||||
clicker:set_eye_offset({x=0,y=-7,z=2}, {x=0,y=0,z=0})
|
||||
clicker:set_physics_override(0, 0, 0)
|
||||
clicker:setpos(pos)
|
||||
default.player_attached[name] = true
|
||||
default.player_set_animation(clicker, "sit", 30)
|
||||
if param2 == 0 then
|
||||
clicker:set_look_yaw(3.15)
|
||||
elseif param2 == 1 then
|
||||
clicker:set_look_yaw(7.9)
|
||||
elseif param2 == 2 then
|
||||
clicker:set_look_yaw(6.28)
|
||||
elseif param2 == 3 then
|
||||
clicker:set_look_yaw(4.75)
|
||||
else return end
|
||||
end
|
||||
end
|
||||
|
||||
ma_pops_furniture.window_operate = function( pos, old_node_state_name, new_node_state_name )
|
||||
|
||||
local offsets = {-1,1,-2,2,-3,3};
|
||||
local stop_up = 0;
|
||||
local stop_down = 0;
|
||||
|
||||
for i,v in ipairs(offsets) do
|
||||
|
||||
local node = minetest.env:get_node_or_nil( {x=pos.x, y=(pos.y+v), z=pos.z } );
|
||||
if( node and node.name and node.name==old_node_state_name
|
||||
and ( (v > 0 and stop_up == 0 )
|
||||
or (v < 0 and stop_down == 0 ))) then
|
||||
|
||||
minetest.env:add_node({x=pos.x, y=(pos.y+v), z=pos.z }, {name = new_node_state_name, param2 = node.param2})
|
||||
|
||||
-- found a diffrent node - no need to search further up
|
||||
elseif( v > 0 and stop_up == 0 ) then
|
||||
stop_up = 1;
|
||||
|
||||
elseif( v < 0 and stop_down == 0 ) then
|
||||
stop_down = 1;
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,30 @@
|
|||
ma_pops_furniture = {}
|
||||
|
||||
dofile(minetest.get_modpath('ma_pops_furniture')..'/sit.lua')
|
||||
dofile(minetest.get_modpath('ma_pops_furniture')..'/functions.lua')
|
||||
dofile(minetest.get_modpath('ma_pops_furniture')..'/formspecs.lua')
|
||||
dofile(minetest.get_modpath('ma_pops_furniture')..'/crafts.lua')
|
||||
dofile(minetest.get_modpath('ma_pops_furniture')..'/nodes.lua')
|
||||
dofile(minetest.get_modpath('ma_pops_furniture')..'/tools.lua')
|
||||
dofile(minetest.get_modpath('ma_pops_furniture')..'/freezer.lua')
|
||||
dofile(minetest.get_modpath('ma_pops_furniture')..'/microwave.lua')
|
||||
dofile(minetest.get_modpath('ma_pops_furniture')..'/oven.lua')
|
||||
dofile(minetest.get_modpath('ma_pops_furniture')..'/sofa.lua')
|
||||
dofile(minetest.get_modpath('ma_pops_furniture')..'/abm.lua')
|
||||
|
||||
|
||||
--GreenDimond's code from waffle mod
|
||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||
local S, NS = dofile(MP.."/intllib.lua")
|
||||
|
||||
ma_pops_furniture.intllib = S
|
||||
dofile(minetest.get_modpath('ma_pops_furniture')..'/toaster.lua')
|
||||
dofile(minetest.get_modpath('ma_pops_furniture')..'/intllib.lua')
|
||||
|
||||
minetest.register_alias("furniture_mod:toilet_closed", "ma_pops_furniture:toilet_closed")
|
||||
minetest.register_alias("furniture_mod:toilet_open", "ma_pops_furniture:toilet_open")
|
||||
minetest.register_alias("furniture_mod:tv", "ma_pops_furniture:tv")
|
||||
minetest.register_alias("furniture_mod:lamp", "ma_pops_furniture:lamp")
|
||||
minetest.register_alias("furniture_mod:lamp_off", "ma_pops_furniture:lamp_off")
|
||||
minetest.register_alias("furniture_mod:ceiling_light", "ma_pops_furniture:ceiling_lamp")
|
||||
minetest.register_alias("furniture_mod:ceiling_light_off", "ma_pops_furniture:ceiling_lamp_off")
|
|
@ -0,0 +1,45 @@
|
|||
|
||||
-- Fallback functions for when `intllib` is not installed.
|
||||
-- Code released under Unlicense <http://unlicense.org>.
|
||||
|
||||
-- Get the latest version of this file at:
|
||||
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
|
||||
|
||||
local function format(str, ...)
|
||||
local args = { ... }
|
||||
local function repl(escape, open, num, close)
|
||||
if escape == "" then
|
||||
local replacement = tostring(args[tonumber(num)])
|
||||
if open == "" then
|
||||
replacement = replacement..close
|
||||
end
|
||||
return replacement
|
||||
else
|
||||
return "@"..open..num..close
|
||||
end
|
||||
end
|
||||
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
|
||||
end
|
||||
|
||||
local gettext, ngettext
|
||||
if minetest.get_modpath("intllib") then
|
||||
if intllib.make_gettext_pair then
|
||||
-- New method using gettext.
|
||||
gettext, ngettext = intllib.make_gettext_pair()
|
||||
else
|
||||
-- Old method using text files.
|
||||
gettext = intllib.Getter()
|
||||
end
|
||||
end
|
||||
|
||||
-- Fill in missing functions.
|
||||
|
||||
gettext = gettext or function(msgid, ...)
|
||||
return format(msgid, ...)
|
||||
end
|
||||
|
||||
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
|
||||
return format(n==1 and msgid or msgid_plural, ...)
|
||||
end
|
||||
|
||||
return gettext, ngettext
|
|
@ -0,0 +1,166 @@
|
|||
--microwave code by Wizzerine
|
||||
--item_percent code by Noodlemire
|
||||
|
||||
local microwave_fs =
|
||||
"size[8,7]"
|
||||
.."button[6.5,1.5;1.5,2;btn_start;START]"
|
||||
.."image[6.5,.2;1.5,.5;mp_mw_bar.png^[transformR270]"
|
||||
.."list[current_player;main;0,3;8,1;]"
|
||||
.."list[current_player;main;0,4.25;8,3;8]"
|
||||
.."list[context;cook_slot;3.5,1.25;1,1;]"
|
||||
.."label[3,0.5;Microwave]"
|
||||
-- possibly add "fire" image?
|
||||
|
||||
local function get_active_microwave_fs(item_percent)
|
||||
return "size[8,7]"
|
||||
.."button[6.5,1.5;1.5,2;button_start;START]"
|
||||
.."image[6.5,.2;1.5,.5;mp_mw_bar.png^[lowpart:"
|
||||
..(item_percent)..":mp_mw_bar_on.png^[transformR270]"
|
||||
.."list[current_player;main;0,3;8,1;]"
|
||||
.."list[current_player;main;0,4.25;8,3;8]"
|
||||
.."list[context;cook_slot;3.5,1.25;1,1;]"
|
||||
.."label[3,0.5;Microwave]"
|
||||
-- possibly add "fire" image?
|
||||
end
|
||||
|
||||
--x,y;w,h
|
||||
|
||||
-- Adding recipe API so we don't end up hardcoding items
|
||||
ma_pops_furniture.microwave = {}
|
||||
local microwave = ma_pops_furniture.microwave
|
||||
microwave.recipes = {}
|
||||
function microwave.register_recipe(input, output) microwave.recipes[input] = output end
|
||||
|
||||
local function update_formspec(progress, goal, meta)
|
||||
local formspec
|
||||
|
||||
if progress > 0 and progress <= goal then
|
||||
local item_percent = math.floor(progress / goal * 100)
|
||||
formspec = get_active_microwave_fs(item_percent)
|
||||
else
|
||||
formspec = microwave_fs
|
||||
end
|
||||
|
||||
meta:set_string("formspec", formspec)
|
||||
end
|
||||
|
||||
local function recalculate(pos)
|
||||
local meta, timer = minetest.get_meta(pos), minetest.get_node_timer(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local stack = inv:get_stack("cook_slot", 1)
|
||||
local goal = 3 * stack:get_count()
|
||||
|
||||
local k = microwave.recipes[stack:get_name()]
|
||||
if not k then return end
|
||||
|
||||
timer:stop()
|
||||
update_formspec(0, goal, meta)
|
||||
timer:start(1)
|
||||
end
|
||||
|
||||
local function do_cook_all(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local stack = meta:get_inventory():get_stack("cook_slot", 1)
|
||||
local food_uncooked = inv:remove_item("cook_slot", inv:get_stack("cook_slot", 1)) -- Clear the slot
|
||||
local food_cooked = microwave.recipes[food_uncooked:get_name()] .. " " .. tostring(food_uncooked:get_count()) -- Get the cooked food
|
||||
inv:add_item("cook_slot", food_cooked) -- Put the cooked food in the slot
|
||||
end
|
||||
|
||||
minetest.register_node("ma_pops_furniture:microwave", {
|
||||
description = "Microwave",
|
||||
tiles = {"mp_mw_top.png", "mp_mw_bottom.png", "mp_mw_right.png", "mp_mw_left.png", "mp_mw_back.png", "mp_mw_front.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 2}, -- currently no pipeworks compat as I don't know how it works
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.4375, -0.4375, -0.3125, 0.4375, 0.0625, 0.3125},
|
||||
{-0.375, -0.5, -0.25, 0.375, -0.4375, 0.25},
|
||||
},
|
||||
},
|
||||
can_dig = function(pos, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("cook_slot")
|
||||
end,
|
||||
|
||||
on_timer = function(pos, elapsed)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local stack = meta:get_inventory():get_stack("cook_slot", 1)
|
||||
local goal = 3 * stack:get_count()
|
||||
local cooking_time = meta:get_int("cooking_time") or 0
|
||||
cooking_time = cooking_time + 1
|
||||
|
||||
update_formspec(cooking_time, goal, meta)
|
||||
meta:set_int("cooking_time", cooking_time)
|
||||
|
||||
--Keep cooking until there is nothing left to cook.
|
||||
if cooking_time <= goal then
|
||||
return true
|
||||
else
|
||||
do_cook_all(pos)
|
||||
meta:set_int("cooking_time", 0)
|
||||
update_formspec(0, goal, meta)
|
||||
return false
|
||||
end
|
||||
end,
|
||||
|
||||
--on_metadata_inventory_put = recalculate,
|
||||
--on_metadata_inventory_take = recalculate,
|
||||
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec", microwave_fs)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("cook_slot", 1)
|
||||
end,
|
||||
on_receive_fields = function(pos, _, fields)
|
||||
if fields.quit then return end
|
||||
if fields.btn_start then
|
||||
recalculate(pos)
|
||||
end
|
||||
end,
|
||||
|
||||
on_blast = function(pos)
|
||||
local drops = {}
|
||||
default.get_inventory_drops(pos, "cook_slot", drops)
|
||||
table.insert(drops, "ma_pops_furniture:microwave")
|
||||
minetest.remove_node(pos)
|
||||
return drops
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_put = function(pos, list, index, stack, player)
|
||||
return microwave.recipes[stack:get_name()] and stack:get_count() or 0
|
||||
end,
|
||||
|
||||
--Only allow items to be taken if the microwave hasn't started yet
|
||||
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
if not minetest.get_node_timer(pos):is_started() then
|
||||
return stack:get_count()
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "ma_pops_furniture:microwave",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:mese_crystal", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "default:mese_crystal", "default:steel_ingot"}
|
||||
}
|
||||
})
|
||||
|
||||
-- Recipe Registration
|
||||
microwave.register_recipe("default:ice", "default:water_source")
|
||||
-- No milk bucket as this doesn't support substitutes for now
|
||||
microwave.register_recipe("mobs_mc:chicken_raw", "test:chicken_cooked")
|
||||
--[[ We don't need to check mod existance when registering recipe
|
||||
Recipe won't even be executed if there is no raw chicken in input ]]--
|
||||
microwave.register_recipe("mobs_mc:beef_raw", "test:beef_cooked")
|
||||
microwave.register_recipe("farming:coffee_cup", "farming:coffee_cup_hot") -- What a crutch there was...
|
||||
-- Add needed recipes as you go, note that other mods can add more recipes too
|
|
@ -0,0 +1,163 @@
|
|||
local oven_fs = "size[8,7]"
|
||||
.."image[3.5,1.5;1,1;default_furnace_fire_bg.png]"
|
||||
.."list[current_player;main;0,3;8,4;]"
|
||||
.."list[context;input;2,1.5;1,1;]"
|
||||
.."list[context;output;5,1.5;1,1;]"
|
||||
.."label[3,0.5;Oven]"
|
||||
.."label[1.5,1;Uncooked Food]"
|
||||
.."label[4.5,1;Cooked Food]"
|
||||
-- possibly add "fire" image?
|
||||
|
||||
local function get_active_oven_fs(item_percent)
|
||||
return "size[8,7]"
|
||||
.."image[3.5,1.5;1,1;default_furnace_fire_bg.png^[lowpart:"
|
||||
..(item_percent)..":default_furnace_fire_fg.png]"
|
||||
.."list[current_player;main;0,3;8,4;]"
|
||||
.."list[context;input;2,1.5;1,1;]"
|
||||
.."list[context;output;5,1.5;1,1;]"
|
||||
.."label[3,0.5;Oven]"
|
||||
.."label[1.5,1;Uncooked Food]"
|
||||
.."label[4.5,1;Cooked Food]"
|
||||
-- possibly add "fire" image?
|
||||
end
|
||||
|
||||
--x,y;w,h
|
||||
|
||||
-- Adding recipe API so we don't end up hardcoding items
|
||||
ma_pops_furniture.oven = {}
|
||||
local oven = ma_pops_furniture.oven
|
||||
oven.recipes = {}
|
||||
function oven.register_recipe(input, output) oven.recipes[input] = output end
|
||||
|
||||
local function update_formspec(progress, goal, meta)
|
||||
local formspec
|
||||
|
||||
if progress > 0 and progress <= goal then
|
||||
local item_percent = math.floor(progress / goal * 100)
|
||||
formspec = get_active_oven_fs(item_percent)
|
||||
else
|
||||
formspec = oven_fs
|
||||
end
|
||||
|
||||
meta:set_string("formspec", formspec)
|
||||
end
|
||||
|
||||
local function recalculate(pos)
|
||||
local meta, timer = minetest.get_meta(pos), minetest.get_node_timer(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local stack = inv:get_stack("input", 1)
|
||||
|
||||
local k = oven.recipes[stack:get_name()]
|
||||
if not k then return end
|
||||
|
||||
timer:stop()
|
||||
update_formspec(0, 3, meta)
|
||||
timer:start(1)
|
||||
end
|
||||
|
||||
local function do_cook_single(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local food_uncooked = inv:get_stack("input", 1)
|
||||
food_uncooked:set_count(1)
|
||||
|
||||
--If the uncooked food wasn't removed mid-cooking, then cook it.
|
||||
if not oven.recipes[food_uncooked:get_name()] then
|
||||
minetest.chat_send_all("Oven cooked nothing because there was nothing to cook.")
|
||||
minetest.get_node_timer(pos):stop()
|
||||
update_formspec(0, 3, meta)
|
||||
else
|
||||
inv:remove_item("input", food_uncooked) -- Clear the slot
|
||||
local food_cooked = oven.recipes[food_uncooked:get_name()] -- Get the cooked food
|
||||
inv:add_item("output", food_cooked) -- Put the cooked food in the slot
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_node("ma_pops_furniture:oven", {
|
||||
description = "Oven",
|
||||
tiles = {
|
||||
"mp_oven_top.png",
|
||||
"mp_oven_bottom.png",
|
||||
"mp_oven_right.png",
|
||||
"mp_oven_left.png",
|
||||
"mp_oven_back.png",
|
||||
"mp_oven_front.png"
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 2, tubedevice = 1, tubedevice_receiver = 1},
|
||||
legacy_facedir_simple = true,
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, 0.3125, -0.5, 0.5, 0.5, 0.5},
|
||||
{-0.5, -0.5, -0.375, 0.5, 0.3125, 0.5},
|
||||
{-0.4375, -0.4375, -0.4375, 0.4375, 0.25, -0.375},
|
||||
{-0.375, 0.125, -0.5, 0.375, 0.1875, -0.375},
|
||||
},
|
||||
},
|
||||
can_dig = function(pos, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("input") and inv:is_empty("output")
|
||||
end,
|
||||
|
||||
on_timer = function(pos, elapsed)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local stack = meta:get_inventory():get_stack("input", 1)
|
||||
local cooking_time = meta:get_int("cooking_time") or 0
|
||||
cooking_time = cooking_time + 1
|
||||
|
||||
if cooking_time % 3 == 0 then
|
||||
do_cook_single(pos)
|
||||
end
|
||||
|
||||
update_formspec(cooking_time % 3, 3, meta)
|
||||
meta:set_int("cooking_time", cooking_time)
|
||||
|
||||
--Keep cooking until there is nothing left to cook.
|
||||
if not stack:is_empty() then
|
||||
return true
|
||||
else
|
||||
meta:set_int("cooking_time", 0)
|
||||
update_formspec(0, 3, meta)
|
||||
return false
|
||||
end
|
||||
end,
|
||||
|
||||
on_metadata_inventory_put = recalculate,
|
||||
on_metadata_inventory_take = recalculate,
|
||||
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec", oven_fs)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("input", 1)
|
||||
inv:set_size("output", 1)
|
||||
end,
|
||||
|
||||
on_blast = function(pos)
|
||||
local drops = {}
|
||||
default.get_inventory_drops(pos, "input", drops)
|
||||
default.get_inventory_drops(pos, "output", drops)
|
||||
table.insert(drops, "ma_pops_furniture:oven")
|
||||
minetest.remove_node(pos)
|
||||
return drops
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_put = function(pos, list, index, stack, player)
|
||||
return oven.recipes[stack:get_name()] and stack:get_count() or 0
|
||||
end,
|
||||
})
|
||||
|
||||
-- Recipe Registration
|
||||
oven.register_recipe("default:ice", "default:water_source")
|
||||
-- No milk bucket as this doesn't support substitutes for now
|
||||
oven.register_recipe("mobs_mc:chicken_raw", "test:chicken_cooked")
|
||||
--[[ We don't need to check mod existance when registering recipe
|
||||
Recipe won't even be executed if there is no raw chicken in input ]]--
|
||||
oven.register_recipe("mobs_mc:beef_raw", "test:beef_cooked")
|
||||
oven.register_recipe("farming:coffee_cup", "farming:coffee_cup_hot") -- What a crutch there was...
|
||||
-- Add needed recipes as you go, note that other mods can add more recipes too
|
|
@ -0,0 +1,32 @@
|
|||
function ma_pops_furniture.sit(pos, node, clicker)
|
||||
do return end -- delete it when the engine is stabler for the player's physics
|
||||
local meta = minetest.get_meta(pos)
|
||||
local param2 = node.param2
|
||||
local name = clicker:get_player_name()
|
||||
|
||||
if name == meta:get_string("is_sit") then
|
||||
meta:set_string("is_sit", "")
|
||||
pos.y = pos.y-0.5
|
||||
clicker:setpos(pos)
|
||||
clicker:set_eye_offset({x=0,y=0,z=0}, {x=0,y=0,z=0})
|
||||
clicker:set_physics_override(1, 1, 1)
|
||||
default.player_attached[name] = false
|
||||
default.player_set_animation(clicker, "stand", 30)
|
||||
else
|
||||
meta:set_string("is_sit", clicker:get_player_name())
|
||||
clicker:set_eye_offset({x=0,y=-7,z=2}, {x=0,y=0,z=0})
|
||||
clicker:set_physics_override(0, 0, 0)
|
||||
clicker:setpos(pos)
|
||||
default.player_attached[name] = true
|
||||
default.player_set_animation(clicker, "sit", 30)
|
||||
if param2 == 0 then
|
||||
clicker:set_look_yaw(3.15)
|
||||
elseif param2 == 1 then
|
||||
clicker:set_look_yaw(7.9)
|
||||
elseif param2 == 2 then
|
||||
clicker:set_look_yaw(6.28)
|
||||
elseif param2 == 3 then
|
||||
clicker:set_look_yaw(4.75)
|
||||
else return end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,193 @@
|
|||
ma_pops_furniture.default_hues = {
|
||||
"white",
|
||||
"grey",
|
||||
"dark_grey",
|
||||
"black",
|
||||
"violet",
|
||||
"blue",
|
||||
"cyan",
|
||||
"dark_green",
|
||||
"green",
|
||||
"yellow",
|
||||
"orange",
|
||||
"red",
|
||||
"magenta"
|
||||
}
|
||||
|
||||
local sofa_table = { --name, color, colorize(hex or color name:intensity(1-255))
|
||||
{'Black', 'black', 'black:225'},
|
||||
{'Blue', 'blue', 'blue:225'},
|
||||
{'Brown', 'brown', 'brown:225'},
|
||||
{'Cyan', 'cyan', 'cyan:200'},
|
||||
{'Dark Green', 'dark_green', 'green:225'},
|
||||
{'Dark Grey', 'dark_grey', 'black:200'},
|
||||
{'Green', 'green', '#32cd32:150'},
|
||||
{'Grey', 'grey', 'black:100'},
|
||||
{'Magenta', 'magenta', 'magenta:200'},
|
||||
{'Orange', 'orange', 'orange:225'},
|
||||
{'Pink', 'pink', 'pink:225'},
|
||||
{'Red', 'red', 'red:225'},
|
||||
{'Violet', 'violet', 'violet:225'},
|
||||
{'White', 'white', 'white:1'},
|
||||
{'Yellow', 'yellow', 'yellow:225'},
|
||||
}
|
||||
|
||||
for i in ipairs (sofa_table) do
|
||||
local name = sofa_table[i][1]
|
||||
local color = sofa_table[i][2]
|
||||
local hex = sofa_table[i][3]
|
||||
|
||||
minetest.register_node('ma_pops_furniture:sofa_'..color, {
|
||||
description = name..' Sofa',
|
||||
drawtype = 'mesh',
|
||||
mesh = 'FM_sofa.obj',
|
||||
tiles = {'wool_'..color..'.png'},
|
||||
groups = {cracky=3, oddly_breakable_by_hand=2, flammable=1, furniture=1, fall_damage_add_percent=-80, bouncy=80},
|
||||
--inventory_image = 'mp_sofa.png^[colorize:'..hex,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sounds = {wood = {name="furn_bouncy", gain=0.8}},
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
ma_pops_furniture.sit(pos, node, clicker)
|
||||
end,
|
||||
selection_box = {
|
||||
type = 'fixed',
|
||||
fixed = {
|
||||
{-.5, -.5, -.5, .5, 0, .5}, --Right, Bottom, Back, Left, Top, Front
|
||||
{-.5, 0, .5, .5, .5, .2},
|
||||
{-.65, -.15, -.45, -.45, .3, .25}, --left
|
||||
{.65, -.15, -.45, .45, .3, .25}, --right
|
||||
},
|
||||
},
|
||||
collision_box = {
|
||||
type = 'fixed',
|
||||
fixed = {
|
||||
{-.5, -.5, -.5, .5, 0, .5}, --base
|
||||
{-.5, 0, .5, .5, .5, .2}, --back
|
||||
{-.65, -.15, -.45, -.45, .3, .25}, --left
|
||||
{.65, -.15, -.45, .45, .3, .25}, --right
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node('ma_pops_furniture:sofa_l_'..color, {
|
||||
description = name..' Sofa',
|
||||
drawtype = 'mesh',
|
||||
mesh = 'FM_sofa_l.obj',
|
||||
tiles = {'wool_'..color..'.png'},
|
||||
groups = {cracky=3, oddly_breakable_by_hand=2, flammable=1, not_in_creative_inventory=1, fall_damage_add_percent=-80, bouncy=80},
|
||||
drop = 'ma_pops_furniture:sofa_'..color,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sounds = {wood = {name="furn_bouncy", gain=0.8}},
|
||||
selection_box = {
|
||||
type = 'fixed',
|
||||
fixed = {
|
||||
{-.5, -.5, -.5, .5, 0, .5},
|
||||
{-.5, 0, .5, .5, .5, .2},
|
||||
{.65, -.15, -.45, .45, .3, .25},
|
||||
}
|
||||
},
|
||||
collision_box = {
|
||||
type = 'fixed',
|
||||
fixed = {
|
||||
{-.5, -.5, -.5, .5, 0, .5},
|
||||
{-.5, 0, .5, .5, .5, .2},
|
||||
{.65, -.15, -.45, .45, .3, .25},
|
||||
}
|
||||
},
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
ma_pops_furniture.sit(pos, node, clicker)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node('ma_pops_furniture:sofa_m_'..color, {
|
||||
description = name..' Sofa',
|
||||
drawtype = 'mesh',
|
||||
mesh = 'FM_sofa_m.obj',
|
||||
tiles = {'wool_'..color..'.png'},
|
||||
groups = {cracky=3, oddly_breakable_by_hand=2, flammable=1, not_in_creative_inventory=1, fall_damage_add_percent=-80, bouncy=80},
|
||||
drop = 'ma_pops_furniture:sofa_'..color,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sounds = {wood = {name="furn_bouncy", gain=0.8}},
|
||||
selection_box = {
|
||||
type = 'fixed',
|
||||
fixed = {
|
||||
{-.5, -.5, -.5, .5, 0, .5},
|
||||
{-.5, 0, .5, .5, .5, .2},
|
||||
}
|
||||
},
|
||||
collision_box = {
|
||||
type = 'fixed',
|
||||
fixed = {
|
||||
{-.5, -.5, -.5, .5, 0, .5},
|
||||
{-.5, 0, .5, .5, .5, .2},
|
||||
}
|
||||
},
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
ma_pops_furniture.sit(pos, node, clicker)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node('ma_pops_furniture:sofa_r_'..color, {
|
||||
description = name..' Sofa',
|
||||
drawtype = 'mesh',
|
||||
mesh = 'FM_sofa_r.obj',
|
||||
tiles = {'wool_'..color..'.png'},
|
||||
groups = {cracky=3, oddly_breakable_by_hand=2, flammable=1, not_in_creative_inventory=1, fall_damage_add_percent=-80, bouncy=80},
|
||||
drop = 'ma_pops_furniture:sofa_'..color,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sounds = {wood = {name="furn_bouncy", gain=0.8}},
|
||||
selection_box = {
|
||||
type = 'fixed',
|
||||
fixed = {
|
||||
{-.5, -.5, -.5, .5, 0, .5},
|
||||
{-.5, 0, .5, .5, .5, .2},
|
||||
{-.65, -.15, -.45, -.45, .3, .25},
|
||||
}
|
||||
},
|
||||
collision_box = {
|
||||
type = 'fixed',
|
||||
fixed = {
|
||||
{-.5, -.5, -.5, .5, 0, .5},
|
||||
{-.5, 0, .5, .5, .5, .2},
|
||||
{-.65, -.15, -.45, -.45, .3, .25},
|
||||
}
|
||||
},
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
ma_pops_furniture.sit(pos, node, clicker)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node('ma_pops_furniture:sofa_c_'..color, {
|
||||
description = name..' Sofa',
|
||||
drawtype = 'mesh',
|
||||
mesh = 'FM_sofa_c.obj',
|
||||
tiles = {'wool_'..color..'.png'},
|
||||
groups = {cracky=3, oddly_breakable_by_hand=2, flammable=1, not_in_creative_inventory=1, furniture=1, fall_damage_add_percent=-80, bouncy=80},
|
||||
drop = 'ma_pops_furniture:sofa_'..color,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sounds = {wood = {name="furn_bouncy", gain=0.8}},
|
||||
selection_box = {
|
||||
type = 'fixed',
|
||||
fixed = {
|
||||
{-.5, -.5, -.5, .5, 0, .5}, --bottom
|
||||
{-.5, 0, .5, .5, .5, .2}, --back
|
||||
{.2, 0, -.5, .5, .5, .2}, --side
|
||||
}
|
||||
},
|
||||
collision_box = {
|
||||
type = 'fixed',
|
||||
fixed = {
|
||||
{-.5, -.5, -.5, .5, 0, .5},
|
||||
{-.5, 0, .5, .5, .5, .2},
|
||||
}
|
||||
},
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
ma_pops_furniture.sit(pos, node, clicker)
|
||||
end
|
||||
})
|
||||
end
|
|
@ -0,0 +1,195 @@
|
|||
local S = ma_pops_furniture.intllib
|
||||
|
||||
--Toaster and Toast--
|
||||
minetest.register_node("ma_pops_furniture:toaster", {
|
||||
description = S("Toaster"),
|
||||
tiles = {
|
||||
"mp_toas_top.png",
|
||||
"mp_toas_bottom.png",
|
||||
"mp_toas_right.png",
|
||||
"mp_toas_left.png",
|
||||
"mp_toas_back.png",
|
||||
"mp_toas_front.png"
|
||||
},
|
||||
walkable = false,
|
||||
groups = { snappy=3 },
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.375, -0.5, 0, 0.375, -0.0625, 0.3125},
|
||||
{-0.4375, -0.1875, 0.0625, -0.375, -0.125, 0.25},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.override_item("farming:bread", {
|
||||
description = S("Bread"),
|
||||
})
|
||||
|
||||
local function breadslice_on_use(itemstack, user, pointed_thing)
|
||||
local node, pos
|
||||
if pointed_thing.under then
|
||||
pos = pointed_thing.under
|
||||
node = minetest.get_node(pos)
|
||||
end
|
||||
|
||||
local pname = user:get_player_name()
|
||||
|
||||
if node and pos and (node.name == "ma_pops_furniture:toaster") then
|
||||
if minetest.is_protected(pos, pname) then
|
||||
minetest.record_protection_violation(pos, pname)
|
||||
else
|
||||
if itemstack:get_count() >= 2 then
|
||||
itemstack:take_item(2)
|
||||
minetest.set_node(pos, {name = "ma_pops_furniture:toaster_with_breadslice", param2 = node.param2})
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
else
|
||||
return minetest.do_item_eat(2, nil, itemstack, user, pointed_thing)
|
||||
end
|
||||
end
|
||||
|
||||
if minetest.registered_items["farming:bread_slice"] then
|
||||
minetest.override_item("farming:bread_slice", {on_use = breadslice_on_use })
|
||||
minetest.register_alias("ma_pops_furniture:breadslice", "farming:bread_slice")
|
||||
else
|
||||
minetest.register_craftitem("ma_pops_furniture:breadslice", {
|
||||
description = S("Slice of Bread"),
|
||||
inventory_image = "mp_breadslice.png",
|
||||
groups = {flammable = 2},
|
||||
on_use = breadslice_on_use,
|
||||
})
|
||||
end
|
||||
|
||||
if minetest.registered_items["farming:toast"] then
|
||||
minetest.register_alias("ma_pops_furniture:toast", "farming:toast")
|
||||
else
|
||||
minetest.register_craftitem("ma_pops_furniture:toast", {
|
||||
description = S("Toast"),
|
||||
inventory_image = "mp_toast.png",
|
||||
on_use = minetest.item_eat(3),
|
||||
groups = {flammable = 2},
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_node("ma_pops_furniture:toaster_with_breadslice", {
|
||||
description = S("Toaster with Breadslice"),
|
||||
tiles = {
|
||||
"mp_toas_top_bread.png",
|
||||
"mp_toas_bottom.png",
|
||||
"mp_toas_right_bread.png",
|
||||
"mp_toas_left_bread.png",
|
||||
"mp_toas_back_bread.png",
|
||||
"mp_toas_front_bread.png"
|
||||
},
|
||||
walkable = false,
|
||||
groups = {not_in_creative_inventory=1},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
diggable = false,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.375, -0.5, 0, 0.375, -0.0625, 0.3125}, -- NodeBox1
|
||||
{-0.25, -0.0625, 0.0625, 0.25, 0.0625, 0.125}, -- NodeBox2
|
||||
{-0.25, -0.0625, 0.1875, 0.25, 0.0625, 0.25}, -- NodeBox3
|
||||
{-0.4375, -0.1875, 0.0625, -0.375, -0.125, 0.25}, -- NodeBox4
|
||||
},
|
||||
},
|
||||
on_punch = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
local fdir = node.param2
|
||||
minetest.set_node(pos, { name = "ma_pops_furniture:toaster_toasting_breadslice", param2 = fdir })
|
||||
minetest.after(6, minetest.set_node, pos, { name = "ma_pops_furniture:toaster_with_toast", param2 = fdir })
|
||||
minetest.sound_play("toaster", {
|
||||
pos = pos,
|
||||
gain = 1.0,
|
||||
max_hear_distance = 5
|
||||
})
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("ma_pops_furniture:toaster_toasting_breadslice", {
|
||||
description = S("Toaster Toasting Slice of Bread"),
|
||||
tiles = {
|
||||
"mp_toas_top_bread_on.png",
|
||||
"mp_toas_bottom.png",
|
||||
"mp_toas_right_bread.png",
|
||||
"mp_toas_left_toast_side.png",
|
||||
"mp_toas_back_side.png",
|
||||
"mp_toas_front_side.png"
|
||||
},
|
||||
walkable = false,
|
||||
groups = {not_in_creative_inventory = 1 },
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
diggable = false,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.375, -0.5, 0, 0.375, -0.0625, 0.3125}, -- NodeBox1
|
||||
{-0.4375, -0.375, 0.0625, -0.375, -0.3125, 0.25}, -- NodeBox4
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("ma_pops_furniture:toaster_with_toast", {
|
||||
description = S("Toaster with Toast"),
|
||||
tiles = {
|
||||
"mp_toas_top_toast.png",
|
||||
"mp_toas_bottom.png",
|
||||
"mp_toas_right_toast.png",
|
||||
"mp_toas_left_toast.png",
|
||||
"mp_toas_back_toast.png",
|
||||
"mp_toas_front_toast.png"
|
||||
},
|
||||
walkable = false,
|
||||
groups = { snappy=3, not_in_creative_inventory=1 },
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.375, -0.5, 0, 0.375, -0.0625, 0.3125}, -- NodeBox1
|
||||
{-0.25, -0.0625, 0.0625, 0.25, 0.0625, 0.125}, -- NodeBox2
|
||||
{-0.25, -0.0625, 0.1875, 0.25, 0.0625, 0.25}, -- NodeBox3
|
||||
{-0.4375, -0.1875, 0.0625, -0.375, -0.125, 0.25}, -- NodeBox4
|
||||
},
|
||||
},
|
||||
on_punch = function (pos, node, player, pointed_thing)
|
||||
local inv = player:get_inventory()
|
||||
local left = inv:add_item("main", "ma_pops_furniture:toast 2")
|
||||
if left:is_empty() then
|
||||
minetest.set_node(pos, {name = "ma_pops_furniture:toaster", param2 = node.param2})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:toaster',
|
||||
recipe = {
|
||||
{'','','',},
|
||||
{'default:steel_ingot','default:mese_crystal','default:steel_ingot',},
|
||||
{'default:steel_ingot','bucket:bucket_lava','default:steel_ingot',},
|
||||
}
|
||||
})
|
||||
|
||||
--Slice of Bread (only if not farming one used)
|
||||
if not minetest.registered_items["farming:bread_slice"] then
|
||||
minetest.register_craft({
|
||||
output = 'ma_pops_furniture:breadslice 2',
|
||||
type = "shapeless",
|
||||
recipe = {"farming:bread"}
|
||||
})
|
||||
end
|
|
@ -0,0 +1,129 @@
|
|||
local USES = 200 --how many times you can use the tool before it breaks.
|
||||
|
||||
minetest.register_tool('ma_pops_furniture:hammer', {
|
||||
description = 'Hammer',
|
||||
inventory_image = 'mp_hammer.png',
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type ~= 'node' then
|
||||
return
|
||||
end
|
||||
local pos = pointed_thing.under
|
||||
local node = minetest.get_node(pos)
|
||||
local sofa_table = {
|
||||
{'black'},
|
||||
{'blue'},
|
||||
{'brown'},
|
||||
{'cyan'},
|
||||
{'dark_green'},
|
||||
{'dark_grey'},
|
||||
{'green'},
|
||||
{'grey'},
|
||||
{'magenta'},
|
||||
{'orange'},
|
||||
{'pink'},
|
||||
{'red'},
|
||||
{'violet'},
|
||||
{'white'},
|
||||
{'yellow'},
|
||||
}
|
||||
|
||||
for i in ipairs (sofa_table) do
|
||||
local color = sofa_table[i][1]
|
||||
|
||||
if node.name == 'ma_pops_furniture:sofa_'..color then
|
||||
minetest.set_node(pos,{name = 'ma_pops_furniture:sofa_r_'..color, param2=node.param2})
|
||||
end
|
||||
if node.name == 'ma_pops_furniture:sofa_r_'..color then
|
||||
minetest.set_node(pos,{name = 'ma_pops_furniture:sofa_m_'..color, param2=node.param2})
|
||||
end
|
||||
if node.name == 'ma_pops_furniture:sofa_m_'..color then
|
||||
minetest.set_node(pos,{name = 'ma_pops_furniture:sofa_l_'..color, param2=node.param2})
|
||||
end
|
||||
if node.name == 'ma_pops_furniture:sofa_l_'..color then
|
||||
minetest.set_node(pos,{name = 'ma_pops_furniture:sofa_c_'..color, param2=node.param2})
|
||||
end
|
||||
if node.name == 'ma_pops_furniture:sofa_c_'..color then
|
||||
minetest.set_node(pos,{name = 'ma_pops_furniture:sofa_'..color, param2=node.param2})
|
||||
end
|
||||
end
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:add_wear(65535 / (USES - 1))
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type ~= 'node' then
|
||||
return
|
||||
end
|
||||
local pos = pointed_thing.under
|
||||
local node = minetest.get_node(pos).name
|
||||
local para = minetest.get_node(pos).param2
|
||||
local newpara = para + 1
|
||||
if newpara > 3 then
|
||||
newpara = 0
|
||||
end
|
||||
minetest.set_node(pos,{name = ""..node, param2 = newpara})
|
||||
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:add_wear(65535 / (USES - 1))
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_tool('ma_pops_furniture:shears', {
|
||||
description = 'Shears',
|
||||
inventory_image = 'mp_shears.png',
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type ~= 'node' then
|
||||
return
|
||||
end
|
||||
local pos = pointed_thing.under
|
||||
local node = minetest.get_node(pos)
|
||||
local hedge_table = { --material
|
||||
{'leaves'},
|
||||
{'pine_needles'},
|
||||
{'jungleleaves'},
|
||||
{'aspen_leaves'},
|
||||
{'acacia_leaves'}
|
||||
}
|
||||
|
||||
for i in ipairs (hedge_table) do
|
||||
local mat = hedge_table[i][1]
|
||||
|
||||
if node.name == 'ma_pops_furniture:hedge_'..mat then
|
||||
minetest.set_node(pos,{name = 'ma_pops_furniture:hedge_t_'..mat, param2=node.param2})
|
||||
end
|
||||
if node.name == 'ma_pops_furniture:hedge_t_'..mat then
|
||||
minetest.set_node(pos,{name = 'ma_pops_furniture:hedge_c_'..mat, param2=node.param2})
|
||||
end
|
||||
if node.name == 'ma_pops_furniture:hedge_c_'..mat then
|
||||
minetest.set_node(pos,{name = 'ma_pops_furniture:hedge_'..mat, param2=node.param2})
|
||||
end
|
||||
end
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:add_wear(65535 / (USES - 1))
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type ~= 'node' then
|
||||
return
|
||||
end
|
||||
local pos = pointed_thing.under
|
||||
local node = minetest.get_node(pos).name
|
||||
local para = minetest.get_node(pos).param2
|
||||
local newpara = para + 1
|
||||
if newpara > 3 then
|
||||
newpara = 0
|
||||
end
|
||||
minetest.set_node(pos,{name = ""..node, param2 = newpara})
|
||||
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:add_wear(65535 / (USES - 1))
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
Loading…
Reference in New Issue