diff options
author | fluxionary <25628292+fluxionary@users.noreply.github.com> | 2023-01-25 23:25:46 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-26 08:25:46 +0100 |
commit | 18155b3ebedd24fba5c3cbf109063f64f882d8a6 (patch) | |
tree | 5d5d67f8108aa963bb229ee3d282f0eb5a18ca1d /commands/user_commands.lua | |
parent | 675e1e1943598893acf3d652caca18b0193746d9 (diff) | |
download | mesecons_debug-18155b3ebedd24fba5c3cbf109063f64f882d8a6.tar.gz mesecons_debug-18155b3ebedd24fba5c3cbf109063f64f882d8a6.zip |
some more updates (#9)
* add proper settings (untested)
* more constants -> settings
* normalize whitespace between code files
* refactor globalsteps in order to simplify logic
* minor refactoring
* rename file
* use mod_storage for persistent data; optimize context initialization
* refactoring (moving files around)
* rewrite penalty
* add settings; document; allow changing while game is running
* add command to update settings
* update init after splitting commands into files
* fix bugs; add debugging tools; too much for one commit...
* fix whitelist conversion
* add adjustable blinky plant to timer overrides
* add some more mesecons nodes with repeating timers
* resolve luacheck warnings
* tweak hud
* Update documentation; parameterize more things; refactor some logic for readability
* update lag even when mesecons isn't active
* update lag even when mesecons isn't active
* tweak default settings
* move hud so it doesn't interfere w/ areas
* tweak default settings
* put the HUD in a place which doesn't conflict w/ areas mod
* ensure that actions have a valid position to avoid a crash
* stylua
* make sure we don't update the wrong HUD
* spaces not tabs
Co-authored-by: AliasAlreadyTaken <aliasalreadytaken@noreply.example.org3>
Diffstat (limited to 'commands/user_commands.lua')
-rw-r--r-- | commands/user_commands.lua | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/commands/user_commands.lua b/commands/user_commands.lua index 5836373..b0e3c14 100644 --- a/commands/user_commands.lua +++ b/commands/user_commands.lua @@ -1,3 +1,5 @@ +local f = string.format + minetest.register_chatcommand("mesecons_hud", { description = "mesecons_hud toggle", func = function(name) @@ -8,7 +10,7 @@ minetest.register_chatcommand("mesecons_hud", { else return true, "mesecons hud disabled" end - end + end, }) minetest.register_chatcommand("mesecons_global_stats", { @@ -26,10 +28,8 @@ minetest.register_chatcommand("mesecons_global_stats", { local txt if top_ctx then - txt = ( - "Most prominent mesecons usage at mapblock %s" .. - " with %f seconds penalty and %i us average use" - ):format( + txt = f( + "Most prominent mesecons usage at mapblock %s" .. " with %f seconds penalty and %i us average use", minetest.pos_to_string(minetest.get_position_from_hash(top_hash)), top_ctx.penalty, top_ctx.avg_micros_per_second @@ -39,7 +39,7 @@ minetest.register_chatcommand("mesecons_global_stats", { end return true, txt - end + end, }) minetest.register_chatcommand("mesecons_stats", { @@ -51,10 +51,11 @@ minetest.register_chatcommand("mesecons_stats", { end local ctx = mesecons_debug.get_context(player:get_pos()) - return true, ("Mapblock usage: %i us/s (across %i mapblocks)"):format( - ctx.avg_micros_per_second, - mesecons_debug.context_store_size - ) - end + return true, + f( + "Mapblock usage: %i us/s (across %i mapblocks)", + ctx.avg_micros_per_second, + mesecons_debug.context_store_size + ) + end, }) - |