Compare commits

...

10 Commits

Author SHA1 Message Date
Wuzzy
a35e00bb62 Version 1.1.2 2023-04-20 17:06:45 +02:00
Wuzzy
777448dddf Fix typo in API.md 2023-04-20 17:06:12 +02:00
Wuzzy
e6b30c8761 Version 1.1.1 2023-04-20 17:03:11 +02:00
Wuzzy
51974ed5b9 Update mod metadata 2023-04-20 17:01:59 +02:00
Wuzzy
20ef10f95a Add Wuzzy to .mailmap 2023-04-20 17:01:14 +02:00
Wuzzy
ebb1f7cc9f Version 1.1.0 2021-01-14 13:31:26 +01:00
Wuzzy
9db2760976 Update translator system 2021-01-14 13:28:45 +01:00
Wuzzy
4f3b075b60 v1.0.0 2017-03-19 21:23:02 +01:00
Wuzzy
9886a2db73 Copy-editing 2016-12-27 23:01:37 +01:00
Wuzzy
3c38635f03 Make API intro a bit clearer 2016-12-27 22:56:56 +01:00
10 changed files with 30 additions and 23 deletions

2
.mailmap Normal file
View File

@ -0,0 +1,2 @@
Wuzzy <Wuzzy@disroot.org> <Wuzzy2@mail.ru>
Wuzzy <Wuzzy@disroot.org> <almikes@aol.com>

20
API.md
View File

@ -1,18 +1,20 @@
# API documentation for [`sfinv_buttons`]
Use this API to add your own buttons to the page.
Use this very simple API to add your own buttons to the new tab. There is only
one function: `sfinv_buttons.register_button`.
## `sfinv_buttons.register_button(name, def)
## `sfinv_buttons.register_button(name, def)`
* `name`: Unique button identifier
* `def`: Coniguration table (see below)
* `def`: Configuration table (see below)
### Fields of `def`
* `title`: Human-readable text on the button
* `action(player)`: Function is called when button is triggered
* `player`: ObjectRef to player who triggered the button
* Default: Nothing happens
* `tooltip: A tooltip for the button (optional, only use it for an additional, non-critical explanation)
* `player`: The `ObjectRef` of the player who triggered the button
* Default behaviour: Nothing happens
* `tooltip`: A tooltip for the button (optional, only use it for an additional,
non-critical explanation)
* `image`: Texture name for the image to show left of the button (optional)
* `show(player)`: Shall return `true` if the button should be displayed (optional)
* `player`: ObjectRef to player who triggered the button
@ -21,6 +23,8 @@ Use this API to add your own buttons to the page.
## Recommendations
* Try to summarize the most important information on the button
* Test if the button title still fits when having >= 9 and <= 18 buttons at a resolution of 800×600
* It is recommended to only add buttons to access core mod functionality and not for every minor feature. The rule of thumb is to add at most 1 button per mod
* Test if the button title still fits when having >= 9 and <= 18 buttons at a
resolution of 800×600
* It is recommended to only add buttons to access core mod functionality and
not for every minor feature. The rule of thumb is to add at most 1 button per mod
* If you like to add many buttons, consider adding your own `sfinv` page instead

View File

@ -3,7 +3,12 @@ This mod adds a new tab (“More”) to the Simple Fast Inventory [`sfinv`] on
which other mods can add their buttons to make it easier to access their
core functionality.
The idea is to free users from typing in lame-ass chat commands. ;-)
The idea is to free users from typing in boring chat commands. ;-)
Minetest version 5.0.0 or later is required.
Version: 1.1.2
(This mod uses [semantic versioning](http://semver.org/) as of version 2.0.0 of the standard.)
## API
The API is documented in `API.md`.

View File

@ -1,2 +0,0 @@
sfinv
intllib?

View File

@ -1 +0,0 @@
Adds a tab to the Simple Fast Inventory on which mods can add buttons for easy access.

View File

@ -1,10 +1,4 @@
-- Boilerplate to support localized strings if intllib mod is installed.
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
S = function(s) return s end
end
local S = minetest.get_translator("sfinv_buttons")
local buttons = {}
local button_names_sorted = {}

View File

@ -1,2 +0,0 @@
More = Mehr
Go = Los

View File

@ -0,0 +1,3 @@
# textdomain: sfinv_buttons
More=Mehr
Go=Los

View File

@ -1,2 +1,3 @@
More =
Go =
# textdomain: sfinv_buttons
More=
Go=

View File

@ -1 +1,4 @@
name = sfinv_buttons
title = Simple Fast Inventory Buttons
depends = sfinv
description = Adds a tab to the Simple Fast Inventory on which mods can add buttons for easy access.