MinetestIDE - Minetest Lua API Code Completion in ZeroBrane

User avatar
poikilos
Member
 
Posts: 32
Joined: Thu Feb 18, 2016 13:45
GitHub: poikilos
In-game: poikilos

MinetestIDE - Minetest Lua API Code Completion in ZeroBrane

by poikilos » Tue Mar 12, 2019 18:28

I have done a minor fork of "MinetestIDE," which is wintermute's mod of ZeroBrane Studio, a Lua editor with code completion (with Minetest code completion added thanks to wintermute). Below is all I've done so far:
  • extracted it from the forum zip and uploaded it to GitHub
  • clarified license & authorship
  • made an installer script for Linux (on Windows, MinetestIDE can still be installed the old way after installing ZeroBrane, by copying a folder, then setting the Lua interpreter to "minetest" in ZeroBrane, as instructed in the included documentation)

Download Source: ZIP
Browse Source: https://github.com/poikilos/MinetestIDE
Clone with git: git clone https://github.com/poikilos/MinetestIDE.git

History:
Wintermute's release post didn't promote MinetestIDE but understated its value at least in the lead-in. The title didn't have effective keywords (such as "code completion") and spelled Minetest incorrectly. Lack of clear licensing and authorship was a major hitch hindering the uptake of MinetestIDE. Another major hitch was that there was no installer. I didn't memorize much of the Minetest Lua API, and not many people had, so code completion was desirable. Therefore, I searched far and wide and finally found Wintermute's release post. After pursuing several dead leads regarding authorship on and off for months, I resolved the licensing issues (see "Authors" section of included README.md). I immediately began work on making the release available. I added an installer script, at least for Linux systems.


Planned Features:
  • annotate parts of the API that were changed (such as
    Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
    Code: Select all
    minetest.check_for_falling({x = 0, y = 0, z = 0})
    vs the original
    Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
    Code: Select all
    nodeupdate
    which remains in the mintest.org releases for backward compatibility)
  • installer script for Windows

Additional Ideas:
(I am not likely to implement these, but you could then let me know using a GitHub pull request):
  • minimal asset management: Add warnings for requirements, such as models in models directory and textures in textures directory, and conventions, such as modname_nodename.png for a texture and modname_nodename.* for a corresponding model.
  • warning model file specifies a texture (causes log spamming on Minetest server due to Irrlicht not finding the texture itself, even though Minetest adds textures manually)--this may require some exotic CLI, possibly for b3view, that uses Irrlicht headlessly to output a texture name or else output nothing.
  • warning on missing mod.conf or modpack.txt
  • warning if no LICENSE* file (possibly recommend MIT license since used for Minetest, and have a button that automatically inserts a license of your choice)
  • warning if no README* file
  • possibly show a tutorial file pop up describing how to do of all of the above manually, and redirect them to the modding book, even if the automation of these steps isn't implemented or reasonably doable.
 

OldCoder
Administrator
 
Posts: 346
Joined: Mon Oct 01, 2012 14:59

Re: MinetestIDE - Minetest Lua API Code Completion in ZeroBr

by OldCoder » Tue Mar 12, 2019 20:44

MinetestIDE is an IDE for Minetest, written in Lua, that is derived from a program named ZBStudio.

This post explains how I got Poikilos's version of MinetestIDE to work in my distro. Read Poikilos's post above this one first.

1. Dependencies and/or recommended packages include shared libraries for bzip2, glib2, freetype2, harfbuzz, wxwidgets 3.0, xorg, and zlib. Recent releases are recommended, though bleeding edge might not work.

Note that wxwidgets should be in the 3.0 series as opposed to older series or recent git branches.

2. To install Poikilos's copy of MinetestIDE, one executes "./install.sh" in the top level git-clone directory. Internet access is required because external code is downloaded.

3. Under some distros, to run the program, users may need to set, and export, either or both of the following environment variables:

LD_PRELOAD
LD_LIBRARY_PATHS

In my case, I needed to set LD_PRELOAD to an absolute path for the following GTK library file:

libgtk-x11-2.0.so.0

Additionally, I needed to set LD_LIBRARY_PATHS to an absolute path for "gcc's" "lib" subdirectory.

I then needed to execute the following command at the "bash" level:

export LD_PRELOAD LD_LIBRARY_PATHS

Subsequent to installation of the program, and these extra steps, I was able to run the program as follows:

cd /opt/zbstudio && ./zbstudio.sh

4. On my system, the fonts were too small to be readable. I was able to partly correct this as follows:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
cd /opt/zbstudio
sed -e 's/defaultsize = 1[0-9]/defaultsize = 18/' \
    -e 's/font_size = 1[0-9]/font_size = 18/' \
    -e 's/fontsize = nil/fontsize = 18/' \
    -e '/ide.font.tree = font/ifont:SetPointSize (18);' \
    -i `find . -type f -name \*.lua`

This fixed most of the fonts, though the menu-bar font was still a bit small. The screenshot below shows the program running after this step.

Some users will consider the output produced by 18 here to be too large. They may wish to substitute a number in the range of 14 to 17 for 18. However, the defaults are definitely too low


Image
 

rudzik8
New member
 
Posts: 5
Joined: Sat Jul 01, 2023 01:53
GitHub: rudzik8
IRC: rudzik

Re: MinetestIDE - Minetest Lua API Code Completion in ZeroBr

by rudzik8 » Sun Jul 02, 2023 13:20

In order to make it work with a standard Windows installation of Final Minetest, you need to locate your Final Minetest folder.
It is usually in the %Appdata% folder, but sadly, ZeroBrane (ZB) doesn't understand such syntaxis and thus you need to use the full path: C:/Users/name/AppData/Roaming/finalminetest. Replace name with the name of your user in Windows. Slashes are used instead of backslashes to make it work.

With that path, go to:
  1. If you didn't install MinetestIDE yet: your copy of MinetestIDE, then into the folder zbstudio > interpreters
  2. If you already installed it on top of ZB: the ZeroBrane folder, then into the interpreters subfolder.

Open the minetest.lua file inside with a text editor of choice. IMPORTANT: you may not be able to save the file later on if you don't open your text editor as administrator. Notepad++, my program of choice, automatically detects that and can reopen itself as administrator; your editor may not have this feature.
Locate the line 18, which starts with CommandLineRun.
Inside the parentheses, there are 4 parameters specified; we only need the 2nd one, which is "/".

Now, append /bin to the end of your path and finally replace this parameter with it. The final result should look like this:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
CommandLineRun("minetest","C:/Users/name/AppData/Roaming/finalminetest/bin",true,false)

Make sure that your final result uses slashes ( / ) and not backslashes ( \ ), or else it will fail.

Now save the file (Ctrl+S).
Proceed by installing the MinetestIDE if you've taken the 1st option previously. Then open ZB and check if it works.

Ta-dah! ;-)
Attachments
screenshot_zbs_mtide.png
Screenshot of it working
screenshot_zbs_mtide.png (54.14 KiB) Viewed 14851 times
 


Return to Minetest Tools

Who is online

Users browsing this forum: No registered users and 1 guest

cron