tidy code, fix hud error on 5.9dev
This commit is contained in:
parent
414f7922fd
commit
479efd8e8f
4 changed files with 21 additions and 5 deletions
|
|
@ -159,6 +159,7 @@ minetest.register_node("protector:protect_hidden", {
|
|||
floodable = false,
|
||||
drop = "",
|
||||
groups = {not_in_creative_inventory = 1, unbreakable = 1},
|
||||
is_ground_content = false,
|
||||
on_blast = function() end,
|
||||
-- 1px block inside door hinge near node top
|
||||
collision_box = {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ function register_door(name, def)
|
|||
inventory_image = def.inventory_image,
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if not pointed_thing.type == "node" then
|
||||
if pointed_thing.type ~= "node" then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ function register_door(name, def)
|
|||
end
|
||||
|
||||
pos.y = pos.y + dir
|
||||
if not minetest.get_node(pos).name == check_name then
|
||||
if minetest.get_node(pos).name ~= check_name then
|
||||
return false
|
||||
end
|
||||
if minetest.is_protected(pos, user:get_player_name()) then
|
||||
|
|
@ -166,6 +166,7 @@ function register_door(name, def)
|
|||
type = "fixed",
|
||||
fixed = def.selection_box_bottom
|
||||
},
|
||||
use_texture_alpha = def.use_texture_alpha,
|
||||
groups = def.groups,
|
||||
_mcl_hardness = 0.8,
|
||||
_mcl_blast_resistance = 1,
|
||||
|
|
@ -206,6 +207,7 @@ function register_door(name, def)
|
|||
type = "fixed",
|
||||
fixed = def.selection_box_top
|
||||
},
|
||||
use_texture_alpha = def.use_texture_alpha,
|
||||
groups = def.groups,
|
||||
_mcl_hardness = 0.8,
|
||||
_mcl_blast_resistance = 1,
|
||||
|
|
@ -246,6 +248,7 @@ function register_door(name, def)
|
|||
type = "fixed",
|
||||
fixed = def.selection_box_bottom
|
||||
},
|
||||
use_texture_alpha = def.use_texture_alpha,
|
||||
groups = def.groups,
|
||||
_mcl_hardness = 0.8,
|
||||
_mcl_blast_resistance = 1,
|
||||
|
|
@ -286,6 +289,7 @@ function register_door(name, def)
|
|||
type = "fixed",
|
||||
fixed = def.selection_box_top
|
||||
},
|
||||
use_texture_alpha = def.use_texture_alpha,
|
||||
groups = def.groups,
|
||||
_mcl_hardness = 0.8,
|
||||
_mcl_blast_resistance = 1,
|
||||
|
|
@ -318,6 +322,7 @@ local name = "protector:door_wood"
|
|||
register_door(name, {
|
||||
description = S("Protected Wooden Door"),
|
||||
inventory_image = "doors_wood.png^protector_logo.png",
|
||||
use_texture_alpha = "clip",
|
||||
groups = {
|
||||
snappy = 1, choppy = 2, dig_immediate = 2,
|
||||
unbreakable = 1, axey = 1, --door = 1
|
||||
|
|
@ -362,6 +367,7 @@ local name = "protector:door_steel"
|
|||
register_door(name, {
|
||||
description = S("Protected Steel Door"),
|
||||
inventory_image = "doors_steel.png^protector_logo.png",
|
||||
use_texture_alpha = "clip",
|
||||
groups = {
|
||||
snappy = 1, bendy = 2, cracky = 1,
|
||||
level = mcl and 0 or 2, pickaxey = 2, unbreakable = 1, -- door = 1
|
||||
|
|
|
|||
14
hud.lua
14
hud.lua
|
|
@ -8,6 +8,7 @@ if radius > 22 then radius = 22 end
|
|||
local hud = {}
|
||||
local hud_timer = 0
|
||||
local hud_interval = (tonumber(minetest.settings:get("protector_hud_interval")) or 5)
|
||||
local hud_style = minetest.has_feature("hud_def_type_field")
|
||||
|
||||
if hud_interval > 0 then
|
||||
minetest.register_globalstep(function(dtime)
|
||||
|
|
@ -42,8 +43,7 @@ minetest.register_globalstep(function(dtime)
|
|||
|
||||
hud[name] = {}
|
||||
|
||||
hud[name].id = player:hud_add({
|
||||
hud_elem_type = "text",
|
||||
local hud_tab = {
|
||||
name = "Protector Area",
|
||||
number = 0xFFFF22,
|
||||
position = {x = 0, y = 0.95},
|
||||
|
|
@ -51,7 +51,15 @@ minetest.register_globalstep(function(dtime)
|
|||
text = hud_text,
|
||||
scale = {x = 200, y = 60},
|
||||
alignment = {x = 1, y = -1},
|
||||
})
|
||||
}
|
||||
|
||||
if hud_style then
|
||||
hud_tab["type"] = "text"
|
||||
else
|
||||
hud_tab["hud_elem_type"] = "text"
|
||||
end
|
||||
|
||||
hud[name].id = player:hud_add(hud_tab)
|
||||
|
||||
return
|
||||
else
|
||||
|
|
|
|||
1
init.lua
1
init.lua
|
|
@ -592,6 +592,7 @@ minetest.register_node("protector:protect2", {
|
|||
inventory_image = "protector_logo.png",
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
groups = {dig_immediate = 2, unbreakable = 1},
|
||||
is_ground_content = false,
|
||||
use_texture_alpha = "clip",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue