First commit
9
README.txt
Normal file
@ -0,0 +1,9 @@
|
||||
minipeli 0.1.0 by paramat.
|
||||
A game for Minetest Engine 5.0.0 and later.
|
||||
See README.txt in each mod directory for more author credits.
|
||||
|
||||
Authors of media (textures)
|
||||
---------------------------
|
||||
paramat (CC BY-SA 3.0):
|
||||
header.png
|
||||
icon.png
|
56
development.txt
Normal file
@ -0,0 +1,56 @@
|
||||
Why Mapgen v6 is not supported
|
||||
------------------------------
|
||||
|
||||
In the 'game.conf' file, mapgen v6 is set as a disallowed mapgen.
|
||||
Mapgen v6 is very different to all the other mapgens, it has hardcoded biomes and does not use the Biome API. Due to this it makes game code more complex and more difficult to maintain, the mapgen also misses many features.
|
||||
It is highly recommended that games do not support Mapgen v6 for these reasons.
|
||||
|
||||
|
||||
Note about 'lamp' mod
|
||||
---------------------
|
||||
|
||||
This is not a necessary part of the game, it is only provided in creative mode to illuminate caves and dungeons during testing.
|
||||
|
||||
|
||||
How this game was created
|
||||
-------------------------
|
||||
|
||||
MTG mods used unmodified:
|
||||
creative (but optional-depend on 'hand' mod instead of default)
|
||||
sfinv
|
||||
|
||||
|
||||
MTG mods used modified:
|
||||
default (becomes 'base' and 'hand' mods)
|
||||
player_api
|
||||
|
||||
|
||||
default mod changes:
|
||||
Move hand out to a separate mod 'hand'.
|
||||
Rename remainder to 'base' mod, now only contains:
|
||||
|
||||
Textures:
|
||||
bubble
|
||||
crack_anylength
|
||||
gui_formbg
|
||||
gui_furnace_arrow_bg
|
||||
gui_hb_bg
|
||||
heart
|
||||
|
||||
Code:
|
||||
minetest.register_on_joinplayer player:set_formspec_prepend
|
||||
base.get_hotbar_bg
|
||||
|
||||
|
||||
player_api mod changes:
|
||||
Now only contains:
|
||||
|
||||
Models:
|
||||
Player model b3d, blend, skin texture
|
||||
Sounds:
|
||||
player_damage
|
||||
Files:
|
||||
api.lua unchanged
|
||||
init.lua: From register_on_joinplayer remove:
|
||||
player:hud_set_hotbar_image("gui_hotbar.png")
|
||||
player:hud_set_hotbar_selected_image("gui_hotbar_selected.png")
|
3
game.conf
Normal file
@ -0,0 +1,3 @@
|
||||
name = Minipeli
|
||||
author = paramat
|
||||
disallowed_mapgens = v6
|
40
license.txt
Normal file
@ -0,0 +1,40 @@
|
||||
See license.txt in each mod directory for more license information.
|
||||
|
||||
License of media (textures, schematics)
|
||||
---------------------------------------
|
||||
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
Copyright (C) 2019 paramat
|
||||
|
||||
You are free to:
|
||||
|
||||
Share — copy and redistribute the material in any medium or format
|
||||
Adapt — remix, transform, and build upon the material for any purpose, even
|
||||
commercially.
|
||||
|
||||
The licensor cannot revoke these freedoms as long as you follow the license
|
||||
terms.
|
||||
|
||||
Under the following terms:
|
||||
|
||||
Attribution — You must give appropriate credit, provide a link to the license,
|
||||
and indicate if changes were made. You may do so in any reasonable manner, but
|
||||
not in any way that suggests the licensor endorses you or your use.
|
||||
|
||||
ShareAlike — If you remix, transform, or build upon the material, you must
|
||||
distribute your contributions under the same license as the original.
|
||||
|
||||
No additional restrictions — You may not apply legal terms or technological
|
||||
measures that legally restrict others from doing anything the license permits.
|
||||
|
||||
Notices:
|
||||
|
||||
You do not have to comply with the license for elements of the material in the
|
||||
public domain or where your use is permitted by an applicable exception or
|
||||
limitation.
|
||||
No warranties are given. The license may not give you all of the permissions
|
||||
necessary for your intended use. For example, other rights such as publicity,
|
||||
privacy, or moral rights may limit how you use the material.
|
||||
|
||||
For more details:
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
BIN
menu/header.png
Normal file
After Width: | Height: | Size: 116 B |
BIN
menu/icon.png
Normal file
After Width: | Height: | Size: 119 B |
0
minetest.conf
Normal file
13
mods/base/README.txt
Normal file
@ -0,0 +1,13 @@
|
||||
Minipeli mod: base
|
||||
==================
|
||||
See license.txt for license information.
|
||||
Derived by paramat from Minetest Game 'default' mod.
|
||||
|
||||
Authors of source code
|
||||
----------------------
|
||||
Originally by celeron55, Perttu Ahola <celeron55@gmail.com> (LGPL 2.1)
|
||||
Various Minetest developers and contributors (LGPL 2.1)
|
||||
|
||||
Authors of media
|
||||
----------------
|
||||
All textures by paramat (CC BY-SA 3.0).
|
1
mods/base/depends.txt
Normal file
@ -0,0 +1 @@
|
||||
player_api?
|
26
mods/base/init.lua
Normal file
@ -0,0 +1,26 @@
|
||||
base = {}
|
||||
|
||||
|
||||
-- Formspec prepend
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
player:set_formspec_prepend([[
|
||||
bgcolor[#080808BB;true]
|
||||
background[5,5;1,1;gui_formbg.png;true]
|
||||
background[5,5;1,1;gui_formbg.png;true;10]
|
||||
listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF] ]])
|
||||
end)
|
||||
|
||||
|
||||
-- Get hotbar background global function
|
||||
|
||||
-- Not currently used by this game, but is often used by node inventory
|
||||
-- formspecs such as chests, furnace, bones, bookshelves.
|
||||
|
||||
function base.get_hotbar_bg(x, y)
|
||||
local out = ""
|
||||
for i = 0, 7 do
|
||||
out = out .."image[" .. x + i .. "," .. y .. ";1,1;gui_hb_bg.png]"
|
||||
end
|
||||
return out
|
||||
end
|
56
mods/base/license.txt
Normal file
@ -0,0 +1,56 @@
|
||||
License of source code
|
||||
----------------------
|
||||
|
||||
GNU Lesser General Public License, version 2.1
|
||||
Copyright (C) 2019 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
Copyright (C) 2019 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
|
||||
Software Foundation; either version 2.1 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
PARTICULAR PURPOSE.
|
||||
See the GNU Lesser General Public License for more details:
|
||||
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
|
||||
|
||||
|
||||
License of media
|
||||
----------------
|
||||
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
Copyright (C) 2019 paramat
|
||||
|
||||
You are free to:
|
||||
Share — copy and redistribute the material in any medium or format.
|
||||
Adapt — remix, transform, and build upon the material for any purpose, even
|
||||
commercially.
|
||||
|
||||
The licensor cannot revoke these freedoms as long as you follow the license
|
||||
terms.
|
||||
|
||||
Under the following terms:
|
||||
|
||||
Attribution — You must give appropriate credit, provide a link to the license,
|
||||
and indicate if changes were made. You may do so in any reasonable manner, but
|
||||
not in any way that suggests the licensor endorses you or your use.
|
||||
|
||||
ShareAlike — If you remix, transform, or build upon the material, you must
|
||||
distribute your contributions under the same license as the original.
|
||||
|
||||
No additional restrictions — You may not apply legal terms or technological
|
||||
measures that legally restrict others from doing anything the license permits.
|
||||
|
||||
Notices:
|
||||
|
||||
You do not have to comply with the license for elements of the material in the
|
||||
public domain or where your use is permitted by an applicable exception or
|
||||
limitation.
|
||||
No warranties are given. The license may not give you all of the permissions
|
||||
necessary for your intended use. For example, other rights such as publicity,
|
||||
privacy, or moral rights may limit how you use the material.
|
||||
|
||||
For more details:
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
BIN
mods/base/textures/bubble.png
Normal file
After Width: | Height: | Size: 116 B |
BIN
mods/base/textures/crack_anylength.png
Normal file
After Width: | Height: | Size: 117 B |
BIN
mods/base/textures/gui_formbg.png
Normal file
After Width: | Height: | Size: 971 B |
BIN
mods/base/textures/gui_furnace_arrow_bg.png
Normal file
After Width: | Height: | Size: 739 B |
BIN
mods/base/textures/gui_hb_bg.png
Normal file
After Width: | Height: | Size: 98 B |
BIN
mods/base/textures/heart.png
Normal file
After Width: | Height: | Size: 112 B |
17
mods/creative/README.txt
Normal file
@ -0,0 +1,17 @@
|
||||
Minetest Game mod: creative
|
||||
===========================
|
||||
See license.txt for license information.
|
||||
|
||||
Authors of source code
|
||||
----------------------
|
||||
Originally by Perttu Ahola (celeron55) <celeron55@gmail.com> (MIT)
|
||||
Jean-Patrick G. (kilbith) <jeanpatrick.guerrero@gmail.com> (MIT)
|
||||
|
||||
Author of media (textures)
|
||||
--------------------------
|
||||
paramat (CC BY-SA 3.0):
|
||||
* creative_prev_icon.png
|
||||
* creative_next_icon.png
|
||||
* creative_search_icon.png
|
||||
* creative_clear_icon.png
|
||||
* creative_trash_icon.png derived from a texture by kilbith (CC BY-SA 3.0)
|
85
mods/creative/init.lua
Normal file
@ -0,0 +1,85 @@
|
||||
creative = {}
|
||||
|
||||
local function update_sfinv(name)
|
||||
minetest.after(0, function()
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if player then
|
||||
if sfinv.get_page(player):sub(1, 9) == "creative:" then
|
||||
sfinv.set_page(player, sfinv.get_homepage_name(player))
|
||||
else
|
||||
sfinv.set_player_inventory_formspec(player)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
minetest.register_privilege("creative", {
|
||||
description = "Allow player to use creative inventory",
|
||||
give_to_singleplayer = false,
|
||||
give_to_admin = false,
|
||||
on_grant = update_sfinv,
|
||||
on_revoke = update_sfinv,
|
||||
})
|
||||
|
||||
local creative_mode_cache = minetest.settings:get_bool("creative_mode")
|
||||
|
||||
function creative.is_enabled_for(name)
|
||||
return creative_mode_cache or
|
||||
minetest.check_player_privs(name, {creative = true})
|
||||
end
|
||||
|
||||
dofile(minetest.get_modpath("creative") .. "/inventory.lua")
|
||||
|
||||
if creative_mode_cache then
|
||||
-- Dig time is modified according to difference (leveldiff) between tool
|
||||
-- 'maxlevel' and node 'level'. Digtime is divided by the larger of
|
||||
-- leveldiff and 1.
|
||||
-- To speed up digging in creative, hand 'maxlevel' and 'digtime' have been
|
||||
-- increased such that nodes of differing levels have an insignificant
|
||||
-- effect on digtime.
|
||||
local digtime = 42
|
||||
local caps = {times = {digtime, digtime, digtime}, uses = 0, maxlevel = 256}
|
||||
|
||||
minetest.register_item(":", {
|
||||
type = "none",
|
||||
wield_image = "wieldhand.png",
|
||||
wield_scale = {x = 1, y = 1, z = 2.5},
|
||||
range = 10,
|
||||
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,
|
||||
},
|
||||
damage_groups = {fleshy = 10},
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
-- Unlimited node placement
|
||||
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
|
||||
if placer and placer:is_player() then
|
||||
return creative.is_enabled_for(placer:get_player_name())
|
||||
end
|
||||
end)
|
||||
|
||||
-- Don't pick up if the item is already in the inventory
|
||||
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.is_enabled_for(digger:get_player_name()) 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
|
189
mods/creative/inventory.lua
Normal file
@ -0,0 +1,189 @@
|
||||
local player_inventory = {}
|
||||
local inventory_cache = {}
|
||||
|
||||
local function init_creative_cache(items)
|
||||
inventory_cache[items] = {}
|
||||
local i_cache = inventory_cache[items]
|
||||
|
||||
for name, def in pairs(items) do
|
||||
if def.groups.not_in_creative_inventory ~= 1 and
|
||||
def.description and def.description ~= "" then
|
||||
i_cache[name] = def
|
||||
end
|
||||
end
|
||||
table.sort(i_cache)
|
||||
return i_cache
|
||||
end
|
||||
|
||||
function creative.init_creative_inventory(player)
|
||||
local player_name = player:get_player_name()
|
||||
player_inventory[player_name] = {
|
||||
size = 0,
|
||||
filter = "",
|
||||
start_i = 0
|
||||
}
|
||||
|
||||
minetest.create_detached_inventory("creative_" .. player_name, {
|
||||
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player2)
|
||||
local name = player2 and player2:get_player_name() or ""
|
||||
if not creative.is_enabled_for(name) or
|
||||
to_list == "main" then
|
||||
return 0
|
||||
end
|
||||
return count
|
||||
end,
|
||||
allow_put = function(inv, listname, index, stack, player2)
|
||||
return 0
|
||||
end,
|
||||
allow_take = function(inv, listname, index, stack, player2)
|
||||
local name = player2 and player2:get_player_name() or ""
|
||||
if not creative.is_enabled_for(name) then
|
||||
return 0
|
||||
end
|
||||
return -1
|
||||
end,
|
||||
on_move = function(inv, from_list, from_index, to_list, to_index, count, player2)
|
||||
end,
|
||||
on_take = function(inv, listname, index, stack, player2)
|
||||
if stack and stack:get_count() > 0 then
|
||||
minetest.log("action", player_name .. " takes " .. stack:get_name().. " from creative inventory")
|
||||
end
|
||||
end,
|
||||
}, player_name)
|
||||
|
||||
return player_inventory[player_name]
|
||||
end
|
||||
|
||||
function creative.update_creative_inventory(player_name, tab_content)
|
||||
local creative_list = {}
|
||||
local inv = player_inventory[player_name] or
|
||||
creative.init_creative_inventory(minetest.get_player_by_name(player_name))
|
||||
local player_inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name})
|
||||
|
||||
local items = inventory_cache[tab_content] or init_creative_cache(tab_content)
|
||||
|
||||
for name, def in pairs(items) do
|
||||
if def.name:find(inv.filter, 1, true) or
|
||||
def.description:lower():find(inv.filter, 1, true) then
|
||||
creative_list[#creative_list+1] = name
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(creative_list)
|
||||
player_inv:set_size("main", #creative_list)
|
||||
player_inv:set_list("main", creative_list)
|
||||
inv.size = #creative_list
|
||||
end
|
||||
|
||||
-- Create the trash field
|
||||
local trash = minetest.create_detached_inventory("creative_trash", {
|
||||
-- Allow the stack to be placed and remove it in on_put()
|
||||
-- This allows the creative inventory to restore the stack
|
||||
allow_put = function(inv, listname, index, stack, player)
|
||||
return stack:get_count()
|
||||
end,
|
||||
on_put = function(inv, listname)
|
||||
inv:set_list(listname, {})
|
||||
end,
|
||||
})
|
||||
trash:set_size("main", 1)
|
||||
|
||||
creative.formspec_add = ""
|
||||
|
||||
function creative.register_tab(name, title, items)
|
||||
sfinv.register_page("creative:" .. name, {
|
||||
title = title,
|
||||
is_in_nav = function(self, player, context)
|
||||
return creative.is_enabled_for(player:get_player_name())
|
||||
end,
|
||||
get = function(self, player, context)
|
||||
local player_name = player:get_player_name()
|
||||
creative.update_creative_inventory(player_name, items)
|
||||
local inv = player_inventory[player_name]
|
||||
local start_i = inv.start_i or 0
|
||||
local pagenum = math.floor(start_i / (3*8) + 1)
|
||||
local pagemax = math.ceil(inv.size / (3*8))
|
||||
return sfinv.make_formspec(player, context,
|
||||
"label[6.2,3.35;" .. minetest.colorize("#FFFF00", tostring(pagenum)) .. " / " .. tostring(pagemax) .. "]" ..
|
||||
[[
|
||||
image[4.06,3.4;0.8,0.8;creative_trash_icon.png]
|
||||
listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]
|
||||
list[detached:creative_trash;main;4,3.3;1,1;]
|
||||
listring[]
|
||||
image_button[5.4,3.25;0.8,0.8;creative_prev_icon.png;creative_prev;]
|
||||
image_button[7.2,3.25;0.8,0.8;creative_next_icon.png;creative_next;]
|
||||
image_button[2.1,3.25;0.8,0.8;creative_search_icon.png;creative_search;]
|
||||
image_button[2.75,3.25;0.8,0.8;creative_clear_icon.png;creative_clear;]
|
||||
tooltip[creative_search;Search]
|
||||
tooltip[creative_clear;Reset]
|
||||
tooltip[creative_prev;Previous page]
|
||||
tooltip[creative_next;Next page]
|
||||
listring[current_player;main]
|
||||
field_close_on_enter[creative_filter;false]
|
||||
]] ..
|
||||
"field[0.3,3.5;2.2,1;creative_filter;;" .. minetest.formspec_escape(inv.filter) .. "]" ..
|
||||
"listring[detached:creative_" .. player_name .. ";main]" ..
|
||||
"list[detached:creative_" .. player_name .. ";main;0,0;8,3;" .. tostring(start_i) .. "]" ..
|
||||
creative.formspec_add, true)
|
||||
end,
|
||||
on_enter = function(self, player, context)
|
||||
local player_name = player:get_player_name()
|
||||
local inv = player_inventory[player_name]
|
||||
if inv then
|
||||
inv.start_i = 0
|
||||
end
|
||||
end,
|
||||
on_player_receive_fields = function(self, player, context, fields)
|
||||
local player_name = player:get_player_name()
|
||||
local inv = player_inventory[player_name]
|
||||
assert(inv)
|
||||
|
||||
if fields.creative_clear then
|
||||
inv.start_i = 0
|
||||
inv.filter = ""
|
||||
creative.update_creative_inventory(player_name, items)
|
||||
sfinv.set_player_inventory_formspec(player, context)
|
||||
elseif fields.creative_search or
|
||||
fields.key_enter_field == "creative_filter" then
|
||||
inv.start_i = 0
|
||||
inv.filter = fields.creative_filter:lower()
|
||||
creative.update_creative_inventory(player_name, items)
|
||||
sfinv.set_player_inventory_formspec(player, context)
|
||||
elseif not fields.quit then
|
||||
local start_i = inv.start_i or 0
|
||||
|
||||
if fields.creative_prev then
|
||||
start_i = start_i - 3*8
|
||||
if start_i < 0 then
|
||||
start_i = inv.size - (inv.size % (3*8))
|
||||
if inv.size == start_i then
|
||||
start_i = math.max(0, inv.size - (3*8))
|
||||
end
|
||||
end
|
||||
elseif fields.creative_next then
|
||||
start_i = start_i + 3*8
|
||||
if start_i >= inv.size then
|
||||
start_i = 0
|
||||
end
|
||||
end
|
||||
|
||||
inv.start_i = start_i
|
||||
sfinv.set_player_inventory_formspec(player, context)
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
creative.register_tab("all", "All", minetest.registered_items)
|
||||
creative.register_tab("nodes", "Nodes", minetest.registered_nodes)
|
||||
creative.register_tab("tools", "Tools", minetest.registered_tools)
|
||||
creative.register_tab("craftitems", "Items", minetest.registered_craftitems)
|
||||
|
||||
local old_homepage_name = sfinv.get_homepage_name
|
||||
function sfinv.get_homepage_name(player)
|
||||
if creative.is_enabled_for(player:get_player_name()) then
|
||||
return "creative:all"
|
||||
else
|
||||
return old_homepage_name(player)
|
||||
end
|
||||
end
|
61
mods/creative/license.txt
Normal file
@ -0,0 +1,61 @@
|
||||
License of source code
|
||||
----------------------
|
||||
|
||||
The MIT License (MIT)
|
||||
Copyright (C) 2012-2016 Perttu Ahola (celeron55) <celeron55@gmail.com>
|
||||
Copyright (C) 2015-2016 Jean-Patrick G. (kilbith) <jeanpatrick.guerrero@gmail.com>
|
||||
|
||||
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
|
||||
|
||||
|
||||
Licenses of media (textures)
|
||||
----------------------------
|
||||
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
Copyright (C) 2016 Jean-Patrick G. (kilbith) <jeanpatrick.guerrero@gmail.com>
|
||||
Copyright (C) 2018 paramat
|
||||
|
||||
You are free to:
|
||||
Share — copy and redistribute the material in any medium or format.
|
||||
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
|
||||
The licensor cannot revoke these freedoms as long as you follow the license terms.
|
||||
|
||||
Under the following terms:
|
||||
|
||||
Attribution — You must give appropriate credit, provide a link to the license, and
|
||||
indicate if changes were made. You may do so in any reasonable manner, but not in any way
|
||||
that suggests the licensor endorses you or your use.
|
||||
|
||||
ShareAlike — If you remix, transform, or build upon the material, you must distribute
|
||||
your contributions under the same license as the original.
|
||||
|
||||
No additional restrictions — You may not apply legal terms or technological measures that
|
||||
legally restrict others from doing anything the license permits.
|
||||
|
||||
Notices:
|
||||
|
||||
You do not have to comply with the license for elements of the material in the public
|
||||
domain or where your use is permitted by an applicable exception or limitation.
|
||||
No warranties are given. The license may not give you all of the permissions necessary
|
||||
for your intended use. For example, other rights such as publicity, privacy, or moral
|
||||
rights may limit how you use the material.
|
||||
|
||||
For more details:
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
4
mods/creative/mod.conf
Normal file
@ -0,0 +1,4 @@
|
||||
name = creative
|
||||
description = Minetest Game mod: creative
|
||||
depends = sfinv
|
||||
optional_depends = hand
|
BIN
mods/creative/textures/creative_clear_icon.png
Normal file
After Width: | Height: | Size: 708 B |
BIN
mods/creative/textures/creative_next_icon.png
Normal file
After Width: | Height: | Size: 727 B |
BIN
mods/creative/textures/creative_prev_icon.png
Normal file
After Width: | Height: | Size: 728 B |
BIN
mods/creative/textures/creative_search_icon.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
mods/creative/textures/creative_trash_icon.png
Normal file
After Width: | Height: | Size: 712 B |
13
mods/hand/README.txt
Normal file
@ -0,0 +1,13 @@
|
||||
Minipeli mod: hand
|
||||
==================
|
||||
See license.txt for license information.
|
||||
Derived by paramat from Minetest Game 'default' mod.
|
||||
|
||||
Authors of source code
|
||||
----------------------
|
||||
Originally by celeron55, Perttu Ahola <celeron55@gmail.com> (LGPL 2.1)
|
||||
Various Minetest developers and contributors (LGPL 2.1)
|
||||
|
||||
Authors of media
|
||||
----------------
|
||||
All textures by paramat (CC BY-SA 3.0).
|
28
mods/hand/init.lua
Normal file
@ -0,0 +1,28 @@
|
||||
-- The hand tool
|
||||
|
||||
minetest.register_item(":", {
|
||||
type = "none",
|
||||
wield_image = "wieldhand.png",
|
||||
wield_scale = {x = 1, y = 1, z = 2.5},
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 0.9,
|
||||
max_drop_level = 0,
|
||||
groupcaps = {
|
||||
crumbly = {
|
||||
times = {[2] = 3.00, [3] = 0.70},
|
||||
uses = 0,
|
||||
maxlevel = 1,
|
||||
},
|
||||
snappy = {
|
||||
times = {[3] = 0.40},
|
||||
uses = 0,
|
||||
maxlevel = 1,
|
||||
},
|
||||
oddly_breakable_by_hand = {
|
||||
times = {[1] = 3.50, [2] = 2.00, [3] = 0.70},
|
||||
uses = 0,
|
||||
},
|
||||
},
|
||||
damage_groups = {fleshy = 1},
|
||||
}
|
||||
})
|
56
mods/hand/license.txt
Normal file
@ -0,0 +1,56 @@
|
||||
License of source code
|
||||
----------------------
|
||||
|
||||
GNU Lesser General Public License, version 2.1
|
||||
Copyright (C) 2019 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
Copyright (C) 2019 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
|
||||
Software Foundation; either version 2.1 of the License, or (at your option) any
|
||||
later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
PARTICULAR PURPOSE.
|
||||
See the GNU Lesser General Public License for more details:
|
||||
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
|
||||
|
||||
|
||||
License of media
|
||||
----------------
|
||||
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
Copyright (C) 2019 paramat
|
||||
|
||||
You are free to:
|
||||
Share — copy and redistribute the material in any medium or format.
|
||||
Adapt — remix, transform, and build upon the material for any purpose, even
|
||||
commercially.
|
||||
|
||||
The licensor cannot revoke these freedoms as long as you follow the license
|
||||
terms.
|
||||
|
||||
Under the following terms:
|
||||
|
||||
Attribution — You must give appropriate credit, provide a link to the license,
|
||||
and indicate if changes were made. You may do so in any reasonable manner, but
|
||||
not in any way that suggests the licensor endorses you or your use.
|
||||
|
||||
ShareAlike — If you remix, transform, or build upon the material, you must
|
||||
distribute your contributions under the same license as the original.
|
||||
|
||||
No additional restrictions — You may not apply legal terms or technological
|
||||
measures that legally restrict others from doing anything the license permits.
|
||||
|
||||
Notices:
|
||||
|
||||
You do not have to comply with the license for elements of the material in the
|
||||
public domain or where your use is permitted by an applicable exception or
|
||||
limitation.
|
||||
No warranties are given. The license may not give you all of the permissions
|
||||
necessary for your intended use. For example, other rights such as publicity,
|
||||
privacy, or moral rights may limit how you use the material.
|
||||
|
||||
For more details:
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
BIN
mods/hand/textures/wieldhand.png
Normal file
After Width: | Height: | Size: 109 B |
10
mods/lamp/init.lua
Normal file
@ -0,0 +1,10 @@
|
||||
-- Lamp
|
||||
|
||||
minetest.register_node("lamp:lamp", {
|
||||
description = "Lamp",
|
||||
tiles = {"lamp_lamp.png"},
|
||||
paramtype = "light",
|
||||
light_source = 14,
|
||||
is_ground_content = false,
|
||||
groups = {dig_immediate = 2},
|
||||
})
|
BIN
mods/lamp/textures/lamp_lamp.png
Normal file
After Width: | Height: | Size: 96 B |
5
mods/mapgen/README.txt
Normal file
@ -0,0 +1,5 @@
|
||||
Minipeli mod: mapgen
|
||||
====================
|
||||
See license.txt for license information.
|
||||
Source code by paramat (MIT).
|
||||
All textures by paramat (CC BY-SA 3.0).
|
314
mods/mapgen/init.lua
Normal file
@ -0,0 +1,314 @@
|
||||
-- Nodes
|
||||
|
||||
minetest.register_node("mapgen:stone", {
|
||||
description = "Stone",
|
||||
tiles = {"mapgen_stone.png"},
|
||||
groups = {cracky = 3},
|
||||
})
|
||||
|
||||
minetest.register_node("mapgen:stone_block", {
|
||||
description = "Stone Block",
|
||||
tiles = {"mapgen_stone_block.png"},
|
||||
is_ground_content = false,
|
||||
groups = {dig_immediate = 2},
|
||||
})
|
||||
|
||||
minetest.register_node("mapgen:stone_block_stair", {
|
||||
description = "Stone Block Stair",
|
||||
drawtype = "nodebox",
|
||||
tiles = {
|
||||
"mapgen_stone_block_divided.png",
|
||||
"mapgen_stone_block.png",
|
||||
"mapgen_stone_block_divided.png"
|
||||
},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = {dig_immediate = 2},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0.0, 0.5},
|
||||
{-0.5, 0.0, 0.0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("mapgen:grass", {
|
||||
description = "Grass",
|
||||
tiles = {"mapgen_grass.png"},
|
||||
groups = {crumbly = 3},
|
||||
})
|
||||
|
||||
minetest.register_node("mapgen:dirt", {
|
||||
description = "Dirt",
|
||||
tiles = {"mapgen_dirt.png"},
|
||||
groups = {crumbly = 3},
|
||||
})
|
||||
|
||||
minetest.register_node("mapgen:sand", {
|
||||
description = "Sand",
|
||||
tiles = {"mapgen_sand.png"},
|
||||
groups = {crumbly = 3},
|
||||
})
|
||||
|
||||
-- Water
|
||||
|
||||
minetest.register_node("mapgen:water_source", {
|
||||
description = "Water Source",
|
||||
drawtype = "liquid",
|
||||
tiles = {
|
||||
{
|
||||
name = "mapgen_water.png",
|
||||
backface_culling = false,
|
||||
},
|
||||
{
|
||||
name = "mapgen_water.png",
|
||||
backface_culling = true,
|
||||
},
|
||||
},
|
||||
alpha = 160,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing = "mapgen:water_flowing",
|
||||
liquid_alternative_source = "mapgen:water_source",
|
||||
liquid_viscosity = 1,
|
||||
post_effect_color = {a = 103, r = 30, g = 60, b = 90},
|
||||
})
|
||||
|
||||
minetest.register_node("mapgen:water_flowing", {
|
||||
description = "Flowing Water",
|
||||
drawtype = "flowingliquid",
|
||||
tiles = {"mapgen_water.png"},
|
||||
special_tiles = {
|
||||
{
|
||||
name = "mapgen_water.png",
|
||||
backface_culling = false,
|
||||
},
|
||||
{
|
||||
name = "mapgen_water.png",
|
||||
backface_culling = false,
|
||||
},
|
||||
},
|
||||
alpha = 160,
|
||||
paramtype = "light",
|
||||
paramtype2 = "flowingliquid",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = "flowing",
|
||||
liquid_alternative_flowing = "mapgen:water_flowing",
|
||||
liquid_alternative_source = "mapgen:water_source",
|
||||
liquid_viscosity = 1,
|
||||
post_effect_color = {a = 103, r = 30, g = 60, b = 90},
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
})
|
||||
|
||||
-- River water
|
||||
|
||||
-- This is an alternative water node required by mapgens with sloping rivers.
|
||||
-- It has 'liquid_renewable = false' and a short 'liquid_range' to avoid
|
||||
-- overflowing riverbanks.
|
||||
|
||||
minetest.register_node("mapgen:river_water_source", {
|
||||
description = "River Water Source",
|
||||
drawtype = "liquid",
|
||||
tiles = {
|
||||
{
|
||||
name = "mapgen_river_water.png",
|
||||
backface_culling = false,
|
||||
},
|
||||
{
|
||||
name = "mapgen_river_water.png",
|
||||
backface_culling = true,
|
||||
},
|
||||
},
|
||||
alpha = 160,
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing = "mapgen:river_water_flowing",
|
||||
liquid_alternative_source = "mapgen:river_water_source",
|
||||
liquid_viscosity = 1,
|
||||
liquid_renewable = false,
|
||||
liquid_range = 2,
|
||||
post_effect_color = {a = 103, r = 30, g = 76, b = 90},
|
||||
})
|
||||
|
||||
minetest.register_node("mapgen:river_water_flowing", {
|
||||
description = "Flowing River Water",
|
||||
drawtype = "flowingliquid",
|
||||
tiles = {"mapgen_river_water.png"},
|
||||
special_tiles = {
|
||||
{
|
||||
name = "mapgen_river_water.png",
|
||||
backface_culling = false,
|
||||
},
|
||||
{
|
||||
name = "mapgen_river_water.png",
|
||||
backface_culling = false,
|
||||
},
|
||||
},
|
||||
alpha = 160,
|
||||
paramtype = "light",
|
||||
paramtype2 = "flowingliquid",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = "flowing",
|
||||
liquid_alternative_flowing = "mapgen:river_water_flowing",
|
||||
liquid_alternative_source = "mapgen:river_water_source",
|
||||
liquid_viscosity = 1,
|
||||
liquid_renewable = false,
|
||||
liquid_range = 2,
|
||||
post_effect_color = {a = 103, r = 30, g = 76, b = 90},
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
})
|
||||
|
||||
-- Lava
|
||||
|
||||
minetest.register_node("mapgen:lava_source", {
|
||||
description = "Lava Source",
|
||||
drawtype = "liquid",
|
||||
tiles = {
|
||||
{
|
||||
name = "mapgen_lava.png",
|
||||
backface_culling = false,
|
||||
},
|
||||
{
|
||||
name = "mapgen_lava.png",
|
||||
backface_culling = true,
|
||||
},
|
||||
},
|
||||
paramtype = "light",
|
||||
light_source = 13,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing = "mapgen:lava_flowing",
|
||||
liquid_alternative_source = "mapgen:lava_source",
|
||||
liquid_viscosity = 7,
|
||||
liquid_renewable = false,
|
||||
damage_per_second = 4 * 2,
|
||||
post_effect_color = {a = 191, r = 255, g = 64, b = 0},
|
||||
})
|
||||
|
||||
minetest.register_node("mapgen:lava_flowing", {
|
||||
description = "Flowing Lava",
|
||||
drawtype = "flowingliquid",
|
||||
tiles = {"mapgen_lava.png"},
|
||||
special_tiles = {
|
||||
{
|
||||
name = "mapgen_lava.png",
|
||||
backface_culling = false,
|
||||
},
|
||||
{
|
||||
name = "mapgen_lava.png",
|
||||
backface_culling = false,
|
||||
},
|
||||
},
|
||||
paramtype = "light",
|
||||
paramtype2 = "flowingliquid",
|
||||
light_source = 13,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = "flowing",
|
||||
liquid_alternative_flowing = "mapgen:lava_flowing",
|
||||
liquid_alternative_source = "mapgen:lava_source",
|
||||
liquid_viscosity = 7,
|
||||
liquid_renewable = false,
|
||||
damage_per_second = 4 * 2,
|
||||
post_effect_color = {a = 191, r = 255, g = 64, b = 0},
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
})
|
||||
|
||||
|
||||
-- Aliases for map generators
|
||||
|
||||
-- Only 3 needed because cave liquids and dungeon nodes are defined in biomes
|
||||
|
||||
minetest.register_alias("mapgen_stone", "mapgen:stone")
|
||||
minetest.register_alias("mapgen_water_source", "mapgen:water_source")
|
||||
minetest.register_alias("mapgen_river_water_source", "mapgen:river_water_source")
|
||||
|
||||
|
||||
-- Biomes
|
||||
|
||||
-- Grassland
|
||||
|
||||
minetest.register_biome({
|
||||
name = "grassland",
|
||||
node_top = "mapgen:grass",
|
||||
depth_top = 1,
|
||||
node_filler = "mapgen:dirt",
|
||||
depth_filler = 1,
|
||||
node_riverbed = "mapgen:sand",
|
||||
depth_riverbed = 2,
|
||||
node_cave_liquid = "mapgen:water_source",
|
||||
node_dungeon = "mapgen:stone_block",
|
||||
node_dungeon_stair = "mapgen:stone_block_stair",
|
||||
y_max = 31000,
|
||||
y_min = 4,
|
||||
heat_point = 50,
|
||||
humidity_point = 50,
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
name = "grassland_shore",
|
||||
node_top = "mapgen:sand",
|
||||
depth_top = 1,
|
||||
node_filler = "mapgen:sand",
|
||||
depth_filler = 2,
|
||||
node_riverbed = "mapgen:sand",
|
||||
node_cave_liquid = "mapgen:water_source",
|
||||
node_dungeon = "mapgen:stone_block",
|
||||
node_dungeon_stair = "mapgen:stone_block_stair",
|
||||
depth_riverbed = 2,
|
||||
vertical_blend = 1,
|
||||
y_max = 3,
|
||||
y_min = -255,
|
||||
heat_point = 50,
|
||||
humidity_point = 50,
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
name = "grassland_under",
|
||||
node_cave_liquid = {"mapgen:water_source", "mapgen:lava_source"},
|
||||
node_dungeon = "mapgen:stone_block",
|
||||
node_dungeon_stair = "mapgen:stone_block_stair",
|
||||
y_max = -256,
|
||||
y_min = -31000,
|
||||
heat_point = 50,
|
||||
humidity_point = 50,
|
||||
})
|
61
mods/mapgen/license.txt
Normal file
@ -0,0 +1,61 @@
|
||||
License of source code
|
||||
----------------------
|
||||
|
||||
The MIT License (MIT)
|
||||
Copyright (C) 2019 paramat
|
||||
|
||||
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
|
||||
|
||||
|
||||
License of media (textures)
|
||||
---------------------------
|
||||
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
Copyright (C) 2019 paramat
|
||||
|
||||
You are free to:
|
||||
|
||||
Share — copy and redistribute the material in any medium or format
|
||||
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
|
||||
|
||||
The licensor cannot revoke these freedoms as long as you follow the license terms.
|
||||
|
||||
Under the following terms:
|
||||
|
||||
Attribution — You must give appropriate credit, provide a link to the license, and
|
||||
indicate if changes were made. You may do so in any reasonable manner, but not in any way
|
||||
that suggests the licensor endorses you or your use.
|
||||
|
||||
ShareAlike — If you remix, transform, or build upon the material, you must distribute
|
||||
your contributions under the same license as the original.
|
||||
|
||||
No additional restrictions — You may not apply legal terms or technological measures that
|
||||
legally restrict others from doing anything the license permits.
|
||||
|
||||
Notices:
|
||||
|
||||
You do not have to comply with the license for elements of the material in the public
|
||||
domain or where your use is permitted by an applicable exception or limitation.
|
||||
No warranties are given. The license may not give you all of the permissions necessary
|
||||
for your intended use. For example, other rights such as publicity, privacy, or moral
|
||||
rights may limit how you use the material.
|
||||
|
||||
For more details:
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
BIN
mods/mapgen/textures/mapgen_dirt.png
Normal file
After Width: | Height: | Size: 98 B |
BIN
mods/mapgen/textures/mapgen_grass.png
Normal file
After Width: | Height: | Size: 98 B |
BIN
mods/mapgen/textures/mapgen_lava.png
Normal file
After Width: | Height: | Size: 99 B |
BIN
mods/mapgen/textures/mapgen_river_water.png
Normal file
After Width: | Height: | Size: 99 B |
BIN
mods/mapgen/textures/mapgen_sand.png
Normal file
After Width: | Height: | Size: 99 B |
BIN
mods/mapgen/textures/mapgen_stone.png
Normal file
After Width: | Height: | Size: 83 B |
BIN
mods/mapgen/textures/mapgen_stone_block.png
Normal file
After Width: | Height: | Size: 96 B |
BIN
mods/mapgen/textures/mapgen_stone_block_divided.png
Normal file
After Width: | Height: | Size: 97 B |
BIN
mods/mapgen/textures/mapgen_water.png
Normal file
After Width: | Height: | Size: 99 B |
17
mods/player_api/README.txt
Normal file
@ -0,0 +1,17 @@
|
||||
Minipeli mod: player_api
|
||||
========================
|
||||
See license.txt for license information.
|
||||
Derived by paramat from Minetest Game 'player_api' mod.
|
||||
|
||||
Authors of source code
|
||||
----------------------
|
||||
Originally by celeron55, Perttu Ahola <celeron55@gmail.com> (LGPL 2.1)
|
||||
Various Minetest developers and contributors (LGPL 2.1)
|
||||
|
||||
Authors of media
|
||||
----------------
|
||||
stujones11 (CC BY-SA 3.0):
|
||||
character.* -- Derived from a model by MirceaKitsune (CC BY-SA 3.0)
|
||||
|
||||
paramat (CC BY-SA 3.0):
|
||||
character.png
|
136
mods/player_api/api.lua
Normal file
@ -0,0 +1,136 @@
|
||||
player_api = {}
|
||||
|
||||
-- Player animation blending
|
||||
-- Note: This is currently broken due to a bug in Irrlicht, leave at 0
|
||||
local animation_blend = 0
|
||||
|
||||
player_api.registered_models = { }
|
||||
|
||||
-- Local for speed.
|
||||
local models = player_api.registered_models
|
||||
|
||||
function player_api.register_model(name, def)
|
||||
models[name] = def
|
||||
end
|
||||
|
||||
-- Player stats and animations
|
||||
local player_model = {}
|
||||
local player_textures = {}
|
||||
local player_anim = {}
|
||||
local player_sneak = {}
|
||||
player_api.player_attached = {}
|
||||
|
||||
function player_api.get_animation(player)
|
||||
local name = player:get_player_name()
|
||||
return {
|
||||
model = player_model[name],
|
||||
textures = player_textures[name],
|
||||
animation = player_anim[name],
|
||||
}
|
||||
end
|
||||
|
||||
-- Called when a player's appearance needs to be updated
|
||||
function player_api.set_model(player, model_name)
|
||||
local name = player:get_player_name()
|
||||
local model = models[model_name]
|
||||
if model then
|
||||
if player_model[name] == model_name then
|
||||
return
|
||||
end
|
||||
player:set_properties({
|
||||
mesh = model_name,
|
||||
textures = player_textures[name] or model.textures,
|
||||
visual = "mesh",
|
||||
visual_size = model.visual_size or {x = 1, y = 1},
|
||||
collisionbox = model.collisionbox or {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
|
||||
stepheight = model.stepheight or 0.6,
|
||||
eye_height = model.eye_height or 1.47,
|
||||
})
|
||||
player_api.set_animation(player, "stand")
|
||||
else
|
||||
player:set_properties({
|
||||
textures = {"player.png", "player_back.png"},
|
||||
visual = "upright_sprite",
|
||||
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.75, 0.3},
|
||||
stepheight = 0.6,
|
||||
eye_height = 1.625,
|
||||
})
|
||||
end
|
||||
player_model[name] = model_name
|
||||
end
|
||||
|
||||
function player_api.set_textures(player, textures)
|
||||
local name = player:get_player_name()
|
||||
local model = models[player_model[name]]
|
||||
local model_textures = model and model.textures or nil
|
||||
player_textures[name] = textures or model_textures
|
||||
player:set_properties({textures = textures or model_textures,})
|
||||
end
|
||||
|
||||
function player_api.set_animation(player, anim_name, speed)
|
||||
local name = player:get_player_name()
|
||||
if player_anim[name] == anim_name then
|
||||
return
|
||||
end
|
||||
local model = player_model[name] and models[player_model[name]]
|
||||
if not (model and model.animations[anim_name]) then
|
||||
return
|
||||
end
|
||||
local anim = model.animations[anim_name]
|
||||
player_anim[name] = anim_name
|
||||
player:set_animation(anim, speed or model.animation_speed, animation_blend)
|
||||
end
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
player_model[name] = nil
|
||||
player_anim[name] = nil
|
||||
player_textures[name] = nil
|
||||
end)
|
||||
|
||||
-- Localize for better performance.
|
||||
local player_set_animation = player_api.set_animation
|
||||
local player_attached = player_api.player_attached
|
||||
|
||||
-- Check each player and apply animations
|
||||
minetest.register_globalstep(function(dtime)
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local name = player:get_player_name()
|
||||
local model_name = player_model[name]
|
||||
local model = model_name and models[model_name]
|
||||
if model and not player_attached[name] then
|
||||
local controls = player:get_player_control()
|
||||
local walking = false
|
||||
local animation_speed_mod = model.animation_speed or 30
|
||||
|
||||
-- Determine if the player is walking
|
||||
if controls.up or controls.down or controls.left or controls.right then
|
||||
walking = true
|
||||
end
|
||||
|
||||
-- Determine if the player is sneaking, and reduce animation speed if so
|
||||
if controls.sneak then
|
||||
animation_speed_mod = animation_speed_mod / 2
|
||||
end
|
||||
|
||||
-- Apply animations based on what the player is doing
|
||||
if player:get_hp() == 0 then
|
||||
player_set_animation(player, "lay")
|
||||
elseif walking then
|
||||
if player_sneak[name] ~= controls.sneak then
|
||||
player_anim[name] = nil
|
||||
player_sneak[name] = controls.sneak
|
||||
end
|
||||
if controls.LMB then
|
||||
player_set_animation(player, "walk_mine", animation_speed_mod)
|
||||
else
|
||||
player_set_animation(player, "walk", animation_speed_mod)
|
||||
end
|
||||
elseif controls.LMB then
|
||||
player_set_animation(player, "mine")
|
||||
else
|
||||
player_set_animation(player, "stand", animation_speed_mod)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
32
mods/player_api/init.lua
Normal file
@ -0,0 +1,32 @@
|
||||
dofile(minetest.get_modpath("player_api") .. "/api.lua")
|
||||
|
||||
-- Default player appearance
|
||||
player_api.register_model("character.b3d", {
|
||||
animation_speed = 30,
|
||||
textures = {"character.png", },
|
||||
animations = {
|
||||
-- Standard animations.
|
||||
stand = {x = 0, y = 79},
|
||||
lay = {x = 162, y = 166},
|
||||
walk = {x = 168, y = 187},
|
||||
mine = {x = 189, y = 198},
|
||||
walk_mine = {x = 200, y = 219},
|
||||
sit = {x = 81, y = 160},
|
||||
},
|
||||
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
|
||||
stepheight = 0.6,
|
||||
eye_height = 1.47,
|
||||
})
|
||||
|
||||
-- Update appearance when the player joins
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
player_api.player_attached[player:get_player_name()] = false
|
||||
player_api.set_model(player, "character.b3d")
|
||||
player:set_local_animation(
|
||||
{x = 0, y = 79},
|
||||
{x = 168, y = 187},
|
||||
{x = 189, y = 198},
|
||||
{x = 200, y = 219},
|
||||
30
|
||||
)
|
||||
end)
|
51
mods/player_api/license.txt
Normal file
@ -0,0 +1,51 @@
|
||||
License of source code
|
||||
----------------------
|
||||
|
||||
GNU Lesser General Public License, version 2.1
|
||||
Copyright (C) 2019 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
Copyright (C) 2019 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 Software Foundation;
|
||||
either version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Lesser General Public License for more details:
|
||||
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
|
||||
|
||||
|
||||
Licenses of media (textures, models and sounds)
|
||||
-----------------------------------------------
|
||||
|
||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
||||
Copyright (C) 2019 stujones11
|
||||
Copyright (C) 2019 paramat
|
||||
|
||||
You are free to:
|
||||
Share — copy and redistribute the material in any medium or format.
|
||||
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
|
||||
The licensor cannot revoke these freedoms as long as you follow the license terms.
|
||||
|
||||
Under the following terms:
|
||||
|
||||
Attribution — You must give appropriate credit, provide a link to the license, and
|
||||
indicate if changes were made. You may do so in any reasonable manner, but not in any way
|
||||
that suggests the licensor endorses you or your use.
|
||||
|
||||
ShareAlike — If you remix, transform, or build upon the material, you must distribute
|
||||
your contributions under the same license as the original.
|
||||
|
||||
No additional restrictions — You may not apply legal terms or technological measures that
|
||||
legally restrict others from doing anything the license permits.
|
||||
|
||||
Notices:
|
||||
|
||||
You do not have to comply with the license for elements of the material in the public
|
||||
domain or where your use is permitted by an applicable exception or limitation.
|
||||
No warranties are given. The license may not give you all of the permissions necessary
|
||||
for your intended use. For example, other rights such as publicity, privacy, or moral
|
||||
rights may limit how you use the material.
|
||||
|
||||
For more details:
|
||||
http://creativecommons.org/licenses/by-sa/3.0/
|
BIN
mods/player_api/models/character.b3d
Normal file
BIN
mods/player_api/models/character.blend
Normal file
BIN
mods/player_api/models/character.png
Normal file
After Width: | Height: | Size: 209 B |
BIN
mods/player_api/sounds/player_damage.ogg
Normal file
13
mods/sfinv/README.txt
Normal file
@ -0,0 +1,13 @@
|
||||
Minetest Game mod: sfinv
|
||||
========================
|
||||
See license.txt for license information.
|
||||
|
||||
Simple Fast Inventory.
|
||||
A cleaner, simpler, solution to having an advanced inventory in Minetest.
|
||||
See game_api.txt for this mod's API.
|
||||
Available for use outside of MTG here:
|
||||
https://forum.minetest.net/viewtopic.php?t=19765
|
||||
|
||||
Authors of source code
|
||||
----------------------
|
||||
rubenwardy (MIT)
|
189
mods/sfinv/api.lua
Normal file
@ -0,0 +1,189 @@
|
||||
sfinv = {
|
||||
pages = {},
|
||||
pages_unordered = {},
|
||||
contexts = {},
|
||||
enabled = true
|
||||
}
|
||||
|
||||
function sfinv.register_page(name, def)
|
||||
assert(name, "Invalid sfinv page. Requires a name")
|
||||
assert(def, "Invalid sfinv page. Requires a def[inition] table")
|
||||
assert(def.get, "Invalid sfinv page. Def requires a get function.")
|
||||
assert(not sfinv.pages[name], "Attempt to register already registered sfinv page " .. dump(name))
|
||||
|
||||
sfinv.pages[name] = def
|
||||
def.name = name
|
||||
table.insert(sfinv.pages_unordered, def)
|
||||
end
|
||||
|
||||
function sfinv.override_page(name, def)
|
||||
assert(name, "Invalid sfinv page override. Requires a name")
|
||||
assert(def, "Invalid sfinv page override. Requires a def[inition] table")
|
||||
local page = sfinv.pages[name]
|
||||
assert(page, "Attempt to override sfinv page " .. dump(name) .. " which does not exist.")
|
||||
for key, value in pairs(def) do
|
||||
page[key] = value
|
||||
end
|
||||
end
|
||||
|
||||
function sfinv.get_nav_fs(player, context, nav, current_idx)
|
||||
-- Only show tabs if there is more than one page
|
||||
if #nav > 1 then
|
||||
return "tabheader[0,0;sfinv_nav_tabs;" .. table.concat(nav, ",") ..
|
||||
";" .. current_idx .. ";true;false]"
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
local theme_inv = [[
|
||||
image[0,4.7;1,1;gui_hb_bg.png]
|
||||
image[1,4.7;1,1;gui_hb_bg.png]
|
||||
image[2,4.7;1,1;gui_hb_bg.png]
|
||||
image[3,4.7;1,1;gui_hb_bg.png]
|
||||
image[4,4.7;1,1;gui_hb_bg.png]
|
||||
image[5,4.7;1,1;gui_hb_bg.png]
|
||||
image[6,4.7;1,1;gui_hb_bg.png]
|
||||
image[7,4.7;1,1;gui_hb_bg.png]
|
||||
list[current_player;main;0,4.7;8,1;]
|
||||
list[current_player;main;0,5.85;8,3;8]
|
||||
]]
|
||||
|
||||
function sfinv.make_formspec(player, context, content, show_inv, size)
|
||||
local tmp = {
|
||||
size or "size[8,8.6]",
|
||||
sfinv.get_nav_fs(player, context, context.nav_titles, context.nav_idx),
|
||||
show_inv and theme_inv or "",
|
||||
content
|
||||
}
|
||||
return table.concat(tmp, "")
|
||||
end
|
||||
|
||||
function sfinv.get_homepage_name(player)
|
||||
return "sfinv:crafting"
|
||||
end
|
||||
|
||||
function sfinv.get_formspec(player, context)
|
||||
-- Generate navigation tabs
|
||||
local nav = {}
|
||||
local nav_ids = {}
|
||||
local current_idx = 1
|
||||
for i, pdef in pairs(sfinv.pages_unordered) do
|
||||
if not pdef.is_in_nav or pdef:is_in_nav(player, context) then
|
||||
nav[#nav + 1] = pdef.title
|
||||
nav_ids[#nav_ids + 1] = pdef.name
|
||||
if pdef.name == context.page then
|
||||
current_idx = #nav_ids
|
||||
end
|
||||
end
|
||||
end
|
||||
context.nav = nav_ids
|
||||
context.nav_titles = nav
|
||||
context.nav_idx = current_idx
|
||||
|
||||
-- Generate formspec
|
||||
local page = sfinv.pages[context.page] or sfinv.pages["404"]
|
||||
if page then
|
||||
return page:get(player, context)
|
||||
else
|
||||
local old_page = context.page
|
||||
local home_page = sfinv.get_homepage_name(player)
|
||||
|
||||
if old_page == home_page then
|
||||
minetest.log("error", "[sfinv] Couldn't find " .. dump(old_page) ..
|
||||
", which is also the old page")
|
||||
|
||||
return ""
|
||||
end
|
||||
|
||||
context.page = home_page
|
||||
assert(sfinv.pages[context.page], "[sfinv] Invalid homepage")
|
||||
minetest.log("warning", "[sfinv] Couldn't find " .. dump(old_page) ..
|
||||
" so switching to homepage")
|
||||
|
||||
return sfinv.get_formspec(player, context)
|
||||
end
|
||||
end
|
||||
|
||||
function sfinv.get_or_create_context(player)
|
||||
local name = player:get_player_name()
|
||||
local context = sfinv.contexts[name]
|
||||
if not context then
|
||||
context = {
|
||||
page = sfinv.get_homepage_name(player)
|
||||
}
|
||||
sfinv.contexts[name] = context
|
||||
end
|
||||
return context
|
||||
end
|
||||
|
||||
function sfinv.set_context(player, context)
|
||||
sfinv.contexts[player:get_player_name()] = context
|
||||
end
|
||||
|
||||
function sfinv.set_player_inventory_formspec(player, context)
|
||||
local fs = sfinv.get_formspec(player,
|
||||
context or sfinv.get_or_create_context(player))
|
||||
player:set_inventory_formspec(fs)
|
||||
end
|
||||
|
||||
function sfinv.set_page(player, pagename)
|
||||
local context = sfinv.get_or_create_context(player)
|
||||
local oldpage = sfinv.pages[context.page]
|
||||
if oldpage and oldpage.on_leave then
|
||||
oldpage:on_leave(player, context)
|
||||
end
|
||||
context.page = pagename
|
||||
local page = sfinv.pages[pagename]
|
||||
if page.on_enter then
|
||||
page:on_enter(player, context)
|
||||
end
|
||||
sfinv.set_player_inventory_formspec(player, context)
|
||||
end
|
||||
|
||||
function sfinv.get_page(player)
|
||||
local context = sfinv.contexts[player:get_player_name()]
|
||||
return context and context.page or sfinv.get_homepage_name(player)
|
||||
end
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
if sfinv.enabled then
|
||||
sfinv.set_player_inventory_formspec(player)
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
sfinv.contexts[player:get_player_name()] = nil
|
||||
end)
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "" or not sfinv.enabled then
|
||||
return false
|
||||
end
|
||||
|
||||
-- Get Context
|
||||
local name = player:get_player_name()
|
||||
local context = sfinv.contexts[name]
|
||||
if not context then
|
||||
sfinv.set_player_inventory_formspec(player)
|
||||
return false
|
||||
end
|
||||
|
||||
-- Was a tab selected?
|
||||
if fields.sfinv_nav_tabs and context.nav then
|
||||
local tid = tonumber(fields.sfinv_nav_tabs)
|
||||
if tid and tid > 0 then
|
||||
local id = context.nav[tid]
|
||||
local page = sfinv.pages[id]
|
||||
if id and page then
|
||||
sfinv.set_page(player, id)
|
||||
end
|
||||
end
|
||||
else
|
||||
-- Pass event to page
|
||||
local page = sfinv.pages[context.page]
|
||||
if page and page.on_player_receive_fields then
|
||||
return page:on_player_receive_fields(player, context, fields)
|
||||
end
|
||||
end
|
||||
end)
|
14
mods/sfinv/init.lua
Normal file
@ -0,0 +1,14 @@
|
||||
dofile(minetest.get_modpath("sfinv") .. "/api.lua")
|
||||
|
||||
sfinv.register_page("sfinv:crafting", {
|
||||
title = "Crafting",
|
||||
get = function(self, player, context)
|
||||
return sfinv.make_formspec(player, context, [[
|
||||
list[current_player;craft;1.75,0.5;3,3;]
|
||||
list[current_player;craftpreview;5.75,1.5;1,1;]
|
||||
image[4.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]
|
||||
listring[current_player;main]
|
||||
listring[current_player;craft]
|
||||
]], true)
|
||||
end
|
||||
})
|
24
mods/sfinv/license.txt
Normal file
@ -0,0 +1,24 @@
|
||||
License of source code
|
||||
----------------------
|
||||
|
||||
The MIT License (MIT)
|
||||
Copyright (C) 2016-2018 rubenwardy <rubenwardy@gmail.com>
|
||||
|
||||
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
|
2
mods/sfinv/mod.conf
Normal file
@ -0,0 +1,2 @@
|
||||
name = sfinv
|
||||
description = Minetest Game mod: sfinv
|