diff --git a/README.md b/README.md index 5791805..1e7231a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# Digimons - Digilines Monitors -Digilines monitors mod for Minetest using Display API / Font API. +# Digiterms - Digilines Terminals +Digilines monitors and keyboards mod for Minetest using Display API / Font API. **Version**: Alpha diff --git a/functions.lua b/functions.lua index ffeb778..0fcfd26 100644 --- a/functions.lua +++ b/functions.lua @@ -1,8 +1,8 @@ --[[ - digimons mod for Minetest - Digiline monitors using Display API / Font API + digiterms mod for Minetest - Digiline monitors using Display API / Font API (c) Pierre-Yves Rollo - This file is part of digimons. + This file is part of digiterms. signs is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ along with signs. If not, see . --]] -digimons.columns = 30 +digiterms.columns = 30 local function get_lines(pos) local lines = {} @@ -73,9 +73,9 @@ local function push_text(lines, text, maxlines, maxcolumns) end end -function digimons.push_text_on_screen(pos, text) +function digiterms.push_text_on_screen(pos, text) local lines = get_lines(pos) - push_text(lines, text, 6, 20) + push_text(lines, text, 6, digiterms.columns) set_lines(pos, lines) display_api.update_entities(pos) end diff --git a/init.lua b/init.lua index 4a408ab..1d16ddc 100644 --- a/init.lua +++ b/init.lua @@ -1,8 +1,8 @@ --[[ - digimons mod for Minetest - Digiline monitors using Display API / Font API + digiterms mod for Minetest - Digiline monitors using Display API / Font API (c) Pierre-Yves Rollo - This file is part of digimons. + This file is part of digiterms. signs is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,13 +18,14 @@ along with signs. If not, see . --]] -digimons = {} -digimons.name = minetest.get_current_modname() -digimons.path = minetest.get_modpath(digimons.name) +digiterms = {} +digiterms.name = minetest.get_current_modname() +digiterms.path = minetest.get_modpath(digiterms.name) +digiterms.font = "mozart" -dofile(digimons.path.."/font_mozart.lua") -dofile(digimons.path.."/functions.lua") -dofile(digimons.path.."/nodes.lua") ---dofile(digimons.path.."/crafts.lua") +dofile(digiterms.path.."/font_mozart.lua") +dofile(digiterms.path.."/functions.lua") +dofile(digiterms.path.."/nodes.lua") +--dofile(digiterms.path.."/crafts.lua") -display_api.register_display_entity("digimons:screen") +display_api.register_display_entity("digiterms:screen") diff --git a/nodes.lua b/nodes.lua index 059a67c..08793c1 100644 --- a/nodes.lua +++ b/nodes.lua @@ -1,86 +1,138 @@ --[[ - digimons mod for Minetest - Digiline monitors using Display API / Font API - (c) Pierre-Yves Rollo + digiterms mod for Minetest - Digilines monitors using Display API / Font API + (c) Pierre-Yves Rollo - This file is part of digimons. + This file is part of digiterms. - signs is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + signs is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - signs is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + signs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with signs. If not, see . + You should have received a copy of the GNU General Public License + along with signs. If not, see . --]] -minetest.register_node('digimons:cathodic_amber_monitor', { - description = "Cathodic amber monitor", - sunlight_propagates = false, - paramtype = "light", - paramtype2 = "facedir", - tiles = { "digimons_amber_top.png", "digimons_amber_bottom.png", - "digimons_amber_sides.png", "digimons_amber_sides.png^[transformFX]", - "digimons_amber_back.png", "digimons_amber_front.png",}, - drawtype = "nodebox", - groups = {choppy = 1, oddly_breakable_by_hand = 1, display_modpack_node = 1}, - node_box = { - type = "fixed", - fixed = { - {-8/16, 8/16, -8/16, 8/16, 7/16, -7/16}, - {-8/16, -8/16, -8/16, 8/16, -5/16, -7/16}, - {-8/16, 7/16, -8/16, -7/16, -5/16, -7/16}, - {7/16, 7/16, -8/16, 8/16, -5/16, -7/16}, - {-8/16, -8/16, -7/16, 8/16, 8/16, 1/16}, - {-6/16, 5/16, 1/16, 6/16, -8/16, 8/16} - }, - }, - display_entities = { - ["digimons:screen"] = { - on_display_update = font_api.on_display_update, - depth = -7/16 - display_api.entity_spacing, - top = -1/16, - aspect_ratio = 0.5, maxlines = 6, - size = { x = 23/32, y = 10/16 }, - color = "#FFA000", font_name = "mozart", halign="left", valing="top", - }, - }, - on_place = function(itemstack, placer, pointed_thing) - minetest.rotate_node(itemstack, placer, pointed_thing) - return display_api.on_place(itemstack, placer, pointed_thing) - end, - on_construct = function(pos) - minetest.get_meta(pos):set_string("formspec", - "field[channel;Channel;${channel}]") - display_api.on_construct(pos) - end, - on_destruct = display_api.on_destruct, - on_rotate = display_api.on_rotate, - on_receive_fields = function(pos, formname, fields, player) - local name = player:get_player_name() - if minetest.is_protected(pos, name) then - minetest.record_protection_violation(pos, name) - return - end +local common_node_def = { + groups = { display_api = 1}, + on_place = function(itemstack, placer, pointed_thing) + minetest.rotate_node(itemstack, placer, pointed_thing) + return display_api.on_place(itemstack, placer, pointed_thing) + end, + on_destruct = display_api.on_destruct, + on_rotate = display_api.on_rotate, + on_punch = display_api.update_entities, + on_construct = function(pos) + minetest.get_meta(pos):set_string("formspec", + "field[channel;Channel;${channel}]") + display_api.on_construct(pos) + end, + on_receive_fields = function(pos, formname, fields, player) + local name = player:get_player_name() + if minetest.is_protected(pos, name) then + minetest.record_protection_violation(pos, name) + return + end - if (fields.channel) then - minetest.get_meta(pos):set_string("channel", fields.channel) - end - end, - on_punch = display_api.update_entities, - digiline = { - receptor = {}, - effector = { - action = function(pos, _, channel, msg) - if channel ~= minetest.get_meta(pos):get_string("channel") then - return - end - digimons.push_text_on_screen(pos, msg) - end, - }, - }, + if (fields.channel) then + minetest.get_meta(pos):set_string("channel", fields.channel) + end + end, + digiline = { + receptor = {}, + effector = { + action = function(pos, _, channel, msg) + if channel ~= minetest.get_meta(pos):get_string("channel") then + return + end + digiterms.push_text_on_screen(pos, msg) + end, + }, + }, +} + +function digiterms.register_monitor(nodename, nodedef) + def = table.copy(common_node_def) + for key, value in pairs(nodedef) do + if key == 'groups' then + def[key] = def[key] or {} + for key2, value2 in pairs(value) do + def[key][key2] = value2 + end + else + def[key] = value + end + end + minetest.register_node(nodename, def) +end + +digiterms.register_monitor('digiterms:cathodic_amber_monitor', { + description = "Cathodic amber monitor", + sunlight_propagates = false, + paramtype = "light", + paramtype2 = "facedir", + tiles = { "digiterms_amber_top.png", "digiterms_amber_bottom.png", + "digiterms_amber_sides.png", "digiterms_amber_sides.png^[transformFX]", + "digiterms_amber_back.png", "digiterms_amber_front.png",}, + drawtype = "nodebox", + groups = {choppy = 1, oddly_breakable_by_hand = 1}, + node_box = { + type = "fixed", + fixed = { + {-8/16, 8/16, -8/16, 8/16, 7/16, -7/16}, + {-8/16, -8/16, -8/16, 8/16, -5/16, -7/16}, + {-8/16, 7/16, -8/16, -7/16, -5/16, -7/16}, + {7/16, 7/16, -8/16, 8/16, -5/16, -7/16}, + {-8/16, -8/16, -7/16, 8/16, 8/16, 1/16}, + {-6/16, 5/16, 1/16, 6/16, -8/16, 8/16} + }, + }, + display_entities = { + ["digiterms:screen"] = { + on_display_update = font_api.on_display_update, + depth = -7/16 - display_api.entity_spacing, + top = -1/16, + size = { x = 23/32, y = 10/16 }, + columns = 20, lines = 6, + color = "#FFA000", font_name = digiterms.font, halign="left", valing="top", + }, + }, +}) + +digiterms.register_monitor('digiterms:cathodic_green_monitor', { + description = "Cathodic green monitor", + sunlight_propagates = false, + paramtype = "light", + paramtype2 = "facedir", + tiles = { "digiterms_green_top.png", "digiterms_green_bottom.png", + "digiterms_green_sides.png", "digiterms_green_sides.png^[transformFX]", + "digiterms_green_back.png", "digiterms_green_front.png",}, + drawtype = "nodebox", + groups = {choppy = 1, oddly_breakable_by_hand = 1}, + node_box = { + type = "fixed", + fixed = { + {-8/16, 8/16, -8/16, 8/16, 7/16, -7/16}, + {-8/16, -8/16, -8/16, 8/16, -5/16, -7/16}, + {-8/16, 7/16, -8/16, -7/16, -5/16, -7/16}, + {7/16, 7/16, -8/16, 8/16, -5/16, -7/16}, + {-8/16, -8/16, -7/16, 8/16, 8/16, 1/16}, + {-6/16, 5/16, 1/16, 6/16, -8/16, 8/16} + }, + }, + display_entities = { + ["digiterms:screen"] = { + on_display_update = font_api.on_display_update, + depth = -7/16 - display_api.entity_spacing, + top = -1/16, + size = { x = 23/32, y = 10/16 }, + columns = 20, lines = 6, + color = "#00FF00", font_name = digiterms.font, halign="left", valing="top", + }, + }, }) diff --git a/svg/Nouveau document 2.2018_12_02_13_19_29.0.svg b/svg/cathodic_monitors.svg similarity index 53% rename from svg/Nouveau document 2.2018_12_02_13_19_29.0.svg rename to svg/cathodic_monitors.svg index 3bf5bff..4bb4634 100644 --- a/svg/Nouveau document 2.2018_12_02_13_19_29.0.svg +++ b/svg/cathodic_monitors.svg @@ -15,7 +15,7 @@ viewBox="0 0 16 16" version="1.1" id="SVGRoot" - sodipodi:docname="Nouveau document 2.2018_12_02_13_19_29.0.svg" + sodipodi:docname="cathodic_monitors.svg" inkscape:version="0.92.3 (2405546, 2018-03-11)" inkscape:export-filename="/home/pyrollo/dev/minetest-mods/digimons/textures/digimons_amber_front.png" inkscape:export-xdpi="96" @@ -28,16 +28,16 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="16" - inkscape:cx="16.839668" - inkscape:cy="12.551387" + inkscape:cx="16.902168" + inkscape:cy="1.1659253" inkscape:document-units="px" inkscape:current-layer="g1617" showgrid="true" - inkscape:window-width="2172" - inkscape:window-height="902" - inkscape:window-x="69" - inkscape:window-y="432" - inkscape:window-maximized="0" + inkscape:window-width="2560" + inkscape:window-height="1376" + inkscape:window-x="0" + inkscape:window-y="27" + inkscape:window-maximized="1" inkscape:grid-bbox="true"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -230,7 +410,7 @@ image/svg+xml - + @@ -251,7 +431,7 @@ inkscape:export-xdpi="96" inkscape:export-ydpi="96" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/textures/digimons_amber_back.png b/textures/digimons_amber_back.png deleted file mode 100644 index 80524e3..0000000 Binary files a/textures/digimons_amber_back.png and /dev/null differ diff --git a/textures/digimons_amber_bottom.png b/textures/digimons_amber_bottom.png deleted file mode 100644 index b989dcf..0000000 Binary files a/textures/digimons_amber_bottom.png and /dev/null differ diff --git a/textures/digimons_amber_front.png b/textures/digimons_amber_front.png deleted file mode 100644 index 3a7f993..0000000 Binary files a/textures/digimons_amber_front.png and /dev/null differ diff --git a/textures/digimons_amber_sides.png b/textures/digimons_amber_sides.png deleted file mode 100644 index a883b03..0000000 Binary files a/textures/digimons_amber_sides.png and /dev/null differ diff --git a/textures/digimons_amber_top.png b/textures/digimons_amber_top.png deleted file mode 100644 index 943b607..0000000 Binary files a/textures/digimons_amber_top.png and /dev/null differ diff --git a/textures/digiterms_amber_back.png b/textures/digiterms_amber_back.png new file mode 100644 index 0000000..07fb8b6 Binary files /dev/null and b/textures/digiterms_amber_back.png differ diff --git a/textures/digiterms_amber_bottom.png b/textures/digiterms_amber_bottom.png new file mode 100644 index 0000000..91ab899 Binary files /dev/null and b/textures/digiterms_amber_bottom.png differ diff --git a/textures/digiterms_amber_front.png b/textures/digiterms_amber_front.png new file mode 100644 index 0000000..ad523c5 Binary files /dev/null and b/textures/digiterms_amber_front.png differ diff --git a/textures/digiterms_amber_front_off.png b/textures/digiterms_amber_front_off.png new file mode 100644 index 0000000..bbc3771 Binary files /dev/null and b/textures/digiterms_amber_front_off.png differ diff --git a/textures/digiterms_amber_sides.png b/textures/digiterms_amber_sides.png new file mode 100644 index 0000000..ec70f6c Binary files /dev/null and b/textures/digiterms_amber_sides.png differ diff --git a/textures/digiterms_amber_top.png b/textures/digiterms_amber_top.png new file mode 100644 index 0000000..79b3f29 Binary files /dev/null and b/textures/digiterms_amber_top.png differ diff --git a/textures/digiterms_green_back.png b/textures/digiterms_green_back.png new file mode 100644 index 0000000..974f9a2 Binary files /dev/null and b/textures/digiterms_green_back.png differ diff --git a/textures/digiterms_green_bottom.png b/textures/digiterms_green_bottom.png new file mode 100644 index 0000000..924250f Binary files /dev/null and b/textures/digiterms_green_bottom.png differ diff --git a/textures/digiterms_green_front.png b/textures/digiterms_green_front.png new file mode 100644 index 0000000..e9429d5 Binary files /dev/null and b/textures/digiterms_green_front.png differ diff --git a/textures/digiterms_green_front_off.png b/textures/digiterms_green_front_off.png new file mode 100644 index 0000000..063aa4b Binary files /dev/null and b/textures/digiterms_green_front_off.png differ diff --git a/textures/digiterms_green_sides.png b/textures/digiterms_green_sides.png new file mode 100644 index 0000000..04632ff Binary files /dev/null and b/textures/digiterms_green_sides.png differ diff --git a/textures/digiterms_green_top.png b/textures/digiterms_green_top.png new file mode 100644 index 0000000..59777e8 Binary files /dev/null and b/textures/digiterms_green_top.png differ