Skip to content
Snippets Groups Projects
Commit fdad41e3 authored by dg's avatar dg
Browse files

Movement mode (attack or not) is now per-actor

git-svn-id: http://svn.net-core.org/repos/t-engine4@4608 51575b47-30f0-44d4-a5cc-537603b46e54
parent 08ecdb12
No related branches found
No related tags found
No related merge requests found
......@@ -241,7 +241,6 @@ function _M:newGame()
self:updateCurrentChar()
end
self.bump_attack_disabled = false
self.always_target = true
local nb_unlocks, max_unlocks = self:countBirthUnlocks()
self.creating_player = true
......@@ -1437,12 +1436,14 @@ function _M:setupCommands()
end,
TOGGLE_BUMP_ATTACK = function()
if (self.bump_attack_disabled) then
local game_or_player = not config.settings.tome.actor_based_movement_mode and self or game.player
if game_or_player.bump_attack_disabled then
self.log("Movement Mode: #LIGHT_GREEN#Default#LAST#.")
self.bump_attack_disabled = false
game_or_player.bump_attack_disabled = false
else
self.log("Movement Mode: #LIGHT_RED#Passive#LAST#.")
self.bump_attack_disabled = true
game_or_player.bump_attack_disabled = true
end
-- Update tooltip display if we're hovering over the icon.
......@@ -1885,7 +1886,7 @@ function _M:displayUI()
x = x + _talents_icon_w
_log_icon:toScreenFull(x, y, _log_icon_w, _log_icon_h, _log_icon_w, _log_icon_h)
x = x + _talents_icon_w
if (not self.bump_attack_disabled) then
if (not config.settings.tome.actor_based_movement_mode and not self.bump_attack_disabled) or (config.settings.tome.actor_based_movement_mode and not self.player.bump_attack_disabled) then
_mm_aggressive_icon:toScreenFull(x, y, _mm_aggressive_icon_w, _mm_aggressive_icon_h, _mm_aggressive_icon_w, _mm_aggressive_icon_h)
else
_mm_passive_icon:toScreenFull(x, y, _mm_passive_icon_w, _mm_passive_icon_h, _mm_passive_icon_w, _mm_passive_icon_h)
......@@ -1989,7 +1990,7 @@ function _M:mouseIcon(bx, by)
virtual = "TOGGLE_BUMP_ATTACK"
key = self.key.binds_remap[virtual] ~= nil and self.key.binds_remap[virtual][1] or game.key:findBoundKeys(virtual)
key = (key ~= nil and game.key:formatKeyString(key) or "unbound"):capitalize()
if (not self.bump_attack_disabled) then
if (not config.settings.tome.actor_based_movement_mode and not self.bump_attack_disabled) or (config.settings.tome.actor_based_movement_mode and not self.player.bump_attack_disabled) then
self:tooltipDisplayAtMap(self.w, self.h, "Movement: #LIGHT_GREEN#Default#LAST# (#{bold}##GOLD#"..key.."#LAST##{normal}#)\nToggle for passive mode")
else
self:tooltipDisplayAtMap(self.w, self.h, "Movement: #LIGHT_RED#Passive#LAST# (#{bold}##GOLD#"..key.."#LAST##{normal}#)\nToggle for default mode")
......
......@@ -1069,9 +1069,10 @@ function _M:on_quest_status(quest, status, sub)
end
function _M:attackOrMoveDir(dir)
local tmp = game.bump_attack_disabled
local game_or_player = not config.settings.tome.actor_based_movement_mode and game or self
local tmp = game_or_player.bump_attack_disabled
game.bump_attack_disabled = false
game_or_player.bump_attack_disabled = false
self:moveDir(dir)
game.bump_attack_disabled = tmp
game_or_player.bump_attack_disabled = tmp
end
......@@ -33,7 +33,7 @@ function _M:bumpInto(target, x, y)
local reaction = self:reactionToward(target)
if reaction < 0 then
if target.encounterAttack and self.player then self:onWorldEncounter(target, x, y) return end
if game.player == self and game.bump_attack_disabled then return end
if game.player == self and ((not config.settings.tome.actor_based_movement_mode and game.bump_attack_disabled) or (config.settings.tome.actor_based_movement_mode and self.bump_attack_disabled)) then return end
return self:useTalent(self.T_ATTACK, nil, nil, nil, target)
elseif reaction >= 0 then
-- Talk ?
......
......@@ -234,6 +234,16 @@ function _M:generateList()
game:saveSettings("tome.autoassign_talents_on_birth", ("tome.autoassign_talents_on_birth = %s\n"):format(tostring(config.settings.tome.autoassign_talents_on_birth)))
self.c_list:drawItem(item)
end,}
--[[
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"Your movement mode depends on which character/creature you're currently controlling.#WHITE#"}
list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Actor-based movement mode#WHITE##{normal}#", status=function(item)
return tostring(config.settings.tome.actor_based_movement_mode and "enabled" or "disabled")
end, fct=function(item)
config.settings.tome.actor_based_movement_mode = not config.settings.tome.actor_based_movement_mode
game:saveSettings("tome.actor_based_movement_mode", ("tome.actor_based_movement_mode = %s\n"):format(tostring(config.settings.tome.actor_based_movement_mode)))
self.c_list:drawItem(item)
end,}
]]
self.list = list
end
......@@ -65,6 +65,7 @@ if type(config.settings.tome.daynight) == "nil" then config.settings.tome.daynig
if type(config.settings.tome.hotkey_icons) == "nil" then config.settings.tome.hotkey_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 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.log_lines then config.settings.tome.log_lines = 5 end
......
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