add stuff xdd

sus gaming!! 😳
master
danil275487 2021-04-03 23:38:54 +03:00
parent b17140a047
commit d947460b18
47 changed files with 814 additions and 3 deletions

3
.gitattributes vendored
View File

@ -1,2 +1,3 @@
@@ -1,2 +0,0 @@
# Auto detect text files and perform LF normalization
* text=auto
* text=auto

View File

@ -1,3 +1,4 @@
@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2021 danil275487
@ -18,4 +19,4 @@ 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.
SOFTWARE.

View File

@ -1,2 +1,3 @@
@@ -1,2 +0,0 @@
# minecraftnt
A attempt to recreate Minecraft Alpha 1.0.0 (inf-20100630-2) into Minetest.
A attempt to recreate Minecraft Alpha 1.0.0 (inf-20100630-2) into Minetest.

4
game.conf Normal file
View File

@ -0,0 +1,4 @@
name = Minecraftn't
release = 1
author = Danil_2461
description = A attempt to recreate Minecraft Alpha 1.0.0 in Minetest.

3
mods/minecraft/init.lua Normal file
View File

@ -0,0 +1,3 @@
dofile(minetest.get_modpath("minecraft") .. "/blocks.lua")
dofile(minetest.get_modpath("minecraft") .. "/mapgen.lua")
dofile(minetest.get_modpath("minecraft") .. "/items.lua")

44
mods/minecraft/items.lua Normal file
View File

@ -0,0 +1,44 @@
if minetest.settings:get_bool("creative_mode") then
local digtime = 42
local caps = {times = {digtime, digtime, digtime}, uses = 0, maxlevel = 256}
minetest.register_item(":", {
type = "none",
wield_image = "hand.png",
wield_scale = {x = 0.5, y = 1, z = 4},
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,
-- dig_immediate group doesn't use value 1. Value 3 is instant dig
dig_immediate =
{times = {[2] = digtime, [3] = 0}, uses = 0, maxlevel = 256},
},
damage_groups = {fleshy = 10},
}
})
else
minetest.register_item(":", {
type = "none",
wield_image = "hand.png",
wield_scale = {x = 0.5, y = 1, z = 4},
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},
}
})
end

View File

@ -0,0 +1,3 @@
minetest.register_alias("mapgen_stone", "minecraft:stone")
minetest.register_alias("mapgen_water_source", "minecraft:stone")
minetest.register_alias("mapgen_river_water_source", "minecraft:stone")

1
mods/minecraft/mod.conf Normal file
View File

@ -0,0 +1 @@
name = minecraft

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -0,0 +1,27 @@
Minetest Game mod: player_api
=============================
See license.txt for license information.
Provides an API to allow multiple mods to set player models and textures.
Also sets the default model, texture, and player flags.
This mod is only for content related to the Player API and the player object.
Authors of source code
----------------------
Originally by celeron55, Perttu Ahola <celeron55@gmail.com> (LGPLv2.1+)
Various Minetest developers and contributors (LGPLv2.1+)
Authors of media (textures, models and sounds)
----------------------------------------------
Original model by MirceaKitsune (CC BY-SA 3.0).
Various alterations and fixes by kilbith, sofar, xunto, Rogier-5, TeTpaAka, Desour,
stujones11, An0n3m0us (CC BY-SA 3.0):
character.b3d
character.blend
Jordach (CC BY-SA 3.0):
character.png
celeron55, Perttu Ahola <celeron55@gmail.com> (CC BY-SA 3.0):
player.png
player_back.png

146
mods/player_api/api.lua Normal file
View File

@ -0,0 +1,146 @@
-- Minetest 0.4 mod: player
-- See README.txt for licensing and other information.
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",
visual_size = {x = 1, y = 2},
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
player_sneak[name] = nil
player_api.player_attached[name] = nil
end)
-- Localize for better performance.
local player_set_animation = player_api.set_animation
local player_attached = player_api.player_attached
-- Prevent knockback for attached players
local old_calculate_knockback = minetest.calculate_knockback
function minetest.calculate_knockback(player, ...)
if player_attached[player:get_player_name()] then
return 0
end
return old_calculate_knockback(player, ...)
end
-- Check each player and apply animations
minetest.register_globalstep(function()
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 animation_speed_mod = model.animation_speed or 30
-- 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")
-- Determine if the player is walking
elseif controls.up or controls.down or controls.left or controls.right then
if player_sneak[name] ~= controls.sneak then
player_anim[name] = nil
player_sneak[name] = controls.sneak
end
if controls.LMB or controls.RMB then
player_set_animation(player, "walk_mine", animation_speed_mod)
else
player_set_animation(player, "walk", animation_speed_mod)
end
elseif controls.LMB or controls.RMB then
player_set_animation(player, "mine", animation_speed_mod)
else
player_set_animation(player, "stand", animation_speed_mod)
end
end
end
end)

