1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2025-06-28 12:56:01 +02:00

initial progress

This commit is contained in:
unknown
2022-04-02 16:32:44 -04:00
parent 3ba59dc2d5
commit 63439e19ea
24 changed files with 397 additions and 321 deletions

View File

@ -1,21 +0,0 @@
unused_args = false
allow_defined_top = true
max_comment_line_length = 999
read_globals = {
"DIR_DELIM",
"minetest", "core",
"unpack",
"dump",
table = { fields = { "copy", "getn" } },
"vector", "nodeupdate",
"VoxelManip", "VoxelArea",
"PseudoRandom", "ItemStack",
"creative",
"default",
"screwdriver",
}
globals = {
}

View File

@ -103,7 +103,7 @@ local function stack(itemstack, placer, fdir, pos, def, pos2, node1, node2, poin
ctrl_node_def.after_place_node(pos, placer, itemstack, pointed_thing)
end
if not creative.is_enabled_for(placer_name) then
if not minetest.is_creative_enabled(placer_name) then
itemstack:take_item()
end
end
@ -133,7 +133,8 @@ function homedecor.stack_vertically(itemstack, placer, pointed_thing, node1, nod
end
-- Stack one door node above another
-- like homedecor.stack_vertically but tests first if it was placed as a right wing, then uses node1_right and node2_right instead
-- like homedecor.stack_vertically but tests first if it was placed as a right wing,
-- then uses node1_right and node2_right instead
function homedecor.stack_wing(itemstack, placer, pointed_thing, node1, node2, node1_right, node2_right)
local rightclick_result = rightclick_pointed_thing(pointed_thing.under, placer, itemstack, pointed_thing)
@ -230,8 +231,9 @@ function homedecor.bed_expansion(pos, placer, itemstack, pointed_thing, trybunks
if trybunks and is_buildable_to(placer_name, toppos, topposfwd) then
local newname = string.gsub(thisnode.name, "_regular", "_extended")
local newparam2 = param2 % 8
-- FIXME: is newparam2 a legacy unused variable from a8729575abfbd15cc622b413b71976c9157fbab4? or should this variable be used somewhere?
-- local newparam2 = param2 % 8
-- FIXME: is newparam2 a legacy unused variable from a8729575abfbd15cc622b413b71976c9157fbab4?
-- or should this variable be used somewhere?
minetest.swap_node(toppos, { name = thisnode.name, param2 = param2})
minetest.swap_node(pos, { name = newname, param2 = param2})
itemstack:take_item()

View File

@ -54,6 +54,16 @@ homedecor.mahogany_wood = { name = "homedecor_generic_wood_plain.png", color =
homedecor.white_wood = "homedecor_generic_wood_plain.png"
homedecor.dark_wood = { name = "homedecor_generic_wood_plain.png", color = 0xff39240f }
homedecor.lux_wood = { name = "homedecor_generic_wood_luxury.png", color = 0xff643f23 }
homedecor.glass = "default_glass.png"
if not minetest.get_modpath("default") then
homedecor.glass =
"[combine:16x16:" ..
"0,0=\\[combine\\:1x16\\^[noalpha\\^[colorize\\:#ffffff:" ..
"0,0=\\[combine\\:16x1\\^[noalpha\\^[colorize\\:#ffffff:" ..
"0,15=\\[combine\\:16x1\\^[noalpha\\^[colorize\\:#ffffff:" ..
"15,0=\\[combine\\:1x16\\^[noalpha\\^[colorize\\:#ffffff"
end
homedecor.color_black = 0xff303030
homedecor.color_dark_grey = 0xff606060
@ -64,6 +74,7 @@ dofile(modpath.."/nodeboxes.lua")
dofile(modpath.."/expansion.lua")
dofile(modpath.."/furnaces.lua")
dofile(modpath.."/inventory.lua")
dofile(modpath.."/materials.lua")
dofile(modpath.."/registration.lua")
dofile(modpath.."/water_particles.lua")
dofile(modpath.."/sit.lua")

View File

@ -12,47 +12,46 @@ local default_can_dig = function(pos,player)
return meta:get_inventory():is_empty("main")
end
local background = default.gui_bg .. default.gui_bg_img .. default.gui_slots
local default_inventory_formspecs = {
["4"]="size[8,6]".. background ..
["4"]="size[8,6]"..
"list[context;main;2,0;4,1;]" ..
"list[current_player;main;0,2;8,4;]" ..
"listring[]",
["6"]="size[8,6]".. background ..
["6"]="size[8,6]"..
"list[context;main;1,0;6,1;]"..
"list[current_player;main;0,2;8,4;]" ..
"listring[]",
["8"]="size[8,6]".. background ..
["8"]="size[8,6]"..
"list[context;main;0,0;8,1;]"..
"list[current_player;main;0,2;8,4;]" ..
"listring[]",
["12"]="size[8,7]".. background ..
["12"]="size[8,7]"..
"list[context;main;1,0;6,2;]"..
"list[current_player;main;0,3;8,4;]" ..
"listring[]",
["16"]="size[8,7]".. background ..
["16"]="size[8,7]"..
"list[context;main;0,0;8,2;]"..
"list[current_player;main;0,3;8,4;]" ..
"listring[]",
["24"]="size[8,8]".. background ..
["24"]="size[8,8]"..
"list[context;main;0,0;8,3;]"..
"list[current_player;main;0,4;8,4;]" ..
"listring[]",
["32"]="size[8,9]".. background ..
["32"]="size[8,9]"..
"list[context;main;0,0.3;8,4;]"..
"list[current_player;main;0,4.85;8,1;]"..
"list[current_player;main;0,6.08;8,3;8]"..
"listring[context;main]" ..
"listring[current_player;main]" ..
default.get_hotbar_bg(0,4.85),
"listring[current_player;main]",
["50"]="size[10,10]".. background ..
["50"]="size[10,10]"..
"list[context;main;0,0;10,5;]"..
"list[current_player;main;1,6;8,4;]" ..
"listring[]",

View File

@ -0,0 +1,101 @@
homedecor.materials = {
dirt = "default:dirt",
sand = "default:sand",
gravel = "default:gravel",
copper_ingot = "default:copper_ingot",
steel_ingot = "default:steel_ingot",
gold_ingot = "default:gold_ingot",
tin_ingot = "default:tin_ingot",
mese_crystal_fragment = "default:mese_crystal_fragment",
torch = "default:torch",
diamond = "default:diamond",
clay_lump = "default:clay_lump",
water_bucket = "bucket:bucket_water",
empty_bucket = "bucket:bucket_empty",
dye_dark_grey = "dye:dark_grey",
dye_black = "dye:black",
silicon = "mesecons_materials:silicon",
string = "farming:string",
paper = "default:paper",
book = "default:book",
}
if minetest.get_modpath("moreores") then
homedecor.materials.silver_ingot = "moreores:silver_ingot"
end
if minetest.get_modpath("mcl_core") then
homedecor.materials = {
dirt = "mcl_core:dirt",
sand = "mcl_core:sand",
gravel = "mcl_core:gravel",
steel_ingot = "mcl_core:iron_ingot",
gold_ingot = "mcl_core:gold_ingot",
mese_crystal_fragment = "mesecons:redstone",
torch = "mcl_torches:torch",
diamond = "mcl_core:diamond",
clay_lump = "mcl_core:clay_lump",
water_bucket = "mcl_buckets:bucket_water",
empty_bucket = "mcl_buckets:bucket_empty",
dye_dark_grey = "mcl_dye:dark_grey",
-- Use iron where no equivalent
copper_ingot = "mcl_core:iron_ingot",
tin_ingot = "mcl_core:iron_ingot",
silver_ingot = "mcl_core:iron_ingot",
silicon = "mesecons_materials:silicon",
}
elseif minetest.get_modpath("fl_ores") and minetest.get_modpath("fl_stone") then
homedecor.materials = {
dirt = "fl_topsoil:dirt",
sand = "fl_stone:sand",
gravel = "fl_topsoil:gravel",
steel_ingot = "fl_ores:iron_ingot",
gold_ingot = "fl_ores:gold_ingot",
mese_crystal_fragment = "fl_ores:iron_ingot",
torch = "fl_light_sources:torch",
diamond = "fl_ores:diamond",
clay_lump = "fl_bricks:clay_lump",
water_bucket = "fl_bucket:bucket_water",
empty_bucket = "fl_bucket:bucket",
dye_dark_grey = "fl_dyes:dark_grey_dye",
dye_black = "fl_dyes:black_dye",
copper_ingot = "fl_ores:copper_ingot",
tin_ingot = "fl_ores:tin_ingot",
silver_ingot = "fl_ores:iron_ingot",
silicon = "mesecons_materials:silicon",
string = "fl_plantlife:oxeye_daisy",
paper = "basic_materials:plastic_sheet",
}
elseif minetest.get_modpath("hades_core") then
homedecor.materials = {
dirt = "hades_core:dirt",
sand = "hades_core:fertile_sand",
gravel = "hades_core:gravel",
steel_ingot = "hades_core:steel_ingot",
gold_ingot = "hades_core:gold_ingot",
mese_crystal_fragment = "hades_core:mese_crystal_fragment",
torch = "hades_torches:torch",
diamond = "hades_core:diamond",
clay_lump = "hades_core:clay_lump",
dye_dark_grey = "dye:dark_grey",
copper_ingot = "hades_core:copper_ingot",
tin_ingot = "hades_core:tin_ingot",
--[[
Since hades doesnt have buckets or water for the user,
using dirt from near water to pull the water out
]]
water_bucket = "hades_core:dirt",
empty_bucket = "hades_core:fertile_sand",
-- Set this to steel unless hadesextraores is present
silver_ingot = "hades_core:steel_ingot",
silicon = "hades_materials:silicon",
}
if minetest.get_modpath("hades_bucket") then
homedecor.materials["water_bucket"] = "hades_bucket:bucket_water"
homedecor.materials["empty_bucket"] = "hades_bucket:bucket_empty"
end
if minetest.get_modpath("hades_extraores") then
homedecor.materials["silver_ingot"] = "hades_extraores:silver_ingot"
end
end

View File

@ -1,4 +1,4 @@
name = homedecor_common
description = Homedecor mod: common
depends = default, creative
optional_depends = screwdriver, hopper
depends = basic_materials
optional_depends = screwdriver, hopper, default, creative, sound_api

View File

@ -10,7 +10,7 @@ homedecor.box = {
slab_y = function(height, shift) return { -0.5, -0.5+(shift or 0), -0.5, 0.5, -0.5+height+(shift or 0), 0.5 } end,
-- slab starting from -z (+z with negative depth)
slab_z = function(depth, shift)
-- for consistency with the other functions here, we have to assume that a "z" slab starts from -z and extends by depth,
-- for consistency with the other functions here, we have to assume that a z slab starts from -z and extends by depth,
-- but since conventionally a lot of nodes place slabs against +z for player convenience, we define
-- a "negative" depth as a depth extending from the other side, i.e. +z
local s = shift or 0

View File

@ -46,9 +46,9 @@ function homedecor.register(name, original_def)
if expand then
-- dissallow rotating only half the expanded node by default
-- unless we know better
def.on_rotate = def.on_rotate
or (minetest.get_modpath("screwdriver") and (def.mesh and expand.top and screwdriver.rotate_simple)
or screwdriver.disallow) or nil
def.on_rotate = def.on_rotate or
(minetest.get_modpath("screwdriver") and (def.mesh and expand.top and screwdriver.rotate_simple) or
minetest.get_modpath("screwdriver") and screwdriver.disallow) or nil
def.on_place = def.on_place or function(itemstack, placer, pointed_thing)
if expand.top then
@ -96,6 +96,31 @@ function homedecor.register(name, original_def)
end
end
local crafts = def.crafts and table.copy(def.crafts) or {}
def.crafts = nil
-- register the actual minetest node
minetest.register_node(":homedecor:" .. name, def)
for _, cdef in pairs(crafts) do
if cdef.recipe then
for k, row in pairs(cdef.recipe) do
if type(row) == "string" and homedecor.materials[row] then
cdef.recipe[k] = homedecor.materials[row]
elseif type(row) == "table" then
for i, item in pairs(row) do
if homedecor.materials[item] then
cdef.recipe[k][i] = homedecor.materials[item]
end
end
end
end
end
if cdef.type ~= "toolrepair" and not cdef.output then
cdef.output = ":homedecor:" .. name
end
minetest.register_craft(cdef)
end
end