How to open/close doors programmatically?

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

How to open/close doors programmatically?

by JavaFXpert » Sun Sep 01, 2019 14:16

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: 4346
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

Re: How to open/close doors programmatically?

by Krock » Sun Sep 01, 2019 17:51

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)
>> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
 

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

Re: How to open/close doors programmatically?

by JavaFXpert » Sun Sep 08, 2019 00:05

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.
 


Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 4 guests