Formatting corrections

This commit is contained in:
Foz 2016-05-01 18:18:42 -04:00
parent 6e3549bd31
commit 6d76b0bdf3
4 changed files with 36 additions and 24 deletions

View File

@ -1,7 +1,7 @@
-- copied config section from technic
worldpath = minetest.get_worldpath()
landrush.config = Settings(worldpath.."/landrush.conf")
landrush.config = Settings(worldpath .. "/landrush.conf")
local conf_table = landrush.config:to_table()
@ -29,8 +29,18 @@ end
-- Create the config file if it doesn't exist
landrush.config:write()
-- These are items that can be dug in unclaimed areas when landrush.config:get_bool("requireClaim") is true
landrush.global_dig_list = {["default:ladder"]=true,["default:leaves"]=true,["default:tree"]=true,["default:grass"]=true,["default:grass_1"]=true,["default:grass_2"]=true,["default:grass_3"]=true,["default:grass_4"]=true}
-- These are items that can be dug in unclaimed areas when
-- landrush.config:get_bool("requireClaim") is true
landrush.global_dig_list = {
["default:ladder"]=true,
["default:leaves"]=true,
["default:tree"]=true,
["default:grass"]=true,
["default:grass_1"]=true,
["default:grass_2"]=true,
["default:grass_3"]=true,
["default:grass_4"]=true
}
if minetest.get_modpath("whoison") then
landrush.whoison=true

View File

@ -45,17 +45,16 @@ end
function landrush.get_distance(pos1,pos2)
if ( pos1 ~= nil and pos2 ~= nil ) then
return math.abs(math.floor(math.sqrt( (pos1.x - pos2.x)^2 + (pos1.z - pos2.z)^2 )))
else
return 0
return math.floor(math.sqrt( (pos1.x - pos2.x)^2 + (pos1.z - pos2.z)^2 ))
end
return 0
end
function landrush.get_timeonline(name)
-- a wrapper for whoison.getTimeOnline since whoison is an optional dependancy
-- a wrapper for whoison.getTimeOnline
-- since whoison is an optional dependency
if ( landrush.whoison == true ) then
return (whoison.getTimeOnline(name) / 60)
else
return -1
end
return -1
end

View File

@ -21,11 +21,15 @@ if ( landrush.config:get_bool("enableHud") ) then
dofile(path.."/hud.lua")
end
minetest.register_privilege("landrush", "Allows player to dig and build anywhere, and use the landrush chat commands.")
minetest.register_privilege(
"landrush",
"Allows player to dig and build anywhere, " ..
"and use the landrush chat commands."
)
landrush.load_claims()
minetest.register_node("landrush:landclaim", {
minetest.register_node("landrush:landclaim", {
description = "Land Rush Land Claim",
tiles = {"landrush_landclaim.png"},
groups = {oddly_breakable_by_hand=2},
@ -37,12 +41,12 @@ landrush.load_claims()
minetest.chat_send_player(player,"Guests cannot claim land")
return itemstack
end
if ( pointed_thing.above.y < -200 ) then
minetest.chat_send_player(player,"You cannot claim below -200")
return itemstack
end
if owner then
minetest.chat_send_player(player, "This area is already owned by "..owner)
else
@ -61,20 +65,20 @@ landrush.load_claims()
return itemstack
end
end,
})
})
minetest.register_craft({
output = 'landrush:landclaim',
recipe = {
{'default:stone','default:steel_ingot','default:stone'},
{'default:steel_ingot','default:mese_crystal','default:steel_ingot'},
{'default:stone','default:steel_ingot','default:stone'}
}
})
output = 'landrush:landclaim',
recipe = {
{'default:stone','default:steel_ingot','default:stone'},
{'default:steel_ingot','default:mese_crystal','default:steel_ingot'},
{'default:stone','default:steel_ingot','default:stone'}
}
})
minetest.register_alias("landclaim", "landrush:landclaim")
minetest.register_alias("landrush:landclaim_b","landrush:landclaim")
minetest.register_entity("landrush:showarea",{
on_activate = function(self, staticdata, dtime_s)
minetest.after(16,function()

View File

@ -147,9 +147,8 @@ landrush.default_is_protected = minetest.is_protected
function minetest.is_protected (pos, name)
if ( landrush.can_interact(pos, name) ) then
return landrush.default_is_protected(pos,name)
else
return true
end
return true
end
minetest.register_on_protection_violation( landrush.protection_violation )