Bump Attack Toggle Button

All new ideas for the upcoming releases of ToME 4.x.x should be discussed here

Moderator: Moderator

Post Reply
Message
Author
magelike
Halfling
Posts: 109
Joined: Mon Sep 26, 2011 4:31 am

Bump Attack Toggle Button

#1 Post by magelike »

I spoke about this with DarkGod and drquicksilver in IRC. It'd be pretty convenient to have a key binding that would allow the player to toggle bump attacking on and off. This would help prevent deaths that don't necessarily involve a lack of tactics or planning on the player's part. Even at full health, I've died multiple times because I happened to be holding down (or sometimes just tapping) a movement key before I could realize I was being attacked.

The following patch adds several new key bindings, the most important of which defaults to the 'b' key: This changes the player's movement mode from the "Default" state to the "Passive" state, preventing him from attacking enemies by bumping into them. The other new key bindings are similar to the regular movement keys, but they ignore the player's current movement mode, allowing him the convenience of being able to attack an enemy without the need to toggle between movement modes. Neutral creatures and allies will not be attacked as this is no different than the normal movement mode currently present in the game.

DarkGod: The below code is not the most up-to-date version. Consider it deprecated in favor of http://forums.te4.org/viewtopic.php?p=120933#p120933

Code: Select all

diff -crB original-tome-3.9.34/class/Game.lua tome-3.9.34/class/Game.lua
*** original-tome-3.9.34/class/Game.lua	2011-09-17 01:10:28.000000000 -0700
--- tome-3.9.34/class/Game.lua	2011-10-13 09:11:15.279700000 -0700
***************
*** 238,243 ****
--- 238,244 ----
  		self:updateCurrentChar()
  	end
  
+ 	self.bump_attack_disabled = false
  	self.always_target = true
  	local nb_unlocks, max_unlocks = self:countBirthUnlocks()
  	self.creating_player = true
***************
*** 469,475 ****
  function _M:save()
  	self.total_playtime = (self.total_playtime or 0) + (os.time() - (self.last_update or self.real_starttime))
  	self.last_update = os.time()
! 	return class.save(self, self:defaultSavedFields{difficulty=true, permadeath=true, to_re_add_actors=true, party=true, _chronoworlds=true, total_playtime=true, on_level_load_fcts=true, visited_zones=true}, true)
  end
  
  function _M:updateCurrentChar()
--- 470,476 ----
  function _M:save()
  	self.total_playtime = (self.total_playtime or 0) + (os.time() - (self.last_update or self.real_starttime))
  	self.last_update = os.time()
! 	return class.save(self, self:defaultSavedFields{difficulty=true, permadeath=true, to_re_add_actors=true, party=true, _chronoworlds=true, total_playtime=true, on_level_load_fcts=true, visited_zones=true, bump_attack_disabled=false}, true)
  end
  
  function _M:updateCurrentChar()
***************
*** 1129,1134 ****
--- 1130,1144 ----
  		RUN_RIGHT_UP = function() self.player:runInit(9) end,
  		RUN_RIGHT_DOWN = function() self.player:runInit(3) end,
  
+ 		ATTACK_OR_MOVE_LEFT = function() self.player:attackOrMoveDir(4) end,
+ 		ATTACK_OR_MOVE_RIGHT = function() self.player:attackOrMoveDir(6) end,
+ 		ATTACK_OR_MOVE_UP = function() self.player:attackOrMoveDir(8) end,
+ 		ATTACK_OR_MOVE_DOWN = function() self.player:attackOrMoveDir(2) end,
+ 		ATTACK_OR_MOVE_LEFT_UP = function() self.player:attackOrMoveDir(7) end,
+ 		ATTACK_OR_MOVE_LEFT_DOWN = function() self.player:attackOrMoveDir(1) end,
+ 		ATTACK_OR_MOVE_RIGHT_UP = function() self.player:attackOrMoveDir(9) end,
+ 		ATTACK_OR_MOVE_RIGHT_DOWN = function() self.player:attackOrMoveDir(3) end,
+ 
  		-- Hotkeys
  		HOTKEY_1 = not_wild(function() self.player:activateHotkey(1) end),
  		HOTKEY_2 = not_wild(function() self.player:activateHotkey(2) end),
