starlit  Diff

Differences From Artifact [c766e87490]:

To Artifact [523263fc9a]:


     1      1   local lib = starlit.mod.lib
     2      2   
     3      3   local function U(unit, prec, fixed)
            4  +	local trunc = 2
     4      5   	if fixed then
     5      6   		return function(amt, excludeUnit)
     6         -			if excludeUnit then return tostring(amt/prec) end
     7         -			return string.format("%s %s", amt/prec, unit)
            7  +			local ta = lib.math.trim(amt/prec, trunc)
            8  +			if excludeUnit then return tostring(ta) end
            9  +			return string.format("%s %s", ta, unit)
     8     10   		end
     9     11   	else
    10     12   		return function(amt, excludeUnit)
    11         -			if excludeUnit then return tostring(amt/prec) end
    12         -			return lib.math.si(unit, amt/prec)
           13  +			local ta = lib.math.trim(amt/prec, trunc)
           14  +			if excludeUnit then return tostring(ta) end
           15  +			return lib.math.si(unit, amt/prec, nil, nil, trunc)
    13     16   		end
    14     17   	end
    15     18   end
    16     19   
    17     20   local function C(h, s, l)
    18     21   	return lib.color {hue = h, sat = s or 1, lum = l or .7}
    19     22   end
................................................................................
    22     25   	-- numina is measured in daψ
    23     26   	warmth     = {min = -1000, max = 1000, base = 0, desc = U('°C', 10, true), color = C(5), name = 'Warmth'};
    24     27   	-- warmth in measured in °C×10
    25     28   	fatigue    = {min = 0, max = 76 * 60, base = 0, desc = U('hr', 60, true), color = C(288,.3,.5), name = 'Fatigue'};
    26     29   	-- fatigue is measured in minutes one needs to sleep to cure it
    27     30   	stamina    = {min = 0, max = 20 * 100, base = true, desc = U('m', 100), color = C(88), name = 'Stamina'};
    28     31   	-- stamina is measured in how many 10th-nodes (== cm) one can sprint
    29         -	hunger     = {min = 0, max = 20000, base = 0, desc = U('Cal', 1), color = C(43,.5,.4), name = 'Hunger'};
    30         -	-- hunger is measured in calories one must consume to cure it
    31         -	thirst     = {min = 0, max = 1600, base = 0, desc = U('l', 100), color = C(217, .25,.4), name = 'Thirst'};
    32         -	-- thirst is measured in centiliters of H²O required to cure it
           32  +	hunger     = {min = 0, max = 2000e3, base = 0, desc = U('kCal', 1000, true), color = C(43,.5,.4), name = 'Hunger'};
           33  +	-- hunger is measured in calories one must consume to cure it. at a 2kCal deficit, you start dying
           34  +	thirst     = {min = 0, max = 4e3, base = 0, desc = U('L', 1e3), color = C(217, .25,.4), name = 'Thirst'};
           35  +	-- thirst is measured in mL of H²O required to cure it
    33     36   	morale     = {min = 0, max = 24 * 60 * 10, base = true, desc = U('hr', 60, true), color = C(0,0,.8), name = 'Morale'};
    34     37   	-- morale is measured in minutes. e.g. at base rate morale degrades by
    35     38   	-- 60 points every hour. morale can last up to 10 days
    36     39   	irradiation = {min = 0, max = 20000, base = 0, desc = U('Gy', 1000), color = C(141,1,.5), name = 'Irradiation'};
    37     40   	-- irrad is measured is milligreys
    38     41   	-- 1Gy counters natural healing
    39     42   	-- ~3Gy counters basic nanomedicine