From d32a75a01458c41f60a213f22edde5ae7af5ef12 Mon Sep 17 00:00:00 2001 From: David G Date: Tue, 31 Dec 2019 13:04:51 -0700 Subject: [PATCH] Make default setting configuration option. --- README.md | 4 +++- init.lua | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f870453..a88b497 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ HUD Compass [hud_compass] ------------------------- -A Minetest mod to optionally place a HUD compass and 24-hour clock on the screen. +A Minetest mod to optionally place a HUD compass and a 24-hour clock on the screen. By David G (kestral246) @@ -34,6 +34,8 @@ In addition: **Note:** The clock is a 24-hour clock, with only one hand that displays the hours. Noon is at the top and midnight is at the bottom. +**New:** The default initial state can now be set in minetest.conf using "compass\_default\_corner = n", where "n" can be one of the eight corner numbers above. If it's positive, the compass (or compass and clock) will be enabled at start, while if it's negative, they will start disabled. + Local mod storage is used to maintain the state and position of hud_compass display between sessions, per user. diff --git a/init.lua b/init.lua index 4d37662..b0be1d2 100644 --- a/init.lua +++ b/init.lua @@ -2,7 +2,7 @@ -- Optionally place a compass and 24-hour clock on the screen. -- A HUD version of my realcompass mod. -- By David_G (kestral246@gmail.com) --- 2019-12-30 +-- 2019-12-31 local hud_compass = {} local storage = minetest.get_mod_storage() @@ -12,7 +12,8 @@ local storage = minetest.get_mod_storage() -- 5 = NE, 6 = SE, 7 = SW, 8 = NW (both compass and clock) -- positive == enabled, negative == disabled -local default_corner = -2 -- SE corner, compass only, off by default +-- Define default (if not overridden): SE corner, compass only, off by default +local default_corner = tonumber(minetest.settings:get("compass_default_corner") or -2) local lookup_compass = { {hud_elem_type="image", text="", position={x=1,y=0}, scale={x=4,y=4}, alignment={x=-1,y=1}, offset={x=-8,y=4}},