***************
*** 1368,1374 ****
  
  		USERCHAT_SHOW_TALK = function()
  			self.show_userchat = not self.show_userchat
! 		end
  	}
  
  	self.key:setCurrent()
--- 1378,1394 ----
  
  		USERCHAT_SHOW_TALK = function()
  			self.show_userchat = not self.show_userchat
! 		end,
! 		
! 		TOGGLE_BUMP_ATTACK = function()
! 			if (self.bump_attack_disabled) then
! 				self.log("Movement Mode: #LIGHT_GREEN#Default#LAST#.")
! 				self.bump_attack_disabled = false
! 			else
! 				self.log("Movement Mode: #LIGHT_RED#Passive#LAST#.")
! 				self.bump_attack_disabled = true
! 			end
! 		end		
  	}
  
  	self.key:setCurrent()
diff -crB original-tome-3.9.34/class/Player.lua tome-3.9.34/class/Player.lua
*** original-tome-3.9.34/class/Player.lua	2011-09-17 01:10:28.000000000 -0700
--- tome-3.9.34/class/Player.lua	2011-10-13 08:49:09.891100000 -0700
***************
*** 1025,1027 ****
--- 1025,1034 ----
  	end
  end
  
+ function _M:attackOrMoveDir(dir)
+ 	local tmp = game.bump_attack_disabled
+ 	
+ 	game.bump_attack_disabled = false
+ 	self:moveDir(dir)
+ 	game.bump_attack_disabled = tmp
+ end
diff -crB original-tome-3.9.34/class/interface/Combat.lua tome-3.9.34/class/interface/Combat.lua
*** original-tome-3.9.34/class/interface/Combat.lua	2011-09-17 01:10:28.000000000 -0700
--- tome-3.9.34/class/interface/Combat.lua	2011-10-13 06:17:25.085500000 -0700
***************
*** 33,38 ****
--- 33,39 ----
  	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
  		return self:useTalent(self.T_ATTACK, nil, nil, nil, target)
  	elseif reaction >= 0 then
  		-- Talk ?
diff -crB original-tome-3.9.34/data/keybinds/tome.lua tome-3.9.34/data/keybinds/tome.lua
*** original-tome-3.9.34/data/keybinds/tome.lua	2011-08-04 11:34:24.000000000 -0700
--- tome-3.9.34/data/keybinds/tome.lua	2011-10-13 08:52:14.592700000 -0700
***************
*** 135,137 ****
--- 135,200 ----
  	group = "party",
  	name = "Give order to character 8",
  }
+ 
+ defineAction{
+ 	default = { "sym:_b:false:false:false:false" },
+ 	type = "TOGGLE_BUMP_ATTACK",
+ 	group = "movement",
+ 	name = "Toggle movement mode",
+ }
+ 
+ defineAction{
+ 	default = { "sym:_LEFT:true:false:false:false", "sym:_KP_4:true:false:false:false" },
+ 	type = "ATTACK_OR_MOVE_LEFT",
+ 	group = "movement",
+ 	name = "Attack left",
+ }
+ 
+ defineAction{
+ 	default = { "sym:_RIGHT:true:false:false:false", "sym:_KP_6:true:false:false:false" },
+ 	type = "ATTACK_OR_MOVE_RIGHT",
+ 	group = "movement",
+ 	name = "Attack right",
+ }
+ 
+ defineAction{
+ 	default = { "sym:_UP:true:false:false:false", "sym:_KP_8:true:false:false:false" },
+ 	type = "ATTACK_OR_MOVE_UP",
+ 	group = "movement",
+ 	name = "Attack up",
+ }
+ 
+ defineAction{
+ 	default = { "sym:_DOWN:true:false:false:false", "sym:_KP_2:true:false:false:false" },
+ 	type = "ATTACK_OR_MOVE_DOWN",
+ 	group = "movement",
+ 	name = "Attack down",
+ }
+ 
+ defineAction{
+ 	default = { "sym:_KP_7:true:false:false:false" },
+ 	type = "ATTACK_OR_MOVE_LEFT_UP",
+ 	group = "movement",
+ 	name = "Attack diagonally left and up",
+ }
+ 
+ defineAction{
+ 	default = { "sym:_KP_9:true:false:false:false" },
+ 	type = "ATTACK_OR_MOVE_RIGHT_UP",
+ 	group = "movement",
+ 	name = "Attack diagonally right and up",
+ }
+ 
+ defineAction{
+ 	default = { "sym:_KP_1:true:false:false:false" },
+ 	type = "ATTACK_OR_MOVE_LEFT_DOWN",
+ 	group = "movement",
+ 	name = "Attack diagonally left and down",
+ }
+ 
+ defineAction{
+ 	default = { "sym:_KP_3:true:false:false:false" },
+ 	type = "ATTACK_OR_MOVE_RIGHT_DOWN",
+ 	group = "movement",
+ 	name = "Attack diagonally right and down",
+ }
The patch applies to the b34 release.
Last edited by magelike on Sat Oct 15, 2011 4:19 pm, edited 7 times in total.

Grey
Loremaster
Posts: 3517
Joined: Thu Sep 23, 2010 10:18 pm
Location: London, England
Contact:

Re: Bump Attack Toggle Button

#2 Post by Grey »

Why are you holding down a movement key? You can either click to move towards an area safely (it interrupts on enemy sighting) or press shift + the direction key to fast move in that direction. Holding down a direction key is just asking for trouble!
http://www.gamesofgrey.com - My own T-Engine games!
Roguelike Radio - A podcast about roguelikes

magelike
Halfling
Posts: 109
Joined: Mon Sep 26, 2011 4:31 am

Re: Bump Attack Toggle Button

#3 Post by magelike »

Yeah, I know, but it's my preferred method of movement (unless I'm running from the level entrance to the exit, then I'll just click on the minimap).

greycat
Sher'Tul
Posts: 1396
Joined: Tue May 11, 2010 11:51 pm

Re: Bump Attack Toggle Button

#4 Post by greycat »

While holding down a movement key is indeed very bad, I really like the idea of being able to toggle move=attack on and off. I'd certainly use that on Archers and Archmages.

marvalis
Uruivellas
Posts: 683
Joined: Sun Sep 05, 2010 5:11 am

Re: Bump Attack Toggle Button

#5 Post by marvalis »

how about just a UI button autoattack on/off?

magelike
Halfling
Posts: 109
Joined: Mon Sep 26, 2011 4:31 am

Re: Bump Attack Toggle Button

#6 Post by magelike »

marvalis wrote:how about just a UI button autoattack on/off?
I considered something like that, but I don't know what DarkGod has planned for the UI. I prefer being able to press a key to toggle the functionality; however, I think that your suggestion would probably be a nice extra addition to the UI. Maybe an extra button next to the other ones on the bottom-left? When the default movement mode is enabled, the button is highlighted red and when passive mode is enabled, it's not. If not that, at least some other kind of visual cue to indicate which movement mode the player is currently using.

marvalis
Uruivellas
Posts: 683
Joined: Sun Sep 05, 2010 5:11 am

Re: Bump Attack Toggle Button

#7 Post by marvalis »

one with gray background and one transparent
passive-icon.png
passive-icon.png (1.81 KiB) Viewed 3204 times
passive-icon2.png
passive-icon2.png (2.25 KiB) Viewed 3204 times
Last edited by marvalis on Fri Oct 14, 2011 5:23 pm, edited 1 time in total.

marvalis
Uruivellas
Posts: 683
Joined: Sun Sep 05, 2010 5:11 am

Re: Bump Attack Toggle Button

#8 Post by marvalis »

The display could swap between the aggressive and passive icons when it is toggled.
aggressive-icon.png
aggressive-icon.png (2.49 KiB) Viewed 3204 times
aggressive-icon2.png
aggressive-icon2.png (2.86 KiB) Viewed 3204 times

magelike
Halfling
Posts: 109
Joined: Mon Sep 26, 2011 4:31 am

Re: Bump Attack Toggle Button

#9 Post by magelike »

Thanks a lot for those images - they look great. I went with the transparent icons. I was able to make our new button fit easily by folding the talent and creature display buttons into one button that switches states when activated (either by using the associated keybinding or by clicking the button). This patch also prints a message to the player when he toggles between talent and creature display (that first button on the bottom-left) and modifies the bottom-left buttons' tooltips to display the actual keys that their functionality is bound to. Additionally, the state of the talent/creature display button will now be preserved when reloading the game (previously, the variable was not set to save). As in the original version of the patch, movement mode will be saved as well

Screenshot 1

Screenshot 2

As usual, this patch applies to b34. Uninteresting notes about implementation after the code jump.

Code: Select all

diff -rupN original-tome-3.9.34/class/Game.lua tome-3.9.34/class/Game.lua
--- original-tome-3.9.34/class/Game.lua	2011-09-17 01:10:28.000000000 -0700
+++ tome-3.9.34/class/Game.lua	2011-10-15 09:16:52.934400000 -0700
@@ -238,6 +238,7 @@ 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
@@ -469,7 +470,7 @@ end
 function _M:save()
 	self.total_playtime = (self.total_playtime or 0) + (os.time() - (self.last_update or self.real_starttime))
 	self.last_update = os.time()
-	return class.save(self, self:defaultSavedFields{difficulty=true, permadeath=true, to_re_add_actors=true, party=true, _chronoworlds=true, total_playtime=true, on_level_load_fcts=true, visited_zones=true}, true)
+	return class.save(self, self:defaultSavedFields{difficulty=true, permadeath=true, to_re_add_actors=true, party=true, _chronoworlds=true, total_playtime=true, on_level_load_fcts=true, visited_zones=true, bump_attack_disabled=true, show_npc_list=true}, true)
 end
 
 function _M:updateCurrentChar()
@@ -1129,6 +1130,15 @@ function _M:setupCommands()
 		RUN_RIGHT_UP = function() self.player:runInit(9) end,
 		RUN_RIGHT_DOWN = function() self.player:runInit(3) end,
 
+		ATTACK_OR_MOVE_LEFT = function() self.player:attackOrMoveDir(4) end,
+		ATTACK_OR_MOVE_RIGHT = function() self.player:attackOrMoveDir(6) end,
+		ATTACK_OR_MOVE_UP = function() self.player:attackOrMoveDir(8) end,
+		ATTACK_OR_MOVE_DOWN = function() self.player:attackOrMoveDir(2) end,
+		ATTACK_OR_MOVE_LEFT_UP = function() self.player:attackOrMoveDir(7) end,
+		ATTACK_OR_MOVE_LEFT_DOWN = function() self.player:attackOrMoveDir(1) end,
+		ATTACK_OR_MOVE_RIGHT_UP = function() self.player:attackOrMoveDir(9) end,
+		ATTACK_OR_MOVE_RIGHT_DOWN = function() self.player:attackOrMoveDir(3) end,
+
 		-- Hotkeys
 		HOTKEY_1 = not_wild(function() self.player:activateHotkey(1) end),
 		HOTKEY_2 = not_wild(function() self.player:activateHotkey(2) end),
@@ -1319,6 +1329,18 @@ function _M:setupCommands()
 		TOGGLE_NPC_LIST = function()
 			self.show_npc_list = not self.show_npc_list
 			self.player.changed = true
+
+			if (self.show_npc_list) then
+				self.log("Displaying creatures.")
+			else
+				self.log("Displaying talents.")
+			end
+
+			-- Update tooltip display if we're hovering over the icon.
+			local mx, my = core.mouse.get()
+			if (mx < self.icons.w and my > self.icons.display_y) then
+				self:mouseIcon(mx, my - self.icons.display_y)
+			end
 		end,
 
 		SCREENSHOT = function() self:saveScreenshot() end,
@@ -1368,6 +1390,22 @@ function _M:setupCommands()
 
 		USERCHAT_SHOW_TALK = function()
 			self.show_userchat = not self.show_userchat
+		end,
+		
+		TOGGLE_BUMP_ATTACK = function()
+			if (self.bump_attack_disabled) then
+				self.log("Movement Mode: #LIGHT_GREEN#Default#LAST#.")
+				self.bump_attack_disabled = false
+			else
+				self.log("Movement Mode: #LIGHT_RED#Passive#LAST#.")
+				self.bump_attack_disabled = true
+			end
+			
+			-- Update tooltip display if we're hovering over the icon.
+			local mx, my = core.mouse.get()
+			if (mx < self.icons.w and my > self.icons.display_y) then
+				self:mouseIcon(mx, my - self.icons.display_y)
+			end
 		end
 	}
 
@@ -1436,9 +1474,9 @@ function _M:setupMouse(reset)
 		)
 	end, nil, "hotkeys", true)
 	-- Use icons
-	self.mouse:registerZone(self.icons.display_x, self.icons.display_y, self.icons.w, self.icons.h, function(button, mx, my, xrel, yrel, bx, by)
+	self.mouse:registerZone(self.icons.display_x, self.icons.display_y, self.icons.w, self.icons.h, function(button, mx, my, xrel, yrel, bx, by, event)
 		self:mouseIcon(bx, by)
-		if button == "left" then self:clickIcon(bx, by) end
+		if button == "left" and event == "button" then self:clickIcon(bx, by) end
 	end)
 	-- Tooltip over the player pane
 	self.mouse:registerZone(self.player_display.display_x, self.player_display.display_y, self.player_display.w, self.player_display.h - self.icons.h, function(button, mx, my, xrel, yrel, bx, by, event)
@@ -1749,7 +1787,9 @@ local _actors_icon, _actors_icon_w, _act
 local _main_menu_icon, _main_menu_icon_w, _main_menu_icon_h = core.display.loadImage("/data/gfx/ui/main-menu-icon.png"):glTexture()
 local _inventory_icon, _inventory_icon_w, _inventory_icon_h = core.display.loadImage("/data/gfx/ui/inventory-icon.png"):glTexture()
 local _charsheet_icon, _charsheet_icon_w, _charsheet_icon_h = core.display.loadImage("/data/gfx/ui/charsheet-icon.png"):glTexture()
-local _sel_icon, _sel_icon_w, _sel_icon_h = core.display.loadImage("/data/gfx/ui/icon-select.png"):glTexture()
+local _mm_aggressive_icon, _mm_aggressive_icon_w, _mm_aggressive_icon_h = core.display.loadImage("/data/gfx/ui/aggressive-icon.png"):glTexture()
+local _mm_passive_icon, _mm_passive_icon_w, _mm_passive_icon_h = core.display.loadImage("/data/gfx/ui/passive-icon.png"):glTexture()
+--local _sel_icon, _sel_icon_w, _sel_icon_h = core.display.loadImage("/data/gfx/ui/icon-select.png"):glTexture()
 
 function _M:displayUI()
 	local middle = self.w * 0.5
@@ -1761,13 +1801,21 @@ function _M:displayUI()
 
 	-- Icons
 	local x, y = icon_x, icon_y
-	_talents_icon:toScreenFull(x, y, _talents_icon_w, _talents_icon_h, _talents_icon_w, _talents_icon_h)
-	if not self.show_npc_list then _sel_icon:toScreenFull(x, y, _sel_icon_w, _sel_icon_h, _sel_icon_w, _sel_icon_h) end
-	x = x + _talents_icon_w
-	_actors_icon:toScreenFull(x, y, _actors_icon_w, _actors_icon_h, _actors_icon_w, _actors_icon_h)
-	if self.show_npc_list then _sel_icon:toScreenFull(x, y, _sel_icon_w, _sel_icon_h, _sel_icon_w, _sel_icon_h) end
+	if (not self.show_npc_list) then
+		_talents_icon:toScreenFull(x, y, _talents_icon_w, _talents_icon_h, _talents_icon_w, _talents_icon_h)
+	else
+		_actors_icon:toScreenFull(x, y, _actors_icon_w, _actors_icon_h, _actors_icon_w, _actors_icon_h)
+	end
 	x = x + _talents_icon_w
 
+	-- This is the old version of what's above. Probably should be deleted?
+--	_talents_icon:toScreenFull(x, y, _talents_icon_w, _talents_icon_h, _talents_icon_w, _talents_icon_h)
+--	if not self.show_npc_list then _sel_icon:toScreenFull(x, y, _sel_icon_w, _sel_icon_h, _sel_icon_w, _sel_icon_h) end
+--	x = x + _talents_icon_w
+--	_actors_icon:toScreenFull(x, y, _actors_icon_w, _actors_icon_h, _actors_icon_w, _actors_icon_h)
+--	if self.show_npc_list then _sel_icon:toScreenFull(x, y, _sel_icon_w, _sel_icon_h, _sel_icon_w, _sel_icon_h) end
+--	x = x + _talents_icon_w
+
 --	if self.logdisplay.changed then core.display.drawQuad(x, y, _sel_icon_w, _sel_icon_h, 139, 210, 77, glow) end
 --	_log_icon:toScreenFull(x, y, _log_icon_w, _log_icon_h, _log_icon_w, _log_icon_h)
 --	if not self.show_userchat then _sel_icon:toScreenFull(x, y, _sel_icon_w, _sel_icon_h, _sel_icon_w, _sel_icon_h) end
@@ -1788,6 +1836,12 @@ function _M:displayUI()
 	_main_menu_icon:toScreenFull(x, y, _main_menu_icon_w, _main_menu_icon_h, _main_menu_icon_w, _main_menu_icon_h)
 	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
+		_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)
+	end
 
 	-- Separators
 --	_sep_horiz.tex[1]:toScreenFull(0, 20, self.w, _sep_horiz[3], _sep_horiz.tex[2], _sep_horiz.tex[3])
@@ -1828,35 +1882,70 @@ end
 
 function _M:clickIcon(bx, by)
 	if bx < _talents_icon_w then
-		self.show_npc_list = false
-		self.player.changed = true
+		self.key:triggerVirtual("TOGGLE_NPC_LIST")
 	elseif bx < 2*_talents_icon_w then
-		self.show_npc_list = true
-		self.player.changed = true
-	elseif bx < 3*_talents_icon_w then
 		self.key:triggerVirtual("SHOW_INVENTORY")
-	elseif bx < 4*_talents_icon_w then
+	elseif bx < 3*_talents_icon_w then
 		self.key:triggerVirtual("SHOW_CHARACTER_SHEET")
-	elseif bx < 5*_talents_icon_w then
+	elseif bx < 4*_talents_icon_w then
 		self.key:triggerVirtual("EXIT")
-	elseif bx < 6*_talents_icon_w then
+	elseif bx < 5*_talents_icon_w then
 		self.key:triggerVirtual("SHOW_MESSAGE_LOG")
+	elseif bx < 6*_talents_icon_w then
+		self.key:triggerVirtual("TOGGLE_BUMP_ATTACK")
 	end
 end
 
 function _M:mouseIcon(bx, by)
+	local virtual
+	local key
+
 	if bx < _talents_icon_w then
-		self:tooltipDisplayAtMap(self.w, self.h, "Display talents\nToggle with #{bold}##GOLD#[tab]#LAST##{normal}#")
+		virtual = "TOGGLE_NPC_LIST"
+		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.show_npc_list) then
+			self:tooltipDisplayAtMap(self.w, self.h, "Displaying talents (#{bold}##GOLD#"..key.."#LAST##{normal}#)\nToggle for creature display")
+		else
+			self:tooltipDisplayAtMap(self.w, self.h, "Displaying creatures (#{bold}##GOLD#"..key.."#LAST##{normal}#)\nToggle for talent display#")
+		end
 	elseif bx < 2*_talents_icon_w then
-		self:tooltipDisplayAtMap(self.w, self.h, "Display creatures\nToggle with #{bold}##GOLD#[tab]#LAST##{normal}#")
+		virtual = "SHOW_INVENTORY"
+		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 (key == "I") then
+			self:tooltipDisplayAtMap(self.w, self.h, "#{bold}##GOLD#I#LAST##{normal}#nventory")
+		else
+			self:tooltipDisplayAtMap(self.w, self.h, "Inventory (#{bold}##GOLD#"..key.."#LAST##{normal}#)")
+		end
 	elseif bx < 3*_talents_icon_w then
-		self:tooltipDisplayAtMap(self.w, self.h, "#{bold}##GOLD#I#LAST##{normal}#nventory")
+		virtual = "SHOW_CHARACTER_SHEET"
+		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 (key == "C") then
+			self:tooltipDisplayAtMap(self.w, self.h, "#{bold}##GOLD#C#LAST##{normal}#haracter Sheet")
+		else
+			self:tooltipDisplayAtMap(self.w, self.h, "Character Sheet (#{bold}##GOLD#"..key.."#LAST##{normal}#)")
+		end
 	elseif bx < 4*_talents_icon_w then
-		self:tooltipDisplayAtMap(self.w, self.h, "#{bold}##GOLD#C#LAST##{normal}#haracter Sheet")
+		virtual = "EXIT"
+		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()
+		self:tooltipDisplayAtMap(self.w, self.h, "Main menu (#{bold}##GOLD#"..key.."#LAST##{normal}#)")
 	elseif bx < 5*_talents_icon_w then
-		self:tooltipDisplayAtMap(self.w, self.h, "Main menu (#{bold}##GOLD#Esc#LAST##{normal}#)")
+		virtual = "SHOW_MESSAGE_LOG"
+		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()
+		self:tooltipDisplayAtMap(self.w, self.h, "Show message/chat log (#{bold}##GOLD#"..key.."#LAST##{normal}#)")
 	elseif bx < 6*_talents_icon_w then
-		self:tooltipDisplayAtMap(self.w, self.h, "Show message/chat log (#{bold}##GOLD#ctrl+m#LAST##{normal}#)")
+		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
+			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")
+		end
 	end
 end
 
diff -rupN original-tome-3.9.34/class/Player.lua tome-3.9.34/class/Player.lua
--- original-tome-3.9.34/class/Player.lua	2011-09-17 01:10:28.000000000 -0700
+++ tome-3.9.34/class/Player.lua	2011-10-13 08:49:09.891100000 -0700
@@ -1025,3 +1025,10 @@ function _M:on_quest_status(quest, statu
 	end
 end
 
+function _M:attackOrMoveDir(dir)
+	local tmp = game.bump_attack_disabled
+	
+	game.bump_attack_disabled = false
+	self:moveDir(dir)
+	game.bump_attack_disabled = tmp
+end
diff -rupN original-tome-3.9.34/class/interface/Combat.lua tome-3.9.34/class/interface/Combat.lua
--- original-tome-3.9.34/class/interface/Combat.lua	2011-09-17 01:10:28.000000000 -0700
+++ tome-3.9.34/class/interface/Combat.lua	2011-10-13 06:17:25.085500000 -0700
@@ -33,6 +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
 		return self:useTalent(self.T_ATTACK, nil, nil, nil, target)
 	elseif reaction >= 0 then
 		-- Talk ?
Files original-tome-3.9.34/data/gfx/ui/aggressive-icon.png and tome-3.9.34/data/gfx/ui/aggressive-icon.png differ
Files original-tome-3.9.34/data/gfx/ui/passive-icon.png and tome-3.9.34/data/gfx/ui/passive-icon.png differ
diff -rupN original-tome-3.9.34/data/keybinds/tome.lua tome-3.9.34/data/keybinds/tome.lua
--- original-tome-3.9.34/data/keybinds/tome.lua	2011-08-04 11:34:24.000000000 -0700
+++ tome-3.9.34/data/keybinds/tome.lua	2011-10-13 08:52:14.592700000 -0700
@@ -135,3 +135,66 @@ defineAction{
 	group = "party",
 	name = "Give order to character 8",
 }
+
+defineAction{
+	default = { "sym:_b:false:false:false:false" },
+	type = "TOGGLE_BUMP_ATTACK",
+	group = "movement",
+	name = "Toggle movement mode",
+}
+
+defineAction{
+	default = { "sym:_LEFT:true:false:false:false", "sym:_KP_4:true:false:false:false" },
+	type = "ATTACK_OR_MOVE_LEFT",
+	group = "movement",
+	name = "Attack left",
+}
+
+defineAction{
+	default = { "sym:_RIGHT:true:false:false:false", "sym:_KP_6:true:false:false:false" },
+	type = "ATTACK_OR_MOVE_RIGHT",
+	group = "movement",
+	name = "Attack right",
+}
+
+defineAction{
+	default = { "sym:_UP:true:false:false:false", "sym:_KP_8:true:false:false:false" },
+	type = "ATTACK_OR_MOVE_UP",
+	group = "movement",
+	name = "Attack up",
+}
+
+defineAction{
+	default = { "sym:_DOWN:true:false:false:false", "sym:_KP_2:true:false:false:false" },
+	type = "ATTACK_OR_MOVE_DOWN",
+	group = "movement",
+	name = "Attack down",
+}
+
+defineAction{
+	default = { "sym:_KP_7:true:false:false:false" },
+	type = "ATTACK_OR_MOVE_LEFT_UP",
+	group = "movement",
+	name = "Attack diagonally left and up",
+}
+
+defineAction{
+	default = { "sym:_KP_9:true:false:false:false" },
+	type = "ATTACK_OR_MOVE_RIGHT_UP",
+	group = "movement",
+	name = "Attack diagonally right and up",
+}
+
+defineAction{
+	default = { "sym:_KP_1:true:false:false:false" },
+	type = "ATTACK_OR_MOVE_LEFT_DOWN",
+	group = "movement",
+	name = "Attack diagonally left and down",
+}
+
+defineAction{
+	default = { "sym:_KP_3:true:false:false:false" },
+	type = "ATTACK_OR_MOVE_RIGHT_DOWN",
+	group = "movement",
+	name = "Attack diagonally right and down",
+}
There's no need for _sel_icon* anymore because the talent/npc display buttons are no longer separate, so I commented out all code related to that in mod.class.Game. I had to add the event parameter to the mini-function in the mouse:registerZone() that calls mod.class.Game:clickIcon() because holding down left-click while moving the mouse over the toggleable buttons kept calling their respective functions, which I was able to stop by checking the event parameter to see if the event was a button click. mod.class.Game:mouseIcon() was heavily modified to implement the display of the proper keybinds in the tooltips. I didn't like resorting to addressing engine.class.KeyBind.binds_remap directly and there's probably a better way to do it, but that was what jumped out at me after a significant amount of tinkering with the code.

Post Reply