Giter VIP home page Giter VIP logo

postool's Introduction

ContentDB luacheck License Minetest

PosTool mod for Minetest

Adds configurable HUD elements for current: position (node and block) and time. If advtrains is installed, it can also display railway time. If mesecons_debug is installed, this info can also be displayed.

Use chat command /postool to invoke formspec to toggle elements and position of HUD.

Screenshots

Pick a location.

Use the tool.

Invoke formspec with /postool

Example display of HUD

The progress-bar shows the mesecons usage in current block. It changes colour based on penalty.

When not disabled and user is not standing in the middle block of a chunk, then a smaller, green grid shows in which direction the chunk borders are. The closer to the orange grid the green one is, the closer a chunk border is in that direction.

PosTool

Crafting recipe:

		|				|				| default:glass |
		|				| default:torch |				|
		| default:stick |				|				|

Punch or place with PosTool to show a grid of the map-block at that position. If PosTool is used on a node, that nodes position will be used otherwise players position.

Settings

Settings with default values:

# HUD offsets in screen percentage
postool.hud.offsetx						0.8
postool.hud.offsety						0.95
# HUD z_index (does not seem to work)
postool.hud.offsetz						-111
# how to separate x, y and z values
postool.hud.posseparator				' | '
# titles in HUD and formspec
postool.hud.titletrain					'Railway Time: '
postool.hud.titletime					'Time: '
postool.hud.titlenode					'Node: '
postool.hud.titleblock					'Block: '
postool.hud.titlemesecons				'Mesecons: '
# value shown in HUD when
# advtrains is not enabled
postool.hud.titletrainna				'advtrains not enabled'
# main HUD switch
postool.hud.defaultshowmain				false (0/1)
# which items to initially show
postool.hud.defaultshowtrain			false (0/1)
postool.hud.defaultshowtime				false (0/1)
postool.hud.defaultshownode				true (0/1)
postool.hud.defaultshowblock			true (0/1)
postool.hud.defaultshowmesecons			false (0/1)
postool.hud.defaultshowmeseconsdetails	false (0/1)
# wait at least this long
# before updating HUD (seconds)
postool.hud.minupdateinterval			2
# how long to show grid for
# when tool is used
postool.tool.griddisplayduration		12
postool.tool.suppresschunkindicator	false (0/1)
postool.tool.usevizlib                    false (0/1)

Thanks

This mod was strongly inspired by poshud. Some techniques I borrowed from missions. I also want to mention replacer <- Coil0's version <- Sokomine's version and protector as I used parts of them too. @6r1d for screenshots and support

Thanks also to the users of pandorabox.io for feedback and inspiration to actually write this mod. @Huhhila for pushing the mapchunk indicator idea. On #minetest IRC/discord @Warr1024, @hlqkj and @Krock for chiming in the discussion.

Thanks to @BuckarooBanzay for helping debugging postool in node-breakers.

(If you feel I should include you by name, just submit a PR)

postool's People

Contributors

swissalps avatar 6r1d avatar coil0 avatar

Stargazers

 avatar tacotexmex avatar Thomas Rudin avatar

Watchers

 avatar James Cloos avatar  avatar  avatar  avatar

postool's Issues

nil related crash in `huds.lua`

