diff --git a/README.md b/README.md index f060f69..db64ccf 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,39 @@ -# QuikBild - -![](screenshot.png) - -Contributors: MisterE, Zughy (hotbar background) - -Code snippets from https://gitlab.com/zughy-friends-minetest/arena_lib/-/blob/master/DOCS.md and from Zughy's minigames - - -License: GPL 3 -sounds: CC0 - - -Description: Each player will get a turn to be the artist. In each round, the artist is given a word to build a representation of, and the tools to build it. THey have a time limit. - -Other players try to be the first to guess the word by sending it in chat (this does not spam global chat) - -the artist gets a point, and the guesser gets a point, if they guess correctly. - -If no one guesses correctly, then no one gets points that round. Send chat messages with keywords lowercase only, and spell them correctly! - - -Basic setup: - -1) type /quikbild create -2) type /quikbild edit -3) use the editor to place a minigame sign, assign it to your minigame. -4) while in the editor, move to where your arena will be. -5) Make your arena. There should be a central cage, for the artist to build in, made from glass, and a viewing area around it. The entire thing should prevent escape. use walls or fullclip. -6) using the editor tools, mark player spawner locations. These should be placed in the viewing area. Protect the arena. -7) go to minigame settings, and open the settings editor. -8) set the build_area_pos_1 and 2 to be locations that fully encompass the central build area. THis will allow the arena to clear builds between rounds. -9) edit the word list. Only a short example word list is given, but you can make your own, and set your arena to a theme! Make sure to use the proper lua table syntax! -10) Set the build time. This is the time allowed for the artist to build, and the time allowed for other players to guess. IF this runs out, no one gets any points -11) Set the artist spawn position. This should be a location inside the build area. -12) exit the editor mode -13) type /minigamesettings quikbild -14) change the hub spawnpoint to be next to the signs, and adjust the queuing time as desired. - +# QuikBild + +![](screenshot.png) + +Contributors: MisterE, Zughy (hotbar background) + +Code snippets from https://gitlab.com/zughy-friends-minetest/arena_lib/-/blob/master/DOCS.md and from Zughy's minigames + + +License: GPL 3 +sounds: CC0 + + +Description: Each player will get a turn to be the artist. In each round, the artist is given a word to build a representation of, and the tools to build it. THey have a time limit. + +Other players try to be the first to guess the word by sending it in chat (this does not spam global chat) + +the artist gets a point, and the guesser gets a point, if they guess correctly. + +If no one guesses correctly, then no one gets points that round. Send chat messages with keywords lowercase only, and spell them correctly! + + +Basic setup: + +1) type /quikbild create +2) type /quikbild edit +3) use the editor to place a minigame sign, assign it to your minigame. +4) while in the editor, move to where your arena will be. +5) Make your arena. There should be a central cage, for the artist to build in, made from glass, and a viewing area around it. The entire thing should prevent escape. use walls or fullclip. +6) using the editor tools, mark player spawner locations. These should be placed in the viewing area. Protect the arena. +7) go to minigame settings, and open the settings editor. +8) set the build_area_pos_1 and 2 to be locations that fully encompass the central build area. THis will allow the arena to clear builds between rounds. +9) edit the word list. Only a short example word list is given, but you can make your own, and set your arena to a theme! Make sure to use the proper lua table syntax! +10) Set the build time. This is the time allowed for the artist to build, and the time allowed for other players to guess. IF this runs out, no one gets any points +11) Set the artist spawn position. This should be a location inside the build area. +12) exit the editor mode +13) type /minigamesettings quikbild +14) change the hub spawnpoint to be next to the signs, and adjust the queuing time as desired. + diff --git a/chatcmdbuilder.lua b/chatcmdbuilder.lua index 705b965..af6194a 100644 --- a/chatcmdbuilder.lua +++ b/chatcmdbuilder.lua @@ -1,306 +1,306 @@ -ChatCmdBuilder = {} - -function ChatCmdBuilder.new(name, func, def) - def = def or {} - local cmd = ChatCmdBuilder.build(func) - cmd.def = def - def.func = cmd.run - minetest.register_chatcommand(name, def) - return cmd -end - -local STATE_READY = 1 -local STATE_PARAM = 2 -local STATE_PARAM_TYPE = 3 -local bad_chars = {} -bad_chars["("] = true -bad_chars[")"] = true -bad_chars["."] = true -bad_chars["%"] = true -bad_chars["+"] = true -bad_chars["-"] = true -bad_chars["*"] = true -bad_chars["?"] = true -bad_chars["["] = true -bad_chars["^"] = true -bad_chars["$"] = true -local function escape(char) - if bad_chars[char] then - return "%" .. char - else - return char - end -end - -local dprint = function() end - -ChatCmdBuilder.types = { - pos = "%(? *(%-?[%d.]+) *, *(%-?[%d.]+) *, *(%-?[%d.]+) *%)?", - text = "(.+)", - number = "(%-?[%d.]+)", - int = "(%-?[%d]+)", - word = "([^ ]+)", - alpha = "([A-Za-z]+)", - modname = "([a-z0-9_]+)", - alphascore = "([A-Za-z_]+)", - alphanumeric = "([A-Za-z0-9]+)", - username = "([A-Za-z0-9-_]+)", -} - -function ChatCmdBuilder.build(func) - local cmd = { - _subs = {} - } - function cmd:sub(route, func, def) - dprint("Parsing " .. route) - - def = def or {} - if string.trim then - route = string.trim(route) - end - - local sub = { - pattern = "^", - params = {}, - func = func - } - - -- End of param reached: add it to the pattern - local param = "" - local param_type = "" - local should_be_eos = false - local function finishParam() - if param ~= "" and param_type ~= "" then - dprint(" - Found param " .. param .. " type " .. param_type) - - local pattern = ChatCmdBuilder.types[param_type] - if not pattern then - error("Unrecognised param_type=" .. param_type) - end - - sub.pattern = sub.pattern .. pattern - - table.insert(sub.params, param_type) - - param = "" - param_type = "" - end - end - - -- Iterate through the route to find params - local state = STATE_READY - local catching_space = false - local match_space = " " -- change to "%s" to also catch tabs and newlines - local catch_space = match_space.."+" - for i = 1, #route do - local c = route:sub(i, i) - if should_be_eos then - error("Should be end of string. Nothing is allowed after a param of type text.") - end - - if state == STATE_READY then - if c == ":" then - dprint(" - Found :, entering param") - state = STATE_PARAM - param_type = "word" - catching_space = false - elseif c:match(match_space) then - print(" - Found space") - if not catching_space then - catching_space = true - sub.pattern = sub.pattern .. catch_space - end - else - catching_space = false - sub.pattern = sub.pattern .. escape(c) - end - elseif state == STATE_PARAM then - if c == ":" then - dprint(" - Found :, entering param type") - state = STATE_PARAM_TYPE - param_type = "" - elseif c:match(match_space) then - print(" - Found whitespace, leaving param") - state = STATE_READY - finishParam() - catching_space = true - sub.pattern = sub.pattern .. catch_space - elseif c:match("%W") then - dprint(" - Found nonalphanum, leaving param") - state = STATE_READY - finishParam() - sub.pattern = sub.pattern .. escape(c) - else - param = param .. c - end - elseif state == STATE_PARAM_TYPE then - if c:match(match_space) then - print(" - Found space, leaving param type") - state = STATE_READY - finishParam() - catching_space = true - sub.pattern = sub.pattern .. catch_space - elseif c:match("%W") then - dprint(" - Found nonalphanum, leaving param type") - state = STATE_READY - finishParam() - sub.pattern = sub.pattern .. escape(c) - else - param_type = param_type .. c - end - end - end - dprint(" - End of route") - finishParam() - sub.pattern = sub.pattern .. "$" - dprint("Pattern: " .. sub.pattern) - - table.insert(self._subs, sub) - end - - if func then - func(cmd) - end - - cmd.run = function(name, param) - for i = 1, #cmd._subs do - local sub = cmd._subs[i] - local res = { string.match(param, sub.pattern) } - if #res > 0 then - local pointer = 1 - local params = { name } - for j = 1, #sub.params do - local param = sub.params[j] - if param == "pos" then - local pos = { - x = tonumber(res[pointer]), - y = tonumber(res[pointer + 1]), - z = tonumber(res[pointer + 2]) - } - table.insert(params, pos) - pointer = pointer + 3 - elseif param == "number" or param == "int" then - table.insert(params, tonumber(res[pointer])) - pointer = pointer + 1 - else - table.insert(params, res[pointer]) - pointer = pointer + 1 - end - end - if table.unpack then - -- lua 5.2 or later - return sub.func(table.unpack(params)) - else - -- lua 5.1 or earlier - return sub.func(unpack(params)) - end - end - end - return false, "Invalid command" - end - - return cmd -end - -local function run_tests() - if not (ChatCmdBuilder.build(function(cmd) - cmd:sub("bar :one and :two:word", function(name, one, two) - if name == "singleplayer" and one == "abc" and two == "def" then - return true - end - end) - end)).run("singleplayer", "bar abc and def") then - error("Test 1 failed") - end - - local move = ChatCmdBuilder.build(function(cmd) - cmd:sub("move :target to :pos:pos", function(name, target, pos) - if name == "singleplayer" and target == "player1" and - pos.x == 0 and pos.y == 1 and pos.z == 2 then - return true - end - end) - end).run - if not move("singleplayer", "move player1 to 0,1,2") then - error("Test 2 failed") - end - if not move("singleplayer", "move player1 to (0,1,2)") then - error("Test 3 failed") - end - if not move("singleplayer", "move player1 to 0, 1,2") then - error("Test 4 failed") - end - if not move("singleplayer", "move player1 to 0 ,1, 2") then - error("Test 5 failed") - end - if not move("singleplayer", "move player1 to 0, 1, 2") then - error("Test 6 failed") - end - if not move("singleplayer", "move player1 to 0 ,1 ,2") then - error("Test 7 failed") - end - if not move("singleplayer", "move player1 to ( 0 ,1 ,2)") then - error("Test 8 failed") - end - if move("singleplayer", "move player1 to abc,def,sdosd") then - error("Test 9 failed") - end - if move("singleplayer", "move player1 to abc def sdosd") then - error("Test 10 failed") - end - - if not (ChatCmdBuilder.build(function(cmd) - cmd:sub("does :one:int plus :two:int equal :three:int", function(name, one, two, three) - if name == "singleplayer" and one + two == three then - return true - end - end) - end)).run("singleplayer", "does 1 plus 2 equal 3") then - error("Test 11 failed") - end - - local checknegint = ChatCmdBuilder.build(function(cmd) - cmd:sub("checknegint :x:int", function(name, x) - return x - end) - end).run - if checknegint("checker","checknegint -2") ~= -2 then - error("Test 12 failed") - end - - local checknegnumber = ChatCmdBuilder.build(function(cmd) - cmd:sub("checknegnumber :x:number", function(name, x) - return x - end) - end).run - if checknegnumber("checker","checknegnumber -3.3") ~= -3.3 then - error("Test 13 failed") - end - - local checknegpos = ChatCmdBuilder.build(function(cmd) - cmd:sub("checknegpos :pos:pos", function(name, pos) - return pos - end) - end).run - local negpos = checknegpos("checker","checknegpos (-13.3,-4.6,-1234.5)") - if negpos.x ~= -13.3 or negpos.y ~= -4.6 or negpos.z ~= -1234.5 then - error("Test 14 failed") - end - - local checktypes = ChatCmdBuilder.build(function(cmd) - cmd:sub("checktypes :int:int :number:number :pos:pos :word:word :text:text", function(name, int, number, pos, word, text) - return int, number, pos.x, pos.y, pos.z, word, text - end) - end).run - local int, number, posx, posy, posz, word, text - int, number, posx, posy, posz, word, text = checktypes("checker","checktypes -1 -2.4 (-3,-5.3,6.12) some text to finish off with") - --dprint(int, number, posx, posy, posz, word, text) - if int ~= -1 or number ~= -2.4 or posx ~= -3 or posy ~= -5.3 or posz ~= 6.12 or word ~= "some" or text ~= "text to finish off with" then - error("Test 15 failed") - end - dprint("All tests passed") - -end -if not minetest then - run_tests() -end +ChatCmdBuilder = {} + +function ChatCmdBuilder.new(name, func, def) + def = def or {} + local cmd = ChatCmdBuilder.build(func) + cmd.def = def + def.func = cmd.run + minetest.register_chatcommand(name, def) + return cmd +end + +local STATE_READY = 1 +local STATE_PARAM = 2 +local STATE_PARAM_TYPE = 3 +local bad_chars = {} +bad_chars["("] = true +bad_chars[")"] = true +bad_chars["."] = true +bad_chars["%"] = true +bad_chars["+"] = true +bad_chars["-"] = true +bad_chars["*"] = true +bad_chars["?"] = true +bad_chars["["] = true +bad_chars["^"] = true +bad_chars["$"] = true +local function escape(char) + if bad_chars[char] then + return "%" .. char + else + return char + end +end + +local dprint = function() end + +ChatCmdBuilder.types = { + pos = "%(? *(%-?[%d.]+) *, *(%-?[%d.]+) *, *(%-?[%d.]+) *%)?", + text = "(.+)", + number = "(%-?[%d.]+)", + int = "(%-?[%d]+)", + word = "([^ ]+)", + alpha = "([A-Za-z]+)", + modname = "([a-z0-9_]+)", + alphascore = "([A-Za-z_]+)", + alphanumeric = "([A-Za-z0-9]+)", + username = "([A-Za-z0-9-_]+)", +} + +function ChatCmdBuilder.build(func) + local cmd = { + _subs = {} + } + function cmd:sub(route, func, def) + dprint("Parsing " .. route) + + def = def or {} + if string.trim then + route = string.trim(route) + end + + local sub = { + pattern = "^", + params = {}, + func = func + } + + -- End of param reached: add it to the pattern + local param = "" + local param_type = "" + local should_be_eos = false + local function finishParam() + if param ~= "" and param_type ~= "" then + dprint(" - Found param " .. param .. " type " .. param_type) + + local pattern = ChatCmdBuilder.types[param_type] + if not pattern then + error("Unrecognised param_type=" .. param_type) + end + + sub.pattern = sub.pattern .. pattern + + table.insert(sub.params, param_type) + + param = "" + param_type = "" + end + end + + -- Iterate through the route to find params + local state = STATE_READY + local catching_space = false + local match_space = " " -- change to "%s" to also catch tabs and newlines + local catch_space = match_space.."+" + for i = 1, #route do + local c = route:sub(i, i) + if should_be_eos then + error("Should be end of string. Nothing is allowed after a param of type text.") + end + + if state == STATE_READY then + if c == ":" then + dprint(" - Found :, entering param") + state = STATE_PARAM + param_type = "word" + catching_space = false + elseif c:match(match_space) then + print(" - Found space") + if not catching_space then + catching_space = true + sub.pattern = sub.pattern .. catch_space + end + else + catching_space = false + sub.pattern = sub.pattern .. escape(c) + end + elseif state == STATE_PARAM then + if c == ":" then + dprint(" - Found :, entering param type") + state = STATE_PARAM_TYPE + param_type = "" + elseif c:match(match_space) then + print(" - Found whitespace, leaving param") + state = STATE_READY + finishParam() + catching_space = true + sub.pattern = sub.pattern .. catch_space + elseif c:match("%W") then + dprint(" - Found nonalphanum, leaving param") + state = STATE_READY + finishParam() + sub.pattern = sub.pattern .. escape(c) + else + param = param .. c + end + elseif state == STATE_PARAM_TYPE then + if c:match(match_space) then + print(" - Found space, leaving param type") + state = STATE_READY + finishParam() + catching_space = true + sub.pattern = sub.pattern .. catch_space + elseif c:match("%W") then + dprint(" - Found nonalphanum, leaving param type") + state = STATE_READY + finishParam() + sub.pattern = sub.pattern .. escape(c) + else + param_type = param_type .. c + end + end + end + dprint(" - End of route") + finishParam() + sub.pattern = sub.pattern .. "$" + dprint("Pattern: " .. sub.pattern) + + table.insert(self._subs, sub) + end + + if func then + func(cmd) + end + + cmd.run = function(name, param) + for i = 1, #cmd._subs do + local sub = cmd._subs[i] + local res = { string.match(param, sub.pattern) } + if #res > 0 then + local pointer = 1 + local params = { name } + for j = 1, #sub.params do + local param = sub.params[j] + if param == "pos" then + local pos = { + x = tonumber(res[pointer]), + y = tonumber(res[pointer + 1]), + z = tonumber(res[pointer + 2]) + } + table.insert(params, pos) + pointer = pointer + 3 + elseif param == "number" or param == "int" then + table.insert(params, tonumber(res[pointer])) + pointer = pointer + 1 + else + table.insert(params, res[pointer]) + pointer = pointer + 1 + end + end + if table.unpack then + -- lua 5.2 or later + return sub.func(table.unpack(params)) + else + -- lua 5.1 or earlier + return sub.func(unpack(params)) + end + end + end + return false, "Invalid command" + end + + return cmd +end + +local function run_tests() + if not (ChatCmdBuilder.build(function(cmd) + cmd:sub("bar :one and :two:word", function(name, one, two) + if name == "singleplayer" and one == "abc" and two == "def" then + return true + end + end) + end)).run("singleplayer", "bar abc and def") then + error("Test 1 failed") + end + + local move = ChatCmdBuilder.build(function(cmd) + cmd:sub("move :target to :pos:pos", function(name, target, pos) + if name == "singleplayer" and target == "player1" and + pos.x == 0 and pos.y == 1 and pos.z == 2 then + return true + end + end) + end).run + if not move("singleplayer", "move player1 to 0,1,2") then + error("Test 2 failed") + end + if not move("singleplayer", "move player1 to (0,1,2)") then + error("Test 3 failed") + end + if not move("singleplayer", "move player1 to 0, 1,2") then + error("Test 4 failed") + end + if not move("singleplayer", "move player1 to 0 ,1, 2") then + error("Test 5 failed") + end + if not move("singleplayer", "move player1 to 0, 1, 2") then + error("Test 6 failed") + end + if not move("singleplayer", "move player1 to 0 ,1 ,2") then + error("Test 7 failed") + end + if not move("singleplayer", "move player1 to ( 0 ,1 ,2)") then + error("Test 8 failed") + end + if move("singleplayer", "move player1 to abc,def,sdosd") then + error("Test 9 failed") + end + if move("singleplayer", "move player1 to abc def sdosd") then + error("Test 10 failed") + end + + if not (ChatCmdBuilder.build(function(cmd) + cmd:sub("does :one:int plus :two:int equal :three:int", function(name, one, two, three) + if name == "singleplayer" and one + two == three then + return true + end + end) + end)).run("singleplayer", "does 1 plus 2 equal 3") then + error("Test 11 failed") + end + + local checknegint = ChatCmdBuilder.build(function(cmd) + cmd:sub("checknegint :x:int", function(name, x) + return x + end) + end).run + if checknegint("checker","checknegint -2") ~= -2 then + error("Test 12 failed") + end + + local checknegnumber = ChatCmdBuilder.build(function(cmd) + cmd:sub("checknegnumber :x:number", function(name, x) + return x + end) + end).run + if checknegnumber("checker","checknegnumber -3.3") ~= -3.3 then + error("Test 13 failed") + end + + local checknegpos = ChatCmdBuilder.build(function(cmd) + cmd:sub("checknegpos :pos:pos", function(name, pos) + return pos + end) + end).run + local negpos = checknegpos("checker","checknegpos (-13.3,-4.6,-1234.5)") + if negpos.x ~= -13.3 or negpos.y ~= -4.6 or negpos.z ~= -1234.5 then + error("Test 14 failed") + end + + local checktypes = ChatCmdBuilder.build(function(cmd) + cmd:sub("checktypes :int:int :number:number :pos:pos :word:word :text:text", function(name, int, number, pos, word, text) + return int, number, pos.x, pos.y, pos.z, word, text + end) + end).run + local int, number, posx, posy, posz, word, text + int, number, posx, posy, posz, word, text = checktypes("checker","checktypes -1 -2.4 (-3,-5.3,6.12) some text to finish off with") + --dprint(int, number, posx, posy, posz, word, text) + if int ~= -1 or number ~= -2.4 or posx ~= -3 or posy ~= -5.3 or posz ~= 6.12 or word ~= "some" or text ~= "text to finish off with" then + error("Test 15 failed") + end + dprint("All tests passed") + +end +if not minetest then + run_tests() +end diff --git a/commands.lua b/commands.lua index 5168b52..49a9873 100644 --- a/commands.lua +++ b/commands.lua @@ -1,55 +1,78 @@ -ChatCmdBuilder.new("quikbild", function(cmd) - - -- create arena - cmd:sub("create :arena", function(name, arena_name) - arena_lib.create_arena(name, "quikbild", arena_name) - end) - - cmd:sub("create :arena :minplayers:int :maxplayers:int", function(name, arena_name, min_players, max_players) - arena_lib.create_arena(name, "quikbild", arena_name, min_players, max_players) - end) - - -- remove arena - cmd:sub("remove :arena", function(name, arena_name) - arena_lib.remove_arena(name, "quikbild", arena_name) - end) - - -- list of the arenas - cmd:sub("list", function(name) - arena_lib.print_arenas(name, "quikbild") - end) - - -- enter editor mode - cmd:sub("edit :arena", function(sender, arena) - arena_lib.enter_editor(sender, "quikbild", arena) - end) - - -- enable and disable arenas - cmd:sub("enable :arena", function(name, arena) - arena_lib.enable_arena(name, "quikbild", arena) - end) - - cmd:sub("disable :arena", function(name, arena) - arena_lib.disable_arena(name, "quikbild", arena) - end) - - cmd:sub("version", function(name) - minetest.chat_send_player(name,"The version of QuikBild is "..quikbild.version) - end) - -end, { - description = [[ - - (/help quikbild) - - Use this to configure your arena: - - create [min players] [max players] - - edit - - enable - - Other commands: - - remove - - disable - ]], - privs = { quikbild_admin = true } -}) +local S = minetest.get_translator("quikbild") + +ChatCmdBuilder.new("quikbild", function(cmd) + + -- create arena + cmd:sub("create :arena", function(name, arena_name) + arena_lib.create_arena(name, "quikbild", arena_name) + end) + + cmd:sub("create :arena :minplayers:int :maxplayers:int", function(name, arena_name, min_players, max_players) + arena_lib.create_arena(name, "quikbild", arena_name, min_players, max_players) + end) + + -- remove arena + cmd:sub("remove :arena", function(name, arena_name) + arena_lib.remove_arena(name, "quikbild", arena_name) + end) + + -- list of the arenas + cmd:sub("list", function(name) + arena_lib.print_arenas(name, "quikbild") + end) + + -- enter editor mode + cmd:sub("edit :arena", function(sender, arena) + arena_lib.enter_editor(sender, "quikbild", arena) + end) + + -- enable and disable arenas + cmd:sub("enable :arena", function(name, arena) + arena_lib.enable_arena(name, "quikbild", arena) + end) + + cmd:sub("disable :arena", function(name, arena) + arena_lib.disable_arena(name, "quikbild", arena) + end) + + cmd:sub("version", function(name) + minetest.chat_send_player(name,S("The version of QuikBild is").." "..quikbild.version) + end) + + +end, { + description = [[ + (/help quikbild) + Use this to configure your arena: + - create [min players] [max players] + - edit + - enable + Other commands: + - remove + - disable + ]], + privs = { quikbild_admin = true } +}) + + + +minetest.register_chatcommand("qblang", { + params = "", + description = "Set Quickbild language: use /qblang Available codes: en,it,es,fr", + func = function(name, param) + quikbild.send_lang_fs(name) + end, +}) + + + +minetest.register_chatcommand("qblang_send", { + params = "", + privs = { quikbild_admin = true }, + description = "Send a player the language selector formspec", + func = function(name, param) + if minetest.get_player_by_name(param) then + quikbild.send_lang_fs(param) + end + end, +}) \ No newline at end of file diff --git a/init.lua b/init.lua index 6a52c47..9c5f3f8 100644 --- a/init.lua +++ b/init.lua @@ -1,61 +1,65 @@ --- local value settings -local player_speed = 2 -- when in the minigame -local player_jump = 2 -- when in the minigame - -quikbild = {} --global table -quikbild.version = "05.15.2022.2" -quikbild.storage = minetest.get_mod_storage() - arena_lib.register_minigame("quikbild", { - prefix = "[QuikBild] ", - show_minimap = false, - show_nametags = true, - time_mode = "incremental", - join_while_in_progress = true, - keep_inventory = false, - in_game_physics = { - speed = player_speed, - jump = player_jump, - sneak = false, - }, - properties = { - build_area_pos_1 = {x = 0, y = 0, z = 0}, - build_area_pos_2 = {x = 0, y = 0, z = 0}, - --word_list = {'dog','cat','house','wheel','bird','road','farm','bell','apple','pencil'}, - word_list = {"picture","gel","warm","paint","bath","drill","chalk","duck","remote","word","spring","stone","rug","thermometer","stockings","CD","flower","car","check","vase","hanger","cookie","speaker","screw","paper","box","glasses","sailboat","pick","helmet","puddle","ring","pot","thread","bow","flag","fork","tape","lamp","tissue","balloon","lace","needle","chandelier","button","note","candy","tooth paste","sharpie","twister","photo","pencil","bookmark","spoon","outlet","quilt","seat belt","mouse pad","swing","nail","cork","stop sign","rust","gage","rubber band","zipper","canvas","sponge","soda","key","eraser","bottle","candle","lip","buckel","shovel","slipper","stick","cable","ice","credit card","clipper","glasses","tweezers","tie","charger","card","horse","door","song","trip","backbone","bomb","round","treasure","garbage","park","whistle","palace","baseball","coal","queen","dominoes","photo","graph","computer","hockey","plane","pepper","key","ipad","whisk","cake","circus","battery","mailman","cowboy","password","bicycle","skate","electric","lightsaber","nature","shallow","toast","outside","america","gingerbread","man","bowtie","light","bulb","platypus","music","sailboat","popsicle","knee","pineapple","tusk","sprinkler","money","spool","lighthouse","doormat","face","flute","owl","gate","suitcase","bathroom","scale","peach","newspaper","watering","can","hook","school","beaver","camera","hair","dryer","mushroom","quilt","chalk","dollar","soda","chin","swing","garden","ticket","boot","cello","rain","clam","pelican","stingray","nail","sheep","stoplight","coconut","crib","hippopotamus","ring","video","camera","snow","cheese","bone","socks","leaf","whale","pie","shirt","orange","lollipop","bed","mouth","person","horse","snake","jar","spoon","lamp","kite","monkey","swing","cloud","snowman","baby","eyes","pen","giraffe","grapes","book","ocean","star","cupcake","cow","lips","worm","sun","basketball","hat","bus","chair","purse","head","spider","shoe","ghost","coat","chicken","heart","jellyfish","tree","seashell","duck","bracelet","grass","jacket","slide","doll","spider","clock","cup","bridge","apple","balloon","drum","ears","egg","bread","nose","house","beach","airplane","inchworm","hippo","light","turtle","ball","carrot","cherry","ice","pencil","circle","bed","ant","girl","glasses","flower","mouse","banana","alligator","bell","robot","smile","bike","rocket","dino","dog","bunny","cookie","bowl","apple","door",}, - build_time = 120, --sec allowed to build - artist_spawn_pos = {x = 0, y = 0, z = 0}, - }, - load_time = 4, - celebration_time = 5, - hotbar = { - slots = #dye.dyes, - background_image = "sumo_gui_hotbar.png", - }, - temp_properties = { - state = 'choose_artist', --game states: 'choose_artist', 'build_think','build','game_over' - state_time = 0, - artist = nil, - word = '', - answer_list = {}, - win_guesser = '', - stall = false, - }, - spectate_mode = false, - disabled_damage_types = {"punch","fall","node_damage","set_hp","drown"}, - - player_properties = { - role = "", - has_built = false, - score = 0, - }, - }) - - -if not minetest.get_modpath("lib_chatcmdbuilder") then - dofile(minetest.get_modpath("quikbild") .. "/chatcmdbuilder.lua") -end - -dofile(minetest.get_modpath("quikbild") .. "/commands.lua") -dofile(minetest.get_modpath("quikbild") .. "/nodes.lua") -dofile(minetest.get_modpath("quikbild") .. "/minigame_manager.lua") -dofile(minetest.get_modpath("quikbild") .. "/privs.lua") + +-- local value settings +local player_speed = 2 -- when in the minigame +local player_jump = 2 -- when in the minigame + +quikbild = {} --global table +quikbild.version = "05.29.2022.2" +quikbild.storage = minetest.get_mod_storage() + arena_lib.register_minigame("quikbild", { + prefix = "[QuikBild] ", + show_minimap = false, + show_nametags = true, + time_mode = "incremental", + join_while_in_progress = true, + keep_inventory = false, + in_game_physics = { + speed = player_speed, + jump = player_jump, + sneak = false, + }, + properties = { + build_area_pos_1 = {x = 0, y = 0, z = 0}, + build_area_pos_2 = {x = 0, y = 0, z = 0}, + word_list_path = "/wordlists/default_wordlist.csv", + build_time = 120, --sec allowed to build + artist_spawn_pos = {x = 0, y = 0, z = 0}, + }, + load_time = 4, + celebration_time = 5, + hotbar = { + slots = #dye.dyes, + background_image = "sumo_gui_hotbar.png", + }, + temp_properties = { + state = 'choose_artist', --game states: 'choose_artist', 'build_think','build','game_over' + state_time = 0, + artist = nil, + word = '', + word_list = {}, + answer_list = {}, + win_guesser = '', + stall = false, + }, + spectate_mode = false, + disabled_damage_types = {"punch","fall","node_damage","set_hp","drown"}, + + player_properties = { + role = "", + has_built = false, + score = 0, + lang = 1, + }, + }) + + +if not minetest.get_modpath("lib_chatcmdbuilder") then + dofile(minetest.get_modpath("quikbild") .. "/chatcmdbuilder.lua") +end + +quikbild.csv = dofile(minetest.get_modpath("quikbild") .. "/lua-csv/lua/csv.lua") +dofile(minetest.get_modpath("quikbild") .. "/items.lua") +dofile(minetest.get_modpath("quikbild") .. "/commands.lua") +dofile(minetest.get_modpath("quikbild") .. "/nodes.lua") +dofile(minetest.get_modpath("quikbild") .. "/minigame_manager.lua") +dofile(minetest.get_modpath("quikbild") .. "/privs.lua") diff --git a/items.lua b/items.lua new file mode 100644 index 0000000..7ba7a83 --- /dev/null +++ b/items.lua @@ -0,0 +1,35 @@ +local S = minetest.get_translator("quikbild") + +minetest.register_tool("quikbild:lang", { + + description = S("Choose Language"), + inventory_image = "quikbild_langchoose.png", + groups = {not_in_creative_inventory = 1}, + on_place = function() end, + on_drop = function() end, + on_use = function(itemstack, user, pointed_thing) + local p_name = user:get_player_name() + if p_name then + quikbild.send_lang_fs(p_name) + end + end + +}) + +minetest.register_tool("quikbild:help", { + + description = S("Help"), + inventory_image = "arenalib_editor_info.png", + groups = {not_in_creative_inventory = 1}, + on_place = function() end, + on_drop = function() end, + on_use = function(itemstack, user, pointed_thing) + local p_name = user:get_player_name() + if p_name then + minetest.show_formspec(p_name, "qb_help", "formspec_version[5]".. + "size[10.5,5]".. + "background9[0,0;0,0;quikbild_gui_bg.png;true;5]".. + "textarea[0.8,0.7;8.8,3.5;Helpbox;Quikbild "..S("Help")..";"..S("Each player gets a turn to be Builder. Everyone else guesses what the Builder is building. To guess type your guess in chat. Use lowercase letters only. Answers can be 1 or 2 words. When it is your turn to be Builder you will be shown a word - build it. DO NOT build letters and do not try to tell other players what the word is. That ruins the game for everyone. No one will want to play this with you anymore. If you do not know the word use a search engine to look it up. You have time to do that!").."]") + end + end +}) \ No newline at end of file diff --git a/license.txt b/license.txt index 7fc13bf..2188d8d 100644 --- a/license.txt +++ b/license.txt @@ -1,5 +1,7 @@ sounds CC0, various authors +textures are or are released to the public domain +lua_csv is MIT, see its license GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 diff --git a/locale/template.txt b/locale/template.txt new file mode 100644 index 0000000..b4dfe5a --- /dev/null +++ b/locale/template.txt @@ -0,0 +1,46 @@ +# version 05.29.2022.2 +# author(s): +# reviewer(s): +# textdomain: quikbild + +# nodes.lua +Quikbild Climb-able Node= +Minigame= + +#privs.lua +With this you can use /quikbild create ,/quikbild edit = + +#commands.lua +The version of QuikBild is= +Set Quickbild language: use /qblang Available codes: en,it,es,fr= + +#items.lua +Choose Language= +Help= +Each player gets a turn to be Builder. Everyone else guesses what the Builder is building. To guess type your guess in chat. Use lowercase letters only. Answers can be 1 or 2 words. When it is your turn to be Builder you will be shown a word - build it. DO NOT build letters and do not try to tell other players what the word is. That ruins the game for everyone. No one will want to play this with you anymore. If you do not know the word use a search engine to look it up. You have time to do that!= + + +#minigame_manager.lua +No one got any points= +Try again!= +won with= +You are the Artist. Build the word you see= +is the artist.= +Guess what they are building.= +Round begins in= +BUILD!= +BEGIN GUESSSING!= +Oops! The artist left the game. The word was= +TIME's UP! The word was:= +WORD= +TIME LEFT IN ROUND= +Correct!= +You got it!= +Way to go!= +Outstanding!= +Yay!= +guessed your word.= +guessed the word. Round over!= +Do not show again= +Language setting confirmed!= + diff --git a/lua-csv/.gitignore b/lua-csv/.gitignore new file mode 100644 index 0000000..131f9b6 --- /dev/null +++ b/lua-csv/.gitignore @@ -0,0 +1,2 @@ +.DS_Store +lua/docs \ No newline at end of file diff --git a/lua-csv/AUTHORS b/lua-csv/AUTHORS new file mode 100644 index 0000000..84961bd --- /dev/null +++ b/lua-csv/AUTHORS @@ -0,0 +1,2 @@ +Leyland, Geoff +Martin, Kevin diff --git a/lua-csv/LICENSE b/lua-csv/LICENSE new file mode 100644 index 0000000..d8472a0 --- /dev/null +++ b/lua-csv/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2013-2014 Incremental IP Limited +Copyright (c) 2014 Kevin Martin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + diff --git a/lua-csv/README.md b/lua-csv/README.md new file mode 100644 index 0000000..d10314a --- /dev/null +++ b/lua-csv/README.md @@ -0,0 +1,93 @@ +# Lua-CSV - delimited file reading + +## 1. What? + +Lua-CSV is a Lua module for reading delimited text files (popularly CSV and +tab-separated files, but you can specify the separator). + +Lua-CSV tries to auto-detect whether a file is delimited with commas or tabs, +copes with non-native newlines, survives newlines and quotes inside quoted +fields and offers an iterator interface so it can handle large files. + + +## 2. How? + + local csv = require("csv") + local f = csv.open("file.csv") + for fields in f:lines() do + for i, v in ipairs(fields) do print(i, v) end + end + +`csv.open` takes a second argument `parameters`, a table of parameters +controlling how the file is read: + ++ `separator` sets the separator. It'll probably guess the separator + correctly if it's a comma or a tab (unless, say, the first field in a + tab-delimited file contains a comma), but if you want something else you'll + have to set this. It could be more than one character, but it's used as + part of a set: `"["..sep.."\n\r]"` + ++ Set `header` to true if the file contains a header and each set of fields + will be keyed by the names in the header rather than by integer index. + ++ `columns` provides a mechanism for column remapping. + Suppose you have a csv file as follows: + + Word,Number + ONE,10 + + And columns is: + + + `{ word = true }` then the only field in the file would be + `{ word = "ONE" }` + + `{ first = { name = "word"} }` then it would be `{ first = "ONE" }` + + `{ word = { transform = string.lower }}` would give `{ word = "one" }` + + finally, + + { word = true + number = { transform = function(x) return tonumber(x) / 10 end }} + + would give `{ word = "ONE", number = 1 }` + + A column can have more than one name: + `{ first = { names = {"word", "worm"}}}` to help cope with badly specified + file formats and spelling mistakes. + ++ `buffer_size` controls the size of the blocks the file is read in. The + default is 1MB. It used to be 4096 bytes which is what `pagesize` says on + my system, but that seems kind of small. + +`csv.openstring` works exactly like `csv.open` except the first argument +is the contents of the csv file. In this case `buffer_size` is set to +the length of the string. + +## 3. Requirements + +Lua 5.1, 5.2 or LuaJIT. + + +## 4. Issues + ++ Some whitespace-delimited files might use more than one space between + fields, for example if the columns are "manually" aligned: + + street nr city + "Oneway Street" 1 Toontown + + It won't cope with this - you'll get lots of extra empty fields. + +## 5. Wishlist + ++ Tests would be nice. ++ So would better LDoc documentation. + + +## 6. Alternatives + ++ [Penlight](http://github.com/stevedonovan/penlight) contains delimited + file reading. It reads the whole file in one go. ++ The Lua Wiki contains two pages on CSV + [here](http://lua-users.org/wiki/LuaCsv) and + [here](http://lua-users.org/wiki/CsvUtils). ++ There's an example using [LPeg](http://www.inf.puc-rio.br/~roberto/lpeg/) + to parse CSV [here](http://www.inf.puc-rio.br/~roberto/lpeg/#CSV) diff --git a/lua-csv/lua/config.ld b/lua-csv/lua/config.ld new file mode 100644 index 0000000..af51949 --- /dev/null +++ b/lua-csv/lua/config.ld @@ -0,0 +1,4 @@ +project = "Lua-CSV" +title = "Lua-CSV Source Documentation" +description = "Lua-CSV reads delimited text files" +format = "markdown" diff --git a/lua-csv/lua/csv.lua b/lua-csv/lua/csv.lua new file mode 100644 index 0000000..64196c0 --- /dev/null +++ b/lua-csv/lua/csv.lua @@ -0,0 +1,557 @@ +--- Read a comma or tab (or other delimiter) separated file. +-- This version of a CSV reader differs from others I've seen in that it +-- +-- + handles embedded newlines in fields (if they're delimited with double +-- quotes) +-- + is line-ending agnostic +-- + reads the file line-by-line, so it can potientially handle large +-- files. +-- +-- Of course, for such a simple format, CSV is horribly complicated, so it +-- likely gets something wrong. + +-- (c) Copyright 2013-2014 Incremental IP Limited. +-- (c) Copyright 2014 Kevin Martin +-- Available under the MIT licence. See LICENSE for more information. + +local DEFAULT_BUFFER_BLOCK_SIZE = 1024 * 1024 + + +------------------------------------------------------------------------------ + +local function trim_space(s) + return s:match("^%s*(.-)%s*$") +end + + +local function fix_quotes(s) + -- the sub(..., -2) is to strip the trailing quote + return string.sub(s:gsub('""', '"'), 1, -2) +end + + +------------------------------------------------------------------------------ + +local column_map = {} +column_map.__index = column_map + + +local function normalise_string(s) + return (s:lower():gsub("[^%w%d]+", " "):gsub("^ *(.-) *$", "%1")) +end + + +--- Parse a list of columns. +-- The main job here is normalising column names and dealing with columns +-- for which we have more than one possible name in the header. +function column_map:new(columns) + local name_map = {} + for n, v in pairs(columns) do + local names + local t + if type(v) == "table" then + t = { transform = v.transform, default = v.default } + if v.name then + names = { normalise_string(v.name) } + elseif v.names then + names = v.names + for i, n in ipairs(names) do names[i] = normalise_string(n) end + end + else + if type(v) == "function" then + t = { transform = v } + else + t = {} + if type(v) == "string" then + names = { normalise_string(v) } + end + end + end + + if not names then + names = { (n:lower():gsub("[^%w%d]+", " ")) } + end + + t.name = n + for _, n in ipairs(names) do + name_map[n:lower()] = t + end + end + + return setmetatable({ name_map = name_map }, column_map) +end + + +--- Map "virtual" columns to file columns. +-- Once we've read the header, work out which columns we're interested in and +-- what to do with them. Mostly this is about checking we've got the columns +-- we need and writing a nice complaint if we haven't. +function column_map:read_header(header) + local index_map = {} + + -- Match the columns in the file to the columns in the name map + local found = {} + local found_any + for i, word in ipairs(header) do + word = normalise_string(word) + local r = self.name_map[word] + if r then + index_map[i] = r + found[r.name] = true + found_any = true + end + end + + if not found_any then return end + + -- check we found all the columns we need + local not_found = {} + for name, r in pairs(self.name_map) do + if not found[r.name] then + local nf = not_found[r.name] + if nf then + nf[#nf+1] = name + else + not_found[r.name] = { name } + end + end + end + -- If any columns are missing, assemble an error message + if next(not_found) then + local problems = {} + for k, v in pairs(not_found) do + local missing + if #v == 1 then + missing = "'"..v[1].."'" + else + missing = v[1] + for i = 2, #v - 1 do + missing = missing..", '"..v[i].."'" + end + missing = missing.." or '"..v[#v].."'" + end + problems[#problems+1] = "Couldn't find a column named "..missing + end + error(table.concat(problems, "\n"), 0) + end + + self.index_map = index_map + return true +end + + +function column_map:transform(value, index) + local field = self.index_map[index] + if field then + if field.transform then + local ok + ok, value = pcall(field.transform, value) + if not ok then + error(("Error reading field '%s': %s"):format(field.name, value), 0) + end + end + return value or field.default, field.name + end +end + + +------------------------------------------------------------------------------ + +local file_buffer = {} +file_buffer.__index = file_buffer + +function file_buffer:new(file, buffer_block_size) + return setmetatable({ + file = file, + buffer_block_size = buffer_block_size or DEFAULT_BUFFER_BLOCK_SIZE, + buffer_start = 0, + buffer = "", + }, file_buffer) +end + + +--- Cut the front off the buffer if we've already read it +function file_buffer:truncate(p) + p = p - self.buffer_start + if p > self.buffer_block_size then + local remove = self.buffer_block_size * + math.floor((p-1) / self.buffer_block_size) + self.buffer = self.buffer:sub(remove + 1) + self.buffer_start = self.buffer_start + remove + end +end + + +--- Find something in the buffer, extending it if necessary +function file_buffer:find(pattern, init) + while true do + local first, last, capture = + self.buffer:find(pattern, init - self.buffer_start) + -- if we found nothing, or the last character is at the end of the + -- buffer (and the match could potentially be longer) then read some + -- more. + if not first or last == #self.buffer then + local s = self.file:read(self.buffer_block_size) + if not s then + if not first then + return + else + return first + self.buffer_start, last + self.buffer_start, capture + end + end + self.buffer = self.buffer..s + else + return first + self.buffer_start, last + self.buffer_start, capture + end + end +end + + +--- Extend the buffer so we can see more +function file_buffer:extend(offset) + local extra = offset - #self.buffer - self.buffer_start + if extra > 0 then + local size = self.buffer_block_size * + math.ceil(extra / self.buffer_block_size) + local s = self.file:read(size) + if not s then return end + self.buffer = self.buffer..s + end +end + + +--- Get a substring from the buffer, extending it if necessary +function file_buffer:sub(a, b) + self:extend(b) + b = b == -1 and b or b - self.buffer_start + return self.buffer:sub(a - self.buffer_start, b) +end + + +--- Close a file buffer +function file_buffer:close() + self.file:close() + self.file = nil +end + + +------------------------------------------------------------------------------ + +local separator_candidates = { ",", "\t", "|" } +local guess_separator_params = { record_limit = 8; } + + +local function try_separator(buffer, sep, f) + guess_separator_params.separator = sep + local min, max = math.huge, 0 + local lines, split_lines = 0, 0 + local iterator = coroutine.wrap(function() f(buffer, guess_separator_params) end) + for t in iterator do + min = math.min(min, #t) + max = math.max(max, #t) + split_lines = split_lines + (t[2] and 1 or 0) + lines = lines + 1 + end + if split_lines / lines > 0.75 then + return max - min + else + return math.huge + end +end + + +--- If the user hasn't specified a separator, try to work out what it is. +function guess_separator(buffer, f) + local best_separator, lowest_diff = "", math.huge + for _, s in ipairs(separator_candidates) do + local ok, diff = pcall(function() return try_separator(buffer, s, f) end) + if ok and diff < lowest_diff then + best_separator = s + lowest_diff = diff + end + end + + return best_separator +end + + +local unicode_BOMS = +{ + { + length = 2, + BOMS = + { + ["\254\255"] = true, -- UTF-16 big-endian + ["\255\254"] = true, -- UTF-16 little-endian + } + }, + { + length = 3, + BOMS = + { + ["\239\187\191"] = true, -- UTF-8 + } + } +} + + +local function find_unicode_BOM(sub) + for _, x in ipairs(unicode_BOMS) do + local code = sub(1, x.length) + if x.BOMS[code] then + return x.length + end + end + return 0 +end + + +--- Iterate through the records in a file +-- Since records might be more than one line (if there's a newline in quotes) +-- and line-endings might not be native, we read the file in chunks of +-- we read the file in chunks using a file_buffer, rather than line-by-line +-- using io.lines. +local function separated_values_iterator(buffer, parameters) + local field_start = 1 + + local advance + if buffer.truncate then + advance = function(n) + field_start = field_start + n + buffer:truncate(field_start) + end + else + advance = function(n) + field_start = field_start + n + end + end + + + local function field_sub(a, b) + b = b == -1 and b or b + field_start - 1 + return buffer:sub(a + field_start - 1, b) + end + + + local function field_find(pattern, init) + init = init or 1 + local f, l, c = buffer:find(pattern, init + field_start - 1) + if not f then return end + return f - field_start + 1, l - field_start + 1, c + end + + + -- Is there some kind of Unicode BOM here? + advance(find_unicode_BOM(field_sub)) + + + -- Start reading the file + local sep = "(["..(parameters.separator or + guess_separator(buffer, separated_values_iterator)).."\n\r])" + local line_start = 1 + local line = 1 + local field_count, fields, starts, nonblanks = 0, {}, {} + local header, header_read + local field_start_line, field_start_column + local record_count = 0 + + + local function problem(message) + error(("%s:%d:%d: %s"): + format(parameters.filename, field_start_line, field_start_column, + message), 0) + end + + + while true do + local field_end, sep_end, this_sep + local tidy + field_start_line = line + field_start_column = field_start - line_start + 1 + + -- If the field is quoted, go find the other quote + if field_sub(1, 1) == '"' then + advance(1) + local current_pos = 0 + repeat + local a, b, c = field_find('"("?)', current_pos + 1) + current_pos = b + until c ~= '"' + if not current_pos then problem("unmatched quote") end + tidy = fix_quotes + field_end, sep_end, this_sep = field_find(" *([^ ])", current_pos+1) + if this_sep and not this_sep:match(sep) then problem("unmatched quote") end + else + field_end, sep_end, this_sep = field_find(sep, 1) + tidy = trim_space + end + + -- Look for the separator or a newline or the end of the file + field_end = (field_end or 0) - 1 + + -- Read the field, then convert all the line endings to \n, and + -- count any embedded line endings + local value = field_sub(1, field_end) + value = value:gsub("\r\n", "\n"):gsub("\r", "\n") + for nl in value:gmatch("\n()") do + line = line + 1 + line_start = nl + field_start + end + + value = tidy(value) + if #value > 0 then nonblanks = true end + field_count = field_count + 1 + + -- Insert the value into the table for this "line" + local key + if parameters.column_map and header_read then + local ok + ok, value, key = pcall(parameters.column_map.transform, + parameters.column_map, value, field_count) + if not ok then problem(value) end + elseif header then + key = header[field_count] + else + key = field_count + end + if key then + fields[key] = value + starts[key] = { line=field_start_line, column=field_start_column } + end + + -- if we ended on a newline then yield the fields on this line. + if not this_sep or this_sep == "\r" or this_sep == "\n" then + if parameters.column_map and not header_read then + header_read = parameters.column_map:read_header(fields) + elseif parameters.header and not header_read then + if nonblanks or field_count > 1 then -- ignore blank lines + header = fields + header_read = true + end + else + if nonblanks or field_count > 1 then -- ignore blank lines + coroutine.yield(fields, starts) + record_count = record_count + 1 + if parameters.record_limit and + record_count >= parameters.record_limit then + break + end + end + end + field_count, fields, starts, nonblanks = 0, {}, {} + end + + -- If we *really* didn't find a separator then we're done. + if not sep_end then break end + + -- If we ended on a newline then count it. + if this_sep == "\r" or this_sep == "\n" then + if this_sep == "\r" and field_sub(sep_end+1, sep_end+1) == "\n" then + sep_end = sep_end + 1 + end + line = line + 1 + line_start = field_start + sep_end + end + + advance(sep_end) + end +end + + +------------------------------------------------------------------------------ + +local buffer_mt = +{ + lines = function(t) + return coroutine.wrap(function() + separated_values_iterator(t.buffer, t.parameters) + end) + end, + close = function(t) + if t.buffer.close then t.buffer:close() end + end, + name = function(t) + return t.parameters.filename + end, +} +buffer_mt.__index = buffer_mt + + +--- Use an existing file or buffer as a stream to read csv from. +-- (A buffer is just something that looks like a string in that we can do +-- `buffer:sub()` and `buffer:find()`) +-- @return a file object +local function use( + buffer, -- ?string|file|buffer: the buffer to read from. If it's: + -- - a string, read from that; + -- - a file, turn it into a file_buffer; + -- - nil, read from stdin + -- otherwise assume it's already a a buffer. + parameters) -- ?table: parameters controlling reading the file. + -- See README.md + parameters = parameters or {} + parameters.filename = parameters.filename or "" + parameters.column_map = parameters.columns and + column_map:new(parameters.columns) + + if not buffer then + buffer = file_buffer:new(io.stdin) + elseif io.type(buffer) == "file" then + buffer = file_buffer:new(buffer) + end + + local f = { buffer = buffer, parameters = parameters } + return setmetatable(f, buffer_mt) +end + + +------------------------------------------------------------------------------ + +--- Open a file for reading as a delimited file +-- @return a file object +local function open( + filename, -- string: name of the file to open + parameters) -- ?table: parameters controlling reading the file. + -- See README.md + local file, message = io.open(filename, "r") + if not file then return nil, message end + + parameters = parameters or {} + parameters.filename = filename + return use(file_buffer:new(file), parameters) +end + + +------------------------------------------------------------------------------ + +local function makename(s) + local t = {} + t[#t+1] = "<(String) " + t[#t+1] = (s:gmatch("[^\n]+")() or ""):sub(1,15) + if #t[#t] > 14 then t[#t+1] = "..." end + t[#t+1] = " >" + return table.concat(t) +end + + +--- Open a string for reading as a delimited file +-- @return a file object +local function openstring( + filecontents, -- string: The contents of the delimited file + parameters) -- ?table: parameters controlling reading the file. + -- See README.md + + parameters = parameters or {} + + + parameters.filename = parameters.filename or makename(filecontents) + parameters.buffer_size = parameters.buffer_size or #filecontents + return use(filecontents, parameters) +end + + +------------------------------------------------------------------------------ + +return { open = open, openstring = openstring, use = use } + +------------------------------------------------------------------------------ diff --git a/lua-csv/lua/test.lua b/lua-csv/lua/test.lua new file mode 100644 index 0000000..f418cf6 --- /dev/null +++ b/lua-csv/lua/test.lua @@ -0,0 +1,102 @@ +pcall(require, "strict") +local csv = require"csv" + +local errors = 0 + +local function testhandle(handle, correct_result) + local result = {} + for r in handle:lines() do + if not r[1] then + local r2 = {} + for k, v in pairs(r) do r2[#r2+1] = k..":"..tostring(v) end + table.sort(r2) + r = r2 + end + result[#result+1] = table.concat(r, ",") + end + + handle:close() + + result = table.concat(result, "!\n").."!" + if result ~= correct_result then + io.stderr:write( + ("Error reading '%s':\nExpected output:\n%s\n\nActual output:\n%s\n\n"): + format(handle:name(), correct_result, result)) + errors = errors + 1 + return false + end + return true +end + +local function test(filename, correct_result, parameters) + parameters = parameters or {} + for i = 1, 16 do + parameters.buffer_size = i + local f = csv.open(filename, parameters) + local fileok = testhandle(f, correct_result) + + if fileok then + f = io.open(filename, "r") + local data = f:read("*a") + f:close() + + f = csv.openstring(data, parameters) + testhandle(f, correct_result) + end + end +end + +test("../test-data/embedded-newlines.csv", [[ +embedded +newline,embedded +newline,embedded +newline! +embedded +newline,embedded +newline,embedded +newline!]]) + +test("../test-data/embedded-quotes.csv", [[ +embedded "quotes",embedded "quotes",embedded "quotes"! +embedded "quotes",embedded "quotes",embedded "quotes"!]]) + +test("../test-data/header.csv", [[ +alpha:ONE,bravo:two,charlie:3! +alpha:four,bravo:five,charlie:6!]], {header=true}) + +test("../test-data/header.csv", [[ +apple:one,charlie:30! +apple:four,charlie:60!]], +{ columns = { + apple = { name = "ALPHA", transform = string.lower }, + charlie = { transform = function(x) return tonumber(x) * 10 end }}}) + +test("../test-data/blank-line.csv", [[ +this,file,ends,with,a,blank,line!]]) + +test("../test-data/BOM.csv", [[ +apple:one,charlie:30! +apple:four,charlie:60!]], +{ columns = { + apple = { name = "ALPHA", transform = string.lower }, + charlie = { transform = function(x) return tonumber(x) * 10 end }}}) + +test("../test-data/bars.txt", [[ +there's a comma in this field, but no newline,embedded +newline,embedded +newline! +embedded +newline,embedded +newline,embedded +newline!]]) + + +if errors == 0 then + io.stdout:write("Passed\n") +elseif errors == 1 then + io.stdout:write("1 error\n") +else + io.stdout:write(("%d errors\n"):format(errors)) +end + +os.exit(errors) diff --git a/lua-csv/makefile b/lua-csv/makefile new file mode 100644 index 0000000..dfa7596 --- /dev/null +++ b/lua-csv/makefile @@ -0,0 +1,14 @@ +LUA= $(shell echo `which lua`) +LUA_BINDIR= $(shell echo `dirname $(LUA)`) +LUA_PREFIX= $(shell echo `dirname $(LUA_BINDIR)`) +LUA_VERSION = $(shell echo `lua -v 2>&1 | cut -d " " -f 2 | cut -b 1-3`) +LUA_SHAREDIR=$(LUA_PREFIX)/share/lua/$(LUA_VERSION) + +default: + @echo "Nothing to build. Try 'make install' or 'make test'." + +install: + cp lua/csv.lua $(LUA_SHAREDIR) + +test: + cd lua && $(LUA) test.lua diff --git a/lua-csv/rockspecs/csv-1-1.rockspec b/lua-csv/rockspecs/csv-1-1.rockspec new file mode 100644 index 0000000..6f280aa --- /dev/null +++ b/lua-csv/rockspecs/csv-1-1.rockspec @@ -0,0 +1,24 @@ +package = "csv" +version = "1-1" +source = +{ + url = "git://github.com/geoffleyland/lua-csv.git", + branch = "master", + tag = "v1", +} +description = +{ + summary = "CSV and other delimited file reading", + homepage = "http://github.com/geoffleyland/lua-csv", + license = "MIT/X11", + maintainer = "Geoff Leyland " +} +dependencies = { "lua >= 5.1" } +build = +{ + type = "builtin", + modules = + { + csv = "lua/csv.lua", + }, +} diff --git a/lua-csv/rockspecs/csv-scm-1.rockspec b/lua-csv/rockspecs/csv-scm-1.rockspec new file mode 100644 index 0000000..29629da --- /dev/null +++ b/lua-csv/rockspecs/csv-scm-1.rockspec @@ -0,0 +1,23 @@ +package = "csv" +version = "scm-1" +source = +{ + url = "git://github.com/geoffleyland/lua-csv.git", + branch = "master", +} +description = +{ + summary = "CSV and other delimited file reading", + homepage = "http://github.com/geoffleyland/lua-csv", + license = "MIT/X11", + maintainer = "Geoff Leyland " +} +dependencies = { "lua >= 5.1" } +build = +{ + type = "builtin", + modules = + { + csv = "lua/csv.lua", + }, +} diff --git a/lua-csv/test-data/BOM.csv b/lua-csv/test-data/BOM.csv new file mode 100644 index 0000000..9787c0d --- /dev/null +++ b/lua-csv/test-data/BOM.csv @@ -0,0 +1,3 @@ +alpha,bravo,charlie +ONE,two,3 +four,five,6 \ No newline at end of file diff --git a/lua-csv/test-data/bars.txt b/lua-csv/test-data/bars.txt new file mode 100644 index 0000000..9decabc --- /dev/null +++ b/lua-csv/test-data/bars.txt @@ -0,0 +1,7 @@ +there's a comma in this field, but no newline|"embedded +newline"|"embedded +newline" +"embedded +newline"|"embedded +newline"|"embedded +newline" \ No newline at end of file diff --git a/lua-csv/test-data/blank-line.csv b/lua-csv/test-data/blank-line.csv new file mode 100644 index 0000000..63fc515 --- /dev/null +++ b/lua-csv/test-data/blank-line.csv @@ -0,0 +1,2 @@ +this,file,ends,with,a,blank,line + diff --git a/lua-csv/test-data/embedded-newlines.csv b/lua-csv/test-data/embedded-newlines.csv new file mode 100644 index 0000000..67987d1 --- /dev/null +++ b/lua-csv/test-data/embedded-newlines.csv @@ -0,0 +1,8 @@ +"embedded +newline","embedded +newline","embedded +newline" +"embedded +newline","embedded +newline","embedded +newline" \ No newline at end of file diff --git a/lua-csv/test-data/embedded-quotes.csv b/lua-csv/test-data/embedded-quotes.csv new file mode 100644 index 0000000..e0c5c73 --- /dev/null +++ b/lua-csv/test-data/embedded-quotes.csv @@ -0,0 +1,2 @@ +"embedded ""quotes""","embedded ""quotes""","embedded ""quotes""" +"embedded ""quotes""","embedded ""quotes""","embedded ""quotes""" \ No newline at end of file diff --git a/lua-csv/test-data/header.csv b/lua-csv/test-data/header.csv new file mode 100644 index 0000000..89f702e --- /dev/null +++ b/lua-csv/test-data/header.csv @@ -0,0 +1,3 @@ +alpha,bravo,charlie +ONE,two,3 +four,five,6 \ No newline at end of file diff --git a/minigame_manager.lua b/minigame_manager.lua index 76b8b26..9957e98 100644 --- a/minigame_manager.lua +++ b/minigame_manager.lua @@ -1,415 +1,438 @@ -local storage = quikbild.storage - - - - -local clearinv = function(p_name) - local player = minetest.get_player_by_name(p_name) - local inv = player:get_inventory() - for idx ,itemname in pairs(quikbild.items) do - local stack = ItemStack(itemname) - local taken = inv:remove_item("main", stack) - end - - -end - - -arena_lib.on_load("quikbild", function(arena) - - - - arena_lib.HUD_send_msg_all("title", arena, 'QuikBild v '..quikbild.version, 3 ,nil,0xFF0000) - - local poss = {} - local ser_poss = storage:get_string("pos_"..arena.name) - if ser_poss then - poss = minetest.deserialize(ser_poss) - if poss == nil then poss = {} end - end - for _,pos in ipairs(poss) do - minetest.set_node(pos, {name="quikbild:climb"}) - end - storage:set_string("pos_"..arena.name,minetest.serialize({})) - -end) - - - - -arena_lib.on_time_tick('quikbild', function(arena) - - - - if arena.state == 'choose_artist' then - - --choose the artist - local artist_canidates = {} - for pl_name,stats in pairs(arena.players) do - if stats.has_built == false then - table.insert(artist_canidates,pl_name) - end - end - if #artist_canidates == 0 then --we have reached game's end - arena.state = 'game_over' - local winning_score = 0 - local winners = {} - - for pl_name,stats in pairs(arena.players) do - if stats.score == winning_score then - table.insert(winners,pl_name) - elseif stats.score > winning_score then - winning_score = stats.score - winners = {pl_name} - end - end - - - - - - -- for pl_name,stats in pairs(arena.players) do - -- local edit = true - -- if not winner_table[1] then - -- winner_table = {{pl_name,stats.score}} - -- edit = false - -- end - -- if edit then - -- local current_winner_stats = winner_table[1] - -- minetest.chat_send_all('current_winner_stats:'..dump(current_winner_stats)) - -- local current_winner_score = current_winner_stats[2] - -- if stats.score == current_winner_score then - -- table.insert(winner_table,{pl_name,stats.score}) - -- elseif stats.score > current_winner_score then - -- winner_table = {{pl_name,stats.score}} - -- end - -- end - -- end - -- local first_winner = winner_table[1] - if winning_score == 0 then --if no one got any points, then eliminate everyone - arena_lib.HUD_send_msg_all("broadcast", arena, 'No one got any points :( Try again!', 3 ,'sumo_lose',0xFF0000) - minetest.after(4,function(arena) - arena_lib.force_arena_ending('quikbild', arena,'Game') - - end,arena) - else - - local winner_string = '' - local pts = 0 - for _,pl_name in pairs(winners) do - - winner_string = winner_string..pl_name..", " - - end - arena_lib.HUD_send_msg_all("broadcast", arena, winner_string..' won with '..winning_score.. ' pts!', 3 ,'sumo_win',0x0000AA) - -- minetest.log(dump(winners)) - minetest.after(4,function(arena) --cant use arena_lib.load celebration rn, doesnt recognize more than 1 winner - arena_lib.force_arena_ending('quikbild', arena,'Game') - - end,arena) - end - - return - end - --game ist over, so we choose the artist - - - - - local rand_art_idx = math.random(1,#artist_canidates) - arena.artist = artist_canidates[rand_art_idx] - arena.players[arena.artist].has_built = true --indicate that they were the artist - arena.state = 'build_think' --change the arena state so we dont run this code again - --send info messages - arena_lib.HUD_send_msg("broadcast", arena.artist, 'You are the Artist. Build the word you see', 4 ,nil,0xFF0000) - for pl_name,stats in pairs(arena.players) do - if pl_name ~= arena.artist then - arena_lib.HUD_send_msg("broadcast", pl_name, arena.artist .. ' is the artist.', 2 ,nil,0xFF0000) - minetest.after(2, function(arena,pl_name) - arena_lib.HUD_send_msg("hotbar", pl_name, 'Guess what they are building. Type it in chat (lowercase only)', 2 ,nil,0xFF0000) - end,arena,pl_name) - end - end - --choose the word - arena.word = arena.word_list[math.random(1,#arena.word_list)] - --clear the building area - -- local pos1 = arena.build_area_pos_1 - -- local pos2 = arena.build_area_pos_2 - -- local x1 = pos1.x - -- local x2 = pos2.x - -- local y1 = pos1.y - -- local y2 = pos2.y - -- local z1 = pos1.z - -- local z2 = pos2.z - -- if x1 > x2 then - -- local temp = x2 - -- x2 = x1 - -- x1 = temp - -- end - -- if y1 > y2 then - -- local temp = y2 - -- y2 = y1 - -- y1 = temp - -- end - -- if z1 > z2 then - -- local temp = z2 - -- z2 = z1 - -- z1 = temp - -- end - - -- for x = x1,x2 do - -- for y = y1,y2 do - -- for z = z1,z2 do - -- local nodename = minetest.get_node({x=x,y=y,z=z}).name - -- if string.find(nodename,'quikbild') then - - - -- minetest.set_node({x=x,y=y,z=z}, {name="quikbild:climb"}) - -- end - - - -- end - -- end - -- end - local poss = {} - local ser_poss = storage:get_string("pos_"..arena.name) - if ser_poss then - poss = minetest.deserialize(ser_poss) - if poss == nil then poss = {} end - end - for _,pos in ipairs(poss) do - minetest.set_node(pos, {name="quikbild:climb"}) - end - storage:set_string("pos_"..arena.name,minetest.serialize({})) - - ----minetest.chat_send_all('cleared!') - - - - - - - -- teleport the artist in to the building area. - - - local artist_pl = minetest.get_player_by_name(arena.artist) - artist_pl:move_to(arena.artist_spawn_pos) - - - - - - - end - - - - - if arena.state == 'build_think' then - arena.state_time = arena.state_time + 1 --increase the timer counter - if arena.state_time == 4 then - --send the word to the artist - arena_lib.HUD_send_msg("title", arena.artist, arena.word, 4 ,nil,0xFF0000) - arena_lib.HUD_send_msg_all("broadcast", arena, 'Round begins in 5', 1 ,nil,0xFF0000) - end - if arena.state_time == 5 then - arena_lib.HUD_send_msg_all("broadcast", arena, 'Round begins in 4', 1 ,nil,0xFF0000) - end - if arena.state_time == 6 then - arena_lib.HUD_send_msg_all("broadcast", arena, 'Round begins in 3', 1 ,nil,0xFF0000) - end - if arena.state_time == 7 then - arena_lib.HUD_send_msg_all("broadcast", arena, 'Round begins in 2', 1 ,nil,0xFF0000) - end - if arena.state_time == 8 then - arena_lib.HUD_send_msg_all("broadcast", arena, 'Round begins in 1', 1 ,nil,0xFF0000) - end - if arena.state_time == 9 then - --give the artist his tools, send start to everyone, change state - for pl_name, stats in pairs(arena.players) do - if pl_name == arena.artist then - local player = minetest.get_player_by_name(pl_name) - for idx ,itemname in pairs(quikbild.items) do - local item = ItemStack(itemname) - player:get_inventory():set_stack("main", idx, item) - end - arena_lib.HUD_send_msg("title", pl_name, 'BUILD!', 1 ,nil,0x00FF00) - arena_lib.HUD_send_msg("title", pl_name, 'BUILD!', 1 ,nil,0x00FF00) - else - arena_lib.HUD_send_msg("title", pl_name, 'BEGIN GUESSSING!', 1 ,nil,0x00FF00) - end - arena.state = 'build' - arena.state_time = 0 - end - end - end - - - - - - if arena.state == 'build' then - if not arena.stall then - local time_left = arena.build_time - arena.state_time - - - local art_is_in_game = false - for pl_name,stats in pairs(arena.players) do - if pl_name == arena.artist then - art_is_in_game = true - end - end - - if not(art_is_in_game) then --if arena.artist is no longer in the game, then send message to players, and change game state to choose artist, and return - arena_lib.HUD_send_msg_all("Title", arena, "Oops! Looks like the artist left the game."..arena.word, 3 ,'sumo_elim',0xFFFFFF) - arena.stall = true --stop gameplay for 3 sec - minetest.after(3,function(arena) - if arena.in_game then - arena.stall = false - arena.state = 'choose_artist' - arena.state_time = 0 - for pl_name,stats in pairs(arena.players) do - local pos = arena_lib.get_random_spawner(arena) - local pl_obj = minetest.get_player_by_name(pl_name) - pl_obj:move_to(pos) - clearinv(pl_name) - end - end - - end,arena) - return - - end - - - if time_left == 0 then - - - --change game state - arena_lib.HUD_send_msg_all("title", arena, "TIME's UP! The word was: "..arena.word, 3 ,'sumo_lose',0xFFFFFF) - arena.stall = true --stop gameplay for 3 sec - minetest.after(3,function(arena) - if arena.in_game then - arena.stall = false - arena.state = 'choose_artist' - arena.state_time = 0 - for pl_name,stats in pairs(arena.players) do - local pos = arena_lib.get_random_spawner(arena) - local pl_obj = minetest.get_player_by_name(pl_name) - pl_obj:move_to(pos) - clearinv(pl_name) - end - - end - - end,arena) - - return - end - - for pl_name,stats in pairs(arena.players) do - if pl_name == arena.artist then - arena_lib.HUD_send_msg("hotbar", pl_name, "WORD: ".. arena.word .." TIME: "..time_left, 1 ,nil,0xFFFFFF) - else - arena_lib.HUD_send_msg("hotbar", pl_name, " TIME LEFT IN ROUND: "..time_left, 1 ,nil,0xFFFFFF) - end - end - - arena.state_time = arena.state_time + 1 - - end - - end -end) - - - -table.insert(minetest.registered_on_chat_messages, 1, function(p_name, message) --thanks rubenwardy, for giving this code snippet that works around Arena_libs's chat prevention! - if message:sub(1, 1) == "/" then - return false - end - - ----minetest.chat_send_all('line 275') - if arena_lib.is_player_in_arena(p_name,'quikbild') then - ----minetest.chat_send_all('line 276') - local arena = arena_lib.get_arena_by_player(p_name) - if not(arena.in_queue) and not(arena.in_celebration) and not(arena.in_loading) then - ----minetest.chat_send_all('line 279') - - if arena.state == 'build' then - ----minetest.chat_send_all('line 283') - - if p_name == arena.artist then - return true -- prevent cheating! - else - ----minetest.chat_send_all('line 285') - - if string.find(message,arena.word) then -- if the word was said... - ----minetest.chat_send_all('line 288') - - for pl_name, stats in pairs(arena.players) do - if pl_name == p_name then - local list = {'Correct!', 'You got it!','Way to go!', 'Outstanding!', 'Yay!'} - local msg = list[math.random(1,5)]..' +1 pt' - arena_lib.HUD_send_msg("title", pl_name, msg, 3 ,'sumo_win',0x00FF00) - arena.players[p_name].score = arena.players[p_name].score + 1 - elseif pl_name == arena.artist then - local msg = 'Yay! '..p_name..' guessed your word. +1 pt' - arena_lib.HUD_send_msg("title", pl_name, msg, 3 ,'sumo_win',0x00FF00) - arena.players[pl_name].score = arena.players[pl_name].score + 1 - else - local msg = p_name..' guessed the word. Round over!' - arena_lib.HUD_send_msg("title", pl_name, msg, 3 ,'sumo_elim',0x00FF00) - end - end - - - arena.stall = true --stop gameplay for 3 sec - minetest.after(3,function(arena) - if arena.in_game then - arena.stall = false - arena.state = 'choose_artist' - arena.state_time = 0 - for pl_name,stats in pairs(arena.players) do - local pos = arena_lib.get_random_spawner(arena) - local pl_obj = minetest.get_player_by_name(pl_name) - pl_obj:move_to(pos) - clearinv(pl_name) - end - end - - end,arena) - - - end - end - end - end - end - -end) - - - - - - --- arena_lib.on_celebration('quikbild', function(arena, winner_name) --- minetest.after(3,function(arena) --- arena_lib.HUD_hide('all', arena) --- end,arena) - --- end) - --- arena_lib.on_quit('quikbild', function(arena, p_name, is_forced) --- local player = --- arena_lib.HUD_hide('all', p_name) --- end) - - -minetest.register_on_joinplayer(function(player) - local name = player:get_player_name() - clearinv(name) - -end) - +local S = minetest.get_translator("quikbild") + +local storage = quikbild.storage + + + +-- funcs defined + +local clearinv = function(p_name) end +local send_lang_fs = function(p_name) end + + +arena_lib.on_load("quikbild", function(arena) + + + local f = quikbild.csv.open(minetest.get_modpath("quikbild")..arena.word_list_path) + if not f then + f = quikbild.csv.open(minetest.get_worldpath()..arena.word_list_path) + end + + if f then + local word_list = {} + + for fields in f:lines() do + local translation_list = {} + for i, v in ipairs(fields) do + table.insert(translation_list,v) + end + table.insert(word_list,translation_list) + end + arena.word_list = word_list + end + + -- send the lang chooser fs + for pl_name,stats in pairs(arena.players) do + local code = storage:get_string("lang_"..pl_name) + code = tonumber(code) or 1 + arena.players[pl_name].lang = code + + end + + local poss = {} + local ser_poss = storage:get_string("pos_"..arena.name) + if ser_poss then + poss = minetest.deserialize(ser_poss) + if poss == nil then poss = {} end + end + for _,pos in ipairs(poss) do + minetest.set_node(pos, {name="quikbild:climb"}) + end + storage:set_string("pos_"..arena.name,minetest.serialize({})) + +end) + + + + + +arena_lib.on_time_tick('quikbild', function(arena) + + if arena.state == 'choose_artist' then + --choose the artist + local artist_canidates = {} + for pl_name,stats in pairs(arena.players) do + if stats.has_built == false then + table.insert(artist_canidates,pl_name) + end + end + if #artist_canidates == 0 then --we have reached game's end + arena.state = 'game_over' + local winning_score = 0 + local winners = {} + + for pl_name,stats in pairs(arena.players) do + if stats.score == winning_score then + table.insert(winners,pl_name) + elseif stats.score > winning_score then + winning_score = stats.score + winners = {pl_name} + end + end + + if winning_score == 0 then --if no one got any points, then eliminate everyone + arena_lib.HUD_send_msg_all("broadcast", arena, S('No one got any points')..' :( '..S('Try again!'), 3 ,'sumo_lose',0xFF0000) + minetest.after(4,function(arena) + arena_lib.force_arena_ending('quikbild', arena,'Game') + + end,arena) + else + + local winner_string = '' + local pts = 0 + for _,pl_name in pairs(winners) do + + winner_string = winner_string..pl_name..", " + + end + arena_lib.HUD_send_msg_all("broadcast", arena, winner_string..' '..S('won with')..' '..winning_score.. ' pts!', 3 ,'sumo_win',0x0000AA) + -- minetest.log(dump(winners)) + minetest.after(4,function(arena) --cant use arena_lib.load celebration rn, doesnt recognize more than 1 winner + arena_lib.force_arena_ending('quikbild', arena,'Game') + + end,arena) + end + + return + end + + + --game isn't over, so we choose the artist + + + local rand_art_idx = math.random(1,#artist_canidates) + arena.artist = artist_canidates[rand_art_idx] + arena.players[arena.artist].has_built = true --indicate that they were the artist + arena.state = 'build_think' --change the arena state so we dont run this code again + --send info messages + arena_lib.HUD_send_msg("broadcast", arena.artist, S('You are the Artist. Build the word you see'), 4 ,nil,0xFF0000) + for pl_name,stats in pairs(arena.players) do + + if pl_name ~= arena.artist then + arena_lib.HUD_send_msg("broadcast", pl_name, arena.artist .. ' '..S('is the artist.'), 2 ,nil,0xFF0000) + + -- give everyone except the artist helpful tools + local l_player = minetest.get_player_by_name(pl_name) + l_player:hud_set_hotbar_itemcount(2) + + for idx ,itemname in pairs({"quikbild:lang","quikbild:help"}) do + local item = ItemStack(itemname) + l_player:get_inventory():set_stack("main", idx, item) + end + + minetest.after(2, function(arena,pl_name) + arena_lib.HUD_send_msg("hotbar", pl_name, S('Guess what they are building.'), 2 ,nil,0xFF0000) + end,arena,pl_name) + else + -- set the artist's hotbar larger + local player = minetest.get_player_by_name(pl_name) + player:hud_set_hotbar_itemcount(#dye.dyes) + end + end + + + --choose the word + + arena.word = arena.word_list[math.random(1,#arena.word_list)] + + -- clear the board of old building peices + local poss = {} + local ser_poss = storage:get_string("pos_"..arena.name) + if ser_poss then + poss = minetest.deserialize(ser_poss) + if poss == nil then poss = {} end + end + for _,pos in ipairs(poss) do + minetest.set_node(pos, {name="quikbild:climb"}) + end + storage:set_string("pos_"..arena.name,minetest.serialize({})) + + -- teleport the artist in to the building area. + local artist_pl = minetest.get_player_by_name(arena.artist) + artist_pl:move_to(arena.artist_spawn_pos) + end + + if arena.state == 'build_think' then + arena.state_time = arena.state_time + 1 --increase the timer counter + if arena.state_time == 4 then + --send the word to the artist + arena_lib.HUD_send_msg("title", arena.artist, arena.word[arena.players[arena.artist].lang], 4 ,nil,0xFF0000) + arena_lib.HUD_send_msg_all("broadcast", arena, S('Round begins in')..' 5', 1 ,nil,0xFF0000) + end + if arena.state_time == 5 then + arena_lib.HUD_send_msg_all("broadcast", arena, S('Round begins in')..' 4', 1 ,nil,0xFF0000) + end + if arena.state_time == 6 then + arena_lib.HUD_send_msg_all("broadcast", arena, S('Round begins in')..' 3', 1 ,nil,0xFF0000) + end + if arena.state_time == 7 then + arena_lib.HUD_send_msg_all("broadcast", arena, S('Round begins in')..' 2', 1 ,nil,0xFF0000) + end + if arena.state_time == 8 then + arena_lib.HUD_send_msg_all("broadcast", arena, S('Round begins in')..' 1', 1 ,nil,0xFF0000) + end + if arena.state_time == 9 then + --give the artist his tools, send start to everyone, change state + for pl_name, stats in pairs(arena.players) do + if pl_name == arena.artist then + local player = minetest.get_player_by_name(pl_name) + for idx ,itemname in pairs(quikbild.items) do + local item = ItemStack(itemname) + player:get_inventory():set_stack("main", idx, item) + end + arena_lib.HUD_send_msg("title", pl_name, S('BUILD!'), 1 ,nil,0x00FF00) + else + arena_lib.HUD_send_msg("title", pl_name, S('BEGIN GUESSSING!'), 1 ,nil,0x00FF00) + end + arena.state = 'build' + arena.state_time = 0 + end + end + end + + + + + + if arena.state == 'build' then + if not arena.stall then + local time_left = arena.build_time - arena.state_time + + + local art_is_in_game = false + for pl_name,stats in pairs(arena.players) do + if pl_name == arena.artist then + art_is_in_game = true + end + end + + if not(art_is_in_game) then --if arena.artist is no longer in the game, then send message to players, and change game state to choose artist, and return + for pl_name,stats in pairs(arena.players) do + local msg = S("Oops! The artist left the game. The word was").." "..arena.word[stats.lang] + arena_lib.HUD_send_msg("title", pl_name, msg, 3, 'sumo_elim',0xFFFFFF) + minetest.chat_send_player(pl_name,minetest.colorize("#7D7071",">> "..msg)) + end + arena.stall = true --stop gameplay for 3 sec + minetest.after(3,function(arena) + if arena.in_game then + arena.stall = false + arena.state = 'choose_artist' + arena.state_time = 0 + for pl_name,stats in pairs(arena.players) do + local pos = arena_lib.get_random_spawner(arena) + local pl_obj = minetest.get_player_by_name(pl_name) + pl_obj:move_to(pos) + clearinv(pl_name) + end + end + + end,arena) + return + + end + + + if time_left == 0 then + + --change game state + for pl_name,stats in pairs(arena.players) do + local msg = S("TIME's UP! The word was:").." "..arena.word[stats.lang] + arena_lib.HUD_send_msg("title", pl_name, msg, 3, 'sumo_lose',0xFFFFFF) + minetest.chat_send_player(pl_name,minetest.colorize("#7D7071",">> "..msg)) + end + arena.stall = true --stop gameplay for 3 sec + minetest.after(3,function(arena) + if arena.in_game then + arena.stall = false + arena.state = 'choose_artist' + arena.state_time = 0 + for pl_name,stats in pairs(arena.players) do + local pos = arena_lib.get_random_spawner(arena) + local pl_obj = minetest.get_player_by_name(pl_name) + pl_obj:move_to(pos) + clearinv(pl_name) + end + + end + + end,arena) + + return + end + + for pl_name,stats in pairs(arena.players) do + if pl_name == arena.artist then + arena_lib.HUD_send_msg("hotbar", pl_name, S("WORD")..": ".. arena.word[stats.lang] .." TIME: "..time_left, 1 ,nil,0xFFFFFF) + else + arena_lib.HUD_send_msg("hotbar", pl_name, S("TIME LEFT IN ROUND")..": "..time_left, 1 ,nil,0xFFFFFF) + end + end + + arena.state_time = arena.state_time + 1 + + end + + end +end) + + + +table.insert(minetest.registered_on_chat_messages, 1, function(p_name, message) --thanks rubenwardy, for giving this code snippet that works around Arena_libs's chat prevention! + if message:sub(1, 1) == "/" then + return false + end + + if arena_lib.is_player_in_arena(p_name,'quikbild') then + local arena = arena_lib.get_arena_by_player(p_name) + if not(arena.in_queue) and not(arena.in_celebration) and not(arena.in_loading) then + + if arena.state == 'build' and arena.stall == false then + + if p_name == arena.artist then + return true -- prevent cheating! + else + + if string.find(message,arena.word[arena.players[p_name].lang]) then -- if the word was said... + + for pl_name, stats in pairs(arena.players) do + if pl_name == p_name then + local list = {S('Correct!'), S('You got it!'),S('Way to go!'), S('Outstanding!'), S('Yay!')} + local msg = list[math.random(1,5)]..' +1 pt' + arena_lib.HUD_send_msg("title", pl_name, msg, 3 ,'sumo_win',0x00FF00) + minetest.chat_send_player(pl_name,minetest.colorize("#7D7071",">> "..msg.." "..S("The word was:").." "..arena.word[stats.lang])) + arena.players[p_name].score = arena.players[p_name].score + 1 + elseif pl_name == arena.artist then + local msg = S('Yay!').. ' '.. p_name ..' ' .. S('guessed your word.') ..' +1 pt' + arena_lib.HUD_send_msg("title", pl_name, msg, 3 ,'sumo_win',0x00FF00) + arena.players[pl_name].score = arena.players[pl_name].score + 1 + else + local msg = p_name..' '..S('guessed the word. Round over!') + arena_lib.HUD_send_msg("title", pl_name, msg, 3 ,'sumo_elim',0x00FF00) + minetest.chat_send_player(pl_name,minetest.colorize("#7D7071",">> "..msg.." "..S("The word was:").." "..arena.word[stats.lang])) + end + end + + + arena.stall = true --stop gameplay for 3 sec + minetest.after(3,function(arena) + if arena.in_game then + arena.stall = false + arena.state = 'choose_artist' + arena.state_time = 0 + for pl_name,stats in pairs(arena.players) do + local pos = arena_lib.get_random_spawner(arena) + local pl_obj = minetest.get_player_by_name(pl_name) + pl_obj:move_to(pos) + clearinv(pl_name) + end + end + + end,arena) + end + end + end + end + end + +end) + + + + + + +arena_lib.on_celebration('quikbild', function(arena, winner_name) + for pl_name,stats in pairs(arena.players) do + minetest.close_formspec(pl_name, "qb_lang") + end +end) + +arena_lib.on_quit('quikbild', function(arena, p_name, is_forced) + minetest.close_formspec(p_name, "qb_lang") +end) + + +minetest.register_on_joinplayer(function(player) + local name = player:get_player_name() + clearinv(name) +end) + + + +-- ########################## +-- Functions Defined +-- ########################## + +-- clears inventory of quikbild items +clearinv = function(p_name) + local player = minetest.get_player_by_name(p_name) + local inv = player:get_inventory() + for idx ,itemname in pairs(quikbild.items) do + local stack = ItemStack(itemname) + local taken = inv:remove_item("main", stack) + end + local list = inv:get_list("main") + for k, v in pairs(list) do + if v:get_name() == "quikbild:lang" or v:get_name() == "quikbild:help" then + inv:remove_item("main", v) + end + end +end + + +send_lang_fs = function(p_name) + minetest.show_formspec(p_name, "qb_lang", "formspec_version[5]".. + "size[13.5,3]".. + "background9[0,0;0,0;quikbild_gui_bg.png;true;6,6]".. + "image_button[0.6,0.6;2.6,1.8;english.png;english;EN;false;true]".. + "image_button[3.8,0.6;2.6,1.8;italian.png;italian;IT;false;true]".. + "image_button[7,0.6;2.6,1.8;spanish.png;spanish;ES;false;true]".. + "image_button[10.2,0.6;2.6,1.8;french.png;french;FR;false;true]") +end + +quikbild.send_lang_fs = send_lang_fs + + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname ~= "qb_lang" then return end + local p_name = player:get_player_name() + local arena = arena_lib.get_arena_by_player(p_name) + local setting = 0 + if fields.english then + setting = 1 + minetest.close_formspec(p_name, "qb_lang") + end + if fields.italian then + setting = 2 + minetest.close_formspec(p_name, "qb_lang") + end + if fields.spanish then + setting = 3 + minetest.close_formspec(p_name, "qb_lang") + end + if fields.french then + setting = 4 + minetest.close_formspec(p_name, "qb_lang") + end + if setting ~= 0 then + + local code = setting + code = tostring(code) + storage:set_string("lang_"..p_name,code) + if arena then + arena.players[p_name].lang = setting + end + minetest.chat_send_player(p_name,minetest.colorize("#7D7071",">> "..S("Language setting confirmed!"))) + end +end) + diff --git a/nodes.lua b/nodes.lua index 0f506f6..6c2688d 100644 --- a/nodes.lua +++ b/nodes.lua @@ -1,73 +1,73 @@ - - - -minetest.register_node("quikbild:climb", { - description = "Minigame Climb", - drawtype = "airlike", - tiles = {}, - pointable = false, - buildable_to = true, - climbable = true, - walkable = false, - sunlight_propagates = true, - paramtype = 'light', - light_source = 6, - -}) - -quikbild.items = {} -local storage = quikbild.storage -local dyes = dye.dyes - -for i = 1, #dyes do - - local name, desc = unpack(dyes[i]) - - minetest.register_node("quikbild:" .. name, { - description = "Minigame ".. desc, - tiles = {"wool_" .. name .. ".png"}, - range = 10.0, - is_ground_content = false, - groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, - flammable = 3, wool = 1}, - sounds = default.node_sound_defaults(), - on_place = function(itemstack, placer, pointed_thing) - if placer:is_player() then - local p_name = placer:get_player_name() - if arena_lib.is_player_in_arena(p_name, "quikbild") then - local arena = arena_lib.get_arena_by_player(p_name) - --minetest.chat_send_all('ln17') - local pos = pointed_thing.above - if pos and minetest.get_node(pos).name == 'air' or string.find(minetest.get_node(pos).name,'quikbild') then - minetest.set_node(pos, {name="quikbild:" .. name}) - local poss = {} - local ser_poss = storage:get_string("pos_"..arena.name) - if ser_poss then - poss = minetest.deserialize(ser_poss) - end - table.insert(poss,pos) - storage:set_string("pos_"..arena.name,minetest.serialize(poss)) - return ItemStack("quikbild:" .. name), pos - end - end - end - - end, - drop = {}, - - on_use = function(itemstack, user, pointed_thing) - if arena_lib.is_player_in_arena(user:get_player_name(), "quikbild") then - local pos = pointed_thing.under - if pos and string.find(minetest.get_node(pos).name,'quikbild') then - - minetest.set_node(pos, {name="quikbild:climb"}) - end - end - return nil - - end, - - }) - table.insert(quikbild.items,"quikbild:" .. name) -end - +local S = minetest.get_translator("quikbild") + + +minetest.register_node("quikbild:climb", { + description = S("Quikbild Climb-able Node"), + drawtype = "airlike", + tiles = {}, + pointable = false, + buildable_to = true, + climbable = true, + walkable = false, + sunlight_propagates = true, + paramtype = 'light', + light_source = 6, + +}) + +quikbild.items = {} +local storage = quikbild.storage +local dyes = dye.dyes + +for i = 1, #dyes do + + local name, desc = unpack(dyes[i]) + + minetest.register_node("quikbild:" .. name, { + description = S("Minigame").." ".. desc, + tiles = {"wool_" .. name .. ".png"}, + range = 10.0, + is_ground_content = false, + groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, + flammable = 3, wool = 1}, + sounds = default.node_sound_defaults(), + on_place = function(itemstack, placer, pointed_thing) + if placer:is_player() then + local p_name = placer:get_player_name() + if arena_lib.is_player_in_arena(p_name, "quikbild") then + local arena = arena_lib.get_arena_by_player(p_name) + --minetest.chat_send_all('ln17') + local pos = pointed_thing.above + if pos and minetest.get_node(pos).name == 'air' or string.find(minetest.get_node(pos).name,'quikbild') then + minetest.set_node(pos, {name="quikbild:" .. name}) + local poss = {} + local ser_poss = storage:get_string("pos_"..arena.name) + if ser_poss then + poss = minetest.deserialize(ser_poss) + end + table.insert(poss,pos) + storage:set_string("pos_"..arena.name,minetest.serialize(poss)) + return ItemStack("quikbild:" .. name), pos + end + end + end + + end, + drop = {}, + + on_use = function(itemstack, user, pointed_thing) + if arena_lib.is_player_in_arena(user:get_player_name(), "quikbild") then + local pos = pointed_thing.under + if pos and string.find(minetest.get_node(pos).name,'quikbild') then + + minetest.set_node(pos, {name="quikbild:climb"}) + end + end + return nil + + end, + + }) + table.insert(quikbild.items,"quikbild:" .. name) +end + diff --git a/privs.lua b/privs.lua index 28bfbed..e99178c 100644 --- a/privs.lua +++ b/privs.lua @@ -1,3 +1,5 @@ -minetest.register_privilege("quikbild_admin", { - description = "With this you can use /quikbild create, edit" -}) +local S = minetest.get_translator("quikbild") + +minetest.register_privilege("quikbild_admin", { + description = S("With this you can use /quikbild create ,/quikbild edit ") +}) diff --git a/sounds/BGM licenses and info b/sounds/BGM licenses and info index c77247d..59613d9 100644 --- a/sounds/BGM licenses and info +++ b/sounds/BGM licenses and info @@ -1,70 +1,70 @@ -fight_looped.ogg -name: fight -https://opengameart.org/content/fast-fight-battle-music - -by mutkanto -http://soundcloud.com/mutkanto - -edited by XCVG xcvgsystems.com - - -CC0 - -======================================= - -s6 -name: dance music 1 -by: dogchicken -CC by 3.0 -https://creativecommons.org/licenses/by/3.0/ - - - -note: good for western or island theme - - -======================================= - - - -jump and run -tropics -https://opengameart.org/content/jump-and-run-tropical-mix - by bart - -CC-BY 3.0 -https://creativecommons.org/licenses/by/3.0/ - -======================================= - -Oldschool Main -CC0 - -by Joth -======================================= - - -# Block League -### BGM -* Hyperium: Drumstep Rock by [Anik's Adobe Tutorials](https://yewtu.be/watch?v=dsX_X0SXhGA) -* Neden1: Melodic Electro Rock by [Sound Lapse](https://yewtu.be/watch?v=VWx2JTBR9DI) -* Station2: Need for Beat by [Infraction](https://yewtu.be/watch?v=6Ja4IXVW2D4) -* Tunnel: Hazy by [SutheeComposer](https://yewtu.be/watch?v=FOhJJCd34mc) - - - -======================================= - -EpicTvTheme -FeelGoodRock -BigSwingBand -clouds - -by Jason Shaw audionautix.com - -Creative Commons Attribution 4.0 International - -https://audionautix.com/creative-commons-music -audionautix.com - -https://creativecommons.org/licenses/by/4.0/legalcode - +fight_looped.ogg +name: fight +https://opengameart.org/content/fast-fight-battle-music + +by mutkanto +http://soundcloud.com/mutkanto + +edited by XCVG xcvgsystems.com + + +CC0 + +======================================= + +s6 +name: dance music 1 +by: dogchicken +CC by 3.0 +https://creativecommons.org/licenses/by/3.0/ + + + +note: good for western or island theme + + +======================================= + + + +jump and run -tropics +https://opengameart.org/content/jump-and-run-tropical-mix + by bart + +CC-BY 3.0 +https://creativecommons.org/licenses/by/3.0/ + +======================================= + +Oldschool Main +CC0 + +by Joth +======================================= + + +# Block League +### BGM +* Hyperium: Drumstep Rock by [Anik's Adobe Tutorials](https://yewtu.be/watch?v=dsX_X0SXhGA) +* Neden1: Melodic Electro Rock by [Sound Lapse](https://yewtu.be/watch?v=VWx2JTBR9DI) +* Station2: Need for Beat by [Infraction](https://yewtu.be/watch?v=6Ja4IXVW2D4) +* Tunnel: Hazy by [SutheeComposer](https://yewtu.be/watch?v=FOhJJCd34mc) + + + +======================================= + +EpicTvTheme +FeelGoodRock +BigSwingBand +clouds + +by Jason Shaw audionautix.com + +Creative Commons Attribution 4.0 International + +https://audionautix.com/creative-commons-music +audionautix.com + +https://creativecommons.org/licenses/by/4.0/legalcode + diff --git a/textures/english.png b/textures/english.png new file mode 100644 index 0000000..250766c Binary files /dev/null and b/textures/english.png differ diff --git a/textures/french.png b/textures/french.png new file mode 100644 index 0000000..793fbcd Binary files /dev/null and b/textures/french.png differ diff --git a/textures/italian.png b/textures/italian.png new file mode 100644 index 0000000..04b9148 Binary files /dev/null and b/textures/italian.png differ diff --git a/textures/quikbild_gui_bg.png b/textures/quikbild_gui_bg.png new file mode 100644 index 0000000..b5de13d Binary files /dev/null and b/textures/quikbild_gui_bg.png differ diff --git a/textures/quikbild_langchoose.png b/textures/quikbild_langchoose.png new file mode 100644 index 0000000..e4bea54 Binary files /dev/null and b/textures/quikbild_langchoose.png differ diff --git a/textures/spanish.png b/textures/spanish.png new file mode 100644 index 0000000..770c606 Binary files /dev/null and b/textures/spanish.png differ diff --git a/word_lists/LICENSE b/word_lists/LICENSE deleted file mode 100644 index ef7e7ef..0000000 --- a/word_lists/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ -GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - {one line to give the program's name and a brief idea of what it does.} - Copyright (C) {year} {name of author} - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - {project} Copyright (C) {year} {fullname} - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/word_lists/README.md b/word_lists/README.md deleted file mode 100644 index 2ce6dc5..0000000 --- a/word_lists/README.md +++ /dev/null @@ -1,44 +0,0 @@ -Word lists are from: -The stated license applies to the word lists only. You are free to use or make your own word lists. Words must be inserted into the word_list variable on the minigame configuration, as a lua table of strings. - -# Pictionary Cards Generator - ----------------------------------- -License GPL 3.0 - -I couldn't find a pictionary anywhere in the city, so I decided to print one myself. I wasn't going to type all those words and names manually into Photoshop though, so I made this - a pictionary cards generator written in Python 3, using the Pillow graphics library. In its current form, it generates 100 cards across 7 A4 international paper size sheets, ready to print. - -## Requirements - -Requires Pythong 3.x, [Pillow](http://pillow.readthedocs.org/en/latest/installation.html#simple-installation) and the [Hans Kendrick font](http://openfontlibrary.org/en/font/hans-kendrick). - -## How to use - -To use the default word list, navigate to your cloned repo directory and then place the Hans Kendrick font into `resources`. Then, just run `./generate` in the terminal. You may need to `chmod +x generate` to give the file permissions to execute. If you'd like to modify the words that appear on the cards, look in /word-lists/ and modify the text files. - -## Extras -There's also a PSD of a board in `resources` that you can print to play the game. It fits on an A3 piece of paper. - -## The final product looks like this -![Pictionary-like Board](http://dew.dangelov.com/dewdrops/DEW-53dbfb4ca46180.37194370.JPG) - -## License -Copyright (C) 2014 Dino Angelov - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/word_lists/word-lists/easy.txt b/word_lists/word-lists/easy.txt deleted file mode 100644 index 5bd21a2..0000000 --- a/word_lists/word-lists/easy.txt +++ /dev/null @@ -1,100 +0,0 @@ -cheese -bone -socks -leaf -whale -pie -shirt -orange -lollipop -bed -mouth -person -horse -snake -jar -spoon -lamp -kite -monkey -swing -cloud -snowman -baby -eyes -pen -giraffe -grapes -book -ocean -star -cupcake -cow -lips -worm -sun -basketball -hat -bus -chair -purse -head -spider -shoe -ghost -coat -chicken -heart -jellyfish -tree -seashell -duck -bracelet -grass -jacket -slide -doll -spider -clock -cup -bridge -apple -balloon -drum -ears -egg -bread -nose -house -beach -airplane -inchworm -hippo -light -turtle -ball -carrot -cherry -ice -pencil -circle -bed -ant -girl -glasses -flower -mouse -banana -alligator -bell -robot -smile -bike -rocket -dinosaur -dog -bunny -cookie -bowl -apple -door \ No newline at end of file diff --git a/word_lists/word-lists/lua_table_list.lua b/word_lists/word-lists/lua_table_list.lua deleted file mode 100644 index 212a6a9..0000000 --- a/word_lists/word-lists/lua_table_list.lua +++ /dev/null @@ -1 +0,0 @@ -{"picture frame","gel","leg warmers","paint brush","bath fizzers","drill press","chalk","rubber duck","remote","word","spring","stone","rug","thermometer","stockings","CD","flower","car","check","vase","hanger","cookie","speaker","screw","paper","box","glasses","sailboat","pick","helmet","puddle","ring","pot","thread","bow","flag","fork","tape","lamp","tissue","balloon","lace","needle","chandelier","deodorant","button","note","candy","tooth paste","sharpie","twister","photo","pencil","bookmark","spoon","outlet","quilt","seat belt","mouse pad","tire swing","nail filer","cork","stop sign","rusty nail","gage","rubber band","zipper","canvas","sponge","soda","key","eraser","bottle","candle","lip","buckel","shovel","slipper","glow stick","cable","ice","credit card","nail clippers","sun glasses","tweezers","hair tie","charger","card","horse","door","song","trip","backbone","bomb","round","treasure","garbage","park","whistle","palace","baseball","coal","queen","dominoes","photo","graph","computer","hockey","plane","pepper","key","iPad","whisk","cake","circus","battery","mailman","cowboy","password","bicycle","skate","electric","lightsaber","nature","shallow","toast","outside","america","gingerbread","man","bowtie","light","bulb","platypus","music","sailboat","popsicle","knee","pineapple","tusk","sprinkler","money","spool","lighthouse","doormat","face","flute","owl","gate","suitcase","bathroom","scale","peach","newspaper","watering","can","hook","school","beaver","camera","hair","dryer","mushroom","quilt","chalk","dollar","soda","chin","swing","garden","ticket","boot","cello","rain","clam","pelican","stingray","nail","sheep","stoplight","coconut","crib","hippopotamus","ring","video","camera","snow","cheese","bone","socks","leaf","whale","pie","shirt","orange","lollipop","bed","mouth","person","horse","snake","jar","spoon","lamp","kite","monkey","swing","cloud","snowman","baby","eyes","pen","giraffe","grapes","book","ocean","star","cupcake","cow","lips","worm","sun","basketball","hat","bus","chair","purse","head","spider","shoe","ghost","coat","chicken","heart","jellyfish","tree","seashell","duck","bracelet","grass","jacket","slide","doll","spider","clock","cup","bridge","apple","balloon","drum","ears","egg","bread","nose","house","beach","airplane","inchworm","hippo","light","turtle","ball","carrot","cherry","ice","pencil","circle","bed","ant","girl","glasses","flower","mouse","banana","alligator","bell","robot","smile","bike","rocket","dino","dog","bunny","cookie","bowl","apple","door",} \ No newline at end of file diff --git a/word_lists/word-lists/medium.txt b/word_lists/word-lists/medium.txt deleted file mode 100644 index 5363ec9..0000000 --- a/word_lists/word-lists/medium.txt +++ /dev/null @@ -1,99 +0,0 @@ -horse -door -song -trip -backbone -bomb -round -treasure -garbage -park -whistle -palace -baseball -coal -queen -dominoes -photo -graph -computer -hockey -plane -pepper -key -iPad -whisk -cake -circus -battery -mailman -cowboy -password -bicycle -skate -electric -lightsaber -nature -shallow -toast -outside -america -gingerbread -man -bowtie -light -bulb -platypus -music -sailboat -popsicle -knee -pineapple -tusk -sprinkler -money -spool -lighthouse -doormat -face -flute -owl -gate -suitcase -bathroom -scale -peach -newspaper -watering -can -hook -school -beaver -camera -hair -dryer -mushroom -quilt -chalk -dollar -soda -chin -swing -garden -ticket -boot -cello -rain -clam -pelican -stingray -nail -sheep -stoplight -coconut -crib -hippopotamus -ring -video -camera -snowflake \ No newline at end of file diff --git a/word_lists/word-lists/objects.txt b/word_lists/word-lists/objects.txt deleted file mode 100644 index bbb386e..0000000 --- a/word_lists/word-lists/objects.txt +++ /dev/null @@ -1,88 +0,0 @@ -picture frame -gel -leg warmers -paint brush -bath fizzers -drill press -chalk -rubber duck -remote -word -spring -stone -rug -thermometer -stockings -CD -flower -car -check -vase -hanger -cookie -speaker -screw -paper -box -glasses -sailboat -pick -helmet -puddle -ring -pot -thread -bow -flag -fork -tape -lamp -tissue -balloon -lace -needle -chandelier -deodorant -button -note -candy -tooth paste -sharpie -twister -photo -pencil -bookmark -spoon -outlet -quilt -seat belt -mouse pad -tire swing -nail filer -cork -stop sign -rusty nail -gage -rubber band -zipper -canvas -sponge -soda -key -eraser -bottle -candle -lip -buckel -shovel -slipper -glow stick -cable -ice -credit card -nail clippers -sun glasses -tweezers -hair tie -charger -card \ No newline at end of file diff --git a/wordlists/README.txt b/wordlists/README.txt new file mode 100644 index 0000000..4134c5f --- /dev/null +++ b/wordlists/README.txt @@ -0,0 +1,6 @@ +the columns for the wordlists are translations as follows: + +english | italian | spanish | french | + + +Every word in the wordlist MUST be translated in all supported languages. Supporting another language would involve translating all the words. diff --git a/wordlists/default_wordlist.csv b/wordlists/default_wordlist.csv new file mode 100644 index 0000000..a162988 --- /dev/null +++ b/wordlists/default_wordlist.csv @@ -0,0 +1,285 @@ +cheese,il formaggio,queso,du fromage +bone,osso,hueso,os +socks,calzini,medias,des chaussettes +leaf,foglia,lámina,feuille +whale,balena,ballena,baleine +pie,torta,tarta,tarte +shirt,camicia,camisa,la chemise +orange,arancia,naranja,orange +lollipop,lecca-lecca,chupete,sucette +bed,letto,cama,lit +mouth,bocca,boca,bouche +person,persona,persona,personne +horse,cavallo,caballo,cheval +snake,serpente,víbora,serpent +jar,vaso,frasco,pot +spoon,cucchiaio,cuchara,cuillère +lamp,lampada,lámpara,lampe +kite,aquilone,cometa,cerf-volant +monkey,scimmia,mono,singe +swing,oscillazione,balancear,se balancer +cloud,nuvola,nube,nuage +snowman,pupazzo di neve,monigote de nieve,bonhomme de neige +baby,bambino,bebé,bébé +eyes,occhi,ojos,les yeux +pen,penna,bolígrafo,plume +giraffe,giraffa,jirafa,girafe +grapes,uva,uvas,les raisins +book,prenotare,libro,livre +ocean,oceano,oceano,océan +star,stella,estrella,étoile +cupcake,cupcake,magdalena,petit gâteau +cow,mucca,vaca,vache +lips,labbra,labios,lèvres +worm,verme,gusano,ver de terre +sun,sole,sol,soleil +basketball,pallacanestro,baloncesto,basketball +hat,cappello,sombrero,chapeau +bus,autobus,autobús,autobus +chair,sedia,silla,chaise +purse,borsa,bolso,sac +head,testa,cabeza,tête +spider,ragno,araña,araignée +shoe,scarpa,zapato,chaussure +ghost,fantasma,fantasma,fantôme +coat,cappotto,saco,manteau +chicken,pollo,pollo,poulet +heart,cuore,corazón,cœur +jellyfish,medusa,medusa,méduse +tree,albero,árbol,arbre +seashell,conchiglia,concha,coquillage +duck,anatra,pato,canard +bracelet,braccialetto,pulsera,bracelet +grass,erba,césped,gazon +jacket,giacca,chaqueta,veste +slide,vetrino,deslizar,glisser +doll,bambola,muñeca,poupée +spider,ragno,araña,araignée +clock,orologio,reloj,horloge +cup,tazza,taza,coupe +bridge,ponte,puente,pont +apple,mela,manzana,pomme +balloon,palloncino,globo,ballon +drum,tamburo,tambor,tambouriner +ears,orecchie,orejas,oreilles +egg,uovo,huevo,oeuf +bread,pane,pan de molde,pain +nose,naso,nariz,nez +house,casa,casa,maison +beach,spiaggia,playa,plage +airplane,aereo,avión,avion +inchworm,verme,oruga,chenille +hippo,ippopotamo,hipopótamo,hippopotame +light,leggero,luz,léger +turtle,tartaruga,tortuga,tortue +ball,palla,pelota,balle +carrot,carota,zanahoria,carotte +cherry,ciliegia,cereza,cerise +ice,ghiaccio,hielo,la glace +pencil,matita,lápiz,crayon +circle,cerchio,círculo,cercle +bed,letto,cama,lit +ant,formica,hormiga,fourmi +girl,ragazza,muchacha,fille +glasses,bicchieri,vasos,lunettes +flower,fiore,flor,fleur +mouse,topo,ratón,souris +banana,banana,plátano,banane +alligator,alligatore,caimán,alligator +bell,campana,campana,cloche +robot,robot,robot,robot +smile,sorridi,sonreír,le sourire +bike,bicicletta,bicicleta,bicyclette +rocket,razzo,cohete,fusée +dinosaur,dinosauro,dinosaurio,dinosaure +dog,cane,perro,chien +bunny,coniglietto,conejito,lapin +cookie,biscotto,galleta,biscuit +bowl,ciotola,cuenco,bol +apple,mela,manzana,pomme +door,porta,puerta,porte +horse,cavallo,caballo,cheval +door,porta,puerta,porte +song,canzone,canción,chanson +trip,viaggio,viaje,voyage +backbone,spina dorsale,columna vertebral,colonne vertébrale +bomb,bomba,bomba,bombe +round,il giro,redondo,tour +treasure,tesoro,tesoro,trésor +garbage,spazzatura,basura,des ordures +park,parco,parque,parc +whistle,fischio,silbato,sifflet +palace,palazzo,palacio,palais +baseball,baseball,béisbol,base-ball +coal,carbone,carbón,charbon +queen,regina,reina,reine +dominoes,domino,dominó,dominos +photo,foto,foto,photo +graph,grafico,grafico,graphique +computer,computer,ordenador,ordinateur +hockey,hockey,hockey,le hockey +plane,aereo,avión,avion +pepper,pepe,pimienta,poivre +key,chiave,llave,clé +iPad,ipad,ipad,ipad +whisk,frusta,batidor,fouet +cake,torta,pastel,gâteau +circus,circo,circo,cirque +battery,batteria,batería,batterie +mailman,postino,cartero,facteur +cowboy,cowboy,vaquero,cow-boy +password,parola d'ordine,clave,le mot de passe +bicycle,bicicletta,bicicleta,bicyclette +skate,pattinare,patinar,patin +electric,elettrico,eléctrico,électrique +lightsaber,spada laser,sable de luz,sabre laser +nature,natura,naturaleza,nature +shallow,poco profondo,poco profundo,peu profond +toast,pane abbrustolito,brindis,pain grillé +outside,fuori,fuera,à l'extérieur +america,america,america,amérique +gingerbread,pan di zenzero,pan de jengibre,pain d'épice +man,uomo,hombre,homme +bowtie,papillon,corbata de moño,nœud papillon +light,leggero,luz,léger +bulb,lampadina,bulbo,ampoule +platypus,ornitorinco,ornitorrinco,ornithorynque +music,musica,música,musique +sailboat,barca a vela,velero,voilier +popsicle,ghiacciolo,paleta de hielo,popsicle +knee,ginocchio,rodilla,le genou +pineapple,ananas,piña,ananas +tusk,zanna,colmillo,défense +sprinkler,spruzzatore,aspersor,arroseur +money,i soldi,dinero,de l'argent +spool,bobina,carrete,bobine +lighthouse,faro,faro,phare +doormat,zerbino,felpudo,paillasson +face,viso,rostro,visage +flute,flauto,flauta,flûte +owl,gufo,búho,hibou +gate,cancello,portón,portail +suitcase,valigia,valija,valise +bathroom,bagno,baño,salle de bain +scale,scala,escala,échelle +peach,pesca,durazno,pêche +newspaper,giornale,periódico,un journal +watering,irrigazione,riego,arrosage +can,potere,puede,pouvez +hook,gancio,gancho,crochet +school,scuola,colegio,l'école +beaver,castoro,castor,castor +camera,telecamera,cámara,appareil photo +hair,capelli,pelo,cheveu +dryer,asciugatrice,secadora,séchoir +mushroom,fungo,champiñón,champignon +quilt,trapunta,colcha,édredon +chalk,gesso,tiza,craie +dollar,dollaro,dólar,dollar +soda,bibita,soda,un soda +chin,mento,barbilla,menton +swing,oscillazione,balancear,se balancer +garden,giardino,jardín,jardin +ticket,biglietto,billete,billet +boot,stivale,bota,démarrage +cello,violoncello,violonchelo,violoncelle +rain,piovere,lluvia,pluie +clam,mollusco,almeja,palourde +pelican,pellicano,pelícano,pélican +stingray,razza,mantarraya,raie +nail,chiodo,clavo,ongle +sheep,pecora,oveja,mouton +stoplight,semaforo,luz de freno,feu rouge +coconut,noce di cocco,coco,noix de coco +crib,culla,cuna,crèche +hippo,ippopotamo,hipopótamo,hippopotame +ring,squillo,anillo,anneau +video,video,video,vidéo +camera,telecamera,cámara,appareil photo +snowflake,fiocco di neve,copo de nieve,flocon de neige +frame,portafoto,marco,cadre +gel,gel,gel,gel +warmers,scaldavivande,calentadores,réchauffeurs +paint,colore,pintura,peinture +bath,bagno,baño,une baignoire +drill,trapano,perforar,perceuse +chalk,gesso,tiza,craie +duck,anatra,pato,canard +remote,a distanza,remoto,télécommande +word,parola,palabra,mot +spring,molla,primavera,printemps +stone,calcolo,roca,calcul +rug,coperta,alfombra,tapis +thermometer,termometro,termómetro,thermomètre +stockings,calze autoreggenti,medias,bas +CD,cd,cd,cd +flower,fiore,flor,fleur +car,auto,coche,auto +check,controllo,cheque,chèque +vase,vaso,florero,vase +hanger,appendiabiti,percha,cintre +cookie,biscotto,galleta,biscuit +speaker,oratore,vocero,conférencier +screw,vite,tornillo,visser +paper,carta,papel,papier +box,scatola,caja,boîte +glasses,bicchieri,vasos,lunettes +sailboat,barca a vela,velero,voilier +pick,scegliere,elegir,prendre +helmet,casco,casco,casque +puddle,pozzanghera,charco,flaque +ring,squillo,anillo,anneau +pot,pentola,maceta,pot +thread,filo,hilo,fil de discussion +bow,arco,inclinarse,arc +flag,bandiera,bandera,drapeau +fork,forchetta,tenedor,fourchette +tape,nastro,cinta,ruban adhésif +lamp,lampada,lámpara,lampe +tissue,tessuto,pañuelo de papel,tissu +balloon,palloncino,globo,ballon +lace,pizzo,cordón,dentelle +needle,ago,aguja,aiguille +chandelier,lampadario,candelabro,lustre +deodorant,deodorante,desodorante,déodorant +button,pulsante,botón,bouton +note,nota,nota,remarque +candy,caramella,caramelo,des bonbons +tooth paste,dentifricio,pasta dental,dentifrice +sharpie,pennarello,rotulador,pointu +twister,twister,tornado,tornade +photo,foto,foto,photo +pencil,matita,lápiz,crayon +bookmark,segnalibro,marcador,signet +spoon,cucchiaio,cuchara,cuillère +outlet,presa,toma de corriente,sortie +quilt,trapunta,colcha,édredon +seatbelt,cintura di sicurezza,cinturón de seguridad,ceinture de sécurité +mouse pad,tappettino del mouse,alfombrilla de ratón,tapis de souris +swing,oscillazione,balancear,se balancer +nail,chiodo,clavo,ongle +cork,sughero,corcho,liège +stopsign,segnale di stop,señal de stop,panneau stop +gage,gag,calibrar,jauge +rubberband,elastico,banda elástica,élastique +zipper,cerniera,cremallera,fermeture éclair +canvas,tela,lienzo,toile +sponge,spugna,esponja,éponge +soda,bibita,soda,un soda +key,chiave,llave,clé +eraser,gomma,goma de borrar,la gomme +bottle,bottiglia,botella,bouteille +candle,candela,vela,bougie +lip,labbro,labio,lèvre +buckel,secchio,hebilla,boucler +shovel,pala,pala,pelle +slipper,ciabatta,zapatilla,pantoufle +cable,cavo,cable,câble +ice,ghiaccio,hielo,la glace +credit card,carta di credito,tarjeta de crédito,carte de crédit +nail clippers,tagliaunghie,cortauñas,coupe-ongles +sun glasses,occhiali da sole,gafas de sol,des lunettes de soleil +tweezers,pinzette,pinzas,pince à épiler +hair tie,elastico per capelli,liga para el cabello,attache-cheveux +charger,caricabatterie,cargador,chargeur +card,carta,tarjeta,carte