Main Game

This commit is contained in:
Olive 2022-09-18 00:24:54 +01:00
parent cafe594f03
commit a387c83d05
10 changed files with 183 additions and 0 deletions

View File

@ -1,11 +1,28 @@
# Cave Game # Cave Game
A recreation of Cave Game, the earliest version of Minecraft. A recreation of Cave Game, the earliest version of Minecraft.
## Features
- Stone and grass nodes.
- Place & destroy them.
- That's about it.
## Notes
Whilst looking like cobble, stone is infact `minecraft:stone`.
Technical names `minecraft:nnn` and `nnn` are aliases to the "modern" Minecraft names.
Select mapgen `singlenode` for a truly flat world.
Mapgen v6 unsupported.
## ##
[CDB] · [Issues] · [Git] [CDB] · [Issues] · [Git]
Game by olive - ISC Game by olive - ISC
[Textures by Rollerozxa], based upon [REFI] - CC-BY-SA 4.0
[REFI]: https://content.minetest.net/packages/MysticTempest/refi_textures/
[Textures by Rollerozxa]: https://github.com/rollerozxa/minecraftnt-classic/
[Git]: https://git.minetest.land/olive/cavegame [Git]: https://git.minetest.land/olive/cavegame
[Issues]: https://git.minetest.land/olive/cavegame/issues [Issues]: https://git.minetest.land/olive/cavegame/issues
[ContentDB]: https://content.minetest.net/packages/GoodClover/cavegame/ [ContentDB]: https://content.minetest.net/packages/GoodClover/cavegame/

7
game.conf Normal file
View File

@ -0,0 +1,7 @@
name = cavegame
title = Cave Game
description = Shoddy, basic, re-creation of "Cave Game". This could never become popular…
author = olive (GoodClover)
disabled_settings = enable_damage, !creative_mode
disallowed_mapgens = v6

41
mods/mapgen/init.lua Normal file
View File

@ -0,0 +1,41 @@
if minetest.get_mapgen_params().mgname == "singlenode" then
local ground_level = tonumber(minetest.settings:get("water_level") or 1)
minetest.register_on_generated(function(minp, maxp, blockseed)
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local va = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
local air = minetest.get_content_id("air")
local stone = minetest.get_content_id("minecraft:stone")
local grass = minetest.get_content_id("minecraft:grass")
local nodes = vm:get_data()
for i, _ in pairs(nodes) do
local y = va:position(i).y
if y < ground_level then
nodes[i] = stone
elseif y == ground_level then
nodes[i] = grass
else
nodes[i] = air
end
end
vm:set_data(nodes)
vm:write_to_map()
end)
else
minetest.register_biome({
name = "cavegame",
-- node_dust = "air",
node_top = "minecraft:grass",
depth_top = 1,
-- depth_filler = 1,
node_stone = "minecraft:stone",
heat_point = 50,
humidity_point = 50,
y_min = -3100, y_max = 3100,
})
end

5
mods/mapgen/mod.conf Normal file
View File

@ -0,0 +1,5 @@
name = cavegame_mapgen
depends = cavegame_nodes
title = Cave Game mapgen
author = olive

25
mods/nodes/init.lua Normal file
View File

@ -0,0 +1,25 @@
minetest.register_alias("mapgen_stone", "minecraft:stone")
minetest.register_alias("mapgen_water_source", "air")
minetest.register_alias("mapgen_river_water_source", "air")
minetest.register_alias("1", "minecraft:stone")
minetest.register_alias("minecraft:1", "minecraft:stone")
minetest.register_node(":minecraft:stone", {
order = 1,
description = "Stone",
tiles = { "stone.png" },
groups = { dig_immediate=3, },
is_ground_content = true,
})
minetest.register_alias("2", "minecraft:grass")
minetest.register_alias("minecraft:2", "minecraft:grass")
minetest.register_node(":minecraft:grass", {
order = 2,
description = "Grass",
tiles = { "grass.png" },
groups = { dig_immediate=3, },
is_ground_content = true,
})

4
mods/nodes/mod.conf Normal file
View File

@ -0,0 +1,4 @@
name = cavegame_nodes
title = Cave Game nodes
author = olive

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 904 B

80
mods/player/init.lua Normal file
View File

@ -0,0 +1,80 @@
local hud_flags = {
hotbar = true,
crosshair = true,
wielditem = false,
healthbar = false,
breathbar = false,
minimap = false,
minimap_radar = false,
basic_debug = true,
}
local inv_list = {}
local inv_size = 0
minetest.register_on_mods_loaded(function()
local unordered = {}
for name,def in pairs(minetest.registered_nodes) do
if def.order then
inv_size = math.max(inv_size, def.order)
inv_list[def.order] = name
minetest.override_item(name, {
-- drop = "",
-- stack_max = 1,
range = 16,
})
else
unordered[name] = def
end
end
for name,def in pairs(unordered) do
if not def.groups.not_in_creative_inventory then
inv_size = inv_size + 1
inv_list[inv_size] = name
end
end
end)
minetest.register_on_joinplayer(function(player, last_login)
-- player:set_sky({}) --TODO
player:set_sun({ visible=false, sunrise_visible=false })
player:set_moon({ visible=false })
player:set_stars({ visible=false })
player:set_clouds({ density=0 })
player:override_day_night_ratio(1)
player:set_lighting({ shadows=0 })
player:set_inventory_formspec("")
-- player:set_formspec_prepend("") --TODO?
player:hud_set_flags(hud_flags)
player:hud_set_hotbar_itemcount(inv_size)
local name = player:get_player_name()
local inv = minetest.get_inventory({ type="player", name=name })
inv:set_size("main", inv_size)
inv:set_list("main", inv_list)
player:set_properties({
collisionbox = {-0.3, 0, -0.3, 0.3, 1.8, 0.3},
-- TODO
})
end)
local old_item_drop = minetest.item_drop
minetest.item_drop = function(itemstack, ...)
return itemstack
end
local old_item_place = minetest.item_place
minetest.item_place = function(...)
old_item_place(...)
return nil
end
local old_handle_node_drops = core.handle_node_drops
core.handle_node_drops = function(...)
-- Ignore all drops
end

4
mods/player/mod.conf Normal file
View File

@ -0,0 +1,4 @@
name = cavegame_player
title = Cave Game player
author = olive