(i haven't looked at this one in detail yet)

2021-05-23 22:42:06: ERROR[Main]: ServerError: AsyncErr: environment_Step: Runtime error from mod 'afkkick' in callback environment_Step(): /data/world//worldmods/postool/huds.lua:18: attempt to call method 'get_meta' (a nil value)
2021-05-23 22:42:06: ERROR[Main]: stack traceback:
2021-05-23 22:42:06: ERROR[Main]: 	/data/world//worldmods/postool/huds.lua:18: in function 'readPlayerToggles'
2021-05-23 22:42:06: ERROR[Main]: 	/data/world//worldmods/postool/huds.lua:381: in function 'initHud'
2021-05-23 22:42:06: ERROR[Main]: 	/data/world//worldmods/postool/huds.lua:153: in function 'getPlayerTables'
2021-05-23 22:42:06: ERROR[Main]: 	/data/world//worldmods/postool/huds.lua:66: in function 'playerWantsChunkIndicator'
2021-05-23 22:42:06: ERROR[Main]: 	/data/world//worldmods/postool/tool.lua:76: in function 'on_use'
2021-05-23 22:42:06: ERROR[Main]: 	/data/world//worldmods/pipeworks/wielder.lua:328: in function 'act'
2021-05-23 22:42:06: ERROR[Main]: 	/data/world//worldmods/pipeworks/wielder.lua:111: in function 'wielder_on'
2021-05-23 22:42:06: ERROR[Main]: 	/data/world//worldmods/pipeworks/wielder.lua:147: in function 'old_action_on'
2021-05-23 22:42:06: ERROR[Main]: 	/data/world//worldmods/mesecons_ratelimiter/api.lua:36: in function 'f'
2021-05-23 22:42:06: ERROR[Main]: 	/data/world//worldmods/monitoring/metrictypes/counter.lua:42: in function 'action_on'
2021-05-23 22:42:06: ERROR[Main]: 	/data/world//worldmods/mesecons/mesecons/internal.lua:190: in function </data/world//worldmods/mesecons/mesecons/internal.lua:183>
2021-05-23 22:42:06: ERROR[Main]: 	/data/world//worldmods/mesecons/mesecons/actionqueue.lua:137: in function 'old_execute'
2021-05-23 22:42:06: ERROR[Main]: 	/data/world//worldmods/mesecons_debug/overrides.lua:7: in function 'f'
2021-05-23 22:42:06: ERROR[Main]: 	/data/world//worldmods/monitoring/metrictypes/counter.lua:42: in function 'execute'
2021-05-23 22:42:06: ERROR[Main]: 	/data/world//worldmods/mesecons/mesecons/actionqueue.lua:111: in function </data/world//worldmods/mesecons/mesecons/actionqueue.lua:73>
2021-05-23 22:42:06: ERROR[Main]: 	/usr/local/share/minetest/builtin/game/register.lua:422: in function </usr/local/share/minetest/builtin/game/register.lua:406>
2021-05-23 22:42:06: ERROR[Main]: stack traceback:

EDIT: the tool was used in a node-breaker, right? 🤦

Logout crash

Found a nice feature: Restarting the server after log out 🤣

minetest_1           | 2019-10-31 21:28:23: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'postool' in callback on_leaveplayer(): /usr/local/share/minetest/builtin/common/after.lua:31: Invalid minetest.after invocation
minetest_1           | 2019-10-31 21:28:23: ERROR[Main]: stack traceback:
minetest_1           | 2019-10-31 21:28:23: ERROR[Main]: 	[C]: in function 'assert'
minetest_1           | 2019-10-31 21:28:23: ERROR[Main]: 	/usr/local/share/minetest/builtin/common/after.lua:31: in function 'after'
minetest_1           | 2019-10-31 21:28:23: ERROR[Main]: 	/data/world//worldmods/postool/init.lua:49: in function 'func'
minetest_1           | 2019-10-31 21:28:23: ERROR[Main]: 	...ocal/share/minetest/builtin/profiler/instrumentation.lua:106: in function <...ocal/share/minetest/builtin/profiler/instrumentation.lua:100>
minetest_1           | 2019-10-31 21:28:23: ERROR[Main]: 	/usr/local/share/minetest/builtin/game/register.lua:429: in function </usr/local/share/minetest/builtin/game/register.lua:413>

Biome data extension / Magic numbers

This project extensively uses magic numbers, especially magic is the number 7. I wanted to write a biome data extension but I can't be bothered having to deal with refactoring it to make it number 8 and inserting my new hud flag at position nr. 7. I doubt if using some explanatory variables would hurt performance much.

huds.lua:	if 6 == #sFlags then sFlags[7] = false end
huds.lua:	local bWantsChunk = tDB.tb[7]
huds.lua:	lCount[5] = 0 lCount[6] = 0 lCount[7] = 0
huds.lua:	for i = 1, 7 do
huds.lua:	tDB.tb[7] = not tDB.tb[7]
huds.lua:	return tDB.tb[7]

player:hud glitches

I just got hit real bad by the bug: fullscreen is coloured and error messages: "can't load texture" and the text of the huds. Somehow the hud manager mistakes text huds as image huds.

To avoid, let's try by creating the hud elements when user activates and destroy them on deactivation.
That should reset the elements at least.

Grid glitches

Just run around and change your pitch and yaw. The module to display the grid is still in experimental development phase. So all mods using it have this issue.
It would be far worse if grid was displayed differently or more grids were added, such as centre.

add heat seaker mode

shows on hud markers with the values of the surrounding blocks.
reason: sometimes it is hard to spot a block that is silently building up penalty.

variant of this would be a mode that when you use tool, that block is added to players hud
updating it's values for x seconds or until you go there again and toggle with tool.

Wasn't it @6r1d who thought all along the postool was to do that?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.