Modding question

User avatar
Extex
Member
 
Posts: 128
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

Modding question

by Extex » Mon Sep 30, 2019 23:28

How would I make a mod with a block that when you interact with it, it shows a formspec and removes the node, but when the player closes the formspec the node re-appears
Code snippet would be appreciated
Player of PK, RIP. Creator of the light_tool mod. Working on another mod which is pretty cool so far
 

User avatar
duane
Member
 
Posts: 1591
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

Re: Modding question

by duane » Tue Oct 01, 2019 02:05

Extex wrote:How would I make a mod with a block that when you interact with it, it shows a formspec and removes the node, but when the player closes the formspec the node re-appears
Code snippet would be appreciated


The first part is easy. Just look at chests.lua and replace with air instead of another chest node. Putting the node back could be a problem. I'm not sure if on_receive_fields gets called in every case of a formspec closing. What if the player disconnects with the formspec open?
Believe in people and you don't need to believe anything else.
 

User avatar
Extex
Member
 
Posts: 128
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

Re: Modding question

by Extex » Thu Oct 03, 2019 17:31

Oh I didn't think of that!
Thanks!
Player of PK, RIP. Creator of the light_tool mod. Working on another mod which is pretty cool so far
 


Return to Modding Discussion



Who is online

Users browsing this forum: runs and 1 guest