Merge branch 'master' of Grossam/scifi_nodes into master

This commit is contained in:
fwhcat 2019-04-26 18:00:53 +00:00 committed by Gitea
commit 1c4e03230b
55 changed files with 127 additions and 106 deletions

233
doors.lua
View File

@ -14,32 +14,38 @@
-- will the authors be held liable for any damages arising from the use of this content.
-- This table now uses named parameters and more convenient variables names
local doors = {
-- DOOM door {closed, closed top, opened, opened top, texture number, main ingredient, sound}
{base_name = "Doom", base_ingredient = "doors:door_obsidian_glass", sound = "scifi_nodes_door_mechanic"},
-- Black door
{"scifi_nodes:door2a","scifi_nodes:door2b","scifi_nodes:door2c","scifi_nodes:door2d","2","black", "doors:door_steel", "scifi_nodes_door_mechanic"},
{base_name = "black", base_ingredient = "doors:door_steel", sound = "scifi_nodes_door_mechanic"},
-- White door
{"scifi_nodes:door3a","scifi_nodes:door3b","scifi_nodes:door3c","scifi_nodes:door3d","3","white", "doors:door_glass", "scifi_nodes_door_normal"},
{base_name = "white", base_ingredient = "doors:door_glass", sound = "scifi_nodes_door_normal"},
-- Green door
{"scifi_nodes:door4a","scifi_nodes:door4b","scifi_nodes:door4c","scifi_nodes:door4d","4","green", "doors:door_wood", "scifi_nodes_door_mechanic"},
-- DOOM door
{"scifi_nodes:door1a","scifi_nodes:door1b","scifi_nodes:door1c","scifi_nodes:door1d","1","Doom", "doors:door_obsidian_glass", "scifi_nodes_door_mechanic"}
{base_name = "green", base_ingredient = "doors:door_wood", sound = "scifi_nodes_door_mechanic"},
{base_name = "blue", base_ingredient = "default:steel_block", sound = "scifi_nodes_door_normal"}
}
for i in ipairs (doors) do
-- Maybe useful later with mesecons_doors.meseconify_door()
function get_doors_list()
return doors
end
-- TODO: make a map with entries: {a="", b="", desc="", etc}
local doora = doors[i][1]
local doorb = doors[i][2]
local doorc = doors[i][3]
local doord = doors[i][4]
local num = doors[i][5]
local des = doors[i][6]
local base_ingredient = doors[i][7]
local sound = doors[i][8]
for _, current_door in ipairs(doors) do
local closed = "scifi_nodes:"..current_door.base_name.."_door_closed"
local closed_top = "scifi_nodes:"..current_door.base_name.."_door_closed_top"
local opened = "scifi_nodes:"..current_door.base_name.."_door_opened"
local opened_top = "scifi_nodes:"..current_door.base_name.."_door_opened_top"
local base_name = current_door.base_name
local base_ingredient = current_door.base_ingredient
local sound = current_door.sound
minetest.register_craft({
output = doora .. " 2",
output = closed .. " 2",
recipe = {
{"scifi_nodes:white2", base_ingredient, "scifi_nodes:white2"},
{"scifi_nodes:black", base_ingredient, "scifi_nodes:black"}
@ -80,12 +86,12 @@ function onplace(itemstack, placer, pointed_thing)
pt3.z = pt3.z-1
p4 = 1
end
if minetest.get_node(pt3).name == doora then
minetest.set_node(pt, {name=doora, param2=p4})
minetest.set_node(pt2, {name=doorb, param2=p4})
if minetest.get_node(pt3).name == closed then
minetest.set_node(pt, {name=closed, param2=p4})
minetest.set_node(pt2, {name=closed_top, param2=p4})
else
minetest.set_node(pt, {name=doora, param2=p2})
minetest.set_node(pt2, {name=doorb, param2=p2})
minetest.set_node(pt, {name=closed, param2=p2})
minetest.set_node(pt2, {name=closed_top, param2=p2})
end
itemstack:take_item(1)
@ -115,40 +121,40 @@ function rightclick(pos, node, player, itemstack, pointed_thing)
local h = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z+1})
minetest.set_node(pos, {name=doorc, param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name=doord, param2=node.param2})
minetest.set_node(pos, {name=opened, param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name=opened_top, param2=node.param2})
if a.name == doora then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name=doorc, param2=a.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z-1}, {name=doord, param2=a.param2})
if a.name == closed then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name=opened, param2=a.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z-1}, {name=opened_top, param2=a.param2})
end
if b.name == doora then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name=doorc, param2=b.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z+1}, {name=doord, param2=b.param2})
if b.name == closed then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name=opened, param2=b.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z+1}, {name=opened_top, param2=b.param2})
end
if c.name == doora then
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name=doorc, param2=c.param2})
minetest.set_node({x=pos.x+1,y=pos.y+1,z=pos.z}, {name=doord, param2=c.param2})
if c.name == closed then
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name=opened, param2=c.param2})
minetest.set_node({x=pos.x+1,y=pos.y+1,z=pos.z}, {name=opened_top, param2=c.param2})
end
if d.name == doora then
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name=doorc, param2=d.param2})
minetest.set_node({x=pos.x-1,y=pos.y+1,z=pos.z}, {name=doord, param2=d.param2})
if d.name == closed then
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name=opened, param2=d.param2})
minetest.set_node({x=pos.x-1,y=pos.y+1,z=pos.z}, {name=opened_top, param2=d.param2})
end
if e.name == doora then
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z-1}, {name=doorc, param2=e.param2})
minetest.set_node({x=pos.x+1, y=pos.y+1, z=pos.z-1}, {name=doord, param2=e.param2})
if e.name == closed then
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z-1}, {name=opened, param2=e.param2})
minetest.set_node({x=pos.x+1, y=pos.y+1, z=pos.z-1}, {name=opened_top, param2=e.param2})
end
if f.name == doora then
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z-1}, {name=doorc, param2=f.param2})
minetest.set_node({x=pos.x-1, y=pos.y+1, z=pos.z-1}, {name=doord, param2=f.param2})
if f.name == closed then
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z-1}, {name=opened, param2=f.param2})
minetest.set_node({x=pos.x-1, y=pos.y+1, z=pos.z-1}, {name=opened_top, param2=f.param2})
end
if g.name == doora then
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z+1}, {name=doorc, param2=g.param2})
minetest.set_node({x=pos.x+1, y=pos.y+1, z=pos.z+1}, {name=doord, param2=g.param2})
if g.name == closed then
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z+1}, {name=opened, param2=g.param2})
minetest.set_node({x=pos.x+1, y=pos.y+1, z=pos.z+1}, {name=opened_top, param2=g.param2})
end
if h.name == doora then
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z+1}, {name=doorc, param2=h.param2})
minetest.set_node({x=pos.x-1, y=pos.y+1, z=pos.z+1}, {name=doord, param2=h.param2})
if h.name == closed then
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z+1}, {name=opened, param2=h.param2})
minetest.set_node({x=pos.x-1, y=pos.y+1, z=pos.z+1}, {name=opened_top, param2=h.param2})
end
timer:start(3)
@ -156,7 +162,7 @@ function rightclick(pos, node, player, itemstack, pointed_thing)
end
function afterplace(pos, placer, itemstack, pointed_thing)
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name=doord,param2=nodeu.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name=opened_top,param2=nodeu.param2})
end
function ontimer(pos, elapsed)
@ -178,55 +184,55 @@ function ontimer(pos, elapsed)
local h = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z+1})
minetest.set_node(pos, {name=doora, param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name=doorb, param2=node.param2})
minetest.set_node(pos, {name=closed, param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name=closed_top, param2=node.param2})
if a.name == doorc then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name=doora, param2=a.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z-1}, {name=doorb, param2=a.param2})
if a.name == opened then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name=closed, param2=a.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z-1}, {name=closed_top, param2=a.param2})
end
if b.name == doorc then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name=doora, param2=b.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z+1}, {name=doorb, param2=b.param2})
if b.name == opened then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name=closed, param2=b.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z+1}, {name=closed_top, param2=b.param2})
end
if c.name == doorc then
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name=doora, param2=c.param2})
minetest.set_node({x=pos.x+1,y=pos.y+1,z=pos.z}, {name=doorb, param2=c.param2})
if c.name == opened then
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name=closed, param2=c.param2})
minetest.set_node({x=pos.x+1,y=pos.y+1,z=pos.z}, {name=closed_top, param2=c.param2})
end
if d.name == doorc then
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name=doora, param2=d.param2})
minetest.set_node({x=pos.x-1,y=pos.y+1,z=pos.z}, {name=doorb, param2=d.param2})
if d.name == opened then
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name=closed, param2=d.param2})
minetest.set_node({x=pos.x-1,y=pos.y+1,z=pos.z}, {name=closed_top, param2=d.param2})
end
if e.name == doorc then
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z-1}, {name=doora, param2=e.param2})
minetest.set_node({x=pos.x+1, y=pos.y+1, z=pos.z-1}, {name=doorb, param2=e.param2})
if e.name == opened then
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z-1}, {name=closed, param2=e.param2})
minetest.set_node({x=pos.x+1, y=pos.y+1, z=pos.z-1}, {name=closed_top, param2=e.param2})
end
if f.name == doorc then
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z-1}, {name=doora, param2=f.param2})
minetest.set_node({x=pos.x-1, y=pos.y+1, z=pos.z-1}, {name=doorb, param2=f.param2})
if f.name == opened then
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z-1}, {name=closed, param2=f.param2})
minetest.set_node({x=pos.x-1, y=pos.y+1, z=pos.z-1}, {name=closed_top, param2=f.param2})
end
if g.name == doorc then
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z+1}, {name=doora, param2=g.param2})
minetest.set_node({x=pos.x+1, y=pos.y+1, z=pos.z+1}, {name=doorb, param2=g.param2})
if g.name == opened then
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z+1}, {name=closed, param2=g.param2})
minetest.set_node({x=pos.x+1, y=pos.y+1, z=pos.z+1}, {name=closed_top, param2=g.param2})
end
if h.name == doorc then
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z+1}, {name=doora, param2=h.param2})
minetest.set_node({x=pos.x-1, y=pos.y+1, z=pos.z+1}, {name=doorb, param2=h.param2})
if h.name == opened then
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z+1}, {name=closed, param2=h.param2})
minetest.set_node({x=pos.x-1, y=pos.y+1, z=pos.z+1}, {name=closed_top, param2=h.param2})
end
end
minetest.register_node(doora, {
description = des.." Sliding Door",
inventory_image = "scifi_nodes_door"..num.."a_inv.png",
wield_image = "scifi_nodes_door"..num.."a_inv.png",
minetest.register_node(closed, {
description = current_door.base_name.." sliding door",
inventory_image = "scifi_nodes_door_"..base_name.."_inv.png",
wield_image = "scifi_nodes_door_"..base_name.."_inv.png",
tiles = {
"scifi_nodes_door"..num.."a_edge.png",
"scifi_nodes_door"..num.."a_edge.png",
"scifi_nodes_door"..num.."a_edge.png",
"scifi_nodes_door"..num.."a_edge.png",
"scifi_nodes_door"..num.."a_rbottom.png",
"scifi_nodes_door"..num.."a_bottom.png"
"scifi_nodes_door_"..base_name.."_edge.png",
"scifi_nodes_door_"..base_name.."_edge.png",
"scifi_nodes_door_"..base_name.."_edge.png",
"scifi_nodes_door_"..base_name.."_edge.png",
"scifi_nodes_door_"..base_name.."_rbottom.png",
"scifi_nodes_door_"..base_name.."_bottom.png"
},
drawtype = "nodebox",
paramtype = "light",
@ -244,6 +250,18 @@ minetest.register_node(doora, {
{-0.5, -0.5, -0.0625, 0.5, 1.5, 0.0625}
}
},
mesecon = {
effector = {
action_on = function (pos, node)
minetest.sound_play(sound, {
max_hear_distance = 16,
pos = pos,
gain = 1.0
})
end,
rules = mesecon.rules.pplate
},
},
on_place = onplace,
@ -251,14 +269,15 @@ after_destruct = afterdestruct,
on_rightclick = rightclick,
})
minetest.register_node(doorb, {
minetest.register_node(closed_top, {
tiles = {
"scifi_nodes_door"..num.."a_edge.png",
"scifi_nodes_door"..num.."a_edge.png",
"scifi_nodes_door"..num.."a_edge.png",
"scifi_nodes_door"..num.."a_edge.png",
"scifi_nodes_door"..num.."a_rtop.png",
"scifi_nodes_door"..num.."a_top.png"
"scifi_nodes_door_"..base_name.."_edge.png",
"scifi_nodes_door_"..base_name.."_edge.png",
"scifi_nodes_door_"..base_name.."_edge.png",
"scifi_nodes_door_"..base_name.."_edge.png",
"scifi_nodes_door_"..base_name.."_rtop.png",
"scifi_nodes_door_"..base_name.."_top.png"
},
drawtype = "nodebox",
paramtype = "light",
@ -277,19 +296,20 @@ minetest.register_node(doorb, {
}
},
})
minetest.register_node(doorc, {
minetest.register_node(opened, {
tiles = {
"scifi_nodes_door"..num.."a_edge.png",
"scifi_nodes_door"..num.."a_edge.png",
"scifi_nodes_door"..num.."a_edge.png",
"scifi_nodes_door"..num.."a_edge.png",
"scifi_nodes_door"..num.."a_rbottom0.png",
"scifi_nodes_door"..num.."a_bottom0.png"
"scifi_nodes_door_"..base_name.."_edge.png",
"scifi_nodes_door_"..base_name.."_edge.png",
"scifi_nodes_door_"..base_name.."_edge.png",
"scifi_nodes_door_"..base_name.."_edge.png",
"scifi_nodes_door_"..base_name.."_rbottom0.png",
"scifi_nodes_door_"..base_name.."_bottom0.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
drop = doora,
drop = closed,
groups = {cracky = 1},
node_box = {
type = "fixed",
@ -307,14 +327,15 @@ after_place_node = afterplace,
after_destruct = afterdestruct,
on_timer = ontimer,
})
minetest.register_node(doord, {
minetest.register_node(opened_top, {
tiles = {
"scifi_nodes_door"..num.."a_edge.png",
"scifi_nodes_door"..num.."a_edge.png",
"scifi_nodes_door"..num.."a_edge.png",
"scifi_nodes_door"..num.."a_edge.png",
"scifi_nodes_door"..num.."a_rtopo.png",
"scifi_nodes_door"..num.."a_topo.png"
"scifi_nodes_door_"..base_name.."_edge.png",
"scifi_nodes_door_"..base_name.."_edge.png",
"scifi_nodes_door_"..base_name.."_edge.png",
"scifi_nodes_door_"..base_name.."_edge.png",
"scifi_nodes_door_"..base_name.."_rtopo.png",
"scifi_nodes_door_"..base_name.."_topo.png"
},
drawtype = "nodebox",
paramtype = "light",

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

View File

Before

Width:  |  Height:  |  Size: 754 B

After

Width:  |  Height:  |  Size: 754 B

View File

Before

Width:  |  Height:  |  Size: 314 B

After

Width:  |  Height:  |  Size: 314 B

View File

Before

Width:  |  Height:  |  Size: 91 B

After

Width:  |  Height:  |  Size: 91 B

View File

Before

Width:  |  Height:  |  Size: 502 B

After

Width:  |  Height:  |  Size: 502 B

View File

Before

Width:  |  Height:  |  Size: 780 B

After

Width:  |  Height:  |  Size: 780 B

View File

Before

Width:  |  Height:  |  Size: 308 B

After

Width:  |  Height:  |  Size: 308 B

View File

Before

Width:  |  Height:  |  Size: 637 B

After

Width:  |  Height:  |  Size: 637 B

View File

Before

Width:  |  Height:  |  Size: 270 B

After

Width:  |  Height:  |  Size: 270 B

View File

Before

Width:  |  Height:  |  Size: 691 B

After

Width:  |  Height:  |  Size: 691 B

View File

Before

Width:  |  Height:  |  Size: 275 B

After

Width:  |  Height:  |  Size: 275 B

View File

Before

Width:  |  Height:  |  Size: 324 B

After

Width:  |  Height:  |  Size: 324 B

View File

Before

Width:  |  Height:  |  Size: 188 B

After

Width:  |  Height:  |  Size: 188 B

View File

Before

Width:  |  Height:  |  Size: 70 B

After

Width:  |  Height:  |  Size: 70 B

View File

Before

Width:  |  Height:  |  Size: 347 B

After

Width:  |  Height:  |  Size: 347 B

View File

Before

Width:  |  Height:  |  Size: 351 B

After

Width:  |  Height:  |  Size: 351 B

View File

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 212 B

View File

Before

Width:  |  Height:  |  Size: 401 B

After

Width:  |  Height:  |  Size: 401 B

View File

Before

Width:  |  Height:  |  Size: 269 B

After

Width:  |  Height:  |  Size: 269 B

View File

Before

Width:  |  Height:  |  Size: 385 B

After

Width:  |  Height:  |  Size: 385 B

View File

Before

Width:  |  Height:  |  Size: 250 B

After

Width:  |  Height:  |  Size: 250 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

View File

Before

Width:  |  Height:  |  Size: 382 B

After

Width:  |  Height:  |  Size: 382 B

View File

Before

Width:  |  Height:  |  Size: 187 B

After

Width:  |  Height:  |  Size: 187 B

View File

Before

Width:  |  Height:  |  Size: 91 B

After

Width:  |  Height:  |  Size: 91 B

View File

Before

Width:  |  Height:  |  Size: 299 B

After

Width:  |  Height:  |  Size: 299 B

View File

Before

Width:  |  Height:  |  Size: 373 B

After

Width:  |  Height:  |  Size: 373 B

View File

Before

Width:  |  Height:  |  Size: 194 B

After

Width:  |  Height:  |  Size: 194 B

View File

Before

Width:  |  Height:  |  Size: 367 B

After

Width:  |  Height:  |  Size: 367 B

View File

Before

Width:  |  Height:  |  Size: 159 B

After

Width:  |  Height:  |  Size: 159 B

View File

Before

Width:  |  Height:  |  Size: 351 B

After

Width:  |  Height:  |  Size: 351 B

View File

Before

Width:  |  Height:  |  Size: 161 B

After

Width:  |  Height:  |  Size: 161 B

View File

Before

Width:  |  Height:  |  Size: 204 B

After

Width:  |  Height:  |  Size: 204 B

View File

Before

Width:  |  Height:  |  Size: 138 B

After

Width:  |  Height:  |  Size: 138 B

View File

Before

Width:  |  Height:  |  Size: 70 B

After

Width:  |  Height:  |  Size: 70 B

View File

Before

Width:  |  Height:  |  Size: 214 B

After

Width:  |  Height:  |  Size: 214 B

View File

Before

Width:  |  Height:  |  Size: 218 B

After

Width:  |  Height:  |  Size: 218 B

View File

Before

Width:  |  Height:  |  Size: 166 B

After

Width:  |  Height:  |  Size: 166 B

View File

Before

Width:  |  Height:  |  Size: 258 B

After

Width:  |  Height:  |  Size: 258 B

View File

Before

Width:  |  Height:  |  Size: 164 B

After

Width:  |  Height:  |  Size: 164 B

View File

Before

Width:  |  Height:  |  Size: 221 B

After

Width:  |  Height:  |  Size: 221 B

View File

Before

Width:  |  Height:  |  Size: 145 B

After

Width:  |  Height:  |  Size: 145 B