[mod] Mesecons Microphone [mesecons_microphone] [wip]

Post Reply
Maverick2797
Member
Posts: 128
Joined: Sun Aug 05, 2018 12:37
In-game: Maverick2797
Location: Poking about here and there...

[mod] Mesecons Microphone [mesecons_microphone] [wip]

by Maverick2797 » Post

The Minecraft mod "Cyclic" adds a node that can toggle a redstone signal when a player says a certain password in chat.
Here is my attempt at recreating that for mesecons.
Image

Use is limited to a 50-node radius for lag-prevention, but this can easily be changed in the settings.

License:
Code: LGPLv3
Textures: CC-BY (they're barely worth licensing)

Depends:
mesecons (and its subsequent requirements)

Source/Download:
here

Thanks:
loosewheel - for decoding my late night ramblings and pointing me in the right direction 👍
Last edited by Maverick2797 on Tue Jan 18, 2022 14:44, edited 4 times in total.
The number you have called is not available during a solar eclipse. This message will self destruct in ten seconds in protest... [BEEP]

loosewheel
Member
Posts: 155
Joined: Mon Dec 28, 2020 01:19
GitHub: loosewheel
In-game: loosewheel

Re: [mod] Mesecons Microphone [mesecons_microphone] [wip]

by loosewheel » Post

I did the following to get it to work:
  • No description in definition, used "Microphone"
  • minetest.formspec_escape miss-spelt
  • minetest.swap_node needs node table {name = "mod:node"}, not string
  • Give the button_exit in the formspec a name (I tried save_hotword). In microphone_on_receive_fields only set the hotword if fields.save_hotword

    Code: Select all

    	if fields.save_hotword then
    		meta:set_string("mesecons_microphone_hotword",fields.hotword)
    		microphone_make_formspec(pos)
    	end
    
    Otherwise hotword is updated on any form action, including escape key
Also
  • not_in_creative_inventory should only be for "mesecons_microphone:microphone_on"?
  • Could use variable in formspec so you don't need to keep updating it.
    "field[0.3,1;5,1;hotword;Set A Hotword;${mesecons_microphone_hotword}]"
  • Should check if placer is valid player ObjectRef in after_place_node
    if placer and placer:is_player () then ... end
    (placer can be nil).

Maverick2797
Member
Posts: 128
Joined: Sun Aug 05, 2018 12:37
In-game: Maverick2797
Location: Poking about here and there...

Re: [mod] Mesecons Microphone [mesecons_microphone] [wip]

by Maverick2797 » Post

@loosewheel thank you so much! For some reason I decided to start my first real mod at 11pm and apparently missed a lot of the particulars :)
The number you have called is not available during a solar eclipse. This message will self destruct in ten seconds in protest... [BEEP]

Maverick2797
Member
Posts: 128
Joined: Sun Aug 05, 2018 12:37
In-game: Maverick2797
Location: Poking about here and there...

Re: [mod] Mesecons Microphone [mesecons_microphone] [wip]

by Maverick2797 » Post

Got this ready to go. Tidied up the code with loosewheel's suggestions, added textures and a license. Please let me know if there's anything else I need to do/add to make it release-worthy 😊
The number you have called is not available during a solar eclipse. This message will self destruct in ten seconds in protest... [BEEP]

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests