Changeset - 4e0b6590547a
[Not reviewed]
default
0 2 0
Silverwing - 6 years ago 2018-12-14 18:39:22

Proper show of HitPoints
2 files changed with 12 insertions and 8 deletions:
0 comments (0 inline, 0 general)
battlefield.lua
Show inline comments
 
@@ -128,12 +128,13 @@ hp_indicator = obj {
 

	
 
hp_indicator:disable();
 

	
 

	
 
battlefield = function(tab)
 
    local make_turn = tab.make_turn;
 
    tab.showhp = true;
 
    tab.nosave = true;
 
    tab.noautosave = true;
 
    tab.isPassable = function(s, x, y)
 
        if (x < 1 or x > 7 or y < 1 or y > 7 or tab.map[y][x] > 0) then
 
            return false;
 
        end;
 
@@ -252,23 +253,18 @@ battlefield = function(tab)
 
    end;
 

	
 
    local entered = tab.entered;
 

	
 
    tab.entered = function(s)
 
        s:check_walk();
 
        hp_indicator:enable();
 
        if (type(entered) == 'function') then
 
            return entered(s);
 
        else
 
            return entered;
 
        end;
 
    end;
 
    
 
    tab.left = function(s)
 
        hp_indicator:disable();
 
    end;
 

	
 
    tab.onreload = function(s)
 
        here():make_turn();
 
    end;
 

	
 
    tab.make_turn = function(s)
utils.lua
Show inline comments
 
@@ -133,16 +133,24 @@ function kh_vroom(disp, target, nam, see
 
		seen_level = seen_level;
 
		--enter = _kh.vroom_enter;
 
		--save = _kh.vroom_save;
 
	};
 
end;
 
 
--[[room = inherit(room, function(v)
 
    v.forcedsc = true;
 
room = inherit(room, function(v)
 
    v.entered = stead.hook(v.entered, function(f, s, ...)
 
        if s.showhp then
 
            hp_indicator:enable();
 
        else
 
            hp_indicator:disable();
 
        end;
 
        return f(s, ...)
 
    end)
 
 
    return v;
 
end);]]
 
end)
 
 
dlg = inherit(dlg, function(v)
 
    v.hideinv = true;
 
    return v;
 
end);
 
0 comments (0 inline, 0 general)