diff options
Diffstat (limited to 'plasmascreen')
-rw-r--r-- | plasmascreen/README.md | 16 | ||||
-rw-r--r-- | plasmascreen/depends.txt | 1 | ||||
-rw-r--r-- | plasmascreen/init.lua | 185 | ||||
-rw-r--r-- | plasmascreen/models/plasmascreen_tv.obj | 135 | ||||
-rw-r--r-- | plasmascreen/textures/plasmascreen_back.png | bin | 0 -> 232 bytes | |||
-rw-r--r-- | plasmascreen/textures/plasmascreen_case.png | bin | 0 -> 1118 bytes | |||
-rw-r--r-- | plasmascreen/textures/plasmascreen_case_off.png | bin | 0 -> 1118 bytes | |||
-rw-r--r-- | plasmascreen/textures/plasmascreen_screen_off.png | bin | 0 -> 324 bytes | |||
-rw-r--r-- | plasmascreen/textures/plasmascreen_tv_inv.png | bin | 0 -> 192 bytes | |||
-rw-r--r-- | plasmascreen/textures/plasmascreen_video.png | bin | 0 -> 21672 bytes |
10 files changed, 337 insertions, 0 deletions
diff --git a/plasmascreen/README.md b/plasmascreen/README.md new file mode 100644 index 0000000..4f33864 --- /dev/null +++ b/plasmascreen/README.md @@ -0,0 +1,16 @@ +PLASMASCREEN +============ + +Mod adding a plasma screen TV for Minetest. + +This mod adds a 2x3 plasma screen TV using a single large mesh node. + +Point at the bottom center position where you want the TV to go, when placing. + +Note: If you're at a really steep view angle when trying to place a screen, +the mod may occasionally refuse to place it (or it just appears for a moment). +Just move over a bit, so that your target position is more directly in front +of you. + +Code, textures and model are WTFPL. + diff --git a/plasmascreen/depends.txt b/plasmascreen/depends.txt new file mode 100644 index 0000000..331d858 --- /dev/null +++ b/plasmascreen/depends.txt @@ -0,0 +1 @@ +default
\ No newline at end of file diff --git a/plasmascreen/init.lua b/plasmascreen/init.lua new file mode 100644 index 0000000..839fa1f --- /dev/null +++ b/plasmascreen/init.lua @@ -0,0 +1,185 @@ +screwdriver = screwdriver or {} + +minetest.register_node("plasmascreen:stand", { + description = "Plasma Screen TV Stand", + tiles = {"plasmascreen_back.png"}, + paramtype = "light", + paramtype2 = "facedir", + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {0.5000,-0.5000,0.0625,-0.5000,-0.4375,-0.5000}, --NodeBox 1 + {-0.1875,-0.5000,-0.3750,0.1875,0.1250,-0.1250}, --NodeBox 2 + {-0.5000,-0.2500,-0.5000,0.5000,0.5000,-0.3750}, --NodeBox 3 + {-0.3750,-0.1875,-0.3750,0.3750,0.3125,-0.2500}, --NodeBox 4 + } + }, + selection_box = { + type = "fixed", + fixed = { + {-0.5000, -0.5000, -0.5000, 0.5000, 0.5000, 0.0000}, + } + }, + groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2}, +}) + +minetest.register_alias("plasmascreen:screen1", "air") +minetest.register_alias("plasmascreen:screen2", "air") +minetest.register_alias("plasmascreen:screen3", "air") +minetest.register_alias("plasmascreen:screen4", "air") +minetest.register_alias("plasmascreen:screen5", "plasmascreen:tv") +minetest.register_alias("plasmascreen:screen6", "air") + +local fdir_to_left = { + { -1, 0 }, + { 0, 1 }, + { 1, 0 }, + { 0, -1 }, +} + +local fdir_to_right = { + { 1, 0 }, + { 0, -1 }, + { -1, 0 }, + { 0, 1 }, +} + +local tv_cbox = { + type = "fixed", + fixed = {-1.5050, -0.3125, 0.3700, 1.5050, 1.5050, 0.5050} +} + +local function checkwall(pos) + + local fdir = minetest.get_node(pos).param2 + + local dxl = fdir_to_left[fdir + 1][1] -- dxl = "[D]elta [X] [L]eft" + local dzl = fdir_to_left[fdir + 1][2] -- Z left + + local dxr = fdir_to_right[fdir + 1][1] -- X right + local dzr = fdir_to_right[fdir + 1][2] -- Z right + + local node1 = minetest.get_node({x=pos.x+dxl, y=pos.y, z=pos.z+dzl}) + if not node1 or not minetest.registered_nodes[node1.name] + or not minetest.registered_nodes[node1.name].buildable_to then + return false + end + + local node2 = minetest.get_node({x=pos.x+dxr, y=pos.y, z=pos.z+dzr}) + if not node2 or not minetest.registered_nodes[node2.name] + or not minetest.registered_nodes[node2.name].buildable_to then + return false + end + + local node3 = minetest.get_node({x=pos.x+dxl, y=pos.y+1, z=pos.z+dzl}) + if not node3 or not minetest.registered_nodes[node3.name] + or not minetest.registered_nodes[node3.name].buildable_to then + return false + end + + local node4 = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}) + if not node4 or not minetest.registered_nodes[node4.name] + or not minetest.registered_nodes[node4.name].buildable_to then + return false + end + + local node5 = minetest.get_node({x=pos.x+dxr, y=pos.y+1, z=pos.z+dzr}) + if not node5 or not minetest.registered_nodes[node5.name] + or not minetest.registered_nodes[node5.name].buildable_to then + return false + end + + return true +end + +minetest.register_node("plasmascreen:tv", { + description = "Plasma TV", + drawtype = "mesh", + mesh = "plasmascreen_tv.obj", + tiles = { + "plasmascreen_case.png", + { name="plasmascreen_video.png", + animation={ + type="vertical_frames", + aspect_w = 42, + aspect_h = 23, + length = 44 + } + } + + }, + inventory_image = "plasmascreen_tv_inv.png", + wield_image = "plasmascreen_tv_inv.png", + paramtype = "light", + paramtype2 = "facedir", + light_source = 10, + selection_box = tv_cbox, + collision_box = tv_cbox, + on_rotate = screwdriver.disallow, + groups = {snappy=1, choppy=2, oddly_breakable_by_hand=2}, + after_place_node = function(pos, placer, itemstack) + if not checkwall(pos) then + minetest.set_node(pos, {name = "air"}) + return true -- "API: If return true no item is taken from itemstack" + end + end, + on_punch = function(pos, node, puncher, pointed_thing) + minetest.set_node(pos, {name = "plasmascreen:tv_off", param2 = node.param2}) + end +}) + +minetest.register_node("plasmascreen:tv_off", { + description = "Plasma TV (off)", + drawtype = "mesh", + mesh = "plasmascreen_tv.obj", + tiles = { + "plasmascreen_case_off.png", + "plasmascreen_screen_off.png", + }, + inventory_image = "plasmascreen_tv_inv.png", + wield_image = "plasmascreen_tv_inv.png", + paramtype = "light", + paramtype2 = "facedir", + light_source = 10, + selection_box = tv_cbox, + collision_box = tv_cbox, + on_rotate = screwdriver.disallow, + groups = {snappy=1, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, + after_place_node = function(pos, placer, itemstack) + if not checkwall(pos) then + minetest.set_node(pos, {name = "air"}) + return true -- "API: If return true no item is taken from itemstack" + end + end, + on_punch = function(pos, node, puncher, pointed_thing) + minetest.set_node(pos, {name = "plasmascreen:tv", param2 = node.param2}) + end, + drop = "plasmascreen:tv" +}) + +-- crafting recipes + +minetest.register_craft({ + output = "plasmascreen:tv", + recipe = { + {'default:glass', 'default:coal_lump', 'default:glass'}, + {'default:steel_ingot', 'default:copper_ingot', 'default:steel_ingot'}, + {'default:glass', 'default:glass', 'default:glass'}, + } +}) + +minetest.register_craft({ + type = "shapeless", + output = "plasmascreen:tv", + recipe = {'homedecor:television', 'homedecor:television'}, +}) + +minetest.register_craft({ + output = "plasmascreen:stand", + recipe = { + {'', '', ''}, + {'', 'default:steel_ingot', ''}, + {'group:stick', 'default:coal_lump', 'group:stick'}, + } +}) diff --git a/plasmascreen/models/plasmascreen_tv.obj b/plasmascreen/models/plasmascreen_tv.obj new file mode 100644 index 0000000..af2df0e --- /dev/null +++ b/plasmascreen/models/plasmascreen_tv.obj @@ -0,0 +1,135 @@ +# Blender v2.73 (sub 0) OBJ File: 'plasmascreen.blend' +# www.blender.org +o Cylinder +v -1.500000 -0.312500 0.500000 +v -1.500000 -0.312500 0.375000 +v 1.500000 -0.312500 0.375000 +v 1.500000 -0.312500 0.500000 +v -1.500000 1.500000 0.500000 +v -1.500000 1.500000 0.375000 +v 1.500000 1.500000 0.375000 +v 1.500000 1.500000 0.500000 +v -1.312500 -0.125000 0.437500 +v 1.375000 1.375000 0.375000 +v -1.312500 1.312500 0.437500 +v 1.375000 -0.187500 0.375000 +v -1.375000 1.375000 0.375000 +v 1.312500 -0.125000 0.437500 +v -1.375000 -0.187500 0.375000 +v 1.312500 1.312500 0.437500 +v 1.500000 1.375000 0.375000 +v 1.500000 -0.187500 0.375000 +v -1.500000 1.375000 0.375000 +v -1.500000 -0.187500 0.375000 +v -1.312500 -0.187500 0.375000 +v -1.312500 1.375000 0.375000 +v 1.312500 -0.187500 0.375000 +v 1.312500 1.375000 0.375000 +v -1.375000 -0.125000 0.375000 +v -1.375000 1.312500 0.375000 +v 1.375000 -0.125000 0.375000 +v 1.375000 1.312500 0.375000 +v -1.312811 -0.125310 0.437500 +v -1.312811 1.312810 0.437500 +v 1.312811 -0.125310 0.437500 +v 1.312811 1.312810 0.437500 +vt 0.953125 0.984375 +vt 0.921875 0.984375 +vt 0.921875 0.531250 +vt 0.953125 0.531250 +vt 0.906250 0.984375 +vt 0.875000 0.984375 +vt 0.875000 0.531250 +vt 0.906250 0.531250 +vt 0.812500 0.984375 +vt 0.781250 0.984375 +vt 0.781250 0.593750 +vt 0.812500 0.593750 +vt 0.015625 0.953125 +vt 0.765625 0.953125 +vt 0.765625 0.984375 +vt 0.015625 0.984375 +vt 0.015625 0.812500 +vt 0.765625 0.812500 +vt 0.765625 0.843750 +vt 0.015625 0.843750 +vt 0.765625 0.796875 +vt 0.015625 0.796875 +vt 0.015625 0.343750 +vt 0.765625 0.343750 +vt 0.828125 0.593750 +vt 0.859375 0.593750 +vt 0.859375 0.984375 +vt 0.828125 0.984375 +vt 0.015625 0.890625 +vt 0.015625 0.859375 +vt 0.765625 0.859375 +vt 0.765625 0.890625 +vt 0.015625 0.937500 +vt 0.015625 0.906250 +vt 0.765625 0.906250 +vt 0.765625 0.937500 +vt 0.031250 0.296875 +vt 0.031250 0.281250 +vt 0.687500 0.281250 +vt 0.687500 0.296875 +vt 0.687500 0.312500 +vt 0.687500 0.328125 +vt 0.031250 0.328125 +vt 0.031250 0.312500 +vt 0.375000 0.250000 +vt 0.375000 0.265625 +vt 0.015625 0.265625 +vt 0.015625 0.250000 +vt 0.703125 0.296875 +vt 0.703125 0.281250 +vt 0.015625 0.234375 +vt 0.015625 0.218750 +vt 0.375000 0.218750 +vt 0.375000 0.234375 +vt 0.703125 0.328125 +vt 0.703125 0.312500 +vt 0.015625 0.328125 +vt 0.015625 0.312500 +vt 0.015625 0.281250 +vt 0.015625 0.296875 +vt 1.000000 1.000000 +vt -0.000000 1.000000 +vt -0.000000 -0.000000 +vt 1.000000 -0.000000 +vn -1.000000 0.000000 0.000000 +vn 1.000000 0.000000 0.000000 +vn 0.000000 0.000000 -1.000000 +vn 0.000000 1.000000 0.000000 +vn 0.000000 -1.000000 0.000000 +vn 0.000000 0.000000 1.000000 +vn 0.000000 0.707100 -0.707100 +vn 0.000000 -0.707100 -0.707100 +vn -0.707100 0.000000 -0.707100 +vn 0.707100 0.000000 -0.707100 +vn 0.000000 -0.707100 0.707100 +g Cylinder_Cylinder_case +s off +f 5/1/1 6/2/1 2/3/1 1/4/1 +f 7/5/2 8/6/2 4/7/2 3/8/2 +f 10/9/3 17/10/3 18/11/3 12/12/3 +f 5/13/4 8/14/4 7/15/4 6/16/4 +f 2/17/5 3/18/5 4/19/5 1/20/5 +f 8/21/6 5/22/6 1/23/6 4/24/6 +f 15/25/3 20/26/3 19/27/3 13/28/3 +f 18/29/3 3/30/3 2/31/3 20/32/3 +f 7/33/3 17/34/3 19/35/3 6/36/3 +f 14/37/7 23/38/7 21/39/7 9/40/7 +f 11/41/8 22/42/8 24/43/8 16/44/8 +f 16/45/9 28/46/9 27/47/9 14/48/9 +f 25/49/10 9/40/10 15/50/10 +f 15/50/7 9/40/7 21/39/7 +f 9/51/10 25/52/10 26/53/10 11/54/10 +f 13/55/10 11/41/10 26/56/10 +f 22/42/8 11/41/8 13/55/8 +f 10/57/8 16/44/8 24/43/8 +f 28/58/9 16/44/9 10/57/9 +f 12/59/9 14/37/9 27/60/9 +f 23/38/11 12/59/11 14/37/11 +g Cylinder_Cylinder_screen +f 30/61/3 32/62/3 31/63/3 29/64/3 diff --git a/plasmascreen/textures/plasmascreen_back.png b/plasmascreen/textures/plasmascreen_back.png Binary files differnew file mode 100644 index 0000000..a9c4375 --- /dev/null +++ b/plasmascreen/textures/plasmascreen_back.png diff --git a/plasmascreen/textures/plasmascreen_case.png b/plasmascreen/textures/plasmascreen_case.png Binary files differnew file mode 100644 index 0000000..4fc269e --- /dev/null +++ b/plasmascreen/textures/plasmascreen_case.png diff --git a/plasmascreen/textures/plasmascreen_case_off.png b/plasmascreen/textures/plasmascreen_case_off.png Binary files differnew file mode 100644 index 0000000..f31329e --- /dev/null +++ b/plasmascreen/textures/plasmascreen_case_off.png diff --git a/plasmascreen/textures/plasmascreen_screen_off.png b/plasmascreen/textures/plasmascreen_screen_off.png Binary files differnew file mode 100644 index 0000000..56cc203 --- /dev/null +++ b/plasmascreen/textures/plasmascreen_screen_off.png diff --git a/plasmascreen/textures/plasmascreen_tv_inv.png b/plasmascreen/textures/plasmascreen_tv_inv.png Binary files differnew file mode 100644 index 0000000..7bd7395 --- /dev/null +++ b/plasmascreen/textures/plasmascreen_tv_inv.png diff --git a/plasmascreen/textures/plasmascreen_video.png b/plasmascreen/textures/plasmascreen_video.png Binary files differnew file mode 100644 index 0000000..d6e6298 --- /dev/null +++ b/plasmascreen/textures/plasmascreen_video.png |