diff --git a/README.txt b/README.txt index 7db59fd..231caa8 100644 --- a/README.txt +++ b/README.txt @@ -1,6 +1,5 @@ -minipeli 0.2.5 by paramat. +minipeli 0.2.6 by paramat. A game for Minetest Engine 5.2.0 and later. -See each mod for mod-specific credits and licenses. Authors of media @@ -8,16 +7,17 @@ Authors of media paramat (CC BY-SA 3.0): header.png icon.png + screenshot.png About Minipeli -------------- 'Peli' is the Finnish word for 'game'. -This game is intended to be an example of minimal requirements for a Minetest Engine game, while still supporting all non-Mapgen V6 mapgens and providing a minimal number of biomes with appropriate vertical variation. +This game is intended to be one example of minimal requirements for a Minetest Engine game, while still supporting all non-Mapgen V6 mapgens and providing a minimal number of biomes with appropriate vertical variation. The intention is to help others and myself create completely new games. -This also suggests a good mod structure, as opposed to the problematic structure of Minetest Game, which has most content in one large mod. It is better to split content into many smaller mods. +This also suggests a good mod structure, as opposed to the problematic structure of Minetest Game, which has most content in one large mod. It is better to divide content into several mods that correspond to the distinct elements of the game. Because creating animated meshes is difficult, the player model from Minetest Game is used, it seems suitable for many games. The player API of Minetest Game is very useful and quite fundamental, so the 'player_api' mod from Minetest Game is included, but with new player textures. @@ -45,14 +45,20 @@ Sets suitable animations according to control inputs and player health. 'gui' Contains formspec and HUD related stuff: -Formspec background, hotbar background, bubble and heart textures. +Formspec background, bubble and heart textures. Sets the formspec prepend. -Sets custom hotbar textures if code un-commented and textures added. 'hand' -Contains the hand tool related stuff: +Contains the hand related stuff: The wieldhand texture. -Registers the hand tool. +Registers the hand. + +'creative_mode' +Activates in creative mode. +A simple creative mod without a creative inventory. +Overrides the hand registration for special digging capabilities. +Enables placing unlimited nodes without removing from inventory. +Prevents dug nodes being added to inventory if already present. 'media' Contains textures and sounds that have no suitable location anywhere else: @@ -73,14 +79,14 @@ Gives 64 lights to a new player. Mapgen aliases -------------- -Since MT 5.0.0 dungeon nodes and cave liquids are defined in biome definitions, so now only 3 mapgen aliases need to be registered: stone, water, river water. +Since MT 5.0.0, dungeon nodes and cave liquids are defined in biome definitions, so now only 3 mapgen aliases need to be registered: stone, water, river water. Biomes ------ This game registers a single 'biome stack': A set of vertically stacked biomes all with the same heat and humidity points. -A developed game would usually add extra biome stacks at differing heat and humidity points. +A more developed game would usually add extra biome stacks at differing heat and humidity points. The 'grassland' biome stack in this game consists of: @@ -122,27 +128,36 @@ Minetest Game mods used heavily modified: 'default' mod: The minipeli 'gui', 'hand' and 'media' mods are derived from it. +'creative' mod: +The minipeli 'creative_mode' mod is derived from it. 'gui' mod contains: Textures: - gui_formbg - gui_hb_bg - bubble - heart + gui_formbg.png + bubble.png + heart.png init.lua: -minetest.register_on_joinplayer to set the formspec prepend. The custom hotbar texture code is commented-out. Also use a temporary fix for minetest.get_player_information occasionally being 'nil'. +minetest.register_on_joinplayer to set the formspec prepend. 'hand' mod contains: Textures: wieldhand.png init.lua: -minetest.register_item to register the hand tool. +minetest.register_item to register the hand. 'media' mod contains: Textures: - crack_anylength + crack_anylength.png Sounds: - player_damage + player_damage.ogg init.lua: Required but empty. + +'creative_mode' mod contains: +init.lua: +minetest.override_item() to override the hand. +minetest.register_on_placenode() for placing unlimited nodes without removing from inventory. +Redefinition of minetest.handle_node_drops() to prevent dug nodes being added to inventory if already present. +Creative inventory and per-player creative mode are not included for simplicity. +Players can use chat command '/giveme' to obtain nodes they want to place, and can drop an inventory itemstack to clear space in inventory. diff --git a/game.conf b/game.conf index 9a1d288..2294a26 100644 --- a/game.conf +++ b/game.conf @@ -1,3 +1,4 @@ name = Minipeli author = paramat disallowed_mapgens = v6 +description = This purpose of this game is to be an example of minimal requirements for a Minetest game, to help content creators create new games. diff --git a/mods/creative_mode/README.txt b/mods/creative_mode/README.txt new file mode 100644 index 0000000..c8ba679 --- /dev/null +++ b/mods/creative_mode/README.txt @@ -0,0 +1,8 @@ +Minipeli mod: creative_mode +=========================== +Derived by paramat from Minetest Game 'creative' mod. + +Authors of source code +---------------------- +Originally by Perttu Ahola (celeron55) (MIT) +Various Minetest developers and contributors (MIT) diff --git a/mods/creative_mode/init.lua b/mods/creative_mode/init.lua new file mode 100644 index 0000000..960f2a2 --- /dev/null +++ b/mods/creative_mode/init.lua @@ -0,0 +1,51 @@ +local creative_mode_cache = minetest.settings:get_bool("creative_mode") + +if creative_mode_cache then + -- Override the hand for special capabilities + local digtime = 42 + local caps = {times = {digtime, digtime, digtime}, uses = 0, maxlevel = 256} + + minetest.override_item("", { + range = 8, + tool_capabilities = { + full_punch_interval = 0.5, + max_drop_level = 3, + groupcaps = { + crumbly = caps, + cracky = caps, + snappy = caps, + choppy = caps, + oddly_breakable_by_hand = caps, + dig_immediate = + {times = {[2] = digtime, [3] = 0}, uses = 0, maxlevel = 256}, + }, + } + }) + + -- When placing a node, do not remove from inventory + minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack) + if placer and placer:is_player() then + return true + end + end) +end + + +-- When digging a node, do not add to inventory if already present + +local old_handle_node_drops = minetest.handle_node_drops + +function minetest.handle_node_drops(pos, drops, digger) + if not digger or not digger:is_player() or not creative_mode_cache then + return old_handle_node_drops(pos, drops, digger) + end + + local inv = digger:get_inventory() + if inv then + for _, item in ipairs(drops) do + if not inv:contains_item("main", item, true) then + inv:add_item("main", item) + end + end + end +end diff --git a/mods/creative_mode/license.txt b/mods/creative_mode/license.txt new file mode 100644 index 0000000..e4ff170 --- /dev/null +++ b/mods/creative_mode/license.txt @@ -0,0 +1,25 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2020 Perttu Ahola (celeron55) +Copyright (C) 2012-2020 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER 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. + +For more details: +https://opensource.org/licenses/MIT diff --git a/mods/creative_mode/mod.conf b/mods/creative_mode/mod.conf new file mode 100644 index 0000000..801620f --- /dev/null +++ b/mods/creative_mode/mod.conf @@ -0,0 +1 @@ +depends = hand diff --git a/mods/gui/README.txt b/mods/gui/README.txt index f487386..657ea1b 100644 --- a/mods/gui/README.txt +++ b/mods/gui/README.txt @@ -9,10 +9,4 @@ Various Minetest developers and contributors (LGPL 2.1) Authors of media ---------------- -BlockMen (CC BY-SA 3.0): - gui_formbg.png - gui_hb_bg.png - -Paramat (CC BY-SA 3.0): - bubble.png - heart.png +All textures by paramat (CC BY-SA 3.0) diff --git a/mods/gui/init.lua b/mods/gui/init.lua index 0c544c3..0da6b41 100644 --- a/mods/gui/init.lua +++ b/mods/gui/init.lua @@ -1,21 +1,10 @@ --- Set formspec prepend and hotbar textures +-- Set formspec prepended string, used for theming minetest.register_on_joinplayer(function(player) 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 - -- Set the string to be added to every mainmenu formspec, used for theming + listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF] + background[5,5;1,1;gui_formbg.png;true] + ]] player:set_formspec_prepend(formspec) - - -- Set hotbar textures. - -- To use, uncomment these 2 lines and add textures to the textures folder. - --player:hud_set_hotbar_image("gui_hotbar.png") - --player:hud_set_hotbar_selected_image("gui_hotbar_selected.png") end) diff --git a/mods/gui/license.txt b/mods/gui/license.txt index 5a53060..9d9db3f 100644 --- a/mods/gui/license.txt +++ b/mods/gui/license.txt @@ -2,8 +2,8 @@ License of source code ---------------------- GNU Lesser General Public License, version 2.1 -Copyright (C) 2019 celeron55, Perttu Ahola -Copyright (C) 2019 Various Minetest developers and contributors +Copyright (C) 2011-2020 celeron55, Perttu Ahola +Copyright (C) 2011-2020 Various Minetest developers and contributors This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free @@ -21,8 +21,7 @@ License of media ---------------- Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) -Copyright (C) 2019 paramat -Copyright (C) 2019 BlockMen +Copyright (C) 2020 paramat You are free to: Share — copy and redistribute the material in any medium or format. diff --git a/mods/gui/textures/gui_formbg.png b/mods/gui/textures/gui_formbg.png index c543466..3ff7c6e 100644 Binary files a/mods/gui/textures/gui_formbg.png and b/mods/gui/textures/gui_formbg.png differ diff --git a/mods/gui/textures/gui_hb_bg.png b/mods/gui/textures/gui_hb_bg.png deleted file mode 100644 index 99248e1..0000000 Binary files a/mods/gui/textures/gui_hb_bg.png and /dev/null differ diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 0000000..016a66a Binary files /dev/null and b/screenshot.png differ