Skip to content

Commit a20d4af

Browse files
committed
Fix health screen not opening for adjacent chars
Fixes #132.
1 parent 8009bb5 commit a20d4af

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/turnbased/helpers/InteractionInput.lua

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,14 @@ function InteractionInput.new()
4646
-- @return (boolean) True if an action was created, false otherwise.
4747
--
4848
function self:request( target, character )
49+
-- Check health of enemy characters.
50+
if target:isOccupied() and target:getCharacter():getFaction():getType() ~= character:getFaction():getType() then
51+
ScreenManager.push( 'health', target:getCharacter() );
52+
return true;
53+
end
54+
4955
-- Characters can only interact with adjacent tiles.
5056
if not target:isAdjacent( character:getTile() ) then
51-
if target:isOccupied() and target:getCharacter():getFaction():getType() ~= character:getFaction():getType() then
52-
ScreenManager.push( 'health', target:getCharacter() );
53-
return true;
54-
end
5557
return false;
5658
end
5759

0 commit comments

Comments
 (0)