Version 0.4, added custom sized games and glass style (and new music for glass!)
This commit is contained in:
parent
2545664358
commit
7373208570
42
LICENSE
42
LICENSE
@ -22,6 +22,48 @@ 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.
|
||||
|
||||
|
||||
License of glass_glass.png texture
|
||||
-----------------------------------------------
|
||||
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
Copyright (C) 2010-2018:
|
||||
|
||||
celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
Cisoun
|
||||
G4JC
|
||||
VanessaE
|
||||
RealBadAngel
|
||||
Calinou
|
||||
MirceaKitsune
|
||||
Jordach
|
||||
PilzAdam
|
||||
jojoa1997
|
||||
InfinityProject
|
||||
Splizard
|
||||
Zeg9
|
||||
paramat
|
||||
BlockMen
|
||||
sofar
|
||||
Neuromancer
|
||||
Gambit
|
||||
asl97
|
||||
KevDoy
|
||||
Mito551
|
||||
GreenXenith
|
||||
kaeza
|
||||
kilbith
|
||||
tobyplowy
|
||||
CloudyProton
|
||||
TumeniNodes
|
||||
Mossmanikin
|
||||
random-geek
|
||||
Extex101
|
||||
An0n3m0us
|
||||
|
||||
|
||||
|
||||
|
||||
Most textures have been taken from CC0 Hand painted texture pack:
|
||||
https://content.minetest.net/packages/drummyfish/drummyfish/
|
||||
|
||||
|
@ -56,6 +56,7 @@ minetest.register_item(":", {
|
||||
--Style Registrations
|
||||
dofile(minetest.get_modpath("game") .. "/styles/classic.lua")
|
||||
dofile(minetest.get_modpath("game") .. "/styles/grassy.lua")
|
||||
dofile(minetest.get_modpath("game") .. "/styles/glass.lua")
|
||||
|
||||
local restart = styles[1].gen_map
|
||||
local cleanup = styles[1].cleanup
|
||||
@ -125,11 +126,11 @@ table.insert(r,"button_exit[2,5.5;2,1;easy;Easy (40x40)]")
|
||||
table.insert(r,"button_exit[6,5.5;2,1;medium;Medium (70x70)]")
|
||||
table.insert(r,"button_exit[2,7;2,1;hard;Hard (120x120)]")
|
||||
|
||||
--table.insert(r,"field[6,6.9;2,0.5;custom_w;"..minetest.colorize("#000","Width")..";"..width.."]")
|
||||
--table.insert(r,"field[6,7.9;2,0.5;custom_h;"..minetest.colorize("#000","Height")..";"..height.."]")
|
||||
--table.insert(r,"field_close_on_enter[custom_w;false]")
|
||||
--table.insert(r,"field_close_on_enter[custom_h;false]")
|
||||
--table.insert(r,"button_exit[6,8.5;2,1;custom;Custom]")
|
||||
table.insert(r,"field[6,6.9;2,0.5;custom_w;"..minetest.colorize("#000","Width")..";"..width.."]")
|
||||
table.insert(r,"field[6,7.9;2,0.5;custom_h;"..minetest.colorize("#000","Height")..";"..height.."]")
|
||||
table.insert(r,"field_close_on_enter[custom_w;false]")
|
||||
table.insert(r,"field_close_on_enter[custom_h;false]")
|
||||
table.insert(r,"button_exit[6,8.5;2,1;custom;Custom]")
|
||||
|
||||
return table.concat(r);
|
||||
end
|
||||
@ -183,8 +184,9 @@ local function onRecieveFields(player, formname, fields)
|
||||
if formname ~= "game:main" and formname ~= "" then return end
|
||||
if formname == "" then --process the inventory formspec
|
||||
if fields.game_menu then
|
||||
minetest.after(0.05, function() to_game_menu(player) end)
|
||||
minetest.after(0.15, function() to_game_menu(player) end)
|
||||
elseif fields.restart then
|
||||
cleanup(gwidth, gheight)
|
||||
local maze = GenMaze(math.floor(gwidth/2)*2+((gwidth+1)%2),math.floor(gheight/2)*2+(gheight+1)%2)
|
||||
restart(maze, player)
|
||||
end
|
||||
@ -226,17 +228,17 @@ local function onRecieveFields(player, formname, fields)
|
||||
--If after all that, nothing is set, they used escape to quit.
|
||||
elseif fields.custom then
|
||||
if tonumber(fields.custom_w) then
|
||||
local var = math.max(math.min(tonumber(fields.custom_w), 150),5)
|
||||
gwidth = math.floor(var/2)*2+1
|
||||
minetest.chat_send_all(gwidth)
|
||||
local var = math.max(math.min(tonumber(fields.custom_w), 125),5)
|
||||
gwidth = var
|
||||
|
||||
end
|
||||
if tonumber(fields.custom_h) then
|
||||
local var = math.max(math.min(tonumber(fields.custom_h), 150),5)
|
||||
gheight = math.floor(var/2)*2+1
|
||||
local var = math.max(math.min(tonumber(fields.custom_h), 125),5)
|
||||
gheight = var
|
||||
end
|
||||
setup(player)
|
||||
elseif fields.quit then
|
||||
minetest.after(0.05, function() minetest.show_formspec(player:get_player_name(), "game:main", main_menu(width_in, height_in, scroll_in)) end)
|
||||
minetest.after(0.10, function() minetest.show_formspec(player:get_player_name(), "game:main", main_menu(width_in, height_in, scroll_in)) end)
|
||||
return
|
||||
elseif fields.labyexit then
|
||||
minetest.request_shutdown("Thanks for playing!")
|
||||
@ -250,7 +252,7 @@ minetest.register_on_player_receive_fields(onRecieveFields)
|
||||
|
||||
local function safe_clear()
|
||||
local vm = minetest.get_voxel_manip()
|
||||
local emin, emax = vm:read_from_map({x=0,y=0,z=0}, {x=200,y=40,z=200})
|
||||
local emin, emax = vm:read_from_map({x=0,y=0,z=0}, {x=250,y=40,z=250})
|
||||
local data = vm:get_data()
|
||||
local a = VoxelArea:new{
|
||||
MinEdge = emin,
|
||||
|
BIN
mods/game/sounds/glass.ogg
Normal file
BIN
mods/game/sounds/glass.ogg
Normal file
Binary file not shown.
@ -48,8 +48,8 @@ local function map_function(maze, player)
|
||||
vm:write_to_map(true)
|
||||
|
||||
--player target coords
|
||||
player_x = math.floor(height/2)+height%2
|
||||
player_z = math.floor(width/2)+width%2
|
||||
player_x = math.floor(height/2)+(math.floor(height/2)+1)%2
|
||||
player_z = math.floor(width/2)+(math.floor(width/2)+1)%2
|
||||
|
||||
--Lets now overwrite the channel for the player to fall into:
|
||||
local emin, emax = vm:read_from_map({x=player_x-1,y=4,z=player_z-1}, {x=player_x+1,y=32,z=player_z+1})
|
||||
@ -104,8 +104,8 @@ local function cleanup(width, height)
|
||||
vm:write_to_map(true)
|
||||
|
||||
--player target coords
|
||||
player_x = math.floor(height/2)+math.floor(width/2)%2+1
|
||||
player_z = math.floor(width/2)+math.floor(width/2)%2+1
|
||||
player_x = math.floor(height/2)+(math.floor(height/2)+1)%2
|
||||
player_z = math.floor(width/2)+(math.floor(width/2)+1)%2
|
||||
|
||||
--Lets now overwrite the channel for the player to fall into:
|
||||
local emin, emax = vm:read_from_map({x=player_x-1,y=4,z=player_z-1}, {x=player_x+1,y=32,z=player_z+1})
|
||||
|
81
mods/game/styles/glass.lua
Normal file
81
mods/game/styles/glass.lua
Normal file
@ -0,0 +1,81 @@
|
||||
-- Node Registrations
|
||||
|
||||
minetest.register_node("game:glass_glass",
|
||||
{
|
||||
description = "Glass",
|
||||
drawtype = "allfaces",
|
||||
nodebox = {
|
||||
type = "fixed",
|
||||
fixed = { -0.499,-0.499,-0.499,0.499,0.499,0.499 },
|
||||
},
|
||||
tiles = {"glass_glass.png"},
|
||||
light_source = 12,
|
||||
})
|
||||
-- Node Registrations
|
||||
|
||||
local function map_function(maze, player)
|
||||
local loc_maze = maze
|
||||
width = loc_maze.width
|
||||
height = loc_maze.height
|
||||
|
||||
--Copy to the map
|
||||
local vm = minetest.get_voxel_manip()
|
||||
local emin, emax = vm:read_from_map({x=0,y=0,z=0}, {x=height+1,y=4,z=width+1})
|
||||
local data = vm:get_data()
|
||||
local a = VoxelArea:new{
|
||||
MinEdge = emin,
|
||||
MaxEdge = emax
|
||||
}
|
||||
local glass = minetest.get_content_id("game:glass_glass")
|
||||
local air = minetest.get_content_id("air")
|
||||
|
||||
--Set up the level itself
|
||||
for z=1, width do --z
|
||||
for x=1, height do --x
|
||||
if loc_maze[x][z] == 1 then
|
||||
data[a:index(x, 0, z)] = glass
|
||||
else
|
||||
for y=0,4 do
|
||||
data[a:index(x, y, z)] = glass
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
vm:set_data(data)
|
||||
vm:write_to_map(true)
|
||||
|
||||
--player target coords
|
||||
player_x = math.floor(height/2)+(math.floor(height/2)+1)%2
|
||||
player_z = math.floor(width/2)+(math.floor(width/2)+1)%2
|
||||
|
||||
--Lets now overwrite the channel for the player to fall into:
|
||||
|
||||
--Finally, move the player
|
||||
player:set_velocity({x=0,y=0,z=0})
|
||||
player:set_pos({x=player_x,y=3,z=player_z})
|
||||
end
|
||||
|
||||
local function cleanup(width, height)
|
||||
--Copy to the map
|
||||
local vm = minetest.get_voxel_manip()
|
||||
local emin, emax = vm:read_from_map({x=0,y=0,z=0}, {x=height+1,y=4,z=width+1})
|
||||
local data = vm:get_data()
|
||||
local a = VoxelArea:new{
|
||||
MinEdge = emin,
|
||||
MaxEdge = emax
|
||||
}
|
||||
local air = minetest.get_content_id("air")
|
||||
|
||||
--Generally a good idea to zero it out
|
||||
for z=0, width+1 do --z
|
||||
for y=0,4 do --
|
||||
for x=0, height+1 do --x
|
||||
data[a:index(x, y, z)] = air
|
||||
end
|
||||
end
|
||||
end
|
||||
vm:set_data(data)
|
||||
vm:write_to_map(true)
|
||||
end
|
||||
|
||||
register_style("glass","glass", map_function, cleanup)
|
@ -67,8 +67,8 @@ local function map_function(maze, player)
|
||||
vm:write_to_map(true)
|
||||
|
||||
--player target coords
|
||||
player_x = height+(height*2)%4
|
||||
player_z = width+(width*2)%4
|
||||
player_x = (math.floor(height/2)+(math.floor(height/2)+1)%2)*2
|
||||
player_z = (math.floor(width/2)+(math.floor(width/2)+1)%2)*2
|
||||
|
||||
--Lets now overwrite the channel for the player to fall into:
|
||||
local emin, emax = vm:read_from_map({x=player_x-1,y=4,z=player_z-1}, {x=player_x+1,y=32,z=player_z+1})
|
||||
@ -120,8 +120,8 @@ local function cleanup(width, height)
|
||||
vm:write_to_map(true)
|
||||
|
||||
--player target coords
|
||||
player_x = height+(height*2)%4
|
||||
player_z = width+(width*2)%4
|
||||
player_x = (math.floor(height/2)+(math.floor(height/2)+1)%2)*2
|
||||
player_z = (math.floor(width/2)+(math.floor(width/2)+1)%2)*2
|
||||
|
||||
--Lets now overwrite the channel for the player to fall into:
|
||||
local emin, emax = vm:read_from_map({x=player_x-1,y=4,z=player_z-1}, {x=player_x+1,y=32,z=player_z+1})
|
||||
|
BIN
mods/game/textures/glass.png
Normal file
BIN
mods/game/textures/glass.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
mods/game/textures/glass_glass.png
Normal file
BIN
mods/game/textures/glass_glass.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 270 B |
Loading…
x
Reference in New Issue
Block a user