1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2025-07-22 15:20:22 +02:00

namespace plasmascreen and inbox (#22)

This commit is contained in:
wsor4035
2022-02-14 17:54:32 -05:00
committed by GitHub
parent 769e14fd11
commit 694bfe5fe7
37 changed files with 43 additions and 38 deletions

View File

@ -0,0 +1,19 @@
unused_args = false
allow_defined_top = true
max_comment_line_length = 999
read_globals = {
"DIR_DELIM",
"minetest", "core",
"unpack",
"dump",
table = { fields = { "copy", "getn" } },
"vector", "nodeupdate",
"VoxelManip", "VoxelArea",
"PseudoRandom", "ItemStack",
"screwdriver", "homedecor",
}
globals = {
}

View File

@ -0,0 +1,14 @@
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.

View File

@ -0,0 +1,190 @@
local S = minetest.get_translator("plasmascreen")
local sc_disallow = minetest.get_modpath("screwdriver") and screwdriver.disallow or nil
homedecor.register("tv_stand", {
description = S("Plasma Screen TV Stand"),
tiles = {"homedecor_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},
})
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
homedecor.register("tv", {
description = S("Plasma TV"),
drawtype = "mesh",
mesh = "homedecor_plasmascreen_tv.obj",
tiles = {
"homedecor_plasmascreen_case.png",
{ name="homedecor_plasmascreen_video.png",
animation={
type="vertical_frames",
aspect_w = 42,
aspect_h = 23,
length = 44
}
}
},
inventory_image = "homedecor_plasmascreen_tv_inv.png",
wield_image = "homedecor_plasmascreen_tv_inv.png",
paramtype = "light",
paramtype2 = "facedir",
light_source = 10,
selection_box = tv_cbox,
collision_box = tv_cbox,
on_rotate = sc_disallow or nil,
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_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
minetest.set_node(pos, {name = "homedecor:tv_off", param2 = node.param2})
end
})
homedecor.register("tv_off", {
description = S("Plasma TV (off)"),
drawtype = "mesh",
mesh = "homedecor_plasmascreen_tv.obj",
tiles = {
"homedecor_plasmascreen_case_off.png",
"homedecor_plasmascreen_screen_off.png",
},
inventory_image = "homedecor_plasmascreen_tv_inv.png",
wield_image = "homedecor_plasmascreen_tv_inv.png",
paramtype = "light",
paramtype2 = "facedir",
light_source = 10,
selection_box = tv_cbox,
collision_box = tv_cbox,
on_rotate = sc_disallow or nil,
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_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
minetest.set_node(pos, {name = "homedecor:tv", param2 = node.param2})
end,
drop = "homedecor:tv"
})
-- crafting recipes
minetest.register_craft({
output = "homedecor: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 = "homedecor:tv",
recipe = {'homedecor:television', 'homedecor:television'},
})
minetest.register_craft({
output = "homedecor:tv_stand",
recipe = {
{'', '', ''},
{'', 'default:steel_ingot', ''},
{'group:stick', 'default:coal_lump', 'group:stick'},
}
})
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:screen6", "air")
minetest.register_alias("plasmascreen:screen5", "homedecor:tv")
minetest.register_alias("plasmascreen:stand", "homedecor:tv_stand")
minetest.register_alias("plasmascreen:tv", "homedecor:tv")
minetest.register_alias("plasmascreen:tv_off", "homedecor:tv_off")

View File

@ -0,0 +1,8 @@
# textdomain: plasmascreen
### init.lua ###
Plasma Screen TV Stand=Plasmafernseherbildschirmständer
Plasma TV=Plasmafernseher
Plasma TV (off)=Plasmafernseher (aus)

View File

@ -0,0 +1,8 @@
# textdomain: plasmascreen
### init.lua ###
Plasma Screen TV Stand=Mesa para televisión de pantalla de plasma
Plasma TV=Televisión de plasma
Plasma TV (off)=Televisión de plasma (apagada)

View File

@ -0,0 +1,8 @@
# textdomain: plasmascreen
### init.lua ###
Plasma Screen TV Stand=Télévision sur pied
Plasma TV=Écran TV géant
Plasma TV (off)=Écran TV géant (éteint)

View File

@ -0,0 +1,8 @@
# textdomain: plasmascreen
### init.lua ###
Plasma Screen TV Stand=Kaki TV Plasma
Plasma TV=TV Plasma
Plasma TV (off)=TV Plasma (tutup)

View File

@ -0,0 +1,8 @@
# textdomain: plasmascreen
### init.lua ###
Plasma Screen TV Stand=Suporte de TV de Plasma
Plasma TV=TV de Plasma
Plasma TV (off)=TV de Plasma (desligada)

View File

@ -0,0 +1,8 @@
# textdomain: plasmascreen
### init.lua ###
Plasma Screen TV Stand=Suporte de TV de Plasma
Plasma TV=TV de Plasma
Plasma TV (off)=TV de Plasma (desligada)

View File

@ -0,0 +1,8 @@
# textdomain: plasmascreen
### init.lua ###
Plasma Screen TV Stand=Подставка для плазменного телевизора
Plasma TV=Плазменный телевизор
Plasma TV (off)=Плазменный телевизор (выключен)

View File

@ -0,0 +1,8 @@
# textdomain: plasmascreen
### init.lua ###
Plasma Screen TV Stand=液晶电视架
Plasma TV=液晶电视
Plasma TV (off)=液晶电视(关闭)

View File

@ -0,0 +1,8 @@
# textdomain: plasmascreen
### init.lua ###
Plasma Screen TV Stand=
Plasma TV=
Plasma TV (off)=

View File

@ -0,0 +1,3 @@
name = homedecor_plasmascreen
depends = default, homedecor_common, homedecor_electronics
optional_depends = screwdriver

View File

@ -0,0 +1,132 @@
v -1.5 -0.312 0.5
v -1.5 -0.312 0.375
v 1.5 -0.312 0.375
v 1.5 -0.312 0.5
v -1.5 1.5 0.5
v -1.5 1.5 0.375
v 1.5 1.5 0.375
v 1.5 1.5 0.5
v -1.312 -0.125 0.438
v 1.375 1.375 0.375
v -1.312 1.313 0.438
v 1.375 -0.187 0.375
v -1.375 1.375 0.375
v 1.313 -0.125 0.438
v -1.375 -0.187 0.375
v 1.313 1.313 0.438
v 1.5 1.375 0.375
v 1.5 -0.187 0.375
v -1.5 1.375 0.375
v -1.5 -0.187 0.375
v -1.312 -0.187 0.375
v -1.312 1.375 0.375
v 1.313 -0.187 0.375
v 1.313 1.375 0.375
v -1.375 -0.125 0.375
v -1.375 1.313 0.375
v 1.375 -0.125 0.375
v 1.375 1.313 0.375
v -1.313 -0.125 0.438
v -1.313 1.313 0.438
v 1.313 -0.125 0.438
v 1.313 1.313 0.438
vt 0.953 0.984
vt 0.922 0.984
vt 0.922 0.531
vt 0.953 0.531
vt 0.906 0.984
vt 0.875 0.984
vt 0.875 0.531
vt 0.906 0.531
vt 0.813 0.984
vt 0.781 0.984
vt 0.781 0.594
vt 0.813 0.594
vt 0.016 0.953
vt 0.766 0.953
vt 0.766 0.984
vt 0.016 0.984
vt 0.016 0.813
vt 0.766 0.813
vt 0.766 0.844
vt 0.016 0.844
vt 0.766 0.797
vt 0.016 0.797
vt 0.016 0.344
vt 0.766 0.344
vt 0.828 0.594
vt 0.859 0.594
vt 0.859 0.984
vt 0.828 0.984
vt 0.016 0.891
vt 0.016 0.859
vt 0.766 0.859
vt 0.766 0.891
vt 0.016 0.938
vt 0.016 0.906
vt 0.766 0.906
vt 0.766 0.938
vt 0.031 0.297
vt 0.031 0.281
vt 0.688 0.281
vt 0.688 0.297
vt 0.688 0.313
vt 0.688 0.328
vt 0.031 0.328
vt 0.031 0.313
vt 0.375 0.25
vt 0.375 0.266
vt 0.016 0.266
vt 0.016 0.25
vt 0.703 0.297
vt 0.703 0.281
vt 0.016 0.234
vt 0.016 0.219
vt 0.375 0.219
vt 0.375 0.234
vt 0.703 0.328
vt 0.703 0.313
vt 0.016 0.328
vt 0.016 0.313
vt 0.016 0.281
vt 0.016 0.297
vt 1 1
vt 0 1
vt 0 0
vt 1 0
vn -1 0 0
vn 1 0 0
vn 0 0 -1
vn 0 1 0
vn 0 -1 0
vn 0 0 1
vn 0 0.707 -0.707
vn 0 -0.707 -0.707
vn -0.707 0 -0.707
vn 0.707 0 -0.707
vn 0 -0.707 0.707
g 1
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 2
f 30/61/3 32/62/3 31/63/3 29/64/3

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB