Skip to content
Snippets Groups Projects
Commit 5d84cd59 authored by Eric Wykoff's avatar Eric Wykoff
Browse files

Merge branch 'master' into chrono_talent_balance

parents 7797f87f 8fc3bdab
No related branches found
No related tags found
No related merge requests found
......@@ -109,6 +109,8 @@ function _M:loadDefinition(dir, team, incompatible)
setfenv(mod_def, mod)
mod_def()
mod.rng = nil
mod.team = team
mod.dir = dir
if not mod.long_name or not mod.name or not mod.short_name or not mod.version or not mod.starter then
print("Bad module definition", mod.long_name, mod.name, mod.short_name, mod.version, mod.starter)
......
......@@ -27,6 +27,7 @@ local Textbox = require "engine.ui.Textbox"
local Separator = require "engine.ui.Separator"
local KeyBind = require "engine.KeyBind"
local FontPackage = require "engine.FontPackage"
local Module = require "engine.Module"
module(..., package.seeall, class.inherit(Dialog))
......@@ -48,6 +49,22 @@ function _M:init()
local list = {
"resume",
"keybinds_all",
{"Game Options", function()
-- OMFG this is such a nasty hack, I'm nearly pround of it !
local mod = Module:listModules().tome
if not mod then return end
local allmounts = fs.getSearchPath(true)
if not mod.team then fs.mount(fs.getRealPath(mod.dir), "/mod", false)
else fs.mount(fs.getRealPath(mod.team), "/", false) end
local d = require("mod.dialogs.GameOptions").new()
function d:unload()
fs.reset()
fs.mountAll(allmounts)
end
game:registerDialog(d)
end},
"video",
"sound",
"steam",
......
......@@ -30,6 +30,9 @@ local FontPackage = require "engine.FontPackage"
module(..., package.seeall, class.inherit(Dialog))
function _M:init()
-- we can be called from the boot menu, so make sure to load initial settings in this case
dofile("/mod/settings.lua")
Dialog.init(self, "Game Options", game.w * 0.8, game.h * 0.8)
self.vsep = Separator.new{dir="horizontal", size=self.ih - 10}
......@@ -69,6 +72,10 @@ function _M:select(item)
end
end
function _M:isTome()
return game.__mod_info.short_name == "tome"
end
function _M:switchTo(kind)
self['generateList'..kind:capitalize()](self)
self:triggerHook{"GameOptions:generateList", list=self.list, kind=kind}
......@@ -105,7 +112,7 @@ function _M:generateListUi()
game:registerDialog(GetQuantity.new("Enter movement speed(lower is faster)", "From 0 to 60", config.settings.tome.smooth_move, 60, function(qty)
game:saveSettings("tome.smooth_move", ("tome.smooth_move = %d\n"):format(qty))
config.settings.tome.smooth_move = qty
engine.Map.smooth_scroll = qty
if self:isTome() then engine.Map.smooth_scroll = qty end
self.c_list:drawItem(item)
end))
end,}
......@@ -163,7 +170,7 @@ function _M:generateListUi()
config.settings.tome.show_grid_lines = not config.settings.tome.show_grid_lines
game:saveSettings("tome.show_grid_lines", ("tome.show_grid_lines = %s\n"):format(tostring(config.settings.tome.show_grid_lines)))
self.c_list:drawItem(item)
game:createMapGridLines()
if self:isTome() then game:createMapGridLines() end
end,}
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"Select the fonts look. Fantasy is the default one. Basic is simplified and smaller.\nYou must restart the game for the change to take effect."}
......@@ -199,8 +206,10 @@ function _M:generateListUi()
qty = util.bound(qty, 0, 20)
game:saveSettings("tome.log_fade", ("tome.log_fade = %d\n"):format(qty))
config.settings.tome.log_fade = qty
game.uiset.logdisplay:enableFading(config.settings.tome.log_fade)
profile.chat:enableFading(config.settings.tome.log_fade)
if self:isTome() then
game.uiset.logdisplay:enableFading(config.settings.tome.log_fade)
profile.chat:enableFading(config.settings.tome.log_fade)
end
self.c_list:drawItem(item)
end, 0))
end,}
......@@ -217,44 +226,45 @@ function _M:generateListUi()
end, 1))
end,}
if game.uiset:checkGameOption("icons_temp_effects") then
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"Uses the icons for status effects instead of text.#WHITE#"}
list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Icons status effects#WHITE##{normal}#", status=function(item)
return tostring(config.settings.tome.effects_icons and "enabled" or "disabled")
end, fct=function(item)
config.settings.tome.effects_icons = not config.settings.tome.effects_icons
game:saveSettings("tome.effects_icons", ("tome.effects_icons = %s\n"):format(tostring(config.settings.tome.effects_icons)))
game.player.changed = true
self.c_list:drawItem(item)
end,}
end
if game.uiset:checkGameOption("icons_hotkeys") then
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"Uses the icons hotkeys toolbar or the textual one.#WHITE#"}
list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Icons hotkey toolbar#WHITE##{normal}#", status=function(item)
return tostring(config.settings.tome.hotkey_icons and "enabled" or "disabled")
end, fct=function(item)
config.settings.tome.hotkey_icons = not config.settings.tome.hotkey_icons
game:saveSettings("tome.hotkey_icons", ("tome.hotkey_icons = %s\n"):format(tostring(config.settings.tome.hotkey_icons)))
game.player.changed = true
game:resizeIconsHotkeysToolbar()
self.c_list:drawItem(item)
end,}
end
if self:isTome() then
if game.uiset:checkGameOption("icons_temp_effects") then
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"Uses the icons for status effects instead of text.#WHITE#"}
list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Icons status effects#WHITE##{normal}#", status=function(item)
return tostring(config.settings.tome.effects_icons and "enabled" or "disabled")
end, fct=function(item)
config.settings.tome.effects_icons = not config.settings.tome.effects_icons
game:saveSettings("tome.effects_icons", ("tome.effects_icons = %s\n"):format(tostring(config.settings.tome.effects_icons)))
if self:isTome() then game.player.changed = true end
self.c_list:drawItem(item)
end,}
end
if game.uiset:checkGameOption("hotkeys_rows") then
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"Number of rows to show in the icons hotkeys toolbar.#WHITE#"}
list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Icons hotkey toolbar rows#WHITE##{normal}#", status=function(item)
return tostring(config.settings.tome.hotkey_icons_rows)
end, fct=function(item)
game:registerDialog(GetQuantity.new("Number of icons rows", "From 1 to 4", config.settings.tome.hotkey_icons_rows, 4, function(qty)
qty = util.bound(qty, 1, 4)
game:saveSettings("tome.hotkey_icons_rows", ("tome.hotkey_icons_rows = %d\n"):format(qty))
config.settings.tome.hotkey_icons_rows = qty
game:resizeIconsHotkeysToolbar()
if game.uiset:checkGameOption("icons_hotkeys") then
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"Uses the icons hotkeys toolbar or the textual one.#WHITE#"}
list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Icons hotkey toolbar#WHITE##{normal}#", status=function(item)
return tostring(config.settings.tome.hotkey_icons and "enabled" or "disabled")
end, fct=function(item)
config.settings.tome.hotkey_icons = not config.settings.tome.hotkey_icons
game:saveSettings("tome.hotkey_icons", ("tome.hotkey_icons = %s\n"):format(tostring(config.settings.tome.hotkey_icons)))
if self:isTome() then game.player.changed = true game:resizeIconsHotkeysToolbar() end
self.c_list:drawItem(item)
end, 1))
end,}
end,}
end
if game.uiset:checkGameOption("hotkeys_rows") then
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"Number of rows to show in the icons hotkeys toolbar.#WHITE#"}
list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Icons hotkey toolbar rows#WHITE##{normal}#", status=function(item)
return tostring(config.settings.tome.hotkey_icons_rows)
end, fct=function(item)
game:registerDialog(GetQuantity.new("Number of icons rows", "From 1 to 4", config.settings.tome.hotkey_icons_rows, 4, function(qty)
qty = util.bound(qty, 1, 4)
game:saveSettings("tome.hotkey_icons_rows", ("tome.hotkey_icons_rows = %d\n"):format(qty))
config.settings.tome.hotkey_icons_rows = qty
if self:isTome() then game:resizeIconsHotkeysToolbar() end
self.c_list:drawItem(item)
end, 1))
end,}
end
end
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"Size of the icons in the hotkeys toolbar.#WHITE#"}
......@@ -265,7 +275,7 @@ function _M:generateListUi()
qty = util.bound(qty, 32, 64)
game:saveSettings("tome.hotkey_icons_size", ("tome.hotkey_icons_size = %d\n"):format(qty))
config.settings.tome.hotkey_icons_size = qty
game:resizeIconsHotkeysToolbar()
if self:isTome() then game:resizeIconsHotkeysToolbar() end
self.c_list:drawItem(item)
end, 32))
end,}
......@@ -288,36 +298,38 @@ function _M:generateListUi()
self.c_list:drawItem(item)
end,}
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString[[Toggles between various tactical information display:
if self:isTome() then
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString[[Toggles between various tactical information display:
- Combined healthbar and small tactical frame
- Combined healthbar and big tactical frame
- Only healthbar
- No tactical information at all
#{italic}#You can also change this directly ingame by pressing shift+T.#{normal}##WHITE#]]}
list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Tactical overlay#WHITE##{normal}#", status=function(item)
local vs = "Combined Small"
if game.always_target == "old" then
local vs = "Combined Big"
elseif game.always_target == "health" then
local vs = "Only Healthbars"
elseif game.always_target == nil then
local vs = "Nothing"
elseif game.always_target == true then
list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Tactical overlay#WHITE##{normal}#", status=function(item)
local vs = "Combined Small"
end
return vs
end, fct=function(item)
Dialog:listPopup("Tactical overlay", "Select overlay mode", {
{name="Combined Small", mode=true},
{name="Combined Big", mode="old"},
{name="Only Healthbars", mode="health"},
{name="Nothing", mode=nil},
}, 300, 200, function(sel)
if not sel then return end
game:setTacticalMode(sel.mode)
end)
end,}
if game.always_target == "old" then
local vs = "Combined Big"
elseif game.always_target == "health" then
local vs = "Only Healthbars"
elseif game.always_target == nil then
local vs = "Nothing"
elseif game.always_target == true then
local vs = "Combined Small"
end
return vs
end, fct=function(item)
Dialog:listPopup("Tactical overlay", "Select overlay mode", {
{name="Combined Small", mode=true},
{name="Combined Big", mode="old"},
{name="Only Healthbars", mode="health"},
{name="Nothing", mode=nil},
}, 300, 200, function(sel)
if not sel then return end
game:setTacticalMode(sel.mode)
end)
end,}
end
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"Toggles between a normal or flagpost tactical bars.#WHITE#"}
list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Flagpost tactical bars#WHITE##{normal}#", status=function(item)
......@@ -344,7 +356,7 @@ function _M:generateListUi()
config.settings.tome.fullscreen_stun = not config.settings.tome.fullscreen_stun
game:saveSettings("tome.fullscreen_stun", ("tome.fullscreen_stun = %s\n"):format(tostring(config.settings.tome.fullscreen_stun)))
self.c_list:drawItem(item)
if game.player.updateMainShader then game.player:updateMainShader() end
if self:isTome() then if game.player.updateMainShader then game.player:updateMainShader() end end
end,}
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"If disabled you will not get a fullscreen notification of confusion effects. Beware.#WHITE#"}
......@@ -354,7 +366,7 @@ function _M:generateListUi()
config.settings.tome.fullscreen_confusion = not config.settings.tome.fullscreen_confusion
game:saveSettings("tome.fullscreen_confusion", ("tome.fullscreen_confusion = %s\n"):format(tostring(config.settings.tome.fullscreen_confusion)))
self.c_list:drawItem(item)
if game.player.updateMainShader then game.player:updateMainShader() end
if self:isTome() then if game.player.updateMainShader then game.player:updateMainShader() end end
end,}
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"Toggles advanced weapon statistics display.#WHITE#"}
......
......@@ -56,12 +56,23 @@ function _M:init()
self.key:addBinds{
EXIT = function()
if self.changed then game:setupDisplayMode(true) end
if self.changed then
if self:isTome() then
game:setupDisplayMode(true)
else
local gfx = config.settings.tome.gfx
game:saveSettings("tome.gfx", ('tome.gfx = {tiles=%q, size=%q, tiles_custom_dir=%q, tiles_custom_moddable=%s, tiles_custom_adv=%s}\n'):format(gfx.tiles, gfx.size, gfx.tiles_custom_dir or "", gfx.tiles_custom_moddable and "true" or "false", gfx.tiles_custom_adv and "true" or "false"))
end
end
game:unregisterDialog(self)
end,
}
end
function _M:isTome()
return game.__mod_info.short_name == "tome"
end
function _M:doCustomTiles()
local d = Dialog.new("Custom Tileset", 100, 100)
......
......@@ -31,46 +31,9 @@ local Level = require "engine.Level"
local FontPackage = require "engine.FontPackage"
-- Init settings
config.settings.tome = config.settings.tome or {}
profile.mod.allow_build = profile.mod.allow_build or {}
--if type(config.settings.tome.autosave) == "nil" then
config.settings.tome.autosave = true
--end
if not config.settings.tome.smooth_move then config.settings.tome.smooth_move = 3 end
if type(config.settings.tome.twitch_move) == "nil" then config.settings.tome.twitch_move = true end
if not config.settings.tome.gfx then
local w, h = core.display.size()
if w >= 1000 then config.settings.tome.gfx = {size="64x64", tiles="shockbolt"}
else config.settings.tome.gfx = {size="48x48", tiles="shockbolt"}
end
end
if config.settings.tome.gfx.tiles == "mushroom" then config.settings.tome.gfx.tiles="shockbolt" end
if type(config.settings.tome.weather_effects) == "nil" then config.settings.tome.weather_effects = true end
if type(config.settings.tome.smooth_fov) == "nil" then config.settings.tome.smooth_fov = true end
if type(config.settings.tome.daynight) == "nil" then config.settings.tome.daynight = true end
if type(config.settings.tome.hotkey_icons) == "nil" then config.settings.tome.hotkey_icons = true end
if type(config.settings.tome.effects_icons) == "nil" then config.settings.tome.effects_icons = true end
if type(config.settings.tome.autoassign_talents_on_birth) == "nil" then config.settings.tome.autoassign_talents_on_birth = true end
if type(config.settings.tome.chat_log) == "nil" then config.settings.tome.chat_log = true end
if type(config.settings.tome.actor_based_movement_mode) == "nil" then config.settings.tome.actor_based_movement_mode = true end
if type(config.settings.tome.rest_before_explore) == "nil" then config.settings.tome.rest_before_explore = true end
if type(config.settings.tome.lore_popup) == "nil" then config.settings.tome.lore_popup = true end
if type(config.settings.tome.auto_hotkey_object) == "nil" then config.settings.tome.auto_hotkey_object = true end
if type(config.settings.tome.immediate_melee_keys) == "nil" then config.settings.tome.immediate_melee_keys = true end
if type(config.settings.tome.immediate_melee_keys_auto) == "nil" then config.settings.tome.immediate_melee_keys_auto = true end
if type(config.settings.tome.allow_online_events) == "nil" then config.settings.tome.allow_online_events = true end
if type(config.settings.tome.small_frame_side) == "nil" then config.settings.tome.small_frame_side = true end
if type(config.settings.tome.fullscreen_stun) == "nil" then config.settings.tome.fullscreen_stun = true end
if type(config.settings.tome.fullscreen_confusion) == "nil" then config.settings.tome.fullscreen_confusion = true end
if type(config.settings.tome.show_grid_lines) == "nil" then config.settings.tome.show_grid_lines = false end
if not config.settings.tome.fonts then config.settings.tome.fonts = {type="fantasy", size="normal"} end
if not config.settings.tome.ui_theme2 then config.settings.tome.ui_theme2 = "metal" end
if not config.settings.tome.uiset_mode then config.settings.tome.uiset_mode = "Minimalist" end
if not config.settings.tome.log_lines then config.settings.tome.log_lines = 5 end
if not config.settings.tome.log_fade then config.settings.tome.log_fade = 3 end
if not config.settings.tome.scroll_dist then config.settings.tome.scroll_dist = 20 end
if not config.settings.tome.hotkey_icons_rows then config.settings.tome.hotkey_icons_rows = 1 end
if not config.settings.tome.hotkey_icons_size then config.settings.tome.hotkey_icons_size = 48 end
dofile("/mod/settings.lua")
-- Apply some settings
Map.smooth_scroll = config.settings.tome.smooth_move
Map.faction_danger2 = "tactical_danger.png"
Map.faction_danger1 = "tactical_enemy_strong.png"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment