diff --git a/README.md b/README.md index ff9e1cb..7364049 100644 --- a/README.md +++ b/README.md @@ -60,8 +60,8 @@ on that line. ## Version compatibility -Gauges is currently primarily tested with Minetest 5.1.0 and 0.4.17. It may or may not work -with newer or older versions. Issues arising in versions older than 5.0.0 +Gauges is currently support Minetest 5.0+ and 0.4.17+. This does not work with older versions. +Issues arising in versions older than 5.0 will generally not be fixed. ## License diff --git a/init.lua b/init.lua index 22fede5..f82acd2 100644 --- a/init.lua +++ b/init.lua @@ -50,8 +50,13 @@ minetest.register_entity("gauges:hp_bar", { local function add_gauge(player) if player and minetest.is_player(player) then local entity = minetest.add_entity(player:get_pos(), "gauges:hp_bar") - -- check for minetest_game 0.4.* - local height = minetest.get_modpath("player_api") and 19 or 9 + local height = 19 + + -- check for Minetest 0.4.17 + local version = tonumber(minetest.get_version().string:sub(1, 1)) + if version and version < 5 then + height = 9 + end entity:set_attach(player, "", {x=0, y=height, z=0}, {x=0, y=0, z=0}) entity:get_luaentity().wielder = player