34
mods/player_api/init.lua Normal file
View File

@ -0,0 +1,34 @@
-- player/init.lua
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)

View File

@ -0,0 +1,60 @@
License of source code
----------------------
GNU Lesser General Public License, version 2.1
Copyright (C) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2011 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) 2011 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2012 MirceaKitsune
Copyright (C) 2012 Jordach
Copyright (C) 2015 kilbith
Copyright (C) 2016 sofar
Copyright (C) 2016 xunto
Copyright (C) 2016 Rogier-5
Copyright (C) 2017 TeTpaAka
Copyright (C) 2017 Desour
Copyright (C) 2018 stujones11
Copyright (C) 2019 An0n3m0us
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/

2
mods/player_api/mod.conf Normal file
View File

@ -0,0 +1,2 @@
name = player_api
description = Minetest Game mod: player_api

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 B

111
mods/sfinv/.gitignore vendored Normal file
View File

@ -0,0 +1,111 @@
# Created by https://www.gitignore.io/api/lua,linux,macos,windows
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### Lua ###
# Compiled Lua sources
luac.out
# luarocks build files
*.src.rock
*.zip
*.tar.gz
# Object files
*.o
*.os
*.ko
*.obj
*.elf
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
*.def
*.exp
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
### macOS ###
*.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
# End of https://www.gitignore.io/api/lua,linux,macos,windows

7
mods/sfinv/LICENSE.txt Normal file
View File

@ -0,0 +1,7 @@
Copyright (C) 2016 rubenwardy <rw@rubenwardy.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.

116
mods/sfinv/README.md Normal file
View File

@ -0,0 +1,116 @@
# Simple Fast Inventory
![SFINV Screeny](screenshot.png)
A cleaner, simpler solution to having an advanced inventory in Minetest.
Written by rubenwardy.\\
License: MIT
* sfinv_crafting_arrow.png - by paramat, derived from a texture by BlockMen (CC BY-SA 3.0).
## API
It is recommended that you read this link for a good introduction to the sfinv API
by its author: https://rubenwardy.com/minetest_modding_book/en/chapters/sfinv.html
### sfinv Methods
**Pages**
* sfinv.set_page(player, pagename) - changes the page
* sfinv.get_homepage_name(player) - get the page name of the first page to show to a player
* sfinv.register_page(name, def) - register a page, see section below
* sfinv.override_page(name, def) - overrides fields of an page registered with register_page.
* Note: Page must already be defined, (opt)depend on the mod defining it.
* sfinv.set_player_inventory_formspec(player) - (re)builds page formspec
and calls set_inventory_formspec().
* sfinv.get_formspec(player, context) - builds current page's formspec
**Contexts**
* sfinv.get_or_create_context(player) - gets the player's context
* sfinv.set_context(player, context)
**Theming**
* sfinv.make_formspec(player, context, content, show_inv, size) - adds a theme to a formspec
* show_inv, defaults to false. Whether to show the player's main inventory
* size, defaults to `size[8,8.6]` if not specified
* sfinv.get_nav_fs(player, context, nav, current_idx) - creates tabheader or ""
### sfinv Members
* pages - table of pages[pagename] = def
* pages_unordered - array table of pages in order of addition (used to build navigation tabs).
* contexts - contexts[playername] = player_context
* enabled - set to false to disable. Good for inventory rehaul mods like unified inventory
### Context
A table with these keys:
* page - current page name
* nav - a list of page names
* nav_titles - a list of page titles
* nav_idx - current nav index (in nav and nav_titles)
* any thing you want to store
* sfinv will clear the stored data on log out / log in
### sfinv.register_page
sfinv.register_page(name, def)
def is a table containing:
* `title` - human readable page name (required)
* `get(self, player, context)` - returns a formspec string. See formspec variables. (required)
* `is_in_nav(self, player, context)` - return true to show in the navigation (the tab header, by default)
* `on_player_receive_fields(self, player, context, fields)` - on formspec submit.
* `on_enter(self, player, context)` - called when the player changes pages, usually using the tabs.
* `on_leave(self, player, context)` - when leaving this page to go to another, called before other's on_enter
### get formspec
Use sfinv.make_formspec to apply a layout:
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]
image[0,4.25;1,1;gui_hb_bg.png]
image[1,4.25;1,1;gui_hb_bg.png]
image[2,4.25;1,1;gui_hb_bg.png]
image[3,4.25;1,1;gui_hb_bg.png]
image[4,4.25;1,1;gui_hb_bg.png]
image[5,4.25;1,1;gui_hb_bg.png]
image[6,4.25;1,1;gui_hb_bg.png]
image[7,4.25;1,1;gui_hb_bg.png]
]], true)
See above (methods section) for more options.
### Customising themes
Simply override this function to change the navigation:
function sfinv.get_nav_fs(player, context, nav, current_idx)
return "navformspec"
end
And override this function to change the layout:
function sfinv.make_formspec(player, context, content, show_inv, size)
local tmp = {
size or "size[8,8.6]",
theme_main,
sfinv.get_nav_fs(player, context, context.nav_titles, context.nav_idx),
content
}
if show_inv then
tmp[4] = theme_inv
end
return table.concat(tmp, "")
end

