diff --git a/battlefield.lua b/battlefield.lua --- a/battlefield.lua +++ b/battlefield.lua @@ -131,6 +131,7 @@ 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) @@ -255,17 +256,12 @@ battlefield = function(tab) 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(); diff --git a/utils.lua b/utils.lua --- a/utils.lua +++ b/utils.lua @@ -136,10 +136,18 @@ function kh_vroom(disp, target, nam, see }; 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;