Skip to content

Commit

Permalink
Builtin/../misc.lua: Replace minetest. with core., improve codestyle (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ClobberXD authored and paramat committed Jul 9, 2018
1 parent a61e1a4 commit 498078b
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions builtin/game/misc.lua
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ local player_list = {}




function core.send_join_message(player_name) function core.send_join_message(player_name)
if not minetest.is_singleplayer() then if not core.is_singleplayer() then
core.chat_send_all("*** " .. player_name .. " joined the game.") core.chat_send_all("*** " .. player_name .. " joined the game.")
end end
end end
Expand Down Expand Up @@ -99,8 +99,8 @@ function core.is_player(player)
end end




function minetest.player_exists(name) function core.player_exists(name)
return minetest.get_auth_handler().get_auth(name) ~= nil return core.get_auth_handler().get_auth(name) ~= nil
end end




Expand All @@ -126,17 +126,19 @@ end




function core.hash_node_position(pos) function core.hash_node_position(pos)
return (pos.z+32768)*65536*65536 + (pos.y+32768)*65536 + pos.x+32768 return (pos.z + 32768) * 65536 * 65536
+ (pos.y + 32768) * 65536
+ pos.x + 32768
end end




function core.get_position_from_hash(hash) function core.get_position_from_hash(hash)
local pos = {} local pos = {}
pos.x = (hash%65536) - 32768 pos.x = (hash % 65536) - 32768
hash = math.floor(hash/65536) hash = math.floor(hash / 65536)
pos.y = (hash%65536) - 32768 pos.y = (hash % 65536) - 32768
hash = math.floor(hash/65536) hash = math.floor(hash / 65536)
pos.z = (hash%65536) - 32768 pos.z = (hash % 65536) - 32768
return pos return pos
end end


Expand Down Expand Up @@ -261,7 +263,7 @@ end




function core.close_formspec(player_name, formname) function core.close_formspec(player_name, formname)
return minetest.show_formspec(player_name, formname, "") return core.show_formspec(player_name, formname, "")
end end




Expand Down

0 comments on commit 498078b

Please sign in to comment.