meseportal_gui.lua 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. local reportFormspecViolation = function(submitter_name, violation)
  2. local path = minetest.get_worldpath().."/meseportals_incidents.log"
  3. local file = io.open( path, "r" )
  4. local data = ""
  5. if( file ) then
  6. data = file:read("*all")
  7. file:close()
  8. end
  9. data = data.."<"..os.date().."> "..submitter_name.." "..violation.."\n"
  10. file = io.open( path, "w" )
  11. if( file ) then
  12. file:write( data )
  13. file:close()
  14. end
  15. end
  16. local getCleanText = function(submitter_name, scan_text)
  17. if scan_text ~= nil then
  18. if string.find(scan_text, ";") or
  19. string.find(scan_text, "%[") or
  20. string.find(scan_text, "%]") or
  21. string.find(scan_text, "\\") then
  22. reportFormspecViolation(submitter_name, "sent dirty string of length "..string.len(scan_text)..": "..scan_text)
  23. --Call me paranoid. The length bit is so that someone can't get away with causing their report to line-break, and fabricating a fake report on the next line, essentially framing another player as well as themself.
  24. return ""
  25. else
  26. return scan_text
  27. end
  28. else
  29. return nil
  30. end
  31. end
  32. meseportals.searchportals = function(pos, player_name, isAdmin)
  33. meseportals_gui["players"][player_name]["own_portals"]={}
  34. meseportals_gui["players"][player_name]["public_portals"]={}
  35. local own_portals_count=0
  36. local public_portals_count=0
  37. for __,portal in ipairs(meseportals_network[player_name]) do
  38. if portal["pos"].x==pos.x and portal["pos"].y==pos.y and portal["pos"].z==pos.z then
  39. --current_portal=portals
  40. else
  41. own_portals_count=own_portals_count+1
  42. if string.find(portal["description"], meseportals_gui["players"][player_name]["query"]) then
  43. table.insert(meseportals_gui["players"][player_name]["own_portals"],portal)
  44. end
  45. end
  46. end
  47. -- get all public portals
  48. for __,tab in ipairs(meseportals["registered_players"]) do
  49. local temp=tab["player_name"]
  50. for __,portal in ipairs(meseportals_network[temp]) do
  51. if string.find(portal["description"], meseportals_gui["players"][player_name]["query"]) then
  52. if portal["type"]=="public" or portal["owner"] == player_name or isAdmin or not meseportals.allowPrivatePortals then
  53. if portal["pos"].x==pos.x and portal["pos"].y==pos.y and portal["pos"].z==pos.z then
  54. --current_portal=portals
  55. else
  56. public_portals_count=public_portals_count+1
  57. table.insert(meseportals_gui["players"][player_name]["public_portals"],portal)
  58. end
  59. end
  60. end
  61. end
  62. end
  63. meseportals_gui["players"][player_name]["own_portals_count"]=own_portals_count
  64. meseportals_gui["players"][player_name]["public_portals_count"]=public_portals_count
  65. end
  66. --show formspec to player
  67. meseportals.portalFormspecHandler = function(pos, _, clicker, _)
  68. if (meseportals.findPortal(pos) ~= nil) then
  69. local player_name = clicker:get_player_name()
  70. local isAdmin = minetest.check_player_privs(clicker, {msp_admin=true})
  71. local owner=meseportals.findPortal(pos)["owner"]
  72. if meseportals.findPortal(pos)["type"] == "private" and player_name ~= owner and meseportals.allowPrivatePortals and not isAdmin then
  73. minetest.chat_send_player(clicker:get_player_name(), meseportals.findPortal(pos)["owner"] .." has set this portal to private.")
  74. return
  75. else
  76. local current_portal=meseportals.findPortal(pos)
  77. meseportals_gui["players"][player_name]["query"]=""
  78. meseportals.searchportals(pos, player_name, isAdmin)
  79. -- print(dump(meseportals_gui["players"][player_name]["public_portals"]))
  80. if current_portal == nil then
  81. print ("Portal not registered in network! Please remove it and place once again.")
  82. return nil
  83. end
  84. meseportals_gui["players"][player_name]["current_index"]=0
  85. meseportals_gui["players"][player_name]["temp_portal"]["owner"]=current_portal.owner
  86. meseportals_gui["players"][player_name]["temp_portal"]["type"]=current_portal["type"]
  87. meseportals_gui["players"][player_name]["temp_portal"]["description"]=current_portal["description"]
  88. meseportals_gui["players"][player_name]["temp_portal"]["pos"]={}
  89. meseportals_gui["players"][player_name]["temp_portal"]["pos"] = vector.new(pos)
  90. if current_portal["destination"] then
  91. meseportals_gui["players"][player_name]["temp_portal"]["destination_description"]=current_portal["destination_description"]
  92. meseportals_gui["players"][player_name]["temp_portal"]["destination_dir"]=current_portal["destination_dir"]
  93. meseportals_gui["players"][player_name]["temp_portal"]["destination"]={}
  94. meseportals_gui["players"][player_name]["temp_portal"]["destination"].x=current_portal["destination"].x
  95. meseportals_gui["players"][player_name]["temp_portal"]["destination"].y=current_portal["destination"].y
  96. meseportals_gui["players"][player_name]["temp_portal"]["destination"].z=current_portal["destination"].z
  97. else
  98. meseportals_gui["players"][player_name]["temp_portal"]["destination"]=nil
  99. end
  100. meseportals_gui["players"][player_name]["dest_type"]="all"
  101. local formspec=meseportals.get_formspec(player_name,"main")
  102. meseportals_gui["players"][player_name]["formspec"]=formspec
  103. if formspec ~=nil then minetest.show_formspec(player_name, "meseportals_main", formspec) end
  104. end
  105. else
  106. minetest.chat_send_player(clicker:get_player_name(), "This portal is broken.")
  107. end
  108. end
  109. -- get_formspec
  110. meseportals.get_formspec = function(player_name,page)
  111. if player_name==nil then return nil end
  112. meseportals_gui["players"][player_name]["current_page"]=page
  113. local temp_portal=meseportals_gui["players"][player_name]["temp_portal"]
  114. local isAdmin = minetest.check_player_privs(player_name, {msp_admin=true})
  115. local formspec = "size[14,9.8]"
  116. --background
  117. formspec = formspec .."background[-0.19,-0.25;14.38,10.6;meseportal_ui_form_bg.png]"
  118. formspec = formspec.."label[0,0.0;Mese Portal ("
  119. if meseportals.allowPrivatePortals then
  120. formspec=formspec..temp_portal["owner"]
  121. end
  122. formspec = formspec..")]"
  123. formspec = formspec.."label[0,.5;Position: ("..temp_portal["pos"].x..","..temp_portal["pos"].y..","..temp_portal["pos"].z..")]"
  124. if player_name == temp_portal["owner"] or isAdmin or not meseportals.allowPrivatePortals then
  125. if meseportals.allowPrivatePortals then
  126. formspec = formspec.."image_button[3.5,.6;.6,.6;meseportal_toggle_icon.png;toggle_type;]"
  127. formspec = formspec.."label[4,.5;Type: "..temp_portal["type"].."]"
  128. end
  129. formspec = formspec.."image_button[6.5,.6;.6,.6;meseportal_pencil_icon.png;edit_desc;]"
  130. end
  131. formspec = formspec.."label[0,1.1;Destination: ]"
  132. if temp_portal["destination"] then
  133. if meseportals.findPortal(temp_portal["destination"]) then
  134. if isAdmin or meseportals.findPortal(temp_portal["destination"])["type"] ~= "private" or player_name == meseportals.findPortal(temp_portal["destination"])["owner"] or not meseportals.allowPrivatePortals then
  135. formspec = formspec.."label[2.5,1.1;"..temp_portal["destination_description"].." ("..temp_portal["destination"].x..","..temp_portal["destination"].y..","..temp_portal["destination"].z..") "
  136. if isAdmin then
  137. formspec = formspec.."("..meseportals.findPortal(temp_portal["destination"])["type"]..")"
  138. end
  139. formspec = formspec.."]"
  140. else
  141. formspec = formspec.."label[2.5,1.1;Private Portal]"
  142. end
  143. else
  144. formspec = formspec.."label[2.5,1.1;Invalid Destination]"
  145. end
  146. formspec = formspec.."image_button[2,1.2;.6,.6;meseportal_cancel_icon.png;remove_dest;]"
  147. else
  148. formspec = formspec.."label[2,1.1;Not connected]"
  149. end
  150. formspec = formspec.."label[0,1.7;Aviable destinations:]"
  151. formspec = formspec.."image_button[3.5,1.8;.6,.6;meseportal_toggle_icon.png;toggle_dest_type;]"
  152. formspec = formspec.."label[4,1.7;Filter: "..meseportals_gui["players"][player_name]["dest_type"].."]"
  153. formspec = formspec.."image_button[12.6,1.375;.8,.8;meseportal_ui_search_icon.png;update_search_query;]"
  154. formspec = formspec.."field[9.5,1.6;3.5,1;search_box;Search...;"..meseportals_gui["players"][player_name]["query"].."]"
  155. if page=="main" then
  156. if player_name == temp_portal["owner"]or isAdmin or not meseportals.allowPrivatePortals then
  157. formspec = formspec.."image_button[6.5,.6;.6,.6;meseportal_pencil_icon.png;edit_desc;]"
  158. end
  159. formspec = formspec.."label[7,.5;Description: "..temp_portal["description"].."]"
  160. end
  161. if page=="edit_desc" then
  162. if player_name == temp_portal["owner"]or isAdmin or not meseportals.allowPrivatePortals then
  163. formspec = formspec.."image_button[6.5,.6;.6,.6;meseportal_ok_icon.png;save_desc;]"
  164. end
  165. formspec = formspec.."field[7.3,.7;5,1;desc_box;Edit portal description:;"..temp_portal["description"].."]"
  166. end
  167. local list_index=meseportals_gui["players"][player_name]["current_index"]
  168. local page=math.ceil(list_index / 24)
  169. local pagemax
  170. if meseportals_gui["players"][player_name]["dest_type"] == "own" then
  171. pagemax = math.ceil((meseportals_gui["players"][player_name]["own_portals_count"] / 24))
  172. local x,y
  173. for y=0,7,1 do
  174. for x=0,2,1 do
  175. local portal_temp=meseportals_gui["players"][player_name]["own_portals"][list_index+1]
  176. if portal_temp then
  177. formspec = formspec.."image_button["..(x*4.5)..","..(2.5+y*.87)..";.6,.6;meseportal.png;list_button"..list_index..";]"
  178. formspec = formspec.."label["..(x*4.5+.5)..","..(2.3+y*.87)..";"
  179. if portal_temp["destination"] ~= nil then
  180. formspec = formspec.."<A> "
  181. end
  182. formspec = formspec.."("..portal_temp["pos"].x..","..portal_temp["pos"].y..","..portal_temp["pos"].z..") "..portal_temp["type"].."]"
  183. formspec = formspec.."label["..(x*4.5+.5)..","..(2.7+y*.87)..";"..portal_temp["description"].."]"
  184. end
  185. list_index=list_index+1
  186. end
  187. end
  188. else
  189. pagemax = math.ceil(meseportals_gui["players"][player_name]["public_portals_count"] / 24)
  190. local x,y
  191. for y=0,7,1 do
  192. for x=0,2,1 do
  193. local portal_temp=meseportals_gui["players"][player_name]["public_portals"][list_index+1]
  194. if portal_temp then
  195. formspec = formspec.."image_button["..(x*4.5)..","..(2.5+y*.87)..";.6,.6;meseportal.png;list_button"..list_index..";]"
  196. formspec = formspec.."label["..(x*4.5+.5)..","..(2.3+y*.87)..";"
  197. if portal_temp["destination"] ~= nil then
  198. formspec = formspec.."<A> "
  199. end
  200. formspec=formspec.."("..portal_temp["pos"].x..","..portal_temp["pos"].y..","..portal_temp["pos"].z..") "..portal_temp["owner"].."]"
  201. formspec = formspec.."label["..(x*4.5+.5)..","..(2.7+y*.87)..";"..portal_temp["description"]
  202. if isAdmin then
  203. formspec = formspec.." ("..portal_temp["type"]..")"
  204. end
  205. formspec = formspec.."]"
  206. end
  207. list_index=list_index+1
  208. end
  209. end
  210. end
  211. formspec=formspec.."label[7.5,1.7;Page: "..((pagemax > 0) and (page + 1) or 0).." of "..pagemax.."]"
  212. formspec = formspec.."image_button[6.5,1.8;.6,.6;meseportal_left_icon.png;page_left;]"
  213. formspec = formspec.."image_button[6.9,1.8;.6,.6;meseportal_right_icon.png;page_right;]"
  214. if isAdmin then formspec = formspec.."image_button_exit[5.1,9.3;.8,.8;meseportal_adminlock.png;lock_and_save;]" end
  215. formspec = formspec.."image_button_exit[6.1,9.3;.8,.8;meseportal_ok_icon.png;save_changes;]"
  216. formspec = formspec.."image_button_exit[7.1,9.3;.8,.8;meseportal_cancel_icon.png;discard_changes;]"
  217. return formspec
  218. end
  219. -- register_on_player_receive_fields
  220. minetest.register_on_player_receive_fields(function(player, formname, fields)
  221. if formname ~= "meseportals_main" then return end
  222. local player_name = player:get_player_name()
  223. local isAdmin = minetest.check_player_privs(player, {msp_admin=true})
  224. local temp_portal=meseportals_gui["players"][player_name]["temp_portal"]
  225. if not temp_portal then return end
  226. local current_portal=meseportals.findPortal(meseportals_gui["players"][player_name]["temp_portal"]["pos"])
  227. local formspec
  228. if current_portal then
  229. if (player_name ~= current_portal["owner"] and temp_portal["type"] == "private" and not isAdmin) and meseportals.allowPrivatePortals then
  230. reportFormspecViolation(player_name, "accessed someone else's private portal!")
  231. return
  232. end
  233. if player_name == current_portal["owner"] or isAdmin or not meseportals.allowPrivatePortals then
  234. if fields.toggle_type then
  235. if temp_portal["type"] == "private" then
  236. temp_portal["type"] = "public"
  237. else
  238. temp_portal["type"] = "private"
  239. end
  240. meseportals_gui["players"][player_name]["current_index"]=0
  241. formspec= meseportals.get_formspec(player_name,"main")
  242. meseportals_gui["players"][player_name]["formspec"] = formspec
  243. minetest.show_formspec(player_name, "meseportals_main", formspec)
  244. minetest.sound_play("click", {to_player=player_name, gain = 0.5})
  245. return
  246. end
  247. if fields.edit_desc then
  248. formspec= meseportals.get_formspec(player_name,"edit_desc")
  249. meseportals_gui["players"][player_name]["formspec"]=formspec
  250. minetest.show_formspec(player_name, "meseportals_main", formspec)
  251. minetest.sound_play("click", {to_player=player_name, gain = 0.5})
  252. return
  253. end
  254. if fields.save_desc then
  255. temp_portal["description"]=getCleanText(player_name, fields.desc_box)
  256. formspec= meseportals.get_formspec(player_name,"main")
  257. meseportals_gui["players"][player_name]["formspec"]=formspec
  258. minetest.show_formspec(player_name, "meseportals_main", formspec)
  259. minetest.sound_play("click", {to_player=player_name, gain = 0.5})
  260. return
  261. end
  262. else
  263. if fields.toggle_type then
  264. reportFormspecViolation(player_name, "attempted to change type of someone else's portal!")
  265. end
  266. if fields.edit_desc then
  267. reportFormspecViolation(player_name, "attempted to edit description of someone else's portal!")
  268. end
  269. if fields.save_desc then
  270. reportFormspecViolation(player_name, "attempted to change description of someone else's portal!")
  271. end
  272. end
  273. if fields.toggle_dest_type then
  274. if meseportals_gui["players"][player_name]["dest_type"] == "own" then
  275. meseportals_gui["players"][player_name]["dest_type"] = "all"
  276. else meseportals_gui["players"][player_name]["dest_type"] = "own" end
  277. meseportals_gui["players"][player_name]["current_index"] = 0
  278. formspec = meseportals.get_formspec(player_name,"main")
  279. meseportals_gui["players"][player_name]["formspec"] = formspec
  280. minetest.show_formspec(player_name, "meseportals_main", formspec)
  281. minetest.sound_play("click", {to_player=player_name, gain = 0.5})
  282. return
  283. end
  284. if fields.update_search_query then
  285. meseportals_gui["players"][player_name]["query"] = getCleanText(player_name, fields.search_box)
  286. meseportals.searchportals(current_portal["pos"], player_name, isAdmin)
  287. formspec = meseportals.get_formspec(player_name,"main")
  288. meseportals_gui["players"][player_name]["formspec"] = formspec
  289. minetest.show_formspec(player_name, "meseportals_main", formspec)
  290. minetest.sound_play("click", {to_player=player_name, gain = 0.5})
  291. end
  292. -- page controls
  293. local start=math.floor(meseportals_gui["players"][player_name]["current_index"]/24 +1 )
  294. local start_i=start
  295. local pagemax
  296. if meseportals_gui["players"][player_name]["dest_type"] == "own" then
  297. pagemax = math.ceil((meseportals_gui["players"][player_name]["own_portals_count"]) / 24)
  298. else
  299. pagemax = math.ceil((meseportals_gui["players"][player_name]["public_portals_count"]) / 24)
  300. end
  301. if pagemax == 0 then pagemax = 1 end
  302. if fields.page_left then
  303. minetest.sound_play("paperflip2", {to_player=player_name, gain = 1.0})
  304. start_i = start_i - 1
  305. if start_i < 1 then start_i = 1 end
  306. if not (start_i == start) then
  307. meseportals_gui["players"][player_name]["current_index"] = (start_i-1)*24
  308. formspec = meseportals.get_formspec(player_name,"main")
  309. meseportals_gui["players"][player_name]["formspec"] = formspec
  310. minetest.show_formspec(player_name, "meseportals_main", formspec)
  311. end
  312. end
  313. if fields.page_right then
  314. minetest.sound_play("paperflip2", {to_player=player_name, gain = 1.0})
  315. start_i = start_i + 1
  316. if start_i > pagemax then start_i = pagemax end
  317. if not (start_i == start) then
  318. meseportals_gui["players"][player_name]["current_index"] = (start_i-1)*24
  319. formspec = meseportals.get_formspec(player_name,"main")
  320. meseportals_gui["players"][player_name]["formspec"] = formspec
  321. minetest.show_formspec(player_name, "meseportals_main", formspec)
  322. end
  323. end
  324. if fields.discard_changes then
  325. minetest.sound_play("click", {to_player=player_name, gain = 0.5})
  326. end
  327. if current_portal.admin_lock and not isAdmin then
  328. minetest.chat_send_player(player_name, "This portal has been locked by an admin.")
  329. return
  330. end
  331. if fields.remove_dest then
  332. minetest.sound_play("click", {to_player=player_name, gain = 0.5})
  333. temp_portal["destination"]=nil
  334. temp_portal["destination_description"]=nil
  335. formspec = meseportals.get_formspec(player_name,"main")
  336. meseportals_gui["players"][player_name]["formspec"] = formspec
  337. minetest.show_formspec(player_name, "meseportals_main", formspec)
  338. end
  339. if fields.save_changes or fields.lock_and_save then
  340. minetest.sound_play("click", {to_player=player_name, gain = 0.5})
  341. if player_name == current_portal["owner"] or isAdmin or not meseportals.allowPrivatePortals then
  342. if fields.desc_box ~= nil then
  343. temp_portal["description"]=getCleanText(player_name, fields.desc_box)
  344. end
  345. current_portal["type"]=temp_portal["type"]
  346. current_portal["description"]=temp_portal["description"]
  347. end
  348. if temp_portal["destination"] then
  349. local dest_portal = meseportals.findPortal(temp_portal["destination"])
  350. if dest_portal then
  351. if isAdmin then
  352. current_portal.admin_lock = fields.lock_and_save
  353. dest_portal.admin_lock = fields.lock_and_save
  354. elseif fields.lock_and_save then
  355. reportFormspecViolation(player_name, "attempted to admin-lock a portal while missing msp_admin privilege!")
  356. end
  357. if dest_portal["type"] ~= "private" or dest_portal["owner"] == player_name or isAdmin then
  358. if current_portal["destination"] ~= nil then
  359. current_portal["destination_deactivate"] = vector.new(current_portal["destination"])
  360. end
  361. current_portal["destination"]={}
  362. current_portal["destination"]=vector.new(temp_portal["destination"])
  363. current_portal["destination_description"]=temp_portal["destination_description"]
  364. current_portal["destination_dir"]=temp_portal["destination_dir"]
  365. else
  366. reportFormspecViolation(player_name, "attempted to connect to private portal at "..minetest.pos_to_string(dest_portal.pos).." from "..minetest.pos_to_string(current_portal.pos))
  367. end
  368. else
  369. minetest.chat_send_player(player_name, "The destination portal seems to have vanished while you were in the menu...")
  370. end
  371. else
  372. if current_portal["destination"] ~= nil then
  373. current_portal["destination_deactivate"] = vector.new(current_portal["destination"])
  374. meseportals.deactivatePortal(current_portal.pos)
  375. end
  376. end
  377. if current_portal["destination_deactivate"] ~= nil then
  378. if not temp_portal["destination"] then
  379. current_portal.admin_lock = nil
  380. end
  381. if meseportals.findPortal(current_portal["destination_deactivate"]) then
  382. meseportals.findPortal(current_portal["destination_deactivate"]).admin_lock = nil
  383. meseportals.deactivatePortal (current_portal["destination_deactivate"])
  384. current_portal["destination_deactivate"] = nil
  385. end
  386. end
  387. if meseportals.findPortal(current_portal["destination"]) then
  388. local dest_portal = meseportals.findPortal(current_portal["destination"])
  389. if dest_portal["destination"] == nil or isAdmin then
  390. dest_portal.admin_lock = current_portal.admin_lock
  391. -- Connecting to a portal, its locked state becomes the same as this portal.
  392. if dest_portal["destination"] then --Admin can interrupt any existing connection
  393. meseportals.deactivatePortal(dest_portal["destination"])
  394. end
  395. meseportals.activatePortal (current_portal.pos)
  396. dest_portal["destination"] = current_portal["pos"]
  397. dest_portal["destination_description"] = current_portal["description"]
  398. dest_portal["destination_dir"] = current_portal["dir"]
  399. meseportals.activatePortal (dest_portal.pos)
  400. current_portal["time"] = meseportals.close_after
  401. else
  402. minetest.chat_send_player(player_name, "Connection failed: Portal is busy.")
  403. meseportals.deactivatePortal (current_portal["pos"])
  404. end
  405. else
  406. meseportals.deactivatePortal (current_portal["pos"])
  407. end
  408. if meseportals.save_data(current_portal["owner"])==nil then
  409. print ("[meseportals] Couldnt update network file!")
  410. end
  411. end
  412. local list_index=meseportals_gui["players"][player_name]["current_index"]
  413. local i
  414. for i=0,23,1 do
  415. local button="list_button"..i+list_index
  416. if fields[button] then
  417. minetest.sound_play("click", {to_player=player_name, gain = 1.0})
  418. local portal=meseportals_gui["players"][player_name]["temp_portal"]
  419. local dest_portal
  420. if meseportals_gui["players"][player_name]["dest_type"] == "own" then
  421. dest_portal=meseportals_gui["players"][player_name]["own_portals"][list_index+i+1]
  422. else
  423. dest_portal=meseportals_gui["players"][player_name]["public_portals"][list_index+i+1]
  424. end
  425. portal["destination"]=vector.new(dest_portal["pos"])
  426. portal["destination_description"]=dest_portal["description"]
  427. portal["destination_dir"]=dest_portal["dir"]
  428. formspec = meseportals.get_formspec(player_name,"main")
  429. meseportals_gui["players"][player_name]["formspec"] = formspec
  430. minetest.show_formspec(player_name, "meseportals_main", formspec)
  431. end
  432. end
  433. end
  434. end)