189
mods/sfinv/api.lua Normal file
View 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,5.2;1,1;gui_hb_bg.png]
image[1,5.2;1,1;gui_hb_bg.png]
image[2,5.2;1,1;gui_hb_bg.png]
image[3,5.2;1,1;gui_hb_bg.png]
image[4,5.2;1,1;gui_hb_bg.png]
image[5,5.2;1,1;gui_hb_bg.png]
image[6,5.2;1,1;gui_hb_bg.png]
image[7,5.2;1,1;gui_hb_bg.png]
list[current_player;main;0,5.2;8,1;]
list[current_player;main;0,6.35;8,3;8]
]]
function sfinv.make_formspec(player, context, content, show_inv, size)
local tmp = {
size or "size[8,9.1]",
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:main"
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)

31
mods/sfinv/init.lua Normal file
View File

@ -0,0 +1,31 @@
-- sfinv/init.lua
dofile(minetest.get_modpath("sfinv") .. "/api.lua")
-- Load support for MT game translation.
local S = minetest.get_translator("sfinv")
sfinv.register_page("sfinv:main", {
title = S("Main"),
get = function(self, player, context)
return sfinv.make_formspec(player, context, [[
size[10.25,10.75,true]
real_coordinates[true]
list[current_player;main;0.25,9.5;8,1;0]
list[current_player;main;0.25,5.5;8,3;8]
list[current_player;armor;0.25,0.25;1,4;0]
box[1.5,0.25;3,4.75;black]
model[1.5,0.25;3,4.75;playermodel;character.b3d;character.png;0,180;false;false;walk,stand]
list[current_player;craft;5,1.5.25;2,2;0]
list[current_player;craftresult;8.75,2.12;2,2;0]
image[7.5,2.12;1,1;sfinv_crafting_arrow.png]
]])
end
})
minetest.register_on_joinplayer(function(ObjectRef)
local InvRef = ObjectRef:get_inventory()
InvRef:set_list("armor", armor)
InvRef:set_size("armor", 4)
end)

View File

@ -0,0 +1,2 @@
# textdomain: sfinv
Crafting=Fertigung

View File

@ -0,0 +1,2 @@
# textdomain: sfinv
Crafting=Creación

View File

@ -0,0 +1,2 @@
# textdomain: sfinv
Crafting=Artisanat

View File

@ -0,0 +1,2 @@
# textdomain: sfinv
Crafting=Kerajinan

View File

@ -0,0 +1,2 @@
# textdomain: sfinv
Crafting=Assemblaggio

View File

@ -0,0 +1,2 @@
# textdomain: sfinv
Crafting=Pertukangan

View File

@ -0,0 +1,2 @@
# textdomain: sfinv
Crafting=Крафтинг

View File

@ -0,0 +1,2 @@
# textdomain: sfinv
Crafting=Tillverkning

View File

@ -0,0 +1,2 @@
# textdomain: sfinv
Crafting=Vytváranie

View File

@ -0,0 +1,2 @@
# textdomain: sfinv
Crafting=合成

View File

@ -0,0 +1,2 @@
# textdomain: sfinv
Crafting=合成

View File

@ -0,0 +1,2 @@
# textdomain: sfinv
Crafting=

6
mods/sfinv/mod.conf Normal file
View File

@ -0,0 +1,6 @@
name = sfinv
description = A cleaner, simpler solution to having an advanced inventory in Minetest.
author = rubenwardy
title = sfinv
release = 6537
depends = player_api

BIN
mods/sfinv/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 B