Compare commits

...

10 Commits

Author SHA1 Message Date
ROllerozxa
c2cb7cdff1 Completely rewrite level select dialogs 2023-07-26 19:09:07 +02:00
ROllerozxa
4cfd1595ee toaster 2023-07-25 20:19:05 +02:00
ROllerozxa
d06cc736de Various fixes and refactors 2023-07-25 20:16:05 +02:00
ROllerozxa
11a9ff30bd Some compat fixes and code cleanups 2023-01-18 17:09:14 +01:00
ROllerozxa
67af574a9d Umm fix licensing haha 2023-01-18 17:08:00 +01:00
ROllerozxa
1769fda3ca Add main menu theme
(duplicates the music file... gross but nothing much else to do)
2022-09-22 15:44:08 +02:00
ROllerozxa
557c38ea3a Rename hotbar texture to prevent 8-slotted hotbar textures from replacing it 2022-08-25 22:13:44 +02:00
ROllerozxa
b5bf927f9a Luacheck warning cleanups 2022-07-13 23:10:51 +02:00
ROllerozxa
7d616e274e Tweak textures 2022-05-29 22:23:43 +02:00
ROllerozxa
31004dd438 Merge all world textures into one 2022-05-29 22:22:26 +02:00
31 changed files with 367 additions and 911 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
music/
*.xcf

16
.luacheckrc Normal file
View 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
View File

@ -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

View File

@ -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

View File

@ -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

Binary file not shown.

View 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

File diff suppressed because it is too large Load Diff

View File

@ -7938,7 +7938,8 @@ levels[4][38] = [[
060502040
800060001
080000030
009040200]]
009040200
000000000]]
levels[4][39] = [[
007000500

View File

@ -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

View 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)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 224 B

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 B

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 B

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

35
mods/sudoku/utils.lua Normal file
View 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

View File

@ -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', {})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 886 B

After

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

View File

Before

Width:  |  Height:  |  Size: 166 B

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 B

After

Width:  |  Height:  |  Size: 97 B

View File

@ -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)

View File

@ -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},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 365 B

View File

@ -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