Added dark rusty fence in two variations, fixed connection API
This commit is contained in:
parent
b1420a9b2e
commit
385c47cafb
@ -176,6 +176,12 @@ minetest.register_craftitem(":multidecor:spring",
|
||||
inventory_image = "multidecor_spring.png"
|
||||
})
|
||||
|
||||
minetest.register_craftitem(":multidecor:chainlink",
|
||||
{
|
||||
description = "Chainlink",
|
||||
inventory_image = "multidecor_chainlink.png"
|
||||
})
|
||||
|
||||
minetest.register_craft(
|
||||
{
|
||||
type = "shapeless",
|
||||
@ -314,6 +320,15 @@ minetest.register_craft({
|
||||
recipe = {"multidecor:metal_wire", "multidecor:metal_wire"}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "multidecor:chainlink",
|
||||
recipe = {
|
||||
{"multidecor:metal_wire", "multidecor:metal_wire", "multidecor:metal_wire"},
|
||||
{"multidecor:metal_wire", "multidecor:metal_wire", "multidecor:metal_wire"},
|
||||
{"multidecor:metal_wire", "multidecor:metal_wire", "multidecor:metal_wire"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv)
|
||||
local contains_saw = false
|
||||
local contains_steel_scissors = false
|
||||
|
BIN
craft_ingredients/textures/multidecor_chainlink.png
Normal file
BIN
craft_ingredients/textures/multidecor_chainlink.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
@ -29,7 +29,7 @@ function helpers.upper_first_letters(s)
|
||||
local new_s = ""
|
||||
|
||||
for substr in s:gmatch("%a+") do
|
||||
minetest.debug("substr: " .. substr)
|
||||
--minetest.debug("substr: " .. substr)
|
||||
new_s = new_s .. substr:sub(1, 1):upper() .. substr:sub(2) .. " "
|
||||
end
|
||||
|
||||
|
@ -76,7 +76,7 @@ function connecting.replace_node_to(pos, disconnect)
|
||||
rel_rot = -90
|
||||
end
|
||||
end
|
||||
minetest.debug("target_node: " .. target_node)
|
||||
--minetest.debug("target_node: " .. target_node)
|
||||
target_node = target_node ~= "" and "_" .. target_node or ""
|
||||
|
||||
if not disconnect and target_node == "" then
|
||||
@ -104,14 +104,31 @@ function connecting.directional_replace_node_to(pos, dir, side, disconnect)
|
||||
local dir_rot = math.deg(vector.dir_to_rotation(dir).y)
|
||||
local dir_rot2 = math.deg(vector.dir_to_rotation(helpers.get_dir(pos)).y)
|
||||
|
||||
local is_left_corner = add_props.connect_parts.left_side == def.mesh and side == "right" and
|
||||
dir_rot-90 == dir_rot2
|
||||
local is_right_corner = add_props.connect_parts.right_side == def.mesh and side == "left" and
|
||||
dir_rot+90 == dir_rot2
|
||||
if is_left_corner then
|
||||
right_dir = dir
|
||||
elseif is_right_corner then
|
||||
left_dir = dir
|
||||
local is_left_corner
|
||||
local is_right_corner
|
||||
|
||||
if disconnect then
|
||||
is_left_corner = add_props.connect_parts.corner == def.mesh and side == "right" and
|
||||
math.abs(dir_rot-90) == math.abs(dir_rot2)
|
||||
is_right_corner = add_props.connect_parts.corner == def.mesh and side == "left" and
|
||||
dir_rot == dir_rot2
|
||||
|
||||
if is_left_corner then
|
||||
dir = vector.rotate_around_axis(dir, {x=0, y=1, z=0}, -math.pi/2)
|
||||
elseif is_right_corner then
|
||||
dir = vector.rotate_around_axis(dir, {x=0, y=1, z=0}, math.pi/2)
|
||||
end
|
||||
else
|
||||
is_left_corner = add_props.connect_parts.left_side == def.mesh and side == "right" and
|
||||
math.abs(dir_rot-90) == math.abs(dir_rot2)
|
||||
is_right_corner = add_props.connect_parts.right_side == def.mesh and side == "left" and
|
||||
math.abs(dir_rot+90) == math.abs(dir_rot2)
|
||||
|
||||
if is_left_corner then
|
||||
right_dir = dir
|
||||
elseif is_right_corner then
|
||||
left_dir = dir
|
||||
end
|
||||
end
|
||||
|
||||
left_dir = left_dir or vector.rotate_around_axis(dir, {x=0, y=1, z=0}, -math.pi/2)
|
||||
@ -141,7 +158,7 @@ function connecting.directional_replace_node_to(pos, dir, side, disconnect)
|
||||
target_node = "middle"
|
||||
end
|
||||
end
|
||||
minetest.debug("target_node: " .. target_node)
|
||||
--minetest.debug("target_node: " .. target_node)
|
||||
target_node = target_node ~= "" and "_" .. target_node or ""
|
||||
|
||||
if not disconnect and target_node == "" then
|
||||
@ -156,7 +173,7 @@ end
|
||||
-- *type* can be "horizontal", "vertical", "pair", "sofa"
|
||||
function connecting.update_adjacent_nodes_connection(pos, type, disconnect, old_node)
|
||||
local node = minetest.get_node(pos)
|
||||
minetest.debug("update_adjacent_nodes_connection()")
|
||||
--minetest.debug("update_adjacent_nodes_connection()")
|
||||
if not disconnect then
|
||||
local add_props = minetest.registered_nodes[node.name].add_properties
|
||||
local modname = node.name:find("multidecor:")
|
||||
@ -220,6 +237,7 @@ function connecting.update_adjacent_nodes_connection(pos, type, disconnect, old_
|
||||
else
|
||||
dir = helpers.get_dir(pos)
|
||||
end
|
||||
|
||||
local left = pos+vector.rotate_around_axis(dir, {x=0, y=1, z=0}, -math.pi/2)
|
||||
local right = pos+vector.rotate_around_axis(dir, {x=0, y=1, z=0}, math.pi/2)
|
||||
|
||||
|
80
decor_api/hedge.lua
Normal file
80
decor_api/hedge.lua
Normal file
@ -0,0 +1,80 @@
|
||||
local function default_on_construct_dir(pos)
|
||||
connecting.update_adjacent_nodes_connection(pos, "directional")
|
||||
end
|
||||
|
||||
local function default_after_destruct_dir(pos, oldnode)
|
||||
connecting.update_adjacent_nodes_connection(pos, "directional", true, oldnode)
|
||||
end
|
||||
|
||||
local function default_on_construct_pair(pos)
|
||||
connecting.update_adjacent_nodes_connection(pos, "pair")
|
||||
end
|
||||
|
||||
local function default_after_destruct_pair(pos, oldnode)
|
||||
connecting.update_adjacent_nodes_connection(pos, "pair", true, oldnode)
|
||||
end
|
||||
|
||||
|
||||
function register.register_hedge(name, base_def, add_def, craft_def)
|
||||
local def = table.copy(base_def)
|
||||
|
||||
def.type = "hedge"
|
||||
def.paramtype = "facedir"
|
||||
|
||||
if add_def then
|
||||
if add_def.recipe then
|
||||
craft_def = table.copy(add_def)
|
||||
else
|
||||
def.add_properties = table.copy(add_def)
|
||||
end
|
||||
end
|
||||
|
||||
if def.callbacks then
|
||||
if add_def.connect_parts then
|
||||
def.callbacks.after_dig_node = def.callbacks.after_dig_node or default_after_destruct_dir
|
||||
|
||||
def.callbacks.on_construct = def.callbacks.on_construct or default_on_construct_dir
|
||||
elseif add_def.double then
|
||||
def.callbacks.on_construct = def.callbacks.on_construct or default_on_construct_pair
|
||||
end
|
||||
else
|
||||
def.callbacks = {}
|
||||
|
||||
if add_def.connect_parts then
|
||||
def.callbacks.after_dig_node = default_after_destruct_dir
|
||||
def.callbacks.on_construct = default_on_construct_dir
|
||||
elseif add_def.double then
|
||||
def.callbacks.on_construct = default_on_construct_pair
|
||||
end
|
||||
end
|
||||
|
||||
register.register_furniture_unit(name, def, craft_def)
|
||||
|
||||
if add_def.connect_parts then
|
||||
connecting.register_connect_parts(def)
|
||||
elseif add_def.double then
|
||||
local def2 = table.copy(def)
|
||||
def2.description = add_def.double.description
|
||||
def2.inventory_image = add_def.double.inv_image
|
||||
def2.mesh = add_def.double.mesh
|
||||
def2.drop = "multidecor:" .. add_def.common_name
|
||||
|
||||
if def2.groups then
|
||||
def2.groups.not_in_creative_inventory = 1
|
||||
else
|
||||
def2.groups = {not_in_creative_inventory=1}
|
||||
end
|
||||
|
||||
if add_def.double.mutable_bounding_box_indices then
|
||||
for i=1, #add_def.double.mutable_bounding_box_indices do
|
||||
def2.bounding_boxes[i][4] = def2.bounding_boxes[i][4] + 1
|
||||
end
|
||||
end
|
||||
|
||||
if def2.callbacks then
|
||||
def2.callbacks.on_construct = nil
|
||||
def2.callbacks.after_dig_node = base_def.callbacks and base_def.callbacks.after_dig_node or default_after_destruct_pair
|
||||
end
|
||||
register.register_furniture_unit(name .. "_double", def2)
|
||||
end
|
||||
end
|
@ -6,6 +6,7 @@ dofile(modpath .. "/common_helpers.lua")
|
||||
dofile(modpath .. "/connecting.lua")
|
||||
dofile(modpath .. "/register.lua")
|
||||
dofile(modpath .. "/bed.lua")
|
||||
dofile(modpath .. "/hedge.lua")
|
||||
dofile(modpath .. "/lighting.lua")
|
||||
dofile(modpath .. "/sitting.lua")
|
||||
dofile(modpath .. "/seat.lua")
|
||||
|
@ -11,6 +11,7 @@ register.supported_types = {
|
||||
"shelf",
|
||||
"bed",
|
||||
"light",
|
||||
"hedge",
|
||||
"decoration"
|
||||
}
|
||||
|
||||
|
59
modern/fences.lua
Normal file
59
modern/fences.lua
Normal file
@ -0,0 +1,59 @@
|
||||
register.register_hedge("dark_rusty_fence", {
|
||||
style = "modern",
|
||||
material = "metal",
|
||||
visual_scale = 0.5,
|
||||
description = "Dark Rusty Fence",
|
||||
mesh = "multidecor_dark_rusty_fence.b3d",
|
||||
tiles = {
|
||||
"multidecor_dark_metal_rusty_fence.png",
|
||||
"multidecor_fence_chainlink.png",
|
||||
"multidecor_wood.png"
|
||||
},
|
||||
bounding_boxes = {
|
||||
{-0.5, -0.5, 0.4, 0.5, 0.5, 0.5}
|
||||
}
|
||||
},
|
||||
{
|
||||
common_name = "dark_rusty_fence",
|
||||
connect_parts = {
|
||||
["left_side"] = "multidecor_dark_rusty_fence_2.b3d",
|
||||
["right_side"] = "multidecor_dark_rusty_fence_1.b3d",
|
||||
["middle"] = "multidecor_dark_rusty_fence_3.b3d",
|
||||
["corner"] = "multidecor_dark_rusty_fence_4.b3d"
|
||||
}
|
||||
},
|
||||
{
|
||||
recipe = {
|
||||
{"multidecor:metal_bar", "dye:black", "multidecor:metal_bar"},
|
||||
{"", "multidecor:chainlink", ""},
|
||||
{"multidecor:metal_bar", "", "multidecor:metal_bar"}
|
||||
}
|
||||
})
|
||||
|
||||
register.register_hedge("high_dark_rusty_fence", {
|
||||
style = "modern",
|
||||
material = "metal",
|
||||
visual_scale = 0.5,
|
||||
description = "High Dark Rusty Fence",
|
||||
mesh = "multidecor_high_dark_rusty_fence.b3d",
|
||||
tiles = {
|
||||
"multidecor_dark_metal_rusty_fence.png",
|
||||
"multidecor_fence_chainlink.png",
|
||||
"multidecor_wood.png"
|
||||
},
|
||||
bounding_boxes = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 1.5, -0.3}
|
||||
}
|
||||
},
|
||||
{
|
||||
common_name = "high_dark_rusty_fence",
|
||||
double = {
|
||||
mutable_bounding_box_indices = {1},
|
||||
description = "High Dark Rusty Fence (extended)",
|
||||
mesh = "multidecor_high_ext_dark_rusty_fence.b3d"
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "shapeless",
|
||||
recipe = {"multidecor:dark_rusty_fence", "multidecor:dark_rusty_fence"}
|
||||
})
|
@ -2,6 +2,7 @@ local modpath = minetest.get_modpath("modern")
|
||||
|
||||
dofile(modpath .. "/bedroom.lua")
|
||||
dofile(modpath .. "/chairs.lua")
|
||||
dofile(modpath .. "/fences.lua")
|
||||
dofile(modpath .. "/lamps.lua")
|
||||
dofile(modpath .. "/living_room.lua")
|
||||
dofile(modpath .. "/paintings.lua")
|
||||
|
BIN
modern/models/multidecor_dark_rusty_fence.b3d
Normal file
BIN
modern/models/multidecor_dark_rusty_fence.b3d
Normal file
Binary file not shown.
BIN
modern/models/multidecor_dark_rusty_fence.blend
Normal file
BIN
modern/models/multidecor_dark_rusty_fence.blend
Normal file
Binary file not shown.
BIN
modern/models/multidecor_dark_rusty_fence.blend1
Normal file
BIN
modern/models/multidecor_dark_rusty_fence.blend1
Normal file
Binary file not shown.
BIN
modern/models/multidecor_dark_rusty_fence_1.b3d
Normal file
BIN
modern/models/multidecor_dark_rusty_fence_1.b3d
Normal file
Binary file not shown.
BIN
modern/models/multidecor_dark_rusty_fence_1.blend
Normal file
BIN
modern/models/multidecor_dark_rusty_fence_1.blend
Normal file
Binary file not shown.
BIN
modern/models/multidecor_dark_rusty_fence_1.blend1
Normal file
BIN
modern/models/multidecor_dark_rusty_fence_1.blend1
Normal file
Binary file not shown.
BIN
modern/models/multidecor_dark_rusty_fence_2.b3d
Normal file
BIN
modern/models/multidecor_dark_rusty_fence_2.b3d
Normal file
Binary file not shown.
BIN
modern/models/multidecor_dark_rusty_fence_2.blend
Normal file
BIN
modern/models/multidecor_dark_rusty_fence_2.blend
Normal file
Binary file not shown.
BIN
modern/models/multidecor_dark_rusty_fence_2.blend1
Normal file
BIN
modern/models/multidecor_dark_rusty_fence_2.blend1
Normal file
Binary file not shown.
BIN
modern/models/multidecor_dark_rusty_fence_3.b3d
Normal file
BIN
modern/models/multidecor_dark_rusty_fence_3.b3d
Normal file
Binary file not shown.
BIN
modern/models/multidecor_dark_rusty_fence_3.blend
Normal file
BIN
modern/models/multidecor_dark_rusty_fence_3.blend
Normal file
Binary file not shown.
BIN
modern/models/multidecor_dark_rusty_fence_3.blend1
Normal file
BIN
modern/models/multidecor_dark_rusty_fence_3.blend1
Normal file
Binary file not shown.
BIN
modern/models/multidecor_dark_rusty_fence_4.b3d
Normal file
BIN
modern/models/multidecor_dark_rusty_fence_4.b3d
Normal file
Binary file not shown.
BIN
modern/models/multidecor_dark_rusty_fence_4.blend
Normal file
BIN
modern/models/multidecor_dark_rusty_fence_4.blend
Normal file
Binary file not shown.
BIN
modern/models/multidecor_dark_rusty_fence_4.blend1
Normal file
BIN
modern/models/multidecor_dark_rusty_fence_4.blend1
Normal file
Binary file not shown.
BIN
modern/models/multidecor_dark_rusty_gate.b3d
Normal file
BIN
modern/models/multidecor_dark_rusty_gate.b3d
Normal file
Binary file not shown.
BIN
modern/models/multidecor_dark_rusty_gate.blend
Normal file
BIN
modern/models/multidecor_dark_rusty_gate.blend
Normal file
Binary file not shown.
BIN
modern/models/multidecor_dark_rusty_gate.blend1
Normal file
BIN
modern/models/multidecor_dark_rusty_gate.blend1
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
modern/models/multidecor_high_dark_rusty_fence.b3d
Normal file
BIN
modern/models/multidecor_high_dark_rusty_fence.b3d
Normal file
Binary file not shown.
BIN
modern/models/multidecor_high_dark_rusty_fence.blend
Normal file
BIN
modern/models/multidecor_high_dark_rusty_fence.blend
Normal file
Binary file not shown.
BIN
modern/models/multidecor_high_dark_rusty_fence.blend1
Normal file
BIN
modern/models/multidecor_high_dark_rusty_fence.blend1
Normal file
Binary file not shown.
BIN
modern/models/multidecor_high_dark_rusty_gate.b3d
Normal file
BIN
modern/models/multidecor_high_dark_rusty_gate.b3d
Normal file
Binary file not shown.
BIN
modern/models/multidecor_high_dark_rusty_gate.blend
Normal file
BIN
modern/models/multidecor_high_dark_rusty_gate.blend
Normal file
Binary file not shown.
BIN
modern/models/multidecor_high_dark_rusty_gate.blend1
Normal file
BIN
modern/models/multidecor_high_dark_rusty_gate.blend1
Normal file
Binary file not shown.
BIN
modern/models/multidecor_high_ext_dark_rusty_fence.b3d
Normal file
BIN
modern/models/multidecor_high_ext_dark_rusty_fence.b3d
Normal file
Binary file not shown.
BIN
modern/models/multidecor_high_ext_dark_rusty_fence.blend
Normal file
BIN
modern/models/multidecor_high_ext_dark_rusty_fence.blend
Normal file
Binary file not shown.
BIN
modern/models/multidecor_high_ext_dark_rusty_fence.blend1
Normal file
BIN
modern/models/multidecor_high_ext_dark_rusty_fence.blend1
Normal file
Binary file not shown.
BIN
modern/textures/multidecor_dark_metal_rusty_fence.png
Normal file
BIN
modern/textures/multidecor_dark_metal_rusty_fence.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
modern/textures/multidecor_fence_chainlink.png
Normal file
BIN
modern/textures/multidecor_fence_chainlink.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
Loading…
x
Reference in New Issue
Block a user