From f6b84a27420fc7c8905350d2a51be9ddea2f2e70 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 14 Nov 2018 19:34:46 +0100 Subject: [PATCH] Add loudspeaker, to toggle music --- README.md | 2 ++ mods/supplemental/depends.txt | 1 + mods/supplemental/init.lua | 32 ++++++++++++++++++ mods/supplemental/locale/de.txt | 2 ++ mods/supplemental/locale/template.txt | 2 ++ .../textures/supplemental_loudspeaker.png | Bin 0 -> 814 bytes 6 files changed, 39 insertions(+) create mode 100644 mods/supplemental/textures/supplemental_loudspeaker.png diff --git a/README.md b/README.md index c1a0883..9a87b8e 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,8 @@ The mod “`castle`” falls under the MIT License (the author allowed me an exc The mod “`arrow_signs`” falls under the CC BY-SA 3.0. The mod “`areas`” falls under the GNU LGPLv2.1 (or later). The mod “`cottages`” falls under the GNU GPLv2 (the author allowed me an exception). +The mod “`supplemental`” falls under the MIT License, with one exception: +The texture `supplemental_loudspeaker.png` falls under the CC BY-SA 3.0 (from the developers of the Mesecons mod). Everything else falls under the MIT License. For even more detailed information (including credits), look for README files in the respective mod directories. diff --git a/mods/supplemental/depends.txt b/mods/supplemental/depends.txt index 9207dab..25ca216 100644 --- a/mods/supplemental/depends.txt +++ b/mods/supplemental/depends.txt @@ -1,2 +1,3 @@ default +mpd intllib? diff --git a/mods/supplemental/init.lua b/mods/supplemental/init.lua index 1a6d594..4ac8daf 100644 --- a/mods/supplemental/init.lua +++ b/mods/supplemental/init.lua @@ -89,6 +89,38 @@ minetest.register_node("supplemental:spikes_large", { damage_per_second = 2 }) +-- TODO: Remove the loudspeaker node when there is a more user-friendly means +-- to control the music. +local set_loudspeaker_infotext = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("infotext", S("loudspeaker (rightclick to toggle music)")) +end + +minetest.register_node("supplemental:loudspeaker", { + description = S("loudspeaker"), + tiles = {"supplemental_loudspeaker.png"}, + groups = { creative_breakable = 1 }, + sounds = default.node_sound_wood_defaults(), + on_construct = set_loudspeaker_infotext, + on_rightclick = function(pos, node, clicker) + if mpd.playing then + mpd.stop_song() + clicker:set_attribute("play_music", "0") + else + mpd.next_song() + clicker:set_attribute("play_music", "1") + end + end, + +}) + +minetest.register_abm({ + nodenames = { "supplemental:loudspeaker" }, + interval = 5, + chance = 1, + action = set_loudspeaker_infotext, +}) + minetest.register_craftitem("supplemental:rock", { description = S("piece of rock"), inventory_image = "supplemental_rock.png", diff --git a/mods/supplemental/locale/de.txt b/mods/supplemental/locale/de.txt index 76f4e03..70ec92a 100644 --- a/mods/supplemental/locale/de.txt +++ b/mods/supplemental/locale/de.txt @@ -11,6 +11,8 @@ purple sheet of paper = violettes Blatt Papier green sheet of paper = grünes Blatt Papier wheat = Weizen piece of rock = Stück Stein +loudspeaker = Lautsprecher +loudspeaker (rightclick to toggle music) = Lautsprecher (Rechtsklick, um Musik umzuschalten) # Test liquids are those seen at the viscosity station flowing test liquid %i = fließende Testflüssigkeit %i test liquid source %i = Testflüssigkeitsquelle %i diff --git a/mods/supplemental/locale/template.txt b/mods/supplemental/locale/template.txt index c16c997..0bf525f 100644 --- a/mods/supplemental/locale/template.txt +++ b/mods/supplemental/locale/template.txt @@ -11,6 +11,8 @@ purple sheet of paper green sheet of paper wheat piece of rock +loudspeaker +loudspeaker (rightclick to toggle music) # Test liquids are those seen at the viscosity station flowing test liquid %i test liquid source %i diff --git a/mods/supplemental/textures/supplemental_loudspeaker.png b/mods/supplemental/textures/supplemental_loudspeaker.png new file mode 100644 index 0000000000000000000000000000000000000000..6da685a2c99db97eab6024eb40c58c9cb1d24998 GIT binary patch literal 814 zcmV+}1JV46P){^M*Iqm3+yp-3DiF-F#N zJVg+GlEi`U`2h{%2!U}DT7KZV9@fkfYjq$Q(S9eLbIiFH6D0lH?|-aXy9R(bGo9IO zryV6xeCP4|=6(MW1u-@7;kJVfnuGN1uRi(rfce=rArEh|GL`S002Mz^3#F)9vCH2b7SjgpL}}S zsi#7mfctGZQ5Jm`#ik~vi}Om^{NJrjb)u$8s?y%t^j{&{)zLjOIW5Z~Q&%Sx|3q<; zTCrj|3ZdtDBuViMUoniK?Itq&Y_Vd)hSsJI6hS1ZN)qI}1@mzXVqu(sByn6P2z=AB z9M^R~5X52R$ByHqd<@&vYr3kbEvAtUU}L2(w_aD!3n`Smf0J415N{HcIJw3C+deyMt zL_-qN4Tm0f)GKej!ID&QL2+z&Oj4xQ=GGMCpa1@yepn-{JO1dSzWDgP$_4=rHQ|*- z+3(BC@4DlzuYUSbQ)Jt=>$v(jj%O=^D9dCWyXUUEe)Q1?E9TAfBLM3e!bDltmT<1_ z%yZ74n4H#(nqum1?05C{9eUWITWz*k_V3^4|NCDmXS#rFJ=PgJ1^@sHtPo>RrjEcd sfIvTr+#q!PKvm?>OM(PM5eO6TKM(kmy-38X6aWAK07*qoM6N<$f)6;Gm;e9( literal 0 HcmV?d00001