mirror of
https://github.com/minetest-mods/gauges.git
synced 2024-12-23 01:10:23 +01:00
More reliable version checking
This commit is contained in:
parent
9425b8dcf5
commit
b075262daf
@ -60,8 +60,8 @@ on that line.
|
|||||||
|
|
||||||
## Version compatibility
|
## Version compatibility
|
||||||
|
|
||||||
Gauges is currently primarily tested with Minetest 5.1.0 and 0.4.17. It may or may not work
|
Gauges is currently support Minetest 5.0+ and 0.4.17+. This does not work with older versions.
|
||||||
with newer or older versions. Issues arising in versions older than 5.0.0
|
Issues arising in versions older than 5.0
|
||||||
will generally not be fixed.
|
will generally not be fixed.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
9
init.lua
9
init.lua
@ -50,8 +50,13 @@ minetest.register_entity("gauges:hp_bar", {
|
|||||||
local function add_gauge(player)
|
local function add_gauge(player)
|
||||||
if player and minetest.is_player(player) then
|
if player and minetest.is_player(player) then
|
||||||
local entity = minetest.add_entity(player:get_pos(), "gauges:hp_bar")
|
local entity = minetest.add_entity(player:get_pos(), "gauges:hp_bar")
|
||||||
-- check for minetest_game 0.4.*
|
local height = 19
|
||||||
local height = minetest.get_modpath("player_api") and 19 or 9
|
|
||||||
|
-- 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:set_attach(player, "", {x=0, y=height, z=0}, {x=0, y=0, z=0})
|
||||||
entity:get_luaentity().wielder = player
|
entity:get_luaentity().wielder = player
|
||||||
|
Loading…
Reference in New Issue
Block a user