1
0
mirror of https://github.com/D00Med/scifi_nodes.git synced 2024-12-23 00:20:17 +01:00

fix metal plant pot

This commit is contained in:
OgelGames 2021-08-15 17:37:15 +10:00 committed by Buckaroo Banzai
parent 5b9431ea18
commit 85aa74e98b
4 changed files with 67 additions and 72 deletions

View File

@ -1099,6 +1099,22 @@ minetest.register_craft({
} }
}) })
-- wet metal plant pot from dry metal plant pot
minetest.register_craft({
output = "scifi_nodes:pot2",
recipe = {
{"scifi_nodes:pot", "bucket:bucket_water"}
},
replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}}
})
-- dry metal plant pot from wet metal plant pot
minetest.register_craft({
type = "cooking",
output = "scifi_nodes:pot",
recipe = "scifi_nodes:pot2",
})
-- 6 itemholder from 2 dented metal block and 1 plastic -- 6 itemholder from 2 dented metal block and 1 plastic
minetest.register_craft({ minetest.register_craft({
output = "scifi_nodes:itemholder 6", output = "scifi_nodes:itemholder 6",

View File

@ -324,60 +324,45 @@ minetest.register_node("scifi_nodes:gloshroom", {
}) })
minetest.register_node("scifi_nodes:pot_lid", { minetest.register_node("scifi_nodes:pot_lid", {
description = "plant pot lid(place above plant)", description = "Plant Pot Lid",
tiles = { tiles = {
"scifi_nodes_glass2.png",
"scifi_nodes_glass2.png",
"scifi_nodes_glass2.png",
"scifi_nodes_glass2.png",
"scifi_nodes_glass2.png",
"scifi_nodes_glass2.png" "scifi_nodes_glass2.png"
}, },
inventory_image = "scifi_nodes_pod_inv.png", inventory_image = "scifi_nodes_pod_inv.png",
wield_image = "scifi_nodes_pod_inv.png", wield_image = "scifi_nodes_pod_inv.png",
use_texture_alpha = "blend", use_texture_alpha = "blend",
drawtype = "nodebox", drawtype = "nodebox",
drop = "", -- part of the pot, don't let it in players inventory
paramtype = "light", paramtype = "light",
groups = {cracky=1, not_in_creative_inventory=1}, groups = {not_in_creative_inventory = 1},
sunlight_propagates = true, sunlight_propagates = true,
diggable = false,
drop = "",
selection_box = { selection_box = {
type = "fixed", type = "fixed",
fixed = {0, 0, 0, 0, 0, 0} fixed = {-0.5, -1.5, -0.5, 0.5, -0.25, 0.5}
},
collision_box = {
type = "fixed",
fixed = {-0.5, -1.5, -0.5, 0.5, -0.5, 0.5}
}, },
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.1875, -0.5625, -0.1875, 0.1875, -0.5, 0.1875}, -- NodeBox13 {-0.4375, -1.5, -0.4375, 0.4375, -0.5, -0.375},
{-0.25, -0.625, -0.25, 0.25, -0.5625, 0.25}, -- NodeBox14 {-0.4375, -1.5, 0.375, 0.4375, -0.5, 0.4375},
{-0.3125, -0.6875, -0.3125, 0.3125, -0.625, 0.3125}, -- NodeBox15 {-0.4375, -1.5, -0.375, -0.375, -0.5, 0.375},
{-0.375, -0.75, -0.375, 0.375, -0.6875, 0.375}, -- NodeBox16 {0.375, -1.5, -0.375, 0.4375, -0.5, 0.375},
{-0.4375, -0.75, 0.375, 0.4375, -1.5, 0.4375}, -- NodeBox17 {-0.375, -0.5, -0.375, 0.375, -0.4375, 0.375},
{-0.4375, -0.75, -0.4375, 0.4375, -1.5, -0.375}, -- NodeBox18 {-0.3125, -0.4375, -0.3125, 0.3125, -0.375, 0.3125},
{0.375, -0.75, -0.4375, 0.4375, -1.5, 0.4375}, -- NodeBox19 {-0.25, -0.375, -0.25, 0.25, -0.3125, 0.25},
{-0.4375, -0.75, -0.4375, -0.375, -1.5, 0.4375}, -- NodeBox20 {-0.1875, -0.3125, -0.1875, 0.1875, -0.25, 0.1875}
} }
}, },
sounds = default.node_sound_glass_defaults() sounds = default.node_sound_glass_defaults()
}) })
local lid_offset = {x=0, y=2, z=0} local function toggle_lid(pos, node, player, itemstack)
if not player or minetest.is_protected(pos, player:get_player_name()) then
local function toggle_lid(pot_pos, player)
if not player then
return return
end end
local player_name = player:get_player_name() local lid_pos = {x = pos.x, y = pos.y+2 , z = pos.z}
local lid_pos = vector.add(pot_pos, lid_offset)
local lid_node = minetest.get_node(lid_pos) local lid_node = minetest.get_node(lid_pos)
if minetest.is_protected(lid_pos, player_name) then
-- lid is in a protected area
return
end
if lid_node.name == "scifi_nodes:pot_lid" then if lid_node.name == "scifi_nodes:pot_lid" then
minetest.set_node(lid_pos, {name = "air"}) minetest.set_node(lid_pos, {name = "air"})
elseif lid_node.name == "air" then elseif lid_node.name == "air" then
@ -385,26 +370,18 @@ local function toggle_lid(pot_pos, player)
end end
end end
local function remove_lid(pot_pos, player) local function remove_lid(pos)
if not player then local lid_pos = {x = pos.x, y = pos.y+2 , z = pos.z}
return
end
local player_name = player:get_player_name()
local lid_pos = vector.add(pot_pos, lid_offset)
local lid_node = minetest.get_node(lid_pos) local lid_node = minetest.get_node(lid_pos)
if minetest.is_protected(lid_pos, player_name) then
-- lid is in protected area
return
end
if lid_node.name == "scifi_nodes:pot_lid" then if lid_node.name == "scifi_nodes:pot_lid" then
minetest.set_node(lid_pos, {name = "air"}) minetest.set_node(lid_pos, {name = "air"})
end end
end end
minetest.register_node("scifi_nodes:pot", { minetest.register_node("scifi_nodes:pot", {
description = "metal plant pot (right click for lid, shift+rightclick to plant)", description = "Metal Plant Pot (right-click for lid, sneak + right-click to plant)",
tiles = { tiles = {
"scifi_nodes_pot.png", "default_dirt.png^scifi_nodes_pot.png",
"scifi_nodes_greybolts.png", "scifi_nodes_greybolts.png",
"scifi_nodes_greybolts.png", "scifi_nodes_greybolts.png",
"scifi_nodes_greybolts.png", "scifi_nodes_greybolts.png",
@ -414,28 +391,29 @@ minetest.register_node("scifi_nodes:pot", {
drawtype = "nodebox", drawtype = "nodebox",
paramtype = "light", paramtype = "light",
groups = {cracky = 1, soil = 1, sand = 1}, groups = {cracky = 1, soil = 1, sand = 1},
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}
},
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.25, -0.5, 0.5, 0.5, 0.5}, -- NodeBox1 {-0.5, -0.25, -0.5, 0.5, 0.5, 0.5},
{0.1875, -0.5, 0.1875, 0.5, -0.25, 0.5}, -- NodeBox2 {0.1875, -0.5, 0.1875, 0.5, -0.25, 0.5},
{-0.5, -0.5, -0.5, -0.1875, -0.25, -0.1875}, -- NodeBox3 {-0.5, -0.5, -0.5, -0.1875, -0.25, -0.1875},
{-0.5, -0.5, 0.1875, -0.1875, -0.25, 0.5}, -- NodeBox4 {-0.5, -0.5, 0.1875, -0.1875, -0.25, 0.5},
{0.1875, -0.5, -0.5, 0.5, -0.25, -0.1875}, -- NodeBox5 {0.1875, -0.5, -0.5, 0.5, -0.25, -0.1875}
} }
}, },
on_rightclick = function(pos, _, player) on_rightclick = toggle_lid,
toggle_lid(pos, player) on_destruct = remove_lid,
end, sounds = default.node_sound_metal_defaults(),
after_dig_node = function(pos, _, _, player)
remove_lid(pos, player)
end
}) })
minetest.register_node("scifi_nodes:pot2", { minetest.register_node("scifi_nodes:pot2", {
description = "metal wet plant pot(right click for lid, shift+rightclick to plant)", description = "Metal Plant Pot Wet (right-click for lid, sneak + right-click to plant)",
tiles = { tiles = {
"scifi_nodes_pot.png^[colorize:black:100", "default_dirt.png^scifi_nodes_pot2.png",
"scifi_nodes_greybolts.png", "scifi_nodes_greybolts.png",
"scifi_nodes_greybolts.png", "scifi_nodes_greybolts.png",
"scifi_nodes_greybolts.png", "scifi_nodes_greybolts.png",
@ -445,22 +423,23 @@ minetest.register_node("scifi_nodes:pot2", {
drawtype = "nodebox", drawtype = "nodebox",
paramtype = "light", paramtype = "light",
groups = {cracky = 1, soil = 3, wet = 1}, groups = {cracky = 1, soil = 3, wet = 1},
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}
},
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
{-0.5, -0.25, -0.5, 0.5, 0.5, 0.5}, -- NodeBox1 {-0.5, -0.25, -0.5, 0.5, 0.5, 0.5},
{0.1875, -0.5, 0.1875, 0.5, -0.25, 0.5}, -- NodeBox2 {0.1875, -0.5, 0.1875, 0.5, -0.25, 0.5},
{-0.5, -0.5, -0.5, -0.1875, -0.25, -0.1875}, -- NodeBox3 {-0.5, -0.5, -0.5, -0.1875, -0.25, -0.1875},
{-0.5, -0.5, 0.1875, -0.1875, -0.25, 0.5}, -- NodeBox4 {-0.5, -0.5, 0.1875, -0.1875, -0.25, 0.5},
{0.1875, -0.5, -0.5, 0.5, -0.25, -0.1875}, -- NodeBox5 {0.1875, -0.5, -0.5, 0.5, -0.25, -0.1875}
} }
}, },
on_rightclick = function(pos, _, player) on_rightclick = toggle_lid,
toggle_lid(pos, player) on_destruct = remove_lid,
end, sounds = default.node_sound_metal_defaults(),
after_dig_node = function(pos, _, _, player)
remove_lid(pos, player)
end
}) })
minetest.register_node("scifi_nodes:lightbar", { minetest.register_node("scifi_nodes:lightbar", {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 B

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 B