add mob_show_health flag to minetest.conf

This commit is contained in:
TenPlus1 2016-12-27 11:10:10 +00:00
parent 3ed2bd9ff6
commit 671fab54eb
2 changed files with 6 additions and 5 deletions

View File

@ -1,5 +1,5 @@
-- Mobs Api (26th December 2016) -- Mobs Api (27th December 2016)
mobs = {} mobs = {}
mobs.mod = "redo" mobs.mod = "redo"
@ -40,6 +40,7 @@ local creative = minetest.setting_getbool("creative_mode")
local spawn_protected = tonumber(minetest.setting_get("mobs_spawn_protected")) or 1 local spawn_protected = tonumber(minetest.setting_get("mobs_spawn_protected")) or 1
local remove_far = minetest.setting_getbool("remove_far_mobs") local remove_far = minetest.setting_getbool("remove_far_mobs")
local difficulty = tonumber(minetest.setting_get("mob_difficulty")) or 1.0 local difficulty = tonumber(minetest.setting_get("mob_difficulty")) or 1.0
local show_health = minetest.setting_getbool("mob_show_health") ~= false
-- calculate aoc range for mob counts -- calculate aoc range for mob counts
local aosrb = tonumber(minetest.setting_get("active_object_send_range_blocks")) local aosrb = tonumber(minetest.setting_get("active_object_send_range_blocks"))
@ -337,13 +338,13 @@ function check_for_death(self)
if not self.nametag2 then if not self.nametag2 then
self.nametag2 = self.nametag or "" self.nametag2 = self.nametag or ""
end end
if show_health then
self.htimer = 2 self.htimer = 2
self.nametag = "health: " .. self.health .. " of " .. self.hp_max self.nametag = "health: " .. self.health .. " of " .. self.hp_max
update_tag(self) update_tag(self)
end
return false return false
end end

View File

@ -1,5 +1,5 @@
MOB API (28th September 2016) MOB API (27th December 2016)
The mob api is a function that can be called on by other mods to add new animals or monsters into minetest. The mob api is a function that can be called on by other mods to add new animals or monsters into minetest.
@ -12,7 +12,7 @@ The mob api is a function that can be called on by other mods to add new animals
'remove_far_mobs' if true then mobs that are outside players visual range will be removed (default is false) 'remove_far_mobs' if true then mobs that are outside players visual range will be removed (default is false)
'mobname' can change specific mob chance rate (0 to disable) and spawn number e.g. mobs_animal:cow = 1000,5 'mobname' can change specific mob chance rate (0 to disable) and spawn number e.g. mobs_animal:cow = 1000,5
'mob_difficulty' sets difficulty level (health and hit damage multiplied by this number), defaults to 1.0. 'mob_difficulty' sets difficulty level (health and hit damage multiplied by this number), defaults to 1.0.
'mob_show_health' if false then punching mob will not show health status (true by default)
mobs:register_mob(name, definition) mobs:register_mob(name, definition)