From 70c708f13945c466d7e6098ba22282367b04c7a8 Mon Sep 17 00:00:00 2001 From: poikilos <7557867+poikilos@users.noreply.github.com> Date: Sat, 3 Feb 2018 22:48:30 -0500 Subject: [PATCH] python3 and other fixes --- README.md | 39 ++++++++++-------- .../game-install-ENLIVEN | 41 +++++++++++-------- mtsenliven.py | 27 ++++++++++-- webapp/README.md | 6 +-- 4 files changed, 73 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index e0b9f76..60ce6ce 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,23 @@ Otherwise just install everything EXCEPT cme_to_spawners & tsm_pyramids_to_spawn * The network folder contains some stuff for networks, which is usually only useful for using Minetest in a network cafe or school. (The purpose of minetest_userscript_localENLIVEN_server_only.vbs is to make sure the user only uses the hostname localENLIVEN, however this only changes the default, and cannot be enforced in any way as far as I know without recompiling the client.) +## Planned Features +* add NPCs (possibly mobs via https://github.com/Bremaweb/adventuretest/tree/master/mods/mobs ) +* add https://github.com/minetest-mods/smartfs ? +* Do not allow teleporting to travelnet teleporters in an area protected from you by protection mod (even if the source teleporter is yours), but allow teleporting to areas where you cannot modify (such as advanced area protection areas where, by default, use is allowed and modify is not). Locked travelnet will not be used by this mod--instead, this less-cumbersome change is planned. +* Log where bones were placed to debug.txt, possibly by way of the following chat message: + after the existing line: + minetest.set_node(pos, {name = "bones:bones", param2 = param2}) + add the new line (not sure if the format call is really ok--it was copied from compassgps: + minetest.chat_send_player(player:get_player_name(), S("Bones placed at %s."):format(pos)) + +### Potential mods to add +* weather: https://github.com/Jeija/minetest-mod-weather ( https://forum.minetest.net/viewtopic.php?t=5245 ) +* Immersive Sounds [ambience]: https://forum.minetest.net/viewtopic.php?t=2807 + OR technic_ambience: http://realbadangel.pl/technic_ambience.zip +* baked clay (Ethereal NG integrates with it, mobs redo, and farming redo) +* Updated pipeworks fork by HybridDog: https://github.com/HybridDog/pipeworks + ## Known issues: * ENLIVEN Windows binary release installer should be signed via a code signing license to avoid browser warnings and possible issues with virus scanners (NOTE: Squirrel.Windows has signing available such as via: ./src\.nuget\NuGet.exe pack .\ENLIVEN..nuspec @@ -143,23 +160,6 @@ squirrel --releasify .\ENLIVEN..nupkg * minetest_game mods and modpacks are owned by root in the end, for some reason. This may cause serious problems on your server. Change the owner to your current user. * (minetestoffline.py) (status:closed reason:no solution) assumes name specified in file is same as id (filename) -## Planned Features -* add NPCs (possibly mobs via https://github.com/Bremaweb/adventuretest/tree/master/mods/mobs ) -* add https://github.com/minetest-mods/smartfs ? -* Do not allow teleporting to travelnet teleporters in an area protected from you by protection mod (even if the source teleporter is yours), but allow teleporting to areas where you cannot modify (such as advanced area protection areas where, by default, use is allowed and modify is not). Locked travelnet will not be used by this mod--instead, this less-cumbersome change is planned. -* Log where bones were placed to debug.txt, possibly by way of the following chat message: - after the existing line: - minetest.set_node(pos, {name = "bones:bones", param2 = param2}) - add the new line (not sure if the format call is really ok--it was copied from compassgps: - minetest.chat_send_player(player:get_player_name(), S("Bones placed at %s."):format(pos)) - -### Potential mods to add -* weather: https://github.com/Jeija/minetest-mod-weather ( https://forum.minetest.net/viewtopic.php?t=5245 ) -* Immersive Sounds [ambience]: https://forum.minetest.net/viewtopic.php?t=2807 - OR technic_ambience: http://realbadangel.pl/technic_ambience.zip -* baked clay (Ethereal NG integrates with it, mobs redo, and farming redo) -* Updated pipeworks fork by HybridDog: https://github.com/HybridDog/pipeworks - ### Known issues in mods: * Mining Drill mk3 duplication bug * Technic manual is not complete. Contribute info on drills and mining? See https://github.com/minetest-mods/technic/blob/master/manual.md @@ -269,3 +269,8 @@ Qt5Core.dll Qt5Gui.dll Qt5Svg.dll Qt5Widgets.dll + +## Developer Notes + +### Regression Tests +* Use of input in python, where should never be used except in expertmm.py and minetestinfo.py for first-time setup or when interactive_enable is True diff --git a/etc/change_hardcoded_world_name_first/game-install-ENLIVEN b/etc/change_hardcoded_world_name_first/game-install-ENLIVEN index 3c425b4..b105539 100755 --- a/etc/change_hardcoded_world_name_first/game-install-ENLIVEN +++ b/etc/change_hardcoded_world_name_first/game-install-ENLIVEN @@ -17,6 +17,7 @@ # sudo find -name 'worlds' (worlds folder is in $HOME/.minetest) # sudo find -name 'minimal' (stable build [such as 0.4.9 games folder is /usr/share/games/minetest/games, but git version games folder is /usr/local/share/minetest/games) +sudo echo "cached password." # NOTE: minetest mods are ALWAYS ONLY installed on server mtgame_name="minetest_game" USR_SHARE_MINETEST=/usr/share/games/minetest @@ -458,11 +459,11 @@ fi if [ -d "tsm_chests_example" ]; then rm -Rf "tsm_chests_example" fi -if [ -f "trm_default_example" ]; then - rm "trm_default_example" +if [ -d "trm_default_example" ]; then + rm -Rf "trm_default_example" fi -if [ -f "tsm_default_example" ]; then - rm "tsm_default_example" +if [ -d "tsm_default_example" ]; then + rm -Rf "tsm_default_example" fi #if [ -d "$MTMOD_UNZ_NAME" ]; then rm -Rf $MTMOD_UNZ_NAME @@ -946,14 +947,15 @@ fi cd "$HOME/Downloads" #does NOT have a zip extension when downloaded via wget: -MTMOD_DL_ZIP=master +MTMOD_DL_ZIP=master.zip MTMOD_SRC_ZIP=mesecons_modpack.zip -MTMOD_UNZ_NAME=Jeija-minetest-mod-mesecons-* +MTMOD_UNZ_NAME=mesecons-master MTMOD_DEST_NAME=mesecons MTMOD_DEST_PATH=$MT_MYGAME_MODS_PATH/$MTMOD_DEST_NAME #if [ -d "$MTMOD_UNZ_NAME" ]; then rm -Rf $MTMOD_UNZ_NAME #fi +rm -Rf minetest-mods-mesecons-* rm -Rf "" if [ -f "$MTMOD_DL_ZIP" ]; then rm -f "$MTMOD_DL_ZIP" @@ -961,16 +963,14 @@ fi if [ -f "$MTMOD_SRC_ZIP" ]; then rm -f "$MTMOD_SRC_ZIP" fi -wget https://github.com/Jeija/minetest-mod-mesecons/zipball/master -mv master mesecons_modpack.zip +wget https://github.com/minetest-mods/mesecons/archive/master.zip +mv $MTMOD_DL_ZIP $MTMOD_SRC_ZIP unzip $MTMOD_SRC_ZIP sudo mv -f $MTMOD_UNZ_NAME "$MTMOD_DEST_PATH" if [ ! -d "$MTMOD_DEST_PATH" ]; then echo "ERROR: failed to create $MTMOD_DEST_PATH, so cannot continue." > $err_txt exit 1 fi -#cd Jeija-minetest-mod-mesecons-* -#sudo mv -f mesecons* "$MT_MYGAME_MODS_PATH/" ############ REQUIRES MESECONS ############ ##### NEEDED since carts in minetest_game added much of this functionality but not yet startstoprail or detectorrail ##### @@ -1016,6 +1016,7 @@ cd "$HOME/Downloads" MTMOD_DL_ZIP=master.zip #MTMOD_SRC_ZIP=throwing_Echoes91.zip MTMOD_SRC_ZIP=throwing_MinetestForFun.zip +MTMODPACK_UNZ_NAME=server-minetestforfun-master MTMOD_UNZ_NAME=server-minetestforfun-master/mods/throwing MTMOD_DEST_NAME=throwing MTMOD_DEST_PATH=$MT_MYGAME_MODS_PATH/$MTMOD_DEST_NAME @@ -1030,6 +1031,9 @@ fi #if [ -d "$MTMOD_UNZ_NAME" ]; then rm -Rf $MTMOD_UNZ_NAME #fi +if [ -d "$MTMODPACK_UNZ_NAME" ]; then + rm -Rf $MTMODPACK_UNZ_NAME +fi if [ -f "$MTMOD_DL_ZIP" ]; then rm -f "$MTMOD_DL_ZIP" fi @@ -1305,10 +1309,12 @@ if [ -f $MTMOD_SRC_ZIP ]; then rm -f $MTMOD_SRC_ZIP fi rm -Rvf $MTMOD_UNZ_NAME -#NOTE: a skin database is at http://minetest.fensta.bplaced.net/ -#bell07's 2016 (FORK of Krock's fork of dmonty's) u_skins (u_skins is a skin GUI that works with unified_inventory, whereas other skin GUIs often use inventory++) +# NOTE: a skin database is at http://minetest.fensta.bplaced.net/ +# bell07's 2016 (FORK of Krock's fork of dmonty's) u_skins (u_skins is a skin GUI that works with unified_inventory, whereas other skin GUIs often use inventory++) # Krock's is outdated and has remaining bugs such as in updater: wget https://github.com/SmallJoker/minetest-u_skinsdb/archive/master.zip -wget https://github.com/bell07/minetest-u_skinsdb/archive/master.zip +# bell07's no longer exists +# wget https://github.com/bell07/minetest-u_skinsdb/archive/master.zip +wget https://github.com/dmonty2/minetest-u_skinsdb/archive/master.zip mv $MTMOD_DL_ZIP "$MTMOD_SRC_ZIP" unzip "$MTMOD_SRC_ZIP" sudo mv -f $MTMOD_UNZ_NAME "$MTMOD_DEST_PATH" @@ -1686,9 +1692,10 @@ if [ ! -d "$MTMOD_DEST_PATH" ]; then fi - +# https://forum.minetest.net/viewtopic.php?f=11&t=12440&p=310915#p310915 cd $HOME/Downloads -MTMOD_DL_ZIP=file.php?id=6140 +#MTMOD_DL_ZIP=file.php?id=6140 +MTMOD_DL_ZIP=master.zip MTMOD_SRC_ZIP=invhack.zip MTMOD_UNZ_NAME=invhack MTMOD_DEST_NAME=invhack @@ -1705,7 +1712,9 @@ fi if [ -d "$MTMOD_DEST_PATH" ]; then sudo rm -Rf "$MTMOD_DEST_PATH" fi -wget https://forum.minetest.net/download/file.php?id=6140 +# wget https://forum.minetest.net/download/file.php?id=6140 +# forum link changed, so use salahzar's GitHub upload instead: +wget https://github.com/salahzar/minetest-invhack/archive/master.zip mv $MTMOD_DL_ZIP "$MTMOD_SRC_ZIP" unzip "$MTMOD_SRC_ZIP" sudo mv $MTMOD_UNZ_NAME "$MTMOD_DEST_PATH" diff --git a/mtsenliven.py b/mtsenliven.py index 99ab23d..804c8a8 100644 --- a/mtsenliven.py +++ b/mtsenliven.py @@ -4,18 +4,37 @@ from mtanalyze.minetestinfo import * import subprocess, signal game_id = "ENLIVEN" #screen -S MinetestServer $mts --gameid ENLIVEN --worldname FCAGameAWorld +print() +print() +print() if not minetestinfo.contains("minetestserver_path"): print("[ mtsenliven.py ] ERROR: minetestserver_path" - "was not found in your version of minetestinfo.py") + " was not found in your version of minetestinfo.py") exit(1) -mts = minetestinfo.get_var("system.minetestserver_path") +mts = minetestinfo.get_var("minetestserver_path") if not minetestinfo.contains("primary_world_path"): print("[ mtsenliven.py ] ERROR: primary_world_path" "was selected by minetestinfo.py") exit(2) wp = minetestinfo.get_var("primary_world_path") wn = os.path.basename(wp) -p = subprocess.Popen([mts, '--gameid '+game_id, '--worldname '+wn]) - # stdout=subprocess.PIPE) +print("Using minetestserver: " + mts) +print("Using primary_world_path: " + wp) +print("Using world_name: " + wn) +print() +process = subprocess.Popen( + [mts, '--gameid', game_id, '--worldname', wn], + stdout=subprocess.PIPE +) + +# see https://www.endpoint.com/blog/2015/01/28/getting-realtime-output- +# using-python +while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + if output: + print(output.strip()) + rc = process.poll() diff --git a/webapp/README.md b/webapp/README.md index a8681dd..34720ee 100755 --- a/webapp/README.md +++ b/webapp/README.md @@ -27,9 +27,9 @@ if (!has_setting("owner.primary_world_path")): var world_path = peek_setting("owner.primary_world_path"); var world_name = path.basename(wp); -p = subprocess.Popen([mts, '--gameid ENLIVEN', '--worldname ' + world_name], - stdout=subprocess.PIPE); -p.write = mts_out; +//var mts_proc; +//mts_proc = /*TODO: finish this*/([mts, '--gameid ENLIVEN', '--worldname ' + world_name]); +mts_proc.write = mts_out; return results; ```