Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make 'screwdriver' optional #39

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ unused_args = false
max_line_length = 140

read_globals = {
table = {fields = {"copy"}},

"minetest",
"core",
"vector",
"default",
"doors",
Expand Down
9 changes: 5 additions & 4 deletions my_future_doors/framed.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
local rotate_disallow = rawget(_G, "screwdriver") and screwdriver.disallow or nil
local doorcolors = {"white","red","black"}

local function add_door(col)
Expand Down Expand Up @@ -36,7 +37,7 @@ local function add_door(col)
{-0.625, 1.4375,-0.5625, 0.625, 1.625, 0.5625}, --top
}
},
on_rotate = screwdriver.disallow,
on_rotate = rotate_disallow,
on_place = function(itemstack, placer, pointed_thing)
local pos1 = pointed_thing.above
local pos2 = vector.add(pos1, {x=0,y=1,z=0})
Expand Down Expand Up @@ -112,7 +113,7 @@ local function add_door(col)
{-0.5, -0.5, -0.5, -0.5, -0.5, -0.5},
}
},
on_rotate = screwdriver.disallow,
on_rotate = rotate_disallow,
})
minetest.register_node("my_future_doors:door1c_"..col, {
tiles = {
Expand Down Expand Up @@ -147,7 +148,7 @@ local function add_door(col)
}
},
drop = "my_future_doors:door1a_"..col,
on_rotate = screwdriver.disallow,
on_rotate = rotate_disallow,
after_place_node = function(pos, placer, itemstack, pointed_thing)
local node = minetest.get_node(pos)
local timer = minetest.get_node_timer(pos)
Expand Down Expand Up @@ -196,7 +197,7 @@ local function add_door(col)
{-0.5, -0.5, -0.5, -0.5, -0.5, -0.5},
}
},
on_rotate = screwdriver.disallow,
on_rotate = rotate_disallow,
})
minetest.register_craft({
output = "my_future_doors:door1a_"..col.." 1",
Expand Down
3 changes: 2 additions & 1 deletion my_future_doors/mod.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name = my_future_doors
description = Futuristic style doors.
depends = my_door_wood, screwdriver
depends = my_door_wood
optional_depends = screwdriver
10 changes: 6 additions & 4 deletions my_future_doors/sliding.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
local rotate_disallow = rawget(_G, "screwdriver") and screwdriver.disallow or nil

local doors = {
{"my_future_doors:door2a","my_future_doors:door2b","my_future_doors:door2c","my_future_doors:door2d","2","Steel",
{{"default:steel_ingot", "default:steelblock", ""},
Expand Down Expand Up @@ -147,7 +149,7 @@ local function add_door(doora, doorb, doorc, doord, num, des, recipe)
{-0.5, -0.5, -0.0625, 0.5, 1.5, 0.0625}
}
},
on_rotate = screwdriver.disallow,
on_rotate = rotate_disallow,

on_place = onplace,

Expand Down Expand Up @@ -180,7 +182,7 @@ local function add_door(doora, doorb, doorc, doord, num, des, recipe)
{0, 0, 0, 0, 0, 0},
}
},
on_rotate = screwdriver.disallow,
on_rotate = rotate_disallow,
})
minetest.register_node(doorc, {
tiles = {
Expand Down Expand Up @@ -211,7 +213,7 @@ local function add_door(doora, doorb, doorc, doord, num, des, recipe)
after_place_node = afterplace,
after_destruct = afterdestruct,
on_timer = ontimer,
on_rotate = screwdriver.disallow,
on_rotate = rotate_disallow,
})
minetest.register_node(doord, {
tiles = {
Expand All @@ -238,7 +240,7 @@ local function add_door(doora, doorb, doorc, doord, num, des, recipe)
{0, 0, 0, 0, 0, 0},
}
},
on_rotate = screwdriver.disallow,
on_rotate = rotate_disallow,
})
minetest.register_craft({
output = "my_future_doors:door"..num.."a 2",
Expand Down
77 changes: 33 additions & 44 deletions my_garage_door/init.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
local rotate_disallow = rawget(_G, "screwdriver") and screwdriver.disallow or nil

local function buildable_to(pos)
local node = minetest.get_node(pos).name
if minetest.registered_nodes[node] then -- The checked node is maybe an unknown node
Expand All @@ -6,6 +8,17 @@ local function buildable_to(pos)
return false
end

local nodebox_closed = {
type = "fixed",
fixed = {
{-1.5, -0.5, -0.125, 1.5, 0.5, -0.0625},
{-1.5, -0.5, -0.1875, 1.5, -0.3125, -0.0625},
{-1.5, -0.25, -0.1875, 1.5, -0.0624999, -0.0625},
{-1.5, 0, -0.1875, 1.5, 0.1875, -0.0625},
{-1.5, 0.25, -0.1875, 1.5, 0.4375, -0.0625},
}
}

minetest.register_node("my_garage_door:garage_door", {
description = "Garage Door",
tiles = {
Expand All @@ -15,23 +28,14 @@ minetest.register_node("my_garage_door:garage_door", {
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky=3},
node_box = {
type = "fixed",
fixed = {
{-1.5, -0.5, -0.125, 1.5, 0.5, -0.0625},
{-1.5, -0.5, -0.1875, 1.5, -0.3125, -0.0625},
{-1.5, -0.25, -0.1875, 1.5, -0.0624999, -0.0625},
{-1.5, 0, -0.1875, 1.5, 0.1875, -0.0625},
{-1.5, 0.25, -0.1875, 1.5, 0.4375, -0.0625},
}
},
node_box = table.copy(nodebox_closed),
selection_box = {
type = "fixed",
fixed = {
{-1.5, -0.5, -0.1875, 1.5, 1.5, -0.0625},
}
},
on_rotate = screwdriver.disallow,
on_rotate = rotate_disallow,
on_place = function(itemstack, placer, pointed_thing)
local pos1 = pointed_thing.above
local pos2 = vector.add(pos1, {x=0,y=1,z=0})
Expand Down Expand Up @@ -114,19 +118,22 @@ minetest.register_node("my_garage_door:garage_door_top", {
diggable = false,
pointable = false,
groups = {cracky=3},
node_box = {
type = "fixed",
fixed = {
{-1.5, -0.5, -0.125, 1.5, 0.5, -0.0625},
{-1.5, -0.5, -0.1875, 1.5, -0.3125, -0.0625},
{-1.5, -0.25, -0.1875, 1.5, -0.0624999, -0.0625},
{-1.5, 0, -0.1875, 1.5, 0.1875, -0.0625},
{-1.5, 0.25, -0.1875, 1.5, 0.4375, -0.0625},
}
},
node_box = table.copy(nodebox_closed),
selection_box = {type = "fixed",fixed = {{0, 0, 0, 0, 0, 0},}},
on_rotate = screwdriver.disallow,
on_rotate = rotate_disallow,
})

local nodebox_open = {
type = "fixed",
fixed = {
{-1.5, 0.4375, -0.5, 1.5, 0.375, 0.5},
{-1.5, 0.375, 0.3125, 1.5, 0.5, 0.5},
{-1.5, 0.375, 0.0625, 1.5, 0.5, 0.25},
{-1.5, 0.375, -0.1875, 1.5, 0.5, 0},
{-1.5, 0.375, -0.4375, 1.5, 0.5, -0.25},
}
}

minetest.register_node("my_garage_door:garage_door_open", {
tiles = {
"default_snow.png"
Expand All @@ -137,18 +144,9 @@ minetest.register_node("my_garage_door:garage_door_open", {
drop = "my_garage_door:garage_door",
diggable = false,
groups = {cracky=3},
node_box = {
type = "fixed",
fixed = {
{-1.5, 0.4375, -0.5, 1.5, 0.375, 0.5},
{-1.5, 0.375, 0.3125, 1.5, 0.5, 0.5},
{-1.5, 0.375, 0.0625, 1.5, 0.5, 0.25},
{-1.5, 0.375, -0.1875, 1.5, 0.5, 0},
{-1.5, 0.375, -0.4375, 1.5, 0.5, -0.25},
}
},
node_box = table.copy(nodebox_open),
selection_box = {type = "fixed",fixed = {{-1.5, 0.375, -0.5, 1.5, 0.5, 1.5},}},
on_rotate = screwdriver.disallow,
on_rotate = rotate_disallow,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local p2 = node.param2
local dir = minetest.facedir_to_dir((p2+2)%4)
Expand Down Expand Up @@ -195,18 +193,9 @@ minetest.register_node("my_garage_door:garage_door_open2", {
diggable = false,
pointable = false,
groups = {cracky=3},
node_box = {
type = "fixed",
fixed = {
{-1.5, 0.4375, -0.5, 1.5, 0.375, 0.5},
{-1.5, 0.375, 0.3125, 1.5, 0.5, 0.5},
{-1.5, 0.375, 0.0625, 1.5, 0.5, 0.25},
{-1.5, 0.375, -0.1875, 1.5, 0.5, 0},
{-1.5, 0.375, -0.4375, 1.5, 0.5, -0.25},
}
},
node_box = table.copy(nodebox_open),
selection_box = {type = "fixed",fixed = {{0, 0, 0, 0, 0, 0},}},
on_rotate = screwdriver.disallow,
on_rotate = rotate_disallow,
})

-- craft
Expand Down
2 changes: 1 addition & 1 deletion my_garage_door/mod.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name = my_garage_door
description = A garage door.
optional_depends = basic_materials
optional_depends = basic_materials, screwdriver
43 changes: 19 additions & 24 deletions my_misc_doors/bars.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
local rotate_disallow = rawget(_G, "screwdriver") and screwdriver.disallow or nil

local nodebox = {
type = "fixed",
fixed = {
{-0.4375, -0.5, -0.0625, -0.3125, 0.5, 0.0625},
{-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.0625},
{ 0.3125, -0.5, -0.0625, 0.4375, 0.5, 0.0625},
{ 0.125, -0.5, -0.0625, 0.25, 0.5, 0.0625},
{-0.25, -0.5, -0.0625, -0.125, 0.5, 0.0625},
}
}

minetest.register_node("my_misc_doors:door2a", {
description = "Sliding Door",
inventory_image = "mydoors_bars.png",
Expand All @@ -13,23 +26,14 @@ minetest.register_node("my_misc_doors:door2a", {
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 3},
node_box = {
type = "fixed",
fixed = {
{-0.4375, -0.5, -0.0625, -0.3125, 0.5, 0.0625},
{-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.0625},
{ 0.3125, -0.5, -0.0625, 0.4375, 0.5, 0.0625},
{ 0.125, -0.5, -0.0625, 0.25, 0.5, 0.0625},
{-0.25, -0.5, -0.0625, -0.125, 0.5, 0.0625},
}
},
node_box = table.copy(nodebox),
selection_box = {
type = "fixed",
fixed = {
{-0.4375, -0.5, -0.0625, 0.4375, 1.5, 0.0625},
}
},
on_rotate = screwdriver.disallow,
on_rotate = rotate_disallow,

on_place = function(itemstack, placer, pointed_thing)
local pos1 = pointed_thing.above
Expand Down Expand Up @@ -102,23 +106,14 @@ minetest.register_node("my_misc_doors:door2b", {
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-0.4375, -0.5, -0.0625, -0.3125, 0.5, 0.0625},
{-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.0625},
{ 0.3125, -0.5, -0.0625, 0.4375, 0.5, 0.0625},
{ 0.125, -0.5, -0.0625, 0.25, 0.5, 0.0625},
{-0.25, -0.5, -0.0625, -0.125, 0.5, 0.0625},
}
},
node_box = table.copy(nodebox),
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0},
}
},
on_rotate = screwdriver.disallow,
on_rotate = rotate_disallow,
})
minetest.register_node("my_misc_doors:door2c", {
tiles = {
Expand Down Expand Up @@ -150,7 +145,7 @@ minetest.register_node("my_misc_doors:door2c", {
}
},
drop = "my_misc_doors:door2a",
on_rotate = screwdriver.disallow,
on_rotate = rotate_disallow,
after_place_node = function(pos, placer, itemstack, pointed_thing)
local node = minetest.get_node(pos)
local timer = minetest.get_node_timer(pos)
Expand Down Expand Up @@ -206,7 +201,7 @@ minetest.register_node("my_misc_doors:door2d", {
{0, 0, 0, 0, 0, 0},
}
},
on_rotate = screwdriver.disallow,
on_rotate = rotate_disallow,
})
minetest.register_craft({
output = "my_misc_doors:door2a 1",
Expand Down
3 changes: 2 additions & 1 deletion my_misc_doors/mod.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name = my_misc_doors
description = Some misc. doors.
depends = default, my_door_wood, doors, wool, screwdriver
depends = default, my_door_wood, doors, wool
optional_depends = screwdriver
6 changes: 4 additions & 2 deletions my_saloon_doors/init.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
local rotate_simple = rawget(_G, "screwdriver") and screwdriver.rotate_simple or nil

local doorcol = {
{"white", "White", "^[colorize:white:120", "my_door_wood:wood_white"},
{"red", "Red", "^[colorize:red:120", "my_door_wood:wood_red"},
Expand Down Expand Up @@ -37,7 +39,7 @@ local function add_door(col, des, tint, craft)
{-0.5, -0.1875, -0.0625, 0.5, 1, 0.0625},
}
},
on_rotate = screwdriver.rotate_simple,
on_rotate = rotate_simple,

on_place = function(itemstack, placer, pointed_thing)
local pos1 = pointed_thing.above
Expand Down Expand Up @@ -107,7 +109,7 @@ local function add_door(col, des, tint, craft)
{0, 0, 0, 0, 0, 0},
}
},
on_rotate = screwdriver.rotate_simple,
on_rotate = rotate_simple,
on_timer = function(pos, elapsed)
local node = minetest.get_node(pos)
minetest.set_node(pos, {name="my_saloon_doors:door1a_"..col, param2=node.param2})
Expand Down
3 changes: 2 additions & 1 deletion my_saloon_doors/mod.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name = my_saloon_doors
description = Saloon style doors.
depends = default, my_door_wood, doors, screwdriver
depends = default, my_door_wood, doors
optional_depends = screwdriver
Loading