Compare commits

...

No commits in common. "main" and "mtsr" have entirely different histories.
main ... mtsr

7 changed files with 228 additions and 4 deletions

104
.gitignore vendored Normal file
View File

@ -0,0 +1,104 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# dotenv
.env
# virtualenv
.venv
venv/
ENV/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
/.buildpath
/.project
/.settings/

19
.luacheckrc Normal file
View File

@ -0,0 +1,19 @@
unused_args = false
allow_defined_top = true
globals = {
"minetest",
"core"
}
read_globals = {
string = {fields = {"split"}},
table = {fields = {"copy", "getn"}},
-- Builtin
"vector", "ItemStack",
"dump", "DIR_DELIM", "VoxelArea", "Settings",
-- MTG
"default", "sfinv", "creative",
}

4
README.md Normal file
View File

@ -0,0 +1,4 @@
# hotbar_16
Hot panel for builders with 16 cells
[![git](https://img.shields.io/badge/git-project-green.svg?style=flat-square)](https://git.minetestserver.ru/MTSR/hotbar_16)

1
description.txt Normal file
View File

@ -0,0 +1 @@
Changes the hotbar slots number.

View File

@ -1,8 +1,87 @@
minetest.register_privilege("builder", {
description = "Privilege for builders",
give_to_singleplayer = false
})
-- Minetest Mod: hotbar_16
-- Version: 0.1.5a+mtsr01
-- Licence(s): see the attached license.txt file
-- Authors:
-- - aristotle, a builder on Red Cat Creative
-- - VinAdmin
--
-- This mod allows the player to set his/her own hotbar slots number
-- by adding a new command.
--
-- hotbar [size]
--
-- By itself, hotbar types the hotbar slots number in the chat;
-- when it is followed by a number in the correct range that is now [0,23],
-- the command accordingly sets the new slots number.
--
-- Features:
-- - It may permanently store the user's preferences by setting & retrieving
-- the "hotbar_slots" & "hotbar_mode" keys in the configuration file.
-- - For those of us who are running MT 0.4.16+, the hotbar size may be
-- different in each world / map.
--
-- Changelog:
-- 0.1.5a
-- - Running luacheck underlined that a couple of fixes were needed:
-- 1. normalize() scope is now local
-- 2. a few lines had their trailing blanks removed.
-- - A couple of "security fixes" have been applied to disallow any
-- floating value inside minetest.conf and the modstorage that might
-- have made the mod fail at load time in legacy and world mode.
-- 0.1.5
-- - Went back to just one command: hotbar, now improved to just not take
-- the size, but the mode as well.
-- - Some feedback messages have been fixed.
-- 0.1.4
-- - A new command - /hotbar_mode - has been added to take advantage of
-- the 0.4.16+ mod_storage API.
-- In singleplayer, the suggested default mode for the most recent
-- clients (0.4.16+) should now be WORLD, because when this mode is
-- active a different size can be stored in each world.
-- The original global behavior / mode is now called LEGACY, and
-- should be the default and only one for any MT < 0.4.16
-- because of the lack of the mod_storage API (not tested).
-- No further effort will be put to provide an alternative storage
-- system for any MT < 0.4.16.
-- A third mode - SESSION - is the only mode available when the mod
-- is running on a server. The player can change the slots number,
-- but every new session its value is restored to the default.
-- The SESSION mode is available in singleplayer too.
-- - The slots range has been extended to include the 0: because of this
-- it is now possible to hide the hotbar, the wielded item (and,
-- consequently, the hand).
-- - The deprecated minetest.setting_{get,set}() calls have been removed:
-- this avoids some warnings, but might at the same time limit the
-- compatibility with MT versions < 0.4.16 (not tested too).
-- - The code has been refactoried to better support future comprehension
-- and extensibility (eg for a clientmod version): most of it should
-- now be hopefully self explainatory to me! and even to the occasional
-- modder. :D
-- - FIXES
-- - The slots number is now checked not to be a float (ty GreenDimond).
-- 0.1.3
-- - New update to assure the full API support because the version 0.1.2
-- update seems to have gone wrong for some reason. (SORRY. Ty _Xenon)
-- The accepted slots number should now be in the range [1,23]!
-- 0.1.2
-- - Some of the existing textures have been modified to comply with an even
-- size (as recommended)
-- - The missing textures have been added.
-- - Some of the textures have been renamed to better support sorting.
-- - As a consequence, the size range has been extended from [1,16] to the
-- fully supported one [1,23]
-- 0.1.1
-- - The code that did not properly show the error message when the
-- received size was out of bounds has been corrected
-- - The accepted range has been extended from [4,16] to [1,16].
-- - Some code optimization to avoid strings repetitions
-- 0.1.0
-- - The hotbar is now correctly shown even when there are no items in it.
--
-- For now this is all folks: happy builds and explorations! :)
-- aristotle
local VERSION = "0.1.5a+mtsr01"
local MODES = {legacy = "legacy", world = "world", session = "session"} -- this redundancy simplifies later checks
local DEFAULT = {mode = MODES.world, slots = {legacy = 16, world = 10, session = 12}}
local MOD_STORAGE = {}
@ -121,6 +200,11 @@ hb.slots.set = function(name, slots)
hb.adjust(name, slots, hb.image.selected, hb.image.bg.get)
end
minetest.register_privilege("builder", {
description = "Privilege for builders",
give_to_singleplayer = false
})
minetest.register_on_joinplayer(function(player)
if minetest.check_player_privs(player, {builder=true}) then
--player:hud_set_hotbar_itemcount(tonumber(16))

12
license.txt Normal file
View File

@ -0,0 +1,12 @@
Textures:
CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0/)
Attribution: askotos and VanessaE
Code:
License: LGPL v2.1 (https://www.gnu.org/licenses/lgpl-2.1.html)
By VinAdmin
History:
This is a fork from https://github.com/askotos/hotbar
The concept and the original images come from VanessaE's
dreambuilder_mp_extras mod deployed as part of the Dreambuilder modpack.

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB