Compare commits
10 Commits
7c5900d30b
...
c2cb7cdff1
Author | SHA1 | Date | |
---|---|---|---|
|
c2cb7cdff1 | ||
|
4cfd1595ee | ||
|
d06cc736de | ||
|
11a9ff30bd | ||
|
67af574a9d | ||
|
1769fda3ca | ||
|
557c38ea3a | ||
|
b5bf927f9a | ||
|
7d616e274e | ||
|
31004dd438 |
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
music/
|
||||
*.xcf
|
16
.luacheckrc
Normal file
@ -0,0 +1,16 @@
|
||||
unused_args = false
|
||||
allow_defined_top = true
|
||||
max_line_length = false
|
||||
|
||||
globals = {
|
||||
"minetest", "core"
|
||||
}
|
||||
|
||||
read_globals = {
|
||||
string = {fields = {"split"}},
|
||||
table = {fields = {"copy", "getn"}},
|
||||
|
||||
-- Builtin
|
||||
"vector", "ItemStack",
|
||||
"dump", "DIR_DELIM", "VoxelArea", "Settings",
|
||||
}
|
15
LICENSE
@ -1,3 +1,18 @@
|
||||
License of media (textures and sounds)
|
||||
--------------------------------------
|
||||
|
||||
Media inside `sudoku_player` and `sudoku_gui` originates from
|
||||
Minetest Game and is licensed under CC-BY-SA 3.0, see
|
||||
respective mod's README for attribution.
|
||||
|
||||
All other media is licensed under CC-BY-SA 4.0.
|
||||
|
||||
For information/attribution about sounds see README.
|
||||
|
||||
|
||||
License of source code
|
||||
----------------------
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
|
@ -5,9 +5,9 @@
|
||||
A game of sudoku for Minetest. Solve the sudoku by placing number nodes in the correct slots on the grid.
|
||||
|
||||
## License
|
||||
Code is licensed under the LGPLv2.1 license, assets under CC-BY-SA. This is a fork of 1248's [Sudoku](https://github.com/Der1248/Sudoku) game with various cleanups, additions and improvements done.
|
||||
Code is licensed under the LGPLv2.1 license, assets under CC-BY-SA 4.0. This is a fork of 1248's [Sudoku](https://github.com/Der1248/Sudoku) game with various cleanups, additions and improvements done.
|
||||
|
||||
### Audio attribution
|
||||
- `sudoku_loop.ogg` - [Own work (ROllerozxa)](https://www.youtube.com/watch?v=wXFygEzN3Mc), CC-BY-SA
|
||||
- `sudoku_failure.ogg` - Own work (ROllerozxa), CC-BY-SA
|
||||
- `sudoku_loop.ogg` - [Own work (ROllerozxa)](https://www.youtube.com/watch?v=wXFygEzN3Mc), CC-BY-SA 4.0
|
||||
- `sudoku_failure.ogg` - Own work (ROllerozxa), CC-BY-SA 4.0
|
||||
- `sudoku_success.ogg` - [Kenneth_Cooney on Freesound](https://freesound.org/people/Kenneth_Cooney/sounds/463067/), CC-0
|
||||
|
@ -1,4 +1,5 @@
|
||||
name = Sudoku
|
||||
title = Sudoku
|
||||
description = A game of sudoku for Minetest.
|
||||
allowed_mapgens = singlenode
|
||||
disallowed_mapgen_settings = seed
|
||||
|
BIN
menu/theme.ogg
Normal file
@ -9,7 +9,7 @@ function file_check(file_name)
|
||||
return file_found
|
||||
end
|
||||
|
||||
function compat(storage)
|
||||
function compat(storage, player)
|
||||
for i = 1, 5, 1 do
|
||||
if file_check(minetest.get_worldpath().."/level"..i..".txt") then
|
||||
local lv = io.open(minetest.get_worldpath().."/level"..i..".txt", "r")
|
||||
@ -25,7 +25,39 @@ function compat(storage)
|
||||
storage:set_int("mapversion", 1)
|
||||
os.remove(verfile)
|
||||
end
|
||||
|
||||
local player_inv = player:get_inventory()
|
||||
local ll = player_inv:get_stack("ll", 1):get_count()
|
||||
local l = player_inv:get_stack("l", ll):get_count()
|
||||
if l ~= 0 and ll ~= 0 then
|
||||
storage:set_int("current_world", ll)
|
||||
storage:set_int("current_level", l)
|
||||
|
||||
player_inv:set_size("ll", 0)
|
||||
player_inv:set_size("l", 0)
|
||||
end
|
||||
end
|
||||
|
||||
-- Set world to singlenode if not already (umm yea)
|
||||
minetest.set_mapgen_setting('mgname', 'singlenode', true)
|
||||
|
||||
-- Alias old "finisch" node to sudoku:desert
|
||||
minetest.register_alias("sudoku:finisch", "sudoku:desert")
|
||||
|
||||
-- Alias some default nodes (because for some reason old sudoku had a flat mapgen outside the gated area)
|
||||
for _, node in ipairs{
|
||||
'dirt_with_grass',
|
||||
--'dirt', we still use dirt to store player data, don't ask me about it
|
||||
'stone',
|
||||
'silver_sand',
|
||||
'stone_with_coal',
|
||||
'stone_with_iron',
|
||||
'stone_with_copper',
|
||||
'stone_with_tin',
|
||||
'stone_with_gold',
|
||||
'stone_with_mese',
|
||||
'stone_with_diamond',
|
||||
'gravel',
|
||||
} do
|
||||
minetest.register_alias("default:"..node, "air")
|
||||
end
|
||||
|
1091
mods/sudoku/init.lua
@ -7938,7 +7938,8 @@ levels[4][38] = [[
|
||||
060502040
|
||||
800060001
|
||||
080000030
|
||||
009040200]]
|
||||
009040200
|
||||
000000000]]
|
||||
|
||||
levels[4][39] = [[
|
||||
007000500
|
||||
|
@ -25,7 +25,7 @@ minetest.register_node("sudoku:meselamp", {
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
light_source = 15,
|
||||
light_source = minetest.LIGHT_MAX,
|
||||
})
|
||||
|
||||
for i=1,9 do
|
||||
|
33
mods/sudoku/tests/utils_spec.lua
Normal file
@ -0,0 +1,33 @@
|
||||
|
||||
dofile('utils.lua')
|
||||
|
||||
describe("string splitter of doom", function()
|
||||
it("works", function()
|
||||
local test = "1234\n2345\n3456\n4567"
|
||||
local output = {
|
||||
{'1','2','3','4'},
|
||||
{'2','3','4','5'},
|
||||
{'3','4','5','6'},
|
||||
{'4','5','6','7'}}
|
||||
|
||||
for i = 1, 10000, 1 do
|
||||
assert.same(string_splitter_of_doom(test), output)
|
||||
end
|
||||
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("repeats", function()
|
||||
it("works", function()
|
||||
assert.same(repeats("amanda", "a"), 3)
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("itemstring to number", function()
|
||||
it("works", function()
|
||||
assert.same(itemstring_to_number('sudoku:n_3'), 3)
|
||||
assert.same(itemstring_to_number('sudoku:3'), 3)
|
||||
|
||||
assert.same(itemstring_to_number('lolmod:amanda_block'), 0)
|
||||
end)
|
||||
end)
|
Before Width: | Height: | Size: 224 B After Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 194 B After Width: | Height: | Size: 201 B |
BIN
mods/sudoku/textures/sudoku_gui_grid.png
Normal file
After Width: | Height: | Size: 89 B |
Before Width: | Height: | Size: 211 B After Width: | Height: | Size: 211 B |
Before Width: | Height: | Size: 124 B |
Before Width: | Height: | Size: 136 B |
Before Width: | Height: | Size: 133 B |
Before Width: | Height: | Size: 138 B |
Before Width: | Height: | Size: 136 B |
BIN
mods/sudoku/textures/sudoku_worlds.png
Normal file
After Width: | Height: | Size: 156 B |
35
mods/sudoku/utils.lua
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
-- Unit tested
|
||||
function string_splitter_of_doom(lol)
|
||||
local t = {}
|
||||
for line in lol:gmatch"[^\n]+" do
|
||||
local row = {}
|
||||
for i = 1, #line do
|
||||
row[i] = line:sub(i, i)
|
||||
end
|
||||
table.insert(t, row)
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
||||
function repeats(s,c)
|
||||
local _,n = s:gsub(c,"")
|
||||
return n
|
||||
end
|
||||
|
||||
function itemstring_to_number(itemstring)
|
||||
local number = tonumber(itemstring:gsub('sudoku:n_', ''):gsub('sudoku:', ''), 10)
|
||||
|
||||
if number and number >= 1 and number <= 9 then
|
||||
return number
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
-- Not unit tested
|
||||
|
||||
function world_block(world)
|
||||
local silver = "sudoku_silver_block.png"
|
||||
return {silver,silver,silver,silver,silver,silver.."^[resize:32x32^(sudoku_worlds.png^[sheet:5x1:"..(world-1)..",0)"}
|
||||
end
|
@ -1,25 +1,21 @@
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
-- Set formspec prepend
|
||||
local formspec = [[
|
||||
bgcolor[#080808BB;true]
|
||||
listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF] ]]
|
||||
local name = player:get_player_name()
|
||||
local info = minetest.get_player_information(name)
|
||||
if info.formspec_version > 1 then
|
||||
formspec = formspec .. "background9[5,5;1,1;gui_formbg.png;true;10]"
|
||||
else
|
||||
formspec = formspec .. "background[5,5;1,1;gui_formbg.png;true]"
|
||||
end
|
||||
player:set_formspec_prepend(formspec)
|
||||
player:set_formspec_prepend([[
|
||||
bgcolor[#080808BB;true]
|
||||
listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]
|
||||
background9[5,5;1,1;gui_formbg.png;true;10]
|
||||
]])
|
||||
|
||||
-- Set hotbar textures
|
||||
player:hud_set_hotbar_image("gui_hotbar.png")
|
||||
player:hud_set_hotbar_image("sudoku_gui_hotbar.png")
|
||||
player:hud_set_hotbar_selected_image("gui_hotbar_selected.png")
|
||||
|
||||
player:hud_set_hotbar_itemcount(9)
|
||||
|
||||
player:set_inventory_formspec("")
|
||||
if player:get_player_name() ~= "singleplayer" then
|
||||
minetest.kick_player(player:get_player_name(), "you can play sudoku only as 'singleplayer'")
|
||||
if not minetest.is_singleplayer() then
|
||||
minetest.kick_player(player:get_player_name(), "Sudoku is a singleplayer-only game.")
|
||||
end
|
||||
end)
|
||||
|
||||
core.hud_replace_builtin('health', {})
|
||||
core.hud_replace_builtin('breath', {})
|
||||
|
Before Width: | Height: | Size: 886 B After Width: | Height: | Size: 346 B |
Before Width: | Height: | Size: 96 B |
Before Width: | Height: | Size: 166 B After Width: | Height: | Size: 166 B |
Before Width: | Height: | Size: 129 B After Width: | Height: | Size: 97 B |
@ -23,15 +23,15 @@ function sudoku_hud_message.message(player, message, colour)
|
||||
end
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
huds[player:get_player_name()] = player:hud_add({
|
||||
huds[player:get_player_name()] = player:hud_add{
|
||||
hud_elem_type = "text",
|
||||
position = {x=0.5, y=1.1},
|
||||
position = {x=0.5, y=1.15},
|
||||
offset = {x = 0, y = -210},
|
||||
alignment = {x=0, y=0},
|
||||
number = 0xFFFFFF,
|
||||
text = "",
|
||||
z_index = 100,
|
||||
})
|
||||
}
|
||||
end)
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
-- Update appearance when the player joins
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
player:set_properties({
|
||||
player:set_properties{
|
||||
mesh = "character.b3d",
|
||||
textures = {"character.png"},
|
||||
visual = "mesh",
|
||||
@ -9,7 +9,7 @@ minetest.register_on_joinplayer(function(player)
|
||||
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
|
||||
stepheight = 0.6,
|
||||
eye_height = 1.47,
|
||||
})
|
||||
}
|
||||
|
||||
player:set_local_animation(
|
||||
{x = 0, y = 79},
|
||||
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 365 B |
@ -8,7 +8,3 @@ Original model by MirceaKitsune (CC BY-SA 3.0).
|
||||
Various alterations and fixes by kilbith, sofar, xunto, Rogier-5, TeTpaAka, Desour,
|
||||
stujones11, An0n3m0us (CC BY-SA 3.0):
|
||||
character.b3d
|
||||
character.blend
|
||||
|
||||
Jordach (CC BY-SA 3.0):
|
||||
character.png
|