How to open/close doors programmatically?

Post Reply
JavaFXpert
Member
Posts: 18
Joined: Sat Jun 01, 2019 23:33
GitHub: JavaFXpert

How to open/close doors programmatically?

by JavaFXpert » Post

I would like to be able to programmatically open and close doors and gates, perhaps by simulating the right-click. Is there a way to simulate the right-click programmatically? minetest.place_node(pos) doesn't seem to do that.

User avatar
Krock
Developer
Posts: 4649
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: How to open/close doors programmatically?

by Krock » Post

https://github.com/minetest/minetest_ga ... s/init.lua

Code: Select all

d = doors.get(pos)
d:open(nil) -- nil would be the player, if there's any
d:close(nil)
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

JavaFXpert
Member
Posts: 18
Joined: Sat Jun 01, 2019 23:33
GitHub: JavaFXpert

Re: How to open/close doors programmatically?

by JavaFXpert » Post

Thanks Krock. Follow-up question: What would be the preferred approach to disabling the ability to rightclick a door to open/close it, so that it may only be open/closed programmatically? I registered a new door that has its on_rightclick function overridden, but would like to avoid altering the code in the doors mod.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests