fix town creation

This commit is contained in:
Evert Prants 2019-06-02 10:43:36 +03:00
parent ea08c52b01
commit 24a7c30d62
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
2 changed files with 4 additions and 4 deletions

View File

@ -126,8 +126,8 @@ local function town_command (name, param)
return towny.create_town(nil, name, pr2)
elseif (pr1 == "invite" and not minetest.get_player_by_name(pr2)) then
return invite_respond(name, (pr2:lower() == "accept" or minetest.is_yes(pr2)))
elseif pr1 == "join" and towny.get_town_by_name(pr2) and not town then
return join_town(pr2,name,false)
elseif pr1 == "join" and not town then
return join_town(towny.get_town_by_name(pr2), name, false)
elseif pr1 == "show" or pr1 == "info" then
if not towny.get_town_by_name(pr2) then
return false, "No such town."

View File

@ -94,8 +94,8 @@ function towny.create_town(pos, player, name)
return err_msg(player, "You're already in a town! Please leave your current town before founding a new one!")
end
local _,__,distance = towny.regions.get_closest_town(pos)
if distance < towny.regions.distance * towny.regions.size and not towny_admin then
local tn,__,distance = towny.regions.get_closest_town(pos)
if tn and distance < towny.regions.distance * towny.regions.size and not towny_admin then
return err_msg(player, "This location is too close to another town!")
end