From f54a7ea5072cb31610a586283e333ca228987a4a Mon Sep 17 00:00:00 2001 From: Giov4 Date: Mon, 14 Sep 2020 23:09:48 +0200 Subject: [PATCH] Added some checks to pos2/pos2 and createschematic cmds + Modified HUD proportions --- SETTINGS.lua | 2 +- commands.lua | 23 ++++++++++++++++------- locale/skywars.it.tr | 2 ++ locale/template.txt | 2 ++ 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/SETTINGS.lua b/SETTINGS.lua index 6105384..ad0324f 100644 --- a/SETTINGS.lua +++ b/SETTINGS.lua @@ -67,7 +67,7 @@ skywars_settings.background_height = 12 skywars_settings.starting_x = 2.2 -- The y position of the first buttons row -skywars_settings.starting_y = 6.8 +skywars_settings.starting_y = 7 -- The horizontal distance betweek buttons in real coordinates skywars_settings.distance_x = 3 diff --git a/commands.lua b/commands.lua index 10db49e..fee5718 100644 --- a/commands.lua +++ b/commands.lua @@ -581,7 +581,12 @@ function(cmd) cmd:sub("pos1", function(sender) local player = minetest.get_player_by_name(sender) + local looking_dir = player:get_look_dir() + if looking_dir.z <= 0 then + skywars.print_error(sender, skywars.T("You have to look to the north!")) + return + end player:get_meta():set_string("pos1", minetest.serialize(player:get_pos())) skywars.print_msg(sender, skywars.T("Position saved!")) end) @@ -590,9 +595,14 @@ function(cmd) cmd:sub("pos2", function(sender) local player = minetest.get_player_by_name(sender) + local looking_dir = player:get_look_dir() + + if looking_dir.z <= 0 then + skywars.print_error(sender, skywars.T("You have to look to the north!")) + return + end player:get_meta():set_string("pos2", minetest.serialize(player:get_pos())) - skywars.print_msg(sender, skywars.T("Position saved!")) end) @@ -608,16 +618,15 @@ function(cmd) if arena == nil then skywars.print_error(sender, skywars.T("Arena not found!")) return - end - - if arena.enabled == true then + elseif arena.enabled == true then skywars.print_error(sender, skywars.T("@1 must be disabled!", arena_name)) return - end - - if pos1 == "" or pos2 == "" then + elseif pos1 == "" or pos2 == "" then skywars.print_error(sender, skywars.T("Pos1 or pos2 are not set!")) return + elseif pos1.z > pos2.z then + skywars.print_error(sender, skywars.T("Pos1 Z has to be smaller than pos2!")) + return end skywars.create_schematic(sender, {x = pos1.x, y = pos1.y, z = pos1.z}, {x = pos2.x, y = pos2.y, z = pos2.z}, name, arena) diff --git a/locale/skywars.it.tr b/locale/skywars.it.tr index dab425e..87d907e 100644 --- a/locale/skywars.it.tr +++ b/locale/skywars.it.tr @@ -23,6 +23,8 @@ Chest not found!=Cassa non trovata! Chest list:=Lista delle casse: ID: @1 - POSITION: @2=ID: @1 - POSIZIONE: @2 Position saved!=Posizione salvata +You have to look to the north!=Devi guardare a nord! +Pos1 Z has to be smaller than pos2!=La Z di pos1 deve essere minore di quella di pos2 Schematic @1 created! You can use /skywars info @2 to know its folder (see schematic@=PATH)=Schematica @1 creata! Puoi usare /skywars info @2 per sapere dove è salvata (vedi schematic@=PERCORSO) @1 wasn't configured properly!=@1 non è stata configurata correttamente @1 must be disabled!=@1 deve essere disabilitata! diff --git a/locale/template.txt b/locale/template.txt index 0684af8..1c26cea 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -25,6 +25,8 @@ Chest not found!= Chest list:= ID: @1 - POSITION: @2= Position saved!= +You have to look to the north!= +Pos1 Z has to be smaller than pos2!= Schematic @1 created! You can use /skywars info @2 to know its folder (see schematic@=PATH)= @1 wasn't configured properly!= @1 must be disabled!=