diff --git a/README.md b/README.md index 482b936..27bc07c 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,28 @@ # Cave Game 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] 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 [Issues]: https://git.minetest.land/olive/cavegame/issues [ContentDB]: https://content.minetest.net/packages/GoodClover/cavegame/ diff --git a/game.conf b/game.conf new file mode 100644 index 0000000..0236d3d --- /dev/null +++ b/game.conf @@ -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 diff --git a/mods/mapgen/init.lua b/mods/mapgen/init.lua new file mode 100644 index 0000000..6c869d7 --- /dev/null +++ b/mods/mapgen/init.lua @@ -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 diff --git a/mods/mapgen/mod.conf b/mods/mapgen/mod.conf new file mode 100644 index 0000000..3fdc7e7 --- /dev/null +++ b/mods/mapgen/mod.conf @@ -0,0 +1,5 @@ +name = cavegame_mapgen +depends = cavegame_nodes + +title = Cave Game mapgen +author = olive diff --git a/mods/nodes/init.lua b/mods/nodes/init.lua new file mode 100644 index 0000000..d774075 --- /dev/null +++ b/mods/nodes/init.lua @@ -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, +}) diff --git a/mods/nodes/mod.conf b/mods/nodes/mod.conf new file mode 100644 index 0000000..9c98eb7 --- /dev/null +++ b/mods/nodes/mod.conf @@ -0,0 +1,4 @@ +name = cavegame_nodes + +title = Cave Game nodes +author = olive diff --git a/mods/nodes/textures/grass.png b/mods/nodes/textures/grass.png new file mode 100644 index 0000000..2cb227a Binary files /dev/null and b/mods/nodes/textures/grass.png differ diff --git a/mods/nodes/textures/stone.png b/mods/nodes/textures/stone.png new file mode 100644 index 0000000..1dc058d Binary files /dev/null and b/mods/nodes/textures/stone.png differ diff --git a/mods/player/init.lua b/mods/player/init.lua new file mode 100644 index 0000000..7116697 --- /dev/null +++ b/mods/player/init.lua @@ -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 diff --git a/mods/player/mod.conf b/mods/player/mod.conf new file mode 100644 index 0000000..418b24f --- /dev/null +++ b/mods/player/mod.conf @@ -0,0 +1,4 @@ +name = cavegame_player + +title = Cave Game player +author = olive