Skip to content

Commit

Permalink
Add more colors
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaedenn committed Apr 8, 2024
1 parent bad825e commit 3badf21
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
21 changes: 14 additions & 7 deletions files/common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function f_shift_count(num, label)
return ("%s %s %s"):format(prefix, label, suffix)
end

--[[ Returns true if logging is enabled, false otherwise. ]]
--[[ Returns true if logging is enabled, false otherwise ]]
function q_logging()
return GlobalsGetValue(K_CONFIG_LOG_ENABLE, FLAG_OFF) ~= FLAG_OFF
end
Expand All @@ -81,14 +81,14 @@ function q_set_logging(enable)
q_force_update()
end

--[[ Display a logging message if logging is enabled. ]]
--[[ Display a logging message if logging is enabled ]]
function q_log(msg)
if q_logging() then
q_print("DEBUG: " .. msg)
end
end

--[[ Display a formatted logging message if logging is enabled. ]]
--[[ Display a formatted logging message if logging is enabled ]]
function q_logf(msg, ...)
if q_logging() then
q_log(msg:format(...))
Expand Down Expand Up @@ -190,20 +190,27 @@ function maybe_localize_material(material)
return localize_material_via(material, loc_mode)
end

--[[ Format a material with the possibility of including a flask. ]]
--[[ Format a material with the possibility of including a flask ]]
function flask_or(material, use_flask)
local logging = q_logging()
local mname = maybe_localize_material(material)
if use_flask then
return ("flask or %s"):format(mname)
return {
{color="cyan_light", "flask"},
{color="lightgray", "or"},
mname
}
end
if logging then
return ("%s (no flask)"):format(mname)
return {
mname,
{color="lightgray", "(no flask)"}
}
end
return mname
end

--[[ Format a fungal shift. Returns a table of pairs of strings. ]]
--[[ Format a fungal shift. Returns a table of pairs of strings ]]
function format_shift(shift)
if not shift then return {{"invalid shift", "invalid shift"}} end
local source = shift.from
Expand Down
9 changes: 7 additions & 2 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ SQ = {
local mat1 = maybe_localize_material(combo[1])
local mat2 = maybe_localize_material(combo[2])
local mat3 = maybe_localize_material(combo[3])
self._fb:addf("%s is (%.2f%% success rate)", result, prob)
self._fb:addf("%s is (%d%% success rate)", result, prob)
local mode = q_setting_get(SETTING_LOCALIZE)
if mode == FORMAT_INTERNAL then
self._fb:addf(" %s, %s, %s", mat1, mat2, mat3)
Expand Down Expand Up @@ -114,7 +114,12 @@ SQ = {
if rare_to then
str_to = {color=RARE_MAT_COLOR, pair[2]}
end
self._fb:add({which_msg, "shift is", str_from, "->", str_to})
self._fb:add({
which_msg,
{color="lightgray", "shift is"},
str_from,
{color="lightgray", "->"},
str_to})
end
end,

Expand Down
1 change: 1 addition & 0 deletions lib/feedback.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Feedback = {
magenta_light = {1, 0.5, 1},
yellow_light = {1, 1, 0.5},
gray = {0.5, 0.5, 0.5},
lightgray = {0.75, 0.75, 0.75},
},

-- The lines table, public for convenience
Expand Down
2 changes: 2 additions & 0 deletions mod_description.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ This mod will tell you exactly these. It lists all pending shifts (configurable)

If a shift mentions using a flask, then a flask will be used, assuming you're holding one. If a flask isn't mentioned, then the shift won't use one.

**NEW!** Shifts using "rare" materials are highlighted yellow.
**NEW!** Formatting of multi-material shifts (configurable) to include all materials instead of just the primary one.
**NEW!** Alchemic precursor and lively concoction are now included! The number next to the materials is the conversion chance. A higher number means a more effective conversion.
**NEW!** Flask resolving! If enabled via the Actions menu, this mod will tell you exactly what materials have been shifted, even if a flask was used.
**NEW!** Live feedback for shift delay period! This mod will tell you exactly how many seconds remain before you can perform another fungal shift.
Expand Down

0 comments on commit 3badf21

Please sign in to comment.