Make default setting configuration option.

master
David G 2019-12-31 13:04:51 -07:00
parent cbc71c0d94
commit d32a75a014
2 changed files with 6 additions and 3 deletions

View File

@ -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.

View File

@ -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}},