lots of mod info added
@@ -4,6 +4,57 @@ own repo so they can be easily referenced per save.
|
|||||||
|
|
||||||
A portmanteau of mods and monolith.
|
A portmanteau of mods and monolith.
|
||||||
|
|
||||||
|
## Format
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"mods":{
|
||||||
|
"name":{
|
||||||
|
"author":"PackageAuthorName",
|
||||||
|
"canonical_name":"mod_name",
|
||||||
|
"colloquial_name":"Mod Redo",
|
||||||
|
"optional":["alphabetical","list"],
|
||||||
|
"provides":["alphabetical","list"],
|
||||||
|
"required":["alphabetical","list"],
|
||||||
|
"status":"untested"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"packs":{
|
||||||
|
"Name of Pack":{
|
||||||
|
"mods":{
|
||||||
|
"alphabetical":true,
|
||||||
|
"list":true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
All items are optional. A mod with no information other than its canonical name
|
||||||
|
can be just the value `true`.
|
||||||
|
**Mods are named by their distributed directory name.**
|
||||||
|
|
||||||
|
- `author`: Name as displayed in the URL at https://content.luanti.org/
|
||||||
|
- `canonical_name`: In rare cases, the name of a mod's distributed directory is
|
||||||
|
*different* from its canonical name, and I organize by the directory name as
|
||||||
|
distributed. (The canonical name is also how things are presented on the
|
||||||
|
content database.)
|
||||||
|
- `colloquial_name`: Display name to distinguish a mod from other providers of
|
||||||
|
the same canonical name.
|
||||||
|
- `optional`: Alphabetical list of optional dependencies.
|
||||||
|
- `provides`: Alphabetical list of mods provided as part of a pack.
|
||||||
|
- `required`: Alphabetical list of required dependencies.
|
||||||
|
- `status`: `untested` or `abandoned` for mods I've not tested or decided not to
|
||||||
|
use.
|
||||||
|
|
||||||
|
I only put in dependencies I consider significant, so many mods provided by a
|
||||||
|
game or commonly present are excluded. Because I'm lazy.
|
||||||
|
|
||||||
|
Pack lists are an alphabetical set of keys to make adding and removing items
|
||||||
|
easier than they would be in an array.
|
||||||
|
|
||||||
|
Packs should include all dependencies in their mod list, and if one is missing,
|
||||||
|
I will complain about it.
|
||||||
|
|
||||||
## Tasks
|
## Tasks
|
||||||
- [ ] Make some kind of JSON format / script to copy out specific mods for
|
- [x] Make some kind of JSON format / script to copy out specific mods for
|
||||||
specific saves.
|
specific saves.
|
||||||
|
|||||||
@@ -1,51 +1,178 @@
|
|||||||
{
|
{
|
||||||
"mods":{
|
"mods":{
|
||||||
"3d_armor":true,
|
"3d_armor":{
|
||||||
"ancient_bones":true,
|
"author":"stu"
|
||||||
"anvil":true,
|
},
|
||||||
"awards":true,
|
"ancient_bones":{
|
||||||
"bucket_wooden":true,
|
"author":"karlexceed"
|
||||||
"ccompass":true,
|
},
|
||||||
"charcoal":true,
|
"anvil":{
|
||||||
"colored_chests":true,
|
"author":"FaceDeer"
|
||||||
"coloredstrings":true,
|
},
|
||||||
"discovery_maps":true,
|
"awards":{
|
||||||
"eye_spy":true,
|
"author":"rubenwardy"
|
||||||
"farming":true,
|
},
|
||||||
"farmtools":true,
|
"bucket_wooden":{
|
||||||
"grass_string":true,
|
"author":"Hume2"
|
||||||
"hammersredo":true,
|
},
|
||||||
"handholds_redo":true,
|
"ccompass":{
|
||||||
"mesecons":true,
|
"author":"bell07"
|
||||||
"mob_horse":true,
|
},
|
||||||
"mob_mese_monster_classic":true,
|
"charcoal":{
|
||||||
"mobs":true,
|
"author":"X17"
|
||||||
"mobs_animal":true,
|
},
|
||||||
"mobs_monster":true,
|
"colored_chests":{
|
||||||
"mobs_water":true,
|
"author":"SkyBuilder1717"
|
||||||
"more_ladders":true,
|
},
|
||||||
"moreawards":true,
|
"coloredstrings":{
|
||||||
"moreores":true,
|
"author":"Alib234"
|
||||||
"multitools":true,
|
},
|
||||||
"nutritional":true,
|
"discovery_maps":{
|
||||||
"ropes":true,
|
"author":"TomCon"
|
||||||
"stamina":true,
|
},
|
||||||
"techage_modpack":true,
|
"eye_spy":{
|
||||||
"too_many_tnt":true,
|
"author":"cjgray24"
|
||||||
"toolranks":true,
|
},
|
||||||
"toolranks_extras":true,
|
"fakelib":{
|
||||||
"towercrane":true,
|
"author":"OgelGames"
|
||||||
"travelnet":true,
|
},
|
||||||
"unified_inventory":true,
|
"farming":{
|
||||||
"unified_inventory_plus":true,
|
"author":"TenPlus1",
|
||||||
"uraniumstuff":true,
|
"colloquial_name":"Farming Redo"
|
||||||
"wetmud":true,
|
},
|
||||||
"worldedit":true,
|
"farmtools":{
|
||||||
"x_farming":true,
|
"author":"camelia"
|
||||||
"xcompat":true,
|
},
|
||||||
"yl_api_nodestages":true,
|
"grass_string":{
|
||||||
"yl_canned_food":true,
|
"author":"Skivling"
|
||||||
"yl_canned_food_mtg":true
|
},
|
||||||
|
"hammersredo":{
|
||||||
|
"author":"elnoonlini",
|
||||||
|
"canonical_name":"hammers_redo"
|
||||||
|
},
|
||||||
|
"handholds_redo":{
|
||||||
|
"author":"TestificateMods"
|
||||||
|
},
|
||||||
|
"mesecons":{
|
||||||
|
"author":"Jeija",
|
||||||
|
"notes":"Add its provides.."
|
||||||
|
},
|
||||||
|
"mob_horse":{
|
||||||
|
"author":"TenPlus1",
|
||||||
|
"required":["mobs"]
|
||||||
|
},
|
||||||
|
"mob_mese_monster_classic":{
|
||||||
|
"author":"TenPlus1",
|
||||||
|
"required":["mobs"]
|
||||||
|
},
|
||||||
|
"mobs":{
|
||||||
|
"author":"TenPlus1",
|
||||||
|
"colloquial_name":"Mobs Redo"
|
||||||
|
},
|
||||||
|
"mobs_animal":{
|
||||||
|
"author":"TenPlus1",
|
||||||
|
"required":["mobs"]
|
||||||
|
},
|
||||||
|
"mobs_monster":{
|
||||||
|
"author":"TenPlus1",
|
||||||
|
"required":["mobs"]
|
||||||
|
},
|
||||||
|
"mobs_water":{
|
||||||
|
"author":"TenPlus1",
|
||||||
|
"required":["mobs"]
|
||||||
|
},
|
||||||
|
"more_ladders":{
|
||||||
|
"author":"SkyBuilder1717"
|
||||||
|
},
|
||||||
|
"moreawards":{
|
||||||
|
"author":"ClothierEdward",
|
||||||
|
"required":["awards"]
|
||||||
|
},
|
||||||
|
"moreores":{
|
||||||
|
"author":"Calinou"
|
||||||
|
},
|
||||||
|
"multitools":{
|
||||||
|
"author":"ChimneySwift"
|
||||||
|
},
|
||||||
|
"nutritional":{
|
||||||
|
"author":"ghurir"
|
||||||
|
},
|
||||||
|
"priviledges_manager":{
|
||||||
|
"author":"Impulse",
|
||||||
|
"status":"untested"
|
||||||
|
},
|
||||||
|
"ropes":{
|
||||||
|
"author":"FaceDeer"
|
||||||
|
},
|
||||||
|
"stamina":{
|
||||||
|
"author":"TenPlus1",
|
||||||
|
"colloquial_name":"Stamina Redo"
|
||||||
|
},
|
||||||
|
"techage_modpack":{
|
||||||
|
"author":"joe7575",
|
||||||
|
"provides":["autobahn","basic_materials","compost","datastorage","doc","hyperloop","lcdlib","minecart","nanobasic","networks","safer_lua","signs_bot","stamina","ta4_addons","ta4_jetpack","ta4_paraglider","techage","techpack_stairway","towercrane","tubelib2","unified_inventory"],
|
||||||
|
"required":["3d_armor","xcompat"]
|
||||||
|
},
|
||||||
|
"too_many_tnt":{
|
||||||
|
"author":"SkyBuilder1717",
|
||||||
|
"notes":"Remember to enable TNT.",
|
||||||
|
"required":["basic_materials","mobs","uraniumstuff"]
|
||||||
|
},
|
||||||
|
"toolranks":{
|
||||||
|
"author":"lisacvuk"
|
||||||
|
},
|
||||||
|
"toolranks_extras":{
|
||||||
|
"author":"louisroyer",
|
||||||
|
"required":["toolranks"]
|
||||||
|
},
|
||||||
|
"towercrane":{
|
||||||
|
"author":"joe7575",
|
||||||
|
"required":["xcompat"]
|
||||||
|
},
|
||||||
|
"travelnet":{
|
||||||
|
"author":"mt-mods",
|
||||||
|
"required":["xcompat"]
|
||||||
|
},
|
||||||
|
"unified_inventory":{
|
||||||
|
"author":"RealBadAngel"
|
||||||
|
},
|
||||||
|
"unified_inventory_plus":{
|
||||||
|
"author":"mt-mods",
|
||||||
|
"required":["fakelib","unified_inventory"]
|
||||||
|
},
|
||||||
|
"unifiedbricks":{
|
||||||
|
"author":"wowiamdiamonds",
|
||||||
|
"required":["unifieddyes"]
|
||||||
|
},
|
||||||
|
"unifieddyes":{
|
||||||
|
"author":"mt-mods"
|
||||||
|
},
|
||||||
|
"uraniumstuff":{
|
||||||
|
"author":"Epoxum"
|
||||||
|
},
|
||||||
|
"wetmud":{
|
||||||
|
"author":"Nicu"
|
||||||
|
},
|
||||||
|
"worldedit":{
|
||||||
|
"author":"sfan5"
|
||||||
|
},
|
||||||
|
"x_farming":{
|
||||||
|
"author":"SaKeL"
|
||||||
|
},
|
||||||
|
"xcompat":{
|
||||||
|
"author":"mt-mods"
|
||||||
|
},
|
||||||
|
"yl_api_nodestages":{
|
||||||
|
"author":"AliasAlreadyTaken"
|
||||||
|
},
|
||||||
|
"yl_canned_food":{
|
||||||
|
"author":"AliasAlreadyTaken",
|
||||||
|
"required":["yl_api_nodestages"]
|
||||||
|
},
|
||||||
|
"yl_canned_food_mtg":{
|
||||||
|
"author":"AliasAlreadyTaken",
|
||||||
|
"required":["yl_canned_food_mtg"]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"packs":{
|
"packs":{
|
||||||
"Unnamed Luanti TechAge Pack":{
|
"Unnamed Luanti TechAge Pack":{
|
||||||
@@ -61,6 +188,7 @@
|
|||||||
"coloredstrings":true,
|
"coloredstrings":true,
|
||||||
"discovery_maps":true,
|
"discovery_maps":true,
|
||||||
"eye_spy":true,
|
"eye_spy":true,
|
||||||
|
"fakelib":true,
|
||||||
"farming":true,
|
"farming":true,
|
||||||
"farmtools":true,
|
"farmtools":true,
|
||||||
"grass_string":true,
|
"grass_string":true,
|
||||||
@@ -79,14 +207,11 @@
|
|||||||
"multitools":true,
|
"multitools":true,
|
||||||
"nutritional":true,
|
"nutritional":true,
|
||||||
"ropes":true,
|
"ropes":true,
|
||||||
"stamina":true,
|
|
||||||
"techage_modpack":true,
|
"techage_modpack":true,
|
||||||
"too_many_tnt":true,
|
"too_many_tnt":true,
|
||||||
"toolranks":true,
|
"toolranks":true,
|
||||||
"toolranks_extras":true,
|
"toolranks_extras":true,
|
||||||
"towercrane":true,
|
|
||||||
"travelnet":true,
|
"travelnet":true,
|
||||||
"unified_inventory":true,
|
|
||||||
"unified_inventory_plus":true,
|
"unified_inventory_plus":true,
|
||||||
"uraniumstuff":true,
|
"uraniumstuff":true,
|
||||||
"wetmud":true,
|
"wetmud":true,
|
||||||
|
|||||||
@@ -0,0 +1,139 @@
|
|||||||
|
# API Documentation
|
||||||
|
|
||||||
|
This documentation covers the API specific to `fakelib`. For documentation of the functionality provided by the fake player, metatdata and inventory, refer to the [Lua API](https://github.com/minetest/minetest/blob/master/doc/lua_api.md), as they function the same as the real thing.
|
||||||
|
|
||||||
|
## Quick Links
|
||||||
|
|
||||||
|
- [`fakelib.is_player(x)`](#fakelibis_playerx)
|
||||||
|
- [`fakelib.is_metadata(x)`](#fakelibis_metadatax)
|
||||||
|
- [`fakelib.is_inventory(x)`](#fakelibis_inventoryx)
|
||||||
|
- [`fakelib.is_vector(x, [add_metatable])`](#fakelibis_vectorx-add_metatable)
|
||||||
|
- [`fakelib.create_player([options])`](#fakelibcreate_playeroptions)
|
||||||
|
- [`fakelib.create_inventory([sizes])`](#fakelibcreate_inventorysizes)
|
||||||
|
- [`fakelib.create_metadata([data])`](#fakelibcreate_metadatadata)
|
||||||
|
|
||||||
|
|
||||||
|
## Type checks
|
||||||
|
|
||||||
|
#### **`fakelib.is_player(x)`**
|
||||||
|
|
||||||
|
Checks if a value is a player. Only returns true for real players and `fakelib`'s fake players.
|
||||||
|
|
||||||
|
**Arguments**
|
||||||
|
|
||||||
|
- `x` - Any value. The value to be checked.
|
||||||
|
|
||||||
|
#### **`fakelib.is_inventory(x)`**
|
||||||
|
|
||||||
|
Checks if a value is an inventory. Only returns true for real inventories and `fakelib`'s fake inventories.
|
||||||
|
|
||||||
|
**Arguments**
|
||||||
|
|
||||||
|
- `x` - Any value. The value to be checked.
|
||||||
|
|
||||||
|
#### **`fakelib.is_metadata(x)`**
|
||||||
|
|
||||||
|
Checks if a value is metadata. Only returns true for real metadata and `fakelib`'s fake metadata.
|
||||||
|
|
||||||
|
**Arguments**
|
||||||
|
|
||||||
|
- `x` - Any value. The value to be checked.
|
||||||
|
|
||||||
|
#### **`fakelib.is_vector(x, [add_metatable])`**
|
||||||
|
|
||||||
|
Checks if a value is a vector. Returns true for any table with `x`, `y`, and `z` values that are numbers.
|
||||||
|
|
||||||
|
**Arguments**
|
||||||
|
|
||||||
|
- `x` - Any value. The value to be checked.
|
||||||
|
- `add_metatable` - Boolean, optional. Add the vector metatable to basic vectors.
|
||||||
|
|
||||||
|
|
||||||
|
## Creation
|
||||||
|
|
||||||
|
#### **`fakelib.create_player([options])`**
|
||||||
|
|
||||||
|
Creates a new fake player.
|
||||||
|
|
||||||
|
**Arguments**
|
||||||
|
|
||||||
|
- `options` - Definition table, optional. Specifies player data. See [`options`](#options) below. Can also be a string as shorthand to set the player name only.
|
||||||
|
|
||||||
|
#### **`fakelib.create_inventory([sizes])`**
|
||||||
|
|
||||||
|
Creates a new fake inventory.
|
||||||
|
|
||||||
|
**Arguments**
|
||||||
|
|
||||||
|
- `sizes` - Definition table, optional. Specifies list names and sizes. See [`sizes`](#sizes) below.
|
||||||
|
|
||||||
|
#### **`fakelib.create_metadata([data])`**
|
||||||
|
|
||||||
|
Creates a new fake metadata object.
|
||||||
|
|
||||||
|
**Arguments**
|
||||||
|
|
||||||
|
- `data` - Definition table, optional. Specifies metadata keys and values. See [`data`](#data) below.
|
||||||
|
|
||||||
|
|
||||||
|
## Definition tables.
|
||||||
|
|
||||||
|
|
||||||
|
#### **`options`**
|
||||||
|
|
||||||
|
Specifies player data. Used by [`fakelib.create_player([options])`](#fakelibcreate_playeroptions).
|
||||||
|
|
||||||
|
All values are optional.
|
||||||
|
|
||||||
|
- `name` - String. Player name. Unlike real player names, this can contain any characters.
|
||||||
|
- `position` - Vector. Player position.
|
||||||
|
- `direction` - Vector. Player look direction.
|
||||||
|
- `controls` - Table. Player controls. Uses the same format returned by `player:get_player_controls()`.
|
||||||
|
- `metadata` - Metadata. Player metadata. Can be fake metadata or a reference to real metadata.
|
||||||
|
- `inventory` - Inventory. Player inventory. Can be a fake inventory or a reference to a real inventory.
|
||||||
|
- `wield_list` - String. Selected inventory list. Must be a list that exists in the player's inventory.
|
||||||
|
- `wield_index` - Number. Selected list index. Must be an index that exists in the selected list.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```lua
|
||||||
|
local options = {
|
||||||
|
name = "sam",
|
||||||
|
position = vector.new(1, 5, 3),
|
||||||
|
direction = vector(1, 0, 0),
|
||||||
|
controls = {sneak = true},
|
||||||
|
}
|
||||||
|
local player = fakelib.create_player(options)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### **`sizes`**
|
||||||
|
|
||||||
|
Specifies list names and sizes. Used by [`fakelib.create_inventory([sizes])`](#fakelibcreate_inventorysizes).
|
||||||
|
|
||||||
|
List names must be strings, and list sizes must be numbers greater than zero.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```lua
|
||||||
|
local sizes = {
|
||||||
|
main = 32,
|
||||||
|
craft = 9,
|
||||||
|
craftpreview = 1,
|
||||||
|
craftresult = 1,
|
||||||
|
}
|
||||||
|
local inv = fakelib.create_inventory(sizes)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
#### **`data`**
|
||||||
|
|
||||||
|
Specifies metadata keys and values. Used by [`fakelib.create_metadata([data])`](#fakelibcreate_metadatadata).
|
||||||
|
|
||||||
|
Keys must be strings, and values must be strings or numbers.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```lua
|
||||||
|
local data = {
|
||||||
|
enabled = "true",
|
||||||
|
energy = 300,
|
||||||
|
}
|
||||||
|
local meta = fakelib.create_metadata(data)
|
||||||
|
```
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2024 OgelGames
|
||||||
|
|
||||||
|
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.
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
# Minetest fake userdata library [fakelib]
|
||||||
|
|
||||||
|
[](https://github.com/OgelGames/fakelib/actions)
|
||||||
|
[](LICENSE.md)
|
||||||
|
[](https://www.minetest.net)
|
||||||
|
[](https://content.minetest.net/packages/OgelGames/fakelib/)
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
This mod is a code library for creating fake userdata (players, inventories and metadata), replicating their functionality as closely as possible.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Simply add `fakelib` to your mod's dependencies, and call any of the API functions from your code.
|
||||||
|
|
||||||
|
See [API.md](API.md) for detailed documentation.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Download the [master branch](https://github.com/OgelGames/fakelib/archive/master.zip) or the [latest release](https://github.com/OgelGames/fakelib/releases), and follow [the usual installation steps](https://wiki.minetest.net/Installing_Mods).
|
||||||
|
|
||||||
|
Alternatively, you can download and install the mod from [ContentDB](https://content.minetest.net/packages/OgelGames/fakelib) or the online content tab in Minetest.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
All code is licensed under the [MIT License](LICENSE).
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
|
||||||
|
fakelib = {}
|
||||||
|
|
||||||
|
local function check(n, v, a, b)
|
||||||
|
local t = type(v)
|
||||||
|
if t == a or t == b then
|
||||||
|
return v
|
||||||
|
end
|
||||||
|
local info = debug.getinfo(2, "n")
|
||||||
|
local f = info.name or "?"
|
||||||
|
if info.namewhat ~= "method" then
|
||||||
|
-- Offset argument number when called using '.' instead of ':'
|
||||||
|
n = n + 1
|
||||||
|
end
|
||||||
|
error(string.format("bad argument #%i to '%s' (%s expected, got %s)", n, f, a, t), 3)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function secure_table(t, index, id)
|
||||||
|
setmetatable(t, {
|
||||||
|
__index = index,
|
||||||
|
__newindex = {},
|
||||||
|
__metatable = id,
|
||||||
|
})
|
||||||
|
return t
|
||||||
|
end
|
||||||
|
|
||||||
|
local path = core.get_modpath("fakelib")
|
||||||
|
|
||||||
|
for _,file in pairs({"metadata", "inventory", "player"}) do
|
||||||
|
loadfile(path.."/"..file..".lua")(check, secure_table)
|
||||||
|
end
|
||||||
|
|
||||||
|
dofile(path.."/misc.lua")
|
||||||
|
|
||||||
|
-- Override `core.is_player()` so only real players and fakelib's fake players will pass.
|
||||||
|
core.is_player = fakelib.is_player
|
||||||
|
|
||||||
|
-- Tests are not included in releases, so check for them before registering the command.
|
||||||
|
|
||||||
|
local tests = loadfile(path.."/tests.lua")
|
||||||
|
|
||||||
|
if tests and core.is_singleplayer() then
|
||||||
|
core.register_chatcommand("fakelib_test", {
|
||||||
|
description = "Test fakelib's API.",
|
||||||
|
params = "[<run error tests>]",
|
||||||
|
func = function(_, param)
|
||||||
|
local start_time = core.get_us_time()
|
||||||
|
local success = tests(param == "true")
|
||||||
|
local end_time = core.get_us_time()
|
||||||
|
if success then
|
||||||
|
return true, string.format("Testing completed in %i us", end_time - start_time)
|
||||||
|
end
|
||||||
|
return true, "Testing failed. See console for errors."
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
@@ -0,0 +1,303 @@
|
|||||||
|
|
||||||
|
local fake_inventory = {}
|
||||||
|
local identifier = "fakelib:inventory"
|
||||||
|
local check, secure_table = ...
|
||||||
|
|
||||||
|
-- API functions
|
||||||
|
----------------------------------------
|
||||||
|
|
||||||
|
function fakelib.is_inventory(x)
|
||||||
|
if type(x) == "userdata" and x.get_lists then
|
||||||
|
return true
|
||||||
|
elseif type(x) == "table" and getmetatable(x) == identifier then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function fakelib.create_inventory(sizes)
|
||||||
|
local lists = {}
|
||||||
|
if type(sizes) == "table" then
|
||||||
|
for listname, size in pairs(sizes) do
|
||||||
|
if type(listname) == "string" and type(size) == "number" and size > 0 then
|
||||||
|
local list = {}
|
||||||
|
for i=1, size do
|
||||||
|
list[i] = ItemStack()
|
||||||
|
end
|
||||||
|
lists[listname] = list
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return secure_table({lists = lists}, fake_inventory, identifier)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Helper functions
|
||||||
|
----------------------------------------
|
||||||
|
|
||||||
|
local function copy_list(list)
|
||||||
|
local copy = {}
|
||||||
|
for i=1, #list do
|
||||||
|
copy[i] = ItemStack(list[i])
|
||||||
|
end
|
||||||
|
return copy
|
||||||
|
end
|
||||||
|
|
||||||
|
local function stack_matches(a, b, match_meta)
|
||||||
|
if a:get_name() ~= b:get_name() then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if match_meta then
|
||||||
|
if a:get_wear() ~= b:get_wear() then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return a:get_meta():equals(b:get_meta())
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Inventory functions
|
||||||
|
----------------------------------------
|
||||||
|
|
||||||
|
function fake_inventory:is_empty(listname)
|
||||||
|
check(1, listname, "string", "number")
|
||||||
|
local list = self.lists[tostring(listname)]
|
||||||
|
if not list or #list == 0 then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
for _,stack in ipairs(list) do
|
||||||
|
if not stack:is_empty() then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_inventory:get_size(listname)
|
||||||
|
check(1, listname, "string", "number")
|
||||||
|
local list = self.lists[tostring(listname)]
|
||||||
|
return list and #list or 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_inventory:set_size(listname, size)
|
||||||
|
check(1, listname, "string", "number")
|
||||||
|
check(2, size, "number")
|
||||||
|
listname = tostring(listname)
|
||||||
|
if size ~= size or size < 0 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
size = math.floor(size)
|
||||||
|
if size == 0 then
|
||||||
|
self.lists[listname] = nil
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
local list = self.lists[listname] or {}
|
||||||
|
if #list < size then
|
||||||
|
for i=#list+1, size do
|
||||||
|
list[i] = ItemStack()
|
||||||
|
end
|
||||||
|
elseif #list > size then
|
||||||
|
for i=size+1, #list do
|
||||||
|
list[i] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.lists[listname] = list
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_inventory:get_width(listname)
|
||||||
|
check(1, listname, "string", "number")
|
||||||
|
local list = self.lists[tostring(listname)]
|
||||||
|
return list and list.width or 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_inventory:set_width(listname, width)
|
||||||
|
check(1, listname, "string", "number")
|
||||||
|
check(2, width, "number")
|
||||||
|
local list = self.lists[tostring(listname)]
|
||||||
|
if not list or width ~= width or width < 0 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
width = math.floor(width)
|
||||||
|
list.width = width > 0 and width or nil
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_inventory:get_stack(listname, i)
|
||||||
|
check(1, listname, "string", "number")
|
||||||
|
check(2, i, "number")
|
||||||
|
i = math.floor(i)
|
||||||
|
local list = self.lists[tostring(listname)]
|
||||||
|
if not list or not list[i] then
|
||||||
|
return ItemStack()
|
||||||
|
end
|
||||||
|
return ItemStack(list[i])
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_inventory:set_stack(listname, i, stack)
|
||||||
|
check(1, listname, "string", "number")
|
||||||
|
check(2, i, "number")
|
||||||
|
stack = ItemStack(stack)
|
||||||
|
i = math.floor(i)
|
||||||
|
local list = self.lists[tostring(listname)]
|
||||||
|
if not list or not list[i] then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
list[i] = stack
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_inventory:get_list(listname)
|
||||||
|
check(1, listname, "string", "number")
|
||||||
|
local list = self.lists[tostring(listname)]
|
||||||
|
return list and copy_list(list) or nil
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_inventory:set_list(listname, list)
|
||||||
|
check(1, listname, "string", "number")
|
||||||
|
listname = tostring(listname)
|
||||||
|
if list == nil then
|
||||||
|
self.lists[listname] = nil
|
||||||
|
return
|
||||||
|
end
|
||||||
|
check(2, list, "table")
|
||||||
|
local new_list = {}
|
||||||
|
local size = self.lists[listname] and #self.lists[listname] or 0
|
||||||
|
for i,s in pairs(list) do
|
||||||
|
check(4, i, "number")
|
||||||
|
if i > size then
|
||||||
|
size = i
|
||||||
|
end
|
||||||
|
new_list[i] = ItemStack(s)
|
||||||
|
end
|
||||||
|
for i=1, size do
|
||||||
|
if not new_list[i] then
|
||||||
|
new_list[i] = ItemStack()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.lists[listname] = new_list
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_inventory:get_lists()
|
||||||
|
local lists = {}
|
||||||
|
for listname, list in pairs(self.lists) do
|
||||||
|
lists[listname] = copy_list(list)
|
||||||
|
end
|
||||||
|
return lists
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_inventory:set_lists(lists)
|
||||||
|
check(1, lists, "table")
|
||||||
|
local new_lists = {}
|
||||||
|
for listname, list in pairs(lists) do
|
||||||
|
check(3, listname, "string", "number")
|
||||||
|
check(3, list, "table")
|
||||||
|
listname = tostring(listname)
|
||||||
|
local new_list, size = {}, 0
|
||||||
|
for i,s in pairs(list) do
|
||||||
|
check(5, i, "number")
|
||||||
|
if i > size then
|
||||||
|
size = i
|
||||||
|
end
|
||||||
|
new_list[i] = ItemStack(s)
|
||||||
|
end
|
||||||
|
for i=1, size do
|
||||||
|
if not new_list[i] then
|
||||||
|
new_list[i] = ItemStack()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
new_lists[listname] = new_list
|
||||||
|
end
|
||||||
|
self.lists = new_lists
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_inventory:add_item(listname, stack)
|
||||||
|
check(1, listname, "string", "number")
|
||||||
|
stack = ItemStack(stack)
|
||||||
|
local list = self.lists[tostring(listname)]
|
||||||
|
if not list or #list == 0 or stack:is_empty() then
|
||||||
|
return stack
|
||||||
|
end
|
||||||
|
local empty = {}
|
||||||
|
for _,s in ipairs(list) do
|
||||||
|
if s:is_empty() then
|
||||||
|
table.insert(empty, s)
|
||||||
|
else
|
||||||
|
stack = s:add_item(stack)
|
||||||
|
if stack:is_empty() then
|
||||||
|
return stack
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for _,s in ipairs(empty) do
|
||||||
|
stack = s:add_item(stack)
|
||||||
|
if stack:is_empty() then
|
||||||
|
return stack
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return stack
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_inventory:room_for_item(listname, stack)
|
||||||
|
check(1, listname, "string", "number")
|
||||||
|
stack = ItemStack(stack)
|
||||||
|
local list = self.lists[tostring(listname)]
|
||||||
|
if not list or #list == 0 or stack:is_empty() then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
for _,s in ipairs(copy_list(list)) do
|
||||||
|
stack = s:add_item(stack)
|
||||||
|
if stack:is_empty() then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_inventory:contains_item(listname, stack, match_meta)
|
||||||
|
check(1, listname, "string", "number")
|
||||||
|
stack = ItemStack(stack)
|
||||||
|
local list = self.lists[tostring(listname)]
|
||||||
|
if not list or stack:is_empty() or stack:is_empty() then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local count = stack:get_count()
|
||||||
|
for _,s in ipairs(list) do
|
||||||
|
if stack_matches(stack, s, match_meta) then
|
||||||
|
count = count - s:get_count()
|
||||||
|
if count <= 0 then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_inventory:remove_item(listname, stack)
|
||||||
|
check(1, listname, "string", "number")
|
||||||
|
stack = ItemStack(stack)
|
||||||
|
local list = self.lists[tostring(listname)]
|
||||||
|
if not list or #list == 0 or stack:is_empty() then
|
||||||
|
return ItemStack()
|
||||||
|
end
|
||||||
|
local name, remaining, removed = stack:get_name(), stack:get_count()
|
||||||
|
for i=#list, 1, -1 do
|
||||||
|
local s = list[i]
|
||||||
|
if s:get_name() == name then
|
||||||
|
s = s:take_item(remaining)
|
||||||
|
remaining = remaining - s:get_count()
|
||||||
|
if not removed then
|
||||||
|
removed = s
|
||||||
|
else
|
||||||
|
removed:set_count(removed:get_count() + s:get_count())
|
||||||
|
end
|
||||||
|
if remaining == 0 then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return removed or ItemStack()
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_inventory.get_location()
|
||||||
|
return {type = "undefined"}
|
||||||
|
end
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
|
||||||
|
local fake_metadata = {}
|
||||||
|
local identifier = "fakelib:metadata"
|
||||||
|
local check, secure_table = ...
|
||||||
|
|
||||||
|
-- API functions
|
||||||
|
----------------------------------------
|
||||||
|
|
||||||
|
function fakelib.is_metadata(x)
|
||||||
|
if type(x) == "userdata" and x.get_keys then
|
||||||
|
return true
|
||||||
|
elseif type(x) == "table" and getmetatable(x) == identifier then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function fakelib.create_metadata(data)
|
||||||
|
local fields = {}
|
||||||
|
if type(data) == "table" then
|
||||||
|
for k,v in pairs(data) do
|
||||||
|
if type(k) == "string" and type(v) == "string" then
|
||||||
|
fields[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return secure_table({fields = fields}, fake_metadata, identifier)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Metadata functions
|
||||||
|
----------------------------------------
|
||||||
|
|
||||||
|
function fake_metadata:contains(key)
|
||||||
|
check(1, key, "string", "number")
|
||||||
|
key = tostring(key)
|
||||||
|
return self.fields[key] ~= nil
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_metadata:get(key)
|
||||||
|
check(1, key, "string", "number")
|
||||||
|
key = tostring(key)
|
||||||
|
return self.fields[key]
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_metadata:set_string(key, value)
|
||||||
|
check(1, key, "string", "number")
|
||||||
|
check(2, value, "string", "number")
|
||||||
|
key = tostring(key)
|
||||||
|
value = tostring(value)
|
||||||
|
if value == "" then
|
||||||
|
self.fields[key] = nil
|
||||||
|
end
|
||||||
|
self.fields[key] = value
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_metadata:get_string(key)
|
||||||
|
check(1, key, "string", "number")
|
||||||
|
key = tostring(key)
|
||||||
|
return self.fields[key] or ""
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_metadata:set_int(key, value)
|
||||||
|
check(1, key, "string", "number")
|
||||||
|
check(2, value, "number")
|
||||||
|
key = tostring(key)
|
||||||
|
if value >= 2^31 then
|
||||||
|
value = 0
|
||||||
|
end
|
||||||
|
self.fields[key] = string.format("%i", value)
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_metadata:get_int(key)
|
||||||
|
check(1, key, "string", "number")
|
||||||
|
key = tostring(key)
|
||||||
|
return tonumber(self.fields[key]) or 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_metadata:set_float(key, value)
|
||||||
|
check(1, key, "string", "number")
|
||||||
|
check(2, value, "number")
|
||||||
|
key = tostring(key)
|
||||||
|
self.fields[key] = string.format("%s", value)
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_metadata:get_float(key)
|
||||||
|
check(1, key, "string", "number")
|
||||||
|
key = tostring(key)
|
||||||
|
return tonumber(self.fields[key]) or 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_metadata:get_keys()
|
||||||
|
local keys = {}
|
||||||
|
for key in pairs(self.fields) do
|
||||||
|
table.insert(keys, key)
|
||||||
|
end
|
||||||
|
return keys
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_metadata:to_table()
|
||||||
|
return {fields = table.copy(self.fields)}
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_metadata:from_table(data)
|
||||||
|
if type(data) ~= "table" or type(data.fields) ~= "table" then
|
||||||
|
self.fields = {}
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
local fields = {}
|
||||||
|
for k,v in pairs(data.fields) do
|
||||||
|
check(4, k, "string")
|
||||||
|
check(5, v, "string", "number")
|
||||||
|
fields[k] = tostring(v)
|
||||||
|
end
|
||||||
|
self.fields = fields
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_metadata:equals(other)
|
||||||
|
if not fakelib.is_metadata(other) then
|
||||||
|
check(1, other, "MetaDataRef")
|
||||||
|
end
|
||||||
|
local fields = other:to_table().fields
|
||||||
|
for k,v in pairs(self.fields) do
|
||||||
|
if fields[k] == v then
|
||||||
|
fields[k] = nil
|
||||||
|
elseif fields[k] ~= nil then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if next(fields) == nil then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
function fakelib.is_vector(x, add_metatable)
|
||||||
|
if type(x) ~= "table" or type(x.x) ~= "number" or type(x.y) ~= "number" or type(x.z) ~= "number" then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if add_metatable and getmetatable(x) ~= vector.metatable then
|
||||||
|
setmetatable(x, vector.metatable)
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
name = fakelib
|
||||||
|
description = Minetest fake userdata library
|
||||||
|
min_minetest_version = 5.0
|
||||||
@@ -0,0 +1,523 @@
|
|||||||
|
|
||||||
|
local fake_player = {is_fake_player = true}
|
||||||
|
local identifier = "fakelib:player"
|
||||||
|
local check, secure_table = ...
|
||||||
|
|
||||||
|
local player_controls = {
|
||||||
|
up = 1, down = 2, left = 4, right = 8, jump = 16,
|
||||||
|
aux1 = 32, sneak = 64, dig = 128, place = 256, zoom = 512,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- API functions
|
||||||
|
----------------------------------------
|
||||||
|
|
||||||
|
function fakelib.is_player(x)
|
||||||
|
if type(x) == "userdata" and x.is_player and x:is_player() then
|
||||||
|
return true
|
||||||
|
elseif type(x) == "table" and getmetatable(x) == identifier then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function fakelib.create_player(options)
|
||||||
|
local data = {}
|
||||||
|
if type(options) == "table" then
|
||||||
|
if type(options.name) == "string" then
|
||||||
|
data.name = options.name
|
||||||
|
end
|
||||||
|
if fakelib.is_vector(options.position) then
|
||||||
|
data.position = vector.copy(options.position)
|
||||||
|
end
|
||||||
|
if fakelib.is_vector(options.direction) then
|
||||||
|
local dir = vector.normalize(options.direction)
|
||||||
|
data.pitch = -math.asin(dir.y)
|
||||||
|
data.yaw = math.atan2(-dir.x, dir.z) % (math.pi * 2)
|
||||||
|
end
|
||||||
|
if type(options.controls) == "table" then
|
||||||
|
data.controls = {}
|
||||||
|
for name in pairs(player_controls) do
|
||||||
|
data.controls[name] = options.controls[name] == true
|
||||||
|
end
|
||||||
|
data.controls.dig = data.controls.dig or options.controls.LMB
|
||||||
|
data.controls.place = data.controls.place or options.controls.RMB
|
||||||
|
end
|
||||||
|
if fakelib.is_metadata(options.metadata) then
|
||||||
|
data.metadata = options.metadata
|
||||||
|
end
|
||||||
|
if fakelib.is_inventory(options.inventory) then
|
||||||
|
data.inventory = options.inventory
|
||||||
|
end
|
||||||
|
local size = 32
|
||||||
|
if data.inventory and type(options.wield_list) == "string" then
|
||||||
|
size = data.inventory:get_size(options.wield_list)
|
||||||
|
if size > 0 then
|
||||||
|
data.wield_list = options.wield_list
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if type(options.wield_index) == "number" then
|
||||||
|
if options.wield_index > 0 and options.wield_index <= size then
|
||||||
|
data.wield_index = options.wield_index
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif type(options) == "string" then
|
||||||
|
data.name = options
|
||||||
|
end
|
||||||
|
return secure_table({data = data}, fake_player, identifier)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Helper functions
|
||||||
|
----------------------------------------
|
||||||
|
|
||||||
|
local function check_vector(v)
|
||||||
|
local t = type(v)
|
||||||
|
if t ~= "table" then
|
||||||
|
error(string.format("\"Invalid vector (expected table got %s).\"", t), 3)
|
||||||
|
end
|
||||||
|
for _,c in ipairs({"x", "y", "z"}) do
|
||||||
|
t = type(v[c])
|
||||||
|
if t ~= "number" then
|
||||||
|
error(string.format("\"Invalid vector coordinate %s (expected number got %s).\"", c, t), 3)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function new_fake_guid()
|
||||||
|
return string.format("@fakeplayer%d%d", os.time(), math.random(100, 999))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Dynamic get/set functions
|
||||||
|
----------------------------------------
|
||||||
|
|
||||||
|
function fake_player:get_player_name()
|
||||||
|
return self.data.name or ""
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player:get_guid()
|
||||||
|
if not self.data.guid then
|
||||||
|
self.data.guid = new_fake_guid()
|
||||||
|
end
|
||||||
|
return self.data.guid
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player:get_inventory()
|
||||||
|
if not self.data.inventory then
|
||||||
|
self.data.inventory = fakelib.create_inventory({
|
||||||
|
main = 32, craft = 9, craftpreview = 1, craftresult = 1
|
||||||
|
})
|
||||||
|
end
|
||||||
|
return self.data.inventory
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player:get_meta()
|
||||||
|
if not self.data.metadata then
|
||||||
|
self.data.metadata = fakelib:create_metadata()
|
||||||
|
end
|
||||||
|
return self.data.metadata
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player:get_look_dir()
|
||||||
|
local p, y = self.data.pitch or 0, self.data.yaw or 0
|
||||||
|
return vector.new(math.sin(-y) * math.cos(p), math.sin(-p), math.cos(y) * math.cos(p))
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player:get_look_horizontal()
|
||||||
|
return self.data.yaw or 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player:set_look_horizontal(value)
|
||||||
|
check(1, value, "number")
|
||||||
|
self.data.yaw = value % (math.pi * 2)
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player:get_look_vertical()
|
||||||
|
return self.data.pitch or 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player:set_look_vertical(value)
|
||||||
|
check(1, value, "number")
|
||||||
|
self.data.pitch = math.max(-math.pi / 2, math.min(value, math.pi / 2))
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player:get_player_control()
|
||||||
|
local controls = {}
|
||||||
|
if self.data.controls then
|
||||||
|
for name in pairs(player_controls) do
|
||||||
|
controls[name] = self.data.controls[name]
|
||||||
|
end
|
||||||
|
else
|
||||||
|
for name in pairs(player_controls) do
|
||||||
|
controls[name] = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
controls.LMB = controls.dig
|
||||||
|
controls.RMB = controls.place
|
||||||
|
controls.movement_x = 0
|
||||||
|
controls.movement_y = 0
|
||||||
|
return controls
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player:get_player_control_bits()
|
||||||
|
if not self.data.controls then
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
local total = 0
|
||||||
|
for name, value in pairs(player_controls) do
|
||||||
|
total = total + self.data.controls[name] and value or 0
|
||||||
|
end
|
||||||
|
return total
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player:get_pos()
|
||||||
|
if self.data.position then
|
||||||
|
return vector.copy(self.data.position)
|
||||||
|
end
|
||||||
|
return vector.zero()
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player:set_pos(pos)
|
||||||
|
check_vector(pos)
|
||||||
|
self.data.position = vector.copy(pos)
|
||||||
|
end
|
||||||
|
fake_player.move_to = fake_player.set_pos
|
||||||
|
|
||||||
|
function fake_player:add_pos(pos)
|
||||||
|
check_vector(pos)
|
||||||
|
if self.data.position then
|
||||||
|
self.data.position = vector.add(self.data.position, pos)
|
||||||
|
else
|
||||||
|
self.data.position = vector.copy(pos)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player:get_wield_index()
|
||||||
|
return self.data.wield_index or 1
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player:get_wield_list()
|
||||||
|
return self.data.wield_list or "main"
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player:get_wielded_item()
|
||||||
|
if self.data.inventory then
|
||||||
|
return self.data.inventory:get_stack(self:get_wield_list(), self:get_wield_index())
|
||||||
|
end
|
||||||
|
return ItemStack()
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player:set_wielded_item(stack)
|
||||||
|
stack = ItemStack(stack)
|
||||||
|
if not self.data.inventory and stack:is_empty() then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
self:get_inventory():set_stack(self:get_wield_list(), self:get_wield_index(), stack)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Static get functions
|
||||||
|
----------------------------------------
|
||||||
|
|
||||||
|
function fake_player.is_player()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_animation()
|
||||||
|
return {x = 1, y = 1}, 15, 0, true
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_armor_groups()
|
||||||
|
return {immortal = 1}
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_bone_override()
|
||||||
|
return {
|
||||||
|
position = {absolute = false, vec = vector.zero(), interpolation = 0},
|
||||||
|
rotation = {absolute = false, vec = vector.zero(), interpolation = 0},
|
||||||
|
scale = {absolute = false, vec = vector.new(1, 1, 1), interpolation = 0},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_bone_overrides()
|
||||||
|
return {}
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_bone_position()
|
||||||
|
return vector.zero(), vector.zero()
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_breath()
|
||||||
|
return 10
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_camera()
|
||||||
|
return {mode = "any"}
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_children()
|
||||||
|
return {}
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_clouds()
|
||||||
|
return {
|
||||||
|
ambient = {r = 0, g = 0, b = 0, a = 255},
|
||||||
|
color = {r = 240, g = 240, b = 255, a = 229},
|
||||||
|
density = 0.4,
|
||||||
|
height = 120,
|
||||||
|
speed = {x = 0, y = -2},
|
||||||
|
thickness = 16,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_eye_offset()
|
||||||
|
return vector.zero(), vector.zero(), vector.zero()
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_flags()
|
||||||
|
return {
|
||||||
|
breathing = true,
|
||||||
|
drowning = true,
|
||||||
|
node_damage = true,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_formspec_prepend()
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_fov()
|
||||||
|
return 0, false, 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_hp()
|
||||||
|
return 20
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_inventory_formspec()
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_lighting()
|
||||||
|
return {
|
||||||
|
exposure = {
|
||||||
|
speed_bright_dark = 1000,
|
||||||
|
center_weight_power = 1,
|
||||||
|
luminance_min = -3,
|
||||||
|
luminance_max = -3,
|
||||||
|
exposure_correction = 0,
|
||||||
|
speed_dark_bright = 1000
|
||||||
|
},
|
||||||
|
saturation = 1,
|
||||||
|
shadows = {intensity = 0},
|
||||||
|
volumetric_light = {strength = 0},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_local_animation()
|
||||||
|
return {x = 0, y = 0}, {x = 0, y = 0}, {x = 0, y = 0}, {x = 0, y = 0}, 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_moon()
|
||||||
|
return {
|
||||||
|
scale = 1,
|
||||||
|
texture = "moon.png",
|
||||||
|
tonemap = "moon_tonemap.png",
|
||||||
|
visible = true,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_nametag_attributes()
|
||||||
|
return {
|
||||||
|
bgcolor = false,
|
||||||
|
color = {r = 255, g = 255, b = 255, a = 255},
|
||||||
|
text = "",
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_physics_override()
|
||||||
|
return {
|
||||||
|
acceleration_air = 1, acceleration_default = 1, acceleration_fast = 1,
|
||||||
|
gravity = 1, jump = 1, speed = 1,
|
||||||
|
liquid_fluidity = 1, liquid_fluidity_smooth = 1, liquid_sink = 1,
|
||||||
|
speed_climb = 1, speed_crouch = 1, speed_fast = 1, speed_walk = 1,
|
||||||
|
new_move = true, sneak = true, sneak_glitch = false,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_properties()
|
||||||
|
return {
|
||||||
|
automatic_face_movement_dir = false,
|
||||||
|
automatic_face_movement_max_rotation_per_sec = -1,
|
||||||
|
automatic_rotate = 0,
|
||||||
|
backface_culling = false,
|
||||||
|
breath_max = 10,
|
||||||
|
collide_with_objects = true,
|
||||||
|
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||||
|
colors = {{r = 255, g = 255, b = 255, a = 255}},
|
||||||
|
damage_texture_modifier = "^[brighten",
|
||||||
|
eye_height = 0,
|
||||||
|
glow = 0,
|
||||||
|
hp_max = 20,
|
||||||
|
infotext = "",
|
||||||
|
initial_sprite_basepos = {x = 0, y = 0},
|
||||||
|
is_visible = true,
|
||||||
|
makes_footstep_sound = true,
|
||||||
|
mesh = "",
|
||||||
|
nametag = "",
|
||||||
|
nametag_bgcolor = false,
|
||||||
|
nametag_color = {r = 255, g = 255, b = 255, a = 255},
|
||||||
|
physical = false,
|
||||||
|
pointable = true,
|
||||||
|
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5, rotate = false},
|
||||||
|
shaded = true,
|
||||||
|
show_on_minimap = true,
|
||||||
|
spritediv = {x = 1, y = 1},
|
||||||
|
static_save = true,
|
||||||
|
stepheight = 0.6,
|
||||||
|
textures = {"blank.png"},
|
||||||
|
use_texture_alpha = false,
|
||||||
|
visual = "cube",
|
||||||
|
visual_size = vector.new(1, 1, 1),
|
||||||
|
wield_item = "",
|
||||||
|
zoom_fov = 15,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_sky_color()
|
||||||
|
return fake_player.get_sky(true).sky_color
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_sky(as_table)
|
||||||
|
if as_table then
|
||||||
|
return {
|
||||||
|
base_color = {r = 255, g = 255, b = 255, a = 255},
|
||||||
|
clouds = true,
|
||||||
|
fog = {fog_distance = -1, fog_start = -1},
|
||||||
|
sky_color = {
|
||||||
|
day_sky = {r = 97, g = 181, b = 245, a = 255},
|
||||||
|
day_horizon = {r = 144, g = 211, b = 246, a = 255},
|
||||||
|
dawn_sky = {r = 180, g = 186, b = 250, a = 255},
|
||||||
|
dawn_horizon = {r = 186, g = 193, b = 240, a = 255},
|
||||||
|
night_sky = {r = 0, g = 107, b = 255, a = 255},
|
||||||
|
night_horizon = {r = 64, g = 144, b = 255, a = 255},
|
||||||
|
indoors = {r = 100, g = 100, b = 100, a = 255},
|
||||||
|
fog_sun_tint = {r = 244, g = 125, b = 29, a = 255},
|
||||||
|
fog_moon_tint = {r = 128, g = 153, b = 204, a = 255},
|
||||||
|
fog_tint_type = "default",
|
||||||
|
},
|
||||||
|
textures = {},
|
||||||
|
type = "regular",
|
||||||
|
}
|
||||||
|
end
|
||||||
|
return {r = 255, g = 255, b = 255, a = 255}, "regular", {}, true
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_stars()
|
||||||
|
return {
|
||||||
|
count = 1000,
|
||||||
|
day_opacity = 0,
|
||||||
|
scale = 1,
|
||||||
|
star_color = {r = 235, g = 235, b = 255, a = 105},
|
||||||
|
visible = true,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_sun()
|
||||||
|
return {
|
||||||
|
scale = 1,
|
||||||
|
sunrise = "sunrisebg.png",
|
||||||
|
sunrise_visible = true,
|
||||||
|
texture = "sun.png",
|
||||||
|
tonemap = "sun_tonemap.png",
|
||||||
|
visible = true,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.get_velocity()
|
||||||
|
return vector.zero()
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.hud_get_all()
|
||||||
|
return {}
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.hud_get_flags()
|
||||||
|
return {
|
||||||
|
basic_debug = false,
|
||||||
|
breathbar = false,
|
||||||
|
chat = false,
|
||||||
|
crosshair = false,
|
||||||
|
healthbar = false,
|
||||||
|
hotbar = false,
|
||||||
|
minimap = false,
|
||||||
|
minimap_radar = false,
|
||||||
|
wielditem = false,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.hud_get_hotbar_image()
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.hud_get_hotbar_itemcount()
|
||||||
|
return 8
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.hud_get_hotbar_selected_image()
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player.is_valid()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- No-op functions
|
||||||
|
----------------------------------------
|
||||||
|
do
|
||||||
|
local functions = {
|
||||||
|
-- Lua entity only (no-op for players)
|
||||||
|
"get_acceleration", "get_entity_name", "get_luaentity", "get_rotation",
|
||||||
|
"get_texture_mod", "get_yaw", "getacceleration", "getyaw", "remove",
|
||||||
|
"set_acceleration", "set_rotation", "set_sprite", "set_texture_mod",
|
||||||
|
"set_velocity", "set_yaw", "setacceleration", "setsprite",
|
||||||
|
"settexturemod", "setvelocity", "setyaw",
|
||||||
|
-- Non-functional get/set functions
|
||||||
|
"add_velocity", "get_attach", "get_attribute", "get_day_night_ratio",
|
||||||
|
"get_observers", "get_effective_observers",
|
||||||
|
"hud_add", "hud_change", "hud_get", "hud_remove", "hud_set_flags",
|
||||||
|
"hud_set_hotbar_image", "hud_set_hotbar_itemcount",
|
||||||
|
"hud_set_hotbar_selected_image", "override_day_night_ratio",
|
||||||
|
"set_animation", "set_animation_frame_speed", "set_armor_groups",
|
||||||
|
"set_attach", "set_attribute", "set_bone_override", "set_bone_position",
|
||||||
|
"set_breath", "set_camera", "set_clouds", "set_detach",
|
||||||
|
"set_eye_offset", "set_formspec_prepend", "set_flags", "set_fov",
|
||||||
|
"set_hp", "set_inventory_formspec", "set_lighting",
|
||||||
|
"set_local_animation", "set_minimap_modes", "set_moon",
|
||||||
|
"set_nametag_attributes", "set_observers", "set_physics_override",
|
||||||
|
"set_properties", "set_sky", "set_stars", "set_sun",
|
||||||
|
-- Other functions that do nothing
|
||||||
|
"punch", "respawn", "right_click", "send_mapblock",
|
||||||
|
}
|
||||||
|
for _,func in ipairs(functions) do
|
||||||
|
fake_player[func] = function() end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Deprecated functions
|
||||||
|
----------------------------------------
|
||||||
|
|
||||||
|
function fake_player:get_look_pitch()
|
||||||
|
return self:get_look_vertical() * -1
|
||||||
|
end
|
||||||
|
|
||||||
|
function fake_player:get_look_yaw()
|
||||||
|
return self:get_look_horizontal() + math.pi / 2
|
||||||
|
end
|
||||||
|
|
||||||
|
fake_player.set_look_pitch = fake_player.set_look_vertical
|
||||||
|
fake_player.set_look_yaw = fake_player.set_look_horizontal
|
||||||
|
fake_player.getpos = fake_player.get_pos
|
||||||
|
fake_player.setpos = fake_player.set_pos
|
||||||
|
fake_player.moveto = fake_player.set_pos
|
||||||
|
fake_player.getvelocity = fake_player.get_velocity
|
||||||
|
fake_player.add_player_velocity = fake_player.add_velocity
|
||||||
|
fake_player.get_player_velocity = fake_player.get_velocity
|
||||||
@@ -0,0 +1,677 @@
|
|||||||
|
Copyright 2026 James David Clarke <james@jamesdavidclarke.com>
|
||||||
|
|
||||||
|
# GNU GENERAL PUBLIC LICENSE
|
||||||
|
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||||
|
<https://fsf.org/>
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies of this
|
||||||
|
license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
## Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom
|
||||||
|
to share and change all versions of a program--to make sure it remains
|
||||||
|
free software for all its users. We, the Free Software Foundation, use
|
||||||
|
the GNU General Public License for most of our software; it applies
|
||||||
|
also to any other work released this way by its authors. You can apply
|
||||||
|
it to your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you
|
||||||
|
have certain responsibilities if you distribute copies of the
|
||||||
|
software, or if you modify it: responsibilities to respect the freedom
|
||||||
|
of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the
|
||||||
|
manufacturer can do so. This is fundamentally incompatible with the
|
||||||
|
aim of protecting users' freedom to change the software. The
|
||||||
|
systematic pattern of such abuse occurs in the area of products for
|
||||||
|
individuals to use, which is precisely where it is most unacceptable.
|
||||||
|
Therefore, we have designed this version of the GPL to prohibit the
|
||||||
|
practice for those products. If such problems arise substantially in
|
||||||
|
other domains, we stand ready to extend this provision to those
|
||||||
|
domains in future versions of the GPL, as needed to protect the
|
||||||
|
freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish
|
||||||
|
to avoid the special danger that patents applied to a free program
|
||||||
|
could make it effectively proprietary. To prevent this, the GPL
|
||||||
|
assures that patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
## TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
### 0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds
|
||||||
|
of works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of
|
||||||
|
an exact copy. The resulting work is called a "modified version" of
|
||||||
|
the earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user
|
||||||
|
through a computer network, with no transfer of a copy, is not
|
||||||
|
conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices" to
|
||||||
|
the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
### 1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work for
|
||||||
|
making modifications to it. "Object code" means any non-source form of
|
||||||
|
a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users can
|
||||||
|
regenerate automatically from other parts of the Corresponding Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that same
|
||||||
|
work.
|
||||||
|
|
||||||
|
### 2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not convey,
|
||||||
|
without conditions so long as your license otherwise remains in force.
|
||||||
|
You may convey covered works to others for the sole purpose of having
|
||||||
|
them make modifications exclusively for you, or provide you with
|
||||||
|
facilities for running those works, provided that you comply with the
|
||||||
|
terms of this License in conveying all material for which you do not
|
||||||
|
control copyright. Those thus making or running the covered works for
|
||||||
|
you must do so exclusively on your behalf, under your direction and
|
||||||
|
control, on terms that prohibit them from making any copies of your
|
||||||
|
copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under the
|
||||||
|
conditions stated below. Sublicensing is not allowed; section 10 makes
|
||||||
|
it unnecessary.
|
||||||
|
|
||||||
|
### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such
|
||||||
|
circumvention is effected by exercising rights under this License with
|
||||||
|
respect to the covered work, and you disclaim any intention to limit
|
||||||
|
operation or modification of the work as a means of enforcing, against
|
||||||
|
the work's users, your or third parties' legal rights to forbid
|
||||||
|
circumvention of technological measures.
|
||||||
|
|
||||||
|
### 4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
### 5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these
|
||||||
|
conditions:
|
||||||
|
|
||||||
|
- a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
- b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under
|
||||||
|
section 7. This requirement modifies the requirement in section 4
|
||||||
|
to "keep intact all notices".
|
||||||
|
- c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
- d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
### 6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms of
|
||||||
|
sections 4 and 5, provided that you also convey the machine-readable
|
||||||
|
Corresponding Source under the terms of this License, in one of these
|
||||||
|
ways:
|
||||||
|
|
||||||
|
- a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
- b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the Corresponding
|
||||||
|
Source from a network server at no charge.
|
||||||
|
- c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
- d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
- e) Convey the object code using peer-to-peer transmission,
|
||||||
|
provided you inform other peers where the object code and
|
||||||
|
Corresponding Source of the work are being offered to the general
|
||||||
|
public at no charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal,
|
||||||
|
family, or household purposes, or (2) anything designed or sold for
|
||||||
|
incorporation into a dwelling. In determining whether a product is a
|
||||||
|
consumer product, doubtful cases shall be resolved in favor of
|
||||||
|
coverage. For a particular product received by a particular user,
|
||||||
|
"normally used" refers to a typical or common use of that class of
|
||||||
|
product, regardless of the status of the particular user or of the way
|
||||||
|
in which the particular user actually uses, or expects or is expected
|
||||||
|
to use, the product. A product is a consumer product regardless of
|
||||||
|
whether the product has substantial commercial, industrial or
|
||||||
|
non-consumer uses, unless such uses represent the only significant
|
||||||
|
mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to
|
||||||
|
install and execute modified versions of a covered work in that User
|
||||||
|
Product from a modified version of its Corresponding Source. The
|
||||||
|
information must suffice to ensure that the continued functioning of
|
||||||
|
the modified object code is in no case prevented or interfered with
|
||||||
|
solely because modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or
|
||||||
|
updates for a work that has been modified or installed by the
|
||||||
|
recipient, or for the User Product in which it has been modified or
|
||||||
|
installed. Access to a network may be denied when the modification
|
||||||
|
itself materially and adversely affects the operation of the network
|
||||||
|
or violates the rules and protocols for communication across the
|
||||||
|
network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
### 7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders
|
||||||
|
of that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
- a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
- b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
- c) Prohibiting misrepresentation of the origin of that material,
|
||||||
|
or requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
- d) Limiting the use for publicity purposes of names of licensors
|
||||||
|
or authors of the material; or
|
||||||
|
- e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
- f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions
|
||||||
|
of it) with contractual assumptions of liability to the recipient,
|
||||||
|
for any liability that these contractual assumptions directly
|
||||||
|
impose on those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions; the
|
||||||
|
above requirements apply either way.
|
||||||
|
|
||||||
|
### 8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your license
|
||||||
|
from a particular copyright holder is reinstated (a) provisionally,
|
||||||
|
unless and until the copyright holder explicitly and finally
|
||||||
|
terminates your license, and (b) permanently, if the copyright holder
|
||||||
|
fails to notify you of the violation by some reasonable means prior to
|
||||||
|
60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
### 9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or run
|
||||||
|
a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
### 10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
### 11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims owned
|
||||||
|
or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within the
|
||||||
|
scope of its coverage, prohibits the exercise of, or is conditioned on
|
||||||
|
the non-exercise of one or more of the rights that are specifically
|
||||||
|
granted under this License. You may not convey a covered work if you
|
||||||
|
are a party to an arrangement with a third party that is in the
|
||||||
|
business of distributing software, under which you make payment to the
|
||||||
|
third party based on the extent of your activity of conveying the
|
||||||
|
work, and under which the third party grants, to any of the parties
|
||||||
|
who would receive the covered work from you, a discriminatory patent
|
||||||
|
license (a) in connection with copies of the covered work conveyed by
|
||||||
|
you (or copies made from those copies), or (b) primarily for and in
|
||||||
|
connection with specific products or compilations that contain the
|
||||||
|
covered work, unless you entered into that arrangement, or that patent
|
||||||
|
license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
### 12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under
|
||||||
|
this License and any other pertinent obligations, then as a
|
||||||
|
consequence you may not convey it at all. For example, if you agree to
|
||||||
|
terms that obligate you to collect a royalty for further conveying
|
||||||
|
from those to whom you convey the Program, the only way you could
|
||||||
|
satisfy both those terms and this License would be to refrain entirely
|
||||||
|
from conveying the Program.
|
||||||
|
|
||||||
|
### 13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
### 14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU General Public License from time to time. Such new versions
|
||||||
|
will be similar in spirit to the present version, but may differ in
|
||||||
|
detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies that a certain numbered version of the GNU General Public
|
||||||
|
License "or any later version" applies to it, you have the option of
|
||||||
|
following the terms and conditions either of that numbered version or
|
||||||
|
of any later version published by the Free Software Foundation. If the
|
||||||
|
Program does not specify a version number of the GNU General Public
|
||||||
|
License, you may choose any version ever published by the Free
|
||||||
|
Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future versions
|
||||||
|
of the GNU General Public License can be used, that proxy's public
|
||||||
|
statement of acceptance of a version permanently authorizes you to
|
||||||
|
choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
### 15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
|
||||||
|
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
|
||||||
|
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
|
||||||
|
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
|
||||||
|
CORRECTION.
|
||||||
|
|
||||||
|
### 16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
|
||||||
|
CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
|
||||||
|
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
|
||||||
|
NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
|
||||||
|
LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
|
||||||
|
TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
|
||||||
|
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
### 17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
## How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these
|
||||||
|
terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest to
|
||||||
|
attach them to the start of each source file to most effectively state
|
||||||
|
the exclusion of warranty; and each file should have at least the
|
||||||
|
"copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 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 General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper
|
||||||
|
mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands \`show w' and \`show c' should show the
|
||||||
|
appropriate parts of the General Public License. Of course, your
|
||||||
|
program's commands might be different; for a GUI interface, you would
|
||||||
|
use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. For more information on this, and how to apply and follow
|
||||||
|
the GNU GPL, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your
|
||||||
|
program into proprietary programs. If your program is a subroutine
|
||||||
|
library, you may consider it more useful to permit linking proprietary
|
||||||
|
applications with the library. If this is what you want to do, use the
|
||||||
|
GNU Lesser General Public License instead of this License. But first,
|
||||||
|
please read <https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
# Privileges Manager
|
||||||
|
|
||||||
|
A visual, searchable GUI for managing player privileges in Luanti (Minetest).
|
||||||
|
Works on **Minetest Game** and **Mineclonia / VoxeLibre**, and can manage
|
||||||
|
**offline players** as well as online ones.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- **Searchable player list** with a search bar — type part of a name and press
|
||||||
|
**Enter** (or click *Search*) to filter. Online players are shown first
|
||||||
|
(● green) above offline players (○ grey).
|
||||||
|
- **Toggle switches** for every registered privilege. Click a switch to grant
|
||||||
|
(green **ON**) or revoke (grey **OFF**) instantly. Each switch shows the
|
||||||
|
privilege description as a tooltip.
|
||||||
|
- **Offline player support** — every account known to the server's auth
|
||||||
|
database is listed, so you can adjust privileges for players who aren't
|
||||||
|
connected. You can also open any player by exact name (bottom-left field),
|
||||||
|
which works even for accounts that don't exist yet.
|
||||||
|
- **Game-aware look** — the formspec uses real coordinates (formspec v4) and
|
||||||
|
adapts its palette to Minetest Game or the Mineclone family automatically.
|
||||||
|
- **Respects the engine permission model** — you need the `privs` privilege to
|
||||||
|
manage any privilege, or `basic_privs` to manage only the privileges listed
|
||||||
|
in the `basic_privs` setting. Privileges you may not grant are shown locked
|
||||||
|
(🔒). Permissions are re-checked on the server for every toggle, so the GUI
|
||||||
|
can't be used to escalate privileges.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
- `/privman` — open the manager.
|
||||||
|
- `/privman <player>` — open it with a player pre-selected.
|
||||||
|
- `/privileges_manager` — alias for `/privman`.
|
||||||
|
|
||||||
|
On games with **sfinv** (e.g. Minetest Game) a *Privileges* tab is added to the
|
||||||
|
inventory for players who may use it. On games with **unified_inventory** a
|
||||||
|
button is added too.
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
- Granting a privilege to a name that has never logged in creates a new account
|
||||||
|
with the server's default password — exactly like the `/grant` command.
|
||||||
|
- Changes take effect immediately; online players are notified in chat.
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
-- Privileges Manager
|
||||||
|
-- A visual, searchable privilege management GUI.
|
||||||
|
|
||||||
|
priviledges_manager = {}
|
||||||
|
|
||||||
|
local modpath = minetest.get_modpath("priviledges_manager")
|
||||||
|
priviledges_manager.modpath = modpath
|
||||||
|
|
||||||
|
-- Detect the running game so the GUI can adapt its look between
|
||||||
|
-- Minetest Game and Mineclonia / VoxeLibre.
|
||||||
|
local game = (minetest.get_game_info and minetest.get_game_info()) or {}
|
||||||
|
priviledges_manager.game_id = game.id or "unknown"
|
||||||
|
priviledges_manager.game_title = game.title or "Luanti"
|
||||||
|
|
||||||
|
-- Mineclone family uses a darker UI palette; Minetest Game a lighter one.
|
||||||
|
local mcl = priviledges_manager.game_id:find("mineclon")
|
||||||
|
or priviledges_manager.game_id:find("voxelibre")
|
||||||
|
or minetest.get_modpath("mcl_core")
|
||||||
|
priviledges_manager.is_mcl = mcl ~= nil
|
||||||
|
|
||||||
|
local src = modpath .. "/src/"
|
||||||
|
dofile(src .. "players.lua")
|
||||||
|
dofile(src .. "privs.lua")
|
||||||
|
dofile(src .. "gui.lua")
|
||||||
|
dofile(src .. "integration.lua")
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
name = priviledges_manager
|
||||||
|
title = Privileges Manager
|
||||||
|
description = A visual, searchable GUI to manage player privileges with toggle switches. Works on Minetest Game and Mineclonia/VoxeLibre, and can manage offline players.
|
||||||
|
author = jamesdavidclarke
|
||||||
|
optional_depends = sfinv, unified_inventory
|
||||||
|
supported_games = voxelibre, mineclone2, mineclonia, minetest_game
|
||||||
|
min_minetest_version = 5.4
|
||||||
|
After Width: | Height: | Size: 106 KiB |
@@ -0,0 +1,347 @@
|
|||||||
|
-- The Privileges Manager formspec: searchable player list on the left,
|
||||||
|
-- toggle-switch privilege rows on the right. Built with formspec version 4
|
||||||
|
-- (real coordinates) so it renders identically on Minetest Game and
|
||||||
|
-- Mineclonia / VoxeLibre.
|
||||||
|
|
||||||
|
local FORMNAME = "priviledges_manager:main"
|
||||||
|
local esc = minetest.formspec_escape
|
||||||
|
|
||||||
|
-- Per-viewer interface state. Cleared when the form is closed.
|
||||||
|
local ctx = {}
|
||||||
|
|
||||||
|
local function get_ctx(name)
|
||||||
|
ctx[name] = ctx[name] or { query = "", target = nil, filtered = {} }
|
||||||
|
return ctx[name]
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Theme colours, adapted to the host game's palette.
|
||||||
|
local THEME = priviledges_manager.is_mcl and {
|
||||||
|
bg = "#0d0d0fee",
|
||||||
|
panel = "#00000055",
|
||||||
|
on = "#3fae54", -- switch ON (green)
|
||||||
|
off = "#5a5a5e", -- switch OFF (grey)
|
||||||
|
locked = "#3a2a2a", -- not grantable by this viewer
|
||||||
|
} or {
|
||||||
|
bg = "#23232bee",
|
||||||
|
panel = "#0000004f",
|
||||||
|
on = "#4caf50",
|
||||||
|
off = "#6d6d75",
|
||||||
|
locked = "#4a3030",
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Layout constants. The formspec is deliberately wide so that long
|
||||||
|
-- privilege descriptions fit on the right without being clipped.
|
||||||
|
local W, H = 19.0, 12.0
|
||||||
|
local PRIV_ROW_H = 1.15
|
||||||
|
local CONTENT_X, CONTENT_Y = 6.1, 2.2
|
||||||
|
local CONTENT_W, CONTENT_H = 12.0, 9.0
|
||||||
|
|
||||||
|
-- Word-wrap `text` into at most `maxlines` lines of about `maxchars`
|
||||||
|
-- characters each, appending an ellipsis if it had to be cut short. This is
|
||||||
|
-- deterministic (no reliance on a widget auto-wrapping), so descriptions can
|
||||||
|
-- never spill under the toggle button.
|
||||||
|
local function wrap(text, maxchars, maxlines)
|
||||||
|
local words = {}
|
||||||
|
for w in tostring(text or ""):gmatch("%S+") do
|
||||||
|
words[#words + 1] = w
|
||||||
|
end
|
||||||
|
|
||||||
|
local lines, cur, i = {}, "", 1
|
||||||
|
while i <= #words do
|
||||||
|
local cand = cur == "" and words[i] or (cur .. " " .. words[i])
|
||||||
|
if #cand <= maxchars then
|
||||||
|
cur = cand
|
||||||
|
i = i + 1
|
||||||
|
elseif cur == "" then
|
||||||
|
-- A single word longer than the line: hard-cut it.
|
||||||
|
cur = words[i]:sub(1, maxchars - 1) .. "\u{2026}"
|
||||||
|
i = i + 1
|
||||||
|
else
|
||||||
|
lines[#lines + 1] = cur
|
||||||
|
cur = ""
|
||||||
|
if #lines == maxlines then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if #lines < maxlines and cur ~= "" then
|
||||||
|
lines[#lines + 1] = cur
|
||||||
|
cur = ""
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Words still remaining means we ran out of lines: mark a truncation.
|
||||||
|
if i <= #words then
|
||||||
|
local last = lines[#lines] or ""
|
||||||
|
if #last + 1 > maxchars then
|
||||||
|
last = last:sub(1, maxchars - 1)
|
||||||
|
end
|
||||||
|
lines[#lines] = last .. "\u{2026}"
|
||||||
|
end
|
||||||
|
|
||||||
|
return lines
|
||||||
|
end
|
||||||
|
|
||||||
|
local function build_player_list(c)
|
||||||
|
local players = priviledges_manager.players.list(c.query)
|
||||||
|
c.filtered = players
|
||||||
|
|
||||||
|
local items, selidx = {}, 0
|
||||||
|
for i, p in ipairs(players) do
|
||||||
|
local marker = p.online and "\u{25CF} " or "\u{25CB} "
|
||||||
|
local colour = p.online and "#7fe07f" or "#bfbfbf"
|
||||||
|
items[i] = colour .. esc(marker .. p.name)
|
||||||
|
if p.name == c.target then
|
||||||
|
selidx = i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return table.concat(items, ","), selidx, #players
|
||||||
|
end
|
||||||
|
|
||||||
|
local function build_priv_rows(c, viewer)
|
||||||
|
if not c.target then
|
||||||
|
return ("label[%f,%f;%s]"):format(
|
||||||
|
CONTENT_X + 0.3, CONTENT_Y + 0.4,
|
||||||
|
esc("Select a player on the left to manage their privileges."))
|
||||||
|
end
|
||||||
|
|
||||||
|
local privs = priviledges_manager.privs.all()
|
||||||
|
local held = minetest.get_player_privs(c.target)
|
||||||
|
|
||||||
|
-- Geometry shared by every row. The toggle is pinned to the right and the
|
||||||
|
-- text is wrapped to end well before it, so they can never overlap.
|
||||||
|
local btn_w, btn_h = 1.7, 0.7
|
||||||
|
local btn_x = CONTENT_W - btn_w - 0.5 -- toggle pinned to the right
|
||||||
|
local text_right = btn_x - 0.3 -- text must end before here
|
||||||
|
local text_w = text_right - 0.5
|
||||||
|
-- Conservative character budget for the wrapped description (tuned for the
|
||||||
|
-- default font so it stays inside even if the smaller font is unavailable).
|
||||||
|
local desc_chars = math.max(12, math.floor(text_w / 0.23))
|
||||||
|
local LINE_H = 0.27
|
||||||
|
|
||||||
|
-- First pass: wrap every description (no truncation) and work out each
|
||||||
|
-- row's height so the full text always fits. Rows grow as tall as needed.
|
||||||
|
local rows = {}
|
||||||
|
local y = 0.1
|
||||||
|
for i, p in ipairs(privs) do
|
||||||
|
local desc = (p.def and p.def.description) or ""
|
||||||
|
local dlines = desc ~= "" and wrap(desc, desc_chars, math.huge) or {}
|
||||||
|
local row_h = #dlines > 0
|
||||||
|
and (0.52 + #dlines * LINE_H + 0.12) or 0.72
|
||||||
|
rows[i] = { p = p, desc = desc, dlines = dlines, y = y, h = row_h }
|
||||||
|
y = y + row_h + 0.06
|
||||||
|
end
|
||||||
|
local content_h = y + 0.05
|
||||||
|
|
||||||
|
-- Size the scrollbar to the actual content so the full list is reachable
|
||||||
|
-- and the thumb reflects how much is visible.
|
||||||
|
local scroll_factor = 0.1
|
||||||
|
local overflow = math.max(0, content_h - CONTENT_H)
|
||||||
|
local max_units = math.ceil(overflow / scroll_factor)
|
||||||
|
local thumb = overflow > 0
|
||||||
|
and math.max(1, math.floor(max_units * CONTENT_H / overflow)) or 0
|
||||||
|
local value = math.min(c.scroll or 0, max_units)
|
||||||
|
|
||||||
|
local fs = {}
|
||||||
|
fs[#fs + 1] = ("scrollbaroptions[arrows=default;max=%d;thumbsize=%d]"):format(
|
||||||
|
max_units, thumb)
|
||||||
|
fs[#fs + 1] = ("scrollbar[%f,%f;0.35,%f;vertical;privscroll;%d]"):format(
|
||||||
|
CONTENT_X + CONTENT_W + 0.05, CONTENT_Y, CONTENT_H, value)
|
||||||
|
fs[#fs + 1] = ("scroll_container[%f,%f;%f,%f;privscroll;vertical;%f]"):format(
|
||||||
|
CONTENT_X, CONTENT_Y, CONTENT_W, CONTENT_H, scroll_factor)
|
||||||
|
|
||||||
|
-- Slightly smaller text for the privilege rows. Only affects labels emitted
|
||||||
|
-- after this point (the rows + nothing else of note before the container end).
|
||||||
|
fs[#fs + 1] = "style_type[label;font_size=*0.9]"
|
||||||
|
|
||||||
|
for _, r in ipairs(rows) do
|
||||||
|
local p, desc, row_h = r.p, r.desc, r.h
|
||||||
|
local is_on = held[p.name] == true
|
||||||
|
local grantable = priviledges_manager.privs.can_grant(viewer, p.name)
|
||||||
|
local btn = "t_" .. p.name
|
||||||
|
|
||||||
|
-- Row background.
|
||||||
|
fs[#fs + 1] = ("box[0.1,%f;%f,%f;#ffffff10]"):format(
|
||||||
|
r.y, CONTENT_W - 0.5, row_h)
|
||||||
|
|
||||||
|
-- Privilege name.
|
||||||
|
fs[#fs + 1] = ("label[0.35,%f;%s]"):format(r.y + 0.27, esc(p.name))
|
||||||
|
|
||||||
|
-- Full description, wrapped across as many lines as it needs.
|
||||||
|
for k, line in ipairs(r.dlines) do
|
||||||
|
fs[#fs + 1] = ("label[0.5,%f;%s]"):format(
|
||||||
|
r.y + 0.52 + (k - 1) * LINE_H, esc(line))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- The toggle switch itself: a coloured button, vertically centred.
|
||||||
|
local colour = grantable and (is_on and THEME.on or THEME.off) or THEME.locked
|
||||||
|
local face = is_on and "ON" or "OFF"
|
||||||
|
if not grantable then
|
||||||
|
face = "\u{1F512}" -- padlock: cannot change this privilege
|
||||||
|
end
|
||||||
|
fs[#fs + 1] = ("style[%s;bgcolor=%s;textcolor=#ffffff]"):format(btn, colour)
|
||||||
|
fs[#fs + 1] = ("button[%f,%f;%f,%f;%s;%s]"):format(
|
||||||
|
btn_x, r.y + (row_h - btn_h) / 2, btn_w, btn_h, btn, face)
|
||||||
|
|
||||||
|
-- Full description on hover: an area tooltip over the text, plus the
|
||||||
|
-- same text on the toggle itself.
|
||||||
|
local tip = desc ~= "" and desc or p.name
|
||||||
|
if not grantable then
|
||||||
|
tip = tip .. "\nYou are not allowed to change this privilege."
|
||||||
|
end
|
||||||
|
fs[#fs + 1] = ("tooltip[%f,%f;%f,%f;%s]"):format(
|
||||||
|
0.1, r.y, text_right, row_h, esc(tip))
|
||||||
|
fs[#fs + 1] = ("tooltip[%s;%s]"):format(btn, esc(tip))
|
||||||
|
end
|
||||||
|
|
||||||
|
fs[#fs + 1] = "scroll_container_end[]"
|
||||||
|
fs[#fs + 1] = "style_type[label;font_size=*1.0]"
|
||||||
|
return table.concat(fs)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function build(viewer)
|
||||||
|
local c = get_ctx(viewer)
|
||||||
|
local list_items, selidx, count = build_player_list(c)
|
||||||
|
|
||||||
|
local target_label
|
||||||
|
if c.target then
|
||||||
|
local online = minetest.get_player_by_name(c.target) ~= nil
|
||||||
|
local known = priviledges_manager.players.exists(c.target)
|
||||||
|
target_label = "Managing: " .. c.target ..
|
||||||
|
(online and " (online)" or known and " (offline)" or " (new account)")
|
||||||
|
else
|
||||||
|
target_label = "No player selected"
|
||||||
|
end
|
||||||
|
|
||||||
|
local fs = {
|
||||||
|
"formspec_version[4]",
|
||||||
|
("size[%f,%f]"):format(W, H),
|
||||||
|
("bgcolor[%s;true]"):format(THEME.bg),
|
||||||
|
|
||||||
|
-- Header.
|
||||||
|
("label[0.4,0.55;%s]"):format(esc("\u{1F511} Privileges Manager \u{2014} " ..
|
||||||
|
priviledges_manager.game_title)),
|
||||||
|
|
||||||
|
-- Left panel: search + player list.
|
||||||
|
("box[0.3,1.0;5.5,%f;%s]"):format(H - 1.3, THEME.panel),
|
||||||
|
"field_close_on_enter[query;false]",
|
||||||
|
("field[0.5,1.25;3.7,0.7;query;;%s]"):format(esc(c.query)),
|
||||||
|
"button[4.3,1.25;1.3,0.7;search;Search]",
|
||||||
|
("tooltip[query;%s]"):format(esc(
|
||||||
|
"Type part of a name and press Enter to filter the list.")),
|
||||||
|
("textlist[0.5,2.15;5.1,%f;playerlist;%s;%d;false]"):format(
|
||||||
|
H - 4.2, list_items, selidx),
|
||||||
|
("label[0.5,%f;%s]"):format(H - 1.85,
|
||||||
|
esc(count .. " player(s) \u{25CF} online \u{25CB} offline")),
|
||||||
|
|
||||||
|
-- Manage an arbitrary (possibly never-seen) account by exact name.
|
||||||
|
"field_close_on_enter[newname;true]",
|
||||||
|
("field[0.5,%f;3.7,0.7;newname;;]"):format(H - 1.5),
|
||||||
|
("button[4.3,%f;1.3,0.7;manage;Open]"):format(H - 1.5),
|
||||||
|
("tooltip[newname;%s]"):format(esc(
|
||||||
|
"Manage an offline player by exact name, then press Enter / Open.")),
|
||||||
|
|
||||||
|
-- Right panel: privilege toggles.
|
||||||
|
("box[6.0,1.0;%f,%f;%s]"):format(W - 6.3, H - 1.3, THEME.panel),
|
||||||
|
("label[6.2,1.55;%s]"):format(esc(target_label)),
|
||||||
|
build_priv_rows(c, viewer),
|
||||||
|
|
||||||
|
"button_exit[" .. ("%f,%f;2.0,0.7;close;Close]"):format(W - 2.3, H - 0.95),
|
||||||
|
}
|
||||||
|
|
||||||
|
return table.concat(fs)
|
||||||
|
end
|
||||||
|
|
||||||
|
function priviledges_manager.show(viewer, target)
|
||||||
|
if target and target ~= "" then
|
||||||
|
local c = get_ctx(viewer)
|
||||||
|
c.target = target
|
||||||
|
priviledges_manager.players.remember(target)
|
||||||
|
end
|
||||||
|
minetest.show_formspec(viewer, FORMNAME, build(viewer))
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
|
if formname ~= FORMNAME then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local viewer = player:get_player_name()
|
||||||
|
|
||||||
|
-- Security: never trust the client. Re-check permission on every action.
|
||||||
|
if not priviledges_manager.privs.can_use(viewer) then
|
||||||
|
minetest.chat_send_player(viewer, "You may no longer use the Privileges Manager.")
|
||||||
|
ctx[viewer] = nil
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
local c = get_ctx(viewer)
|
||||||
|
|
||||||
|
if fields.quit or fields.close then
|
||||||
|
ctx[viewer] = nil
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
local rerender = false
|
||||||
|
|
||||||
|
-- Remember the scroll position so toggling a switch doesn't jump to top.
|
||||||
|
if fields.privscroll then
|
||||||
|
local ev = minetest.explode_scrollbar_event(fields.privscroll)
|
||||||
|
if ev.type == "CHG" then
|
||||||
|
c.scroll = ev.value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Live search (fires on Enter in the query field or the Search button).
|
||||||
|
if fields.query ~= nil and fields.query ~= c.query then
|
||||||
|
c.query = fields.query
|
||||||
|
rerender = true
|
||||||
|
end
|
||||||
|
if fields.search then
|
||||||
|
rerender = true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Player picked from the list.
|
||||||
|
if fields.playerlist then
|
||||||
|
local ev = minetest.explode_textlist_event(fields.playerlist)
|
||||||
|
if ev.type == "CHG" or ev.type == "DCL" then
|
||||||
|
local item = c.filtered[ev.index]
|
||||||
|
if item then
|
||||||
|
c.target = item.name
|
||||||
|
rerender = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Manage an arbitrary account by exact name.
|
||||||
|
if (fields.manage or fields.key_enter_field == "newname")
|
||||||
|
and fields.newname and fields.newname:trim() ~= "" then
|
||||||
|
c.target = fields.newname:trim()
|
||||||
|
priviledges_manager.players.remember(c.target)
|
||||||
|
rerender = true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- A privilege toggle was pressed.
|
||||||
|
for key in pairs(fields) do
|
||||||
|
local priv = key:match("^t_(.+)$")
|
||||||
|
if priv and c.target and minetest.registered_privileges[priv] then
|
||||||
|
if priviledges_manager.privs.can_grant(viewer, priv) then
|
||||||
|
local held = minetest.get_player_privs(c.target)
|
||||||
|
priviledges_manager.privs.set(c.target, priv, not held[priv], viewer)
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(viewer,
|
||||||
|
"You are not allowed to change the '" .. priv .. "' privilege.")
|
||||||
|
end
|
||||||
|
rerender = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if rerender then
|
||||||
|
priviledges_manager.show(viewer)
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end)
|
||||||
|
|
||||||
|
minetest.register_on_leaveplayer(function(player)
|
||||||
|
ctx[player:get_player_name()] = nil
|
||||||
|
end)
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
-- Entry points: chat command, plus optional inventory buttons for the two
|
||||||
|
-- common inventory frameworks (sfinv on Minetest Game, unified_inventory).
|
||||||
|
|
||||||
|
local function open_for(name, target)
|
||||||
|
if not priviledges_manager.privs.can_use(name) then
|
||||||
|
return false, "You need the 'privs' (or 'basic_privs') privilege to manage privileges."
|
||||||
|
end
|
||||||
|
priviledges_manager.show(name, target ~= "" and target or nil)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_chatcommand("privman", {
|
||||||
|
params = "[player]",
|
||||||
|
description = "Open the visual Privileges Manager (optionally for a player)",
|
||||||
|
-- No priv requirement here so basic_privs holders can open it too;
|
||||||
|
-- the real check happens in open_for and on every toggle.
|
||||||
|
func = function(name, param)
|
||||||
|
return open_for(name, param:trim())
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_chatcommand("privileges_manager", {
|
||||||
|
params = "[player]",
|
||||||
|
description = "Alias for /privman",
|
||||||
|
func = function(name, param)
|
||||||
|
return open_for(name, param:trim())
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- sfinv tab (Minetest Game and games that use sfinv).
|
||||||
|
if minetest.get_modpath("sfinv") and sfinv and sfinv.register_page then
|
||||||
|
sfinv.register_page("priviledges_manager:tab", {
|
||||||
|
title = "Privileges",
|
||||||
|
is_in_nav = function(self, player, context)
|
||||||
|
return priviledges_manager.privs.can_use(player:get_player_name())
|
||||||
|
end,
|
||||||
|
get = function(self, player, context)
|
||||||
|
return sfinv.make_formspec(player, context,
|
||||||
|
"button[2.5,3;5,1;privman_open;Open Privileges Manager]"
|
||||||
|
.. "label[0.5,1;Manage player privileges visually.]",
|
||||||
|
false)
|
||||||
|
end,
|
||||||
|
on_player_receive_fields = function(self, player, context, fields)
|
||||||
|
if fields.privman_open then
|
||||||
|
priviledges_manager.show(player:get_player_name())
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- unified_inventory button (used by many games incl. some Mineclone setups).
|
||||||
|
if minetest.get_modpath("unified_inventory") and unified_inventory
|
||||||
|
and unified_inventory.register_button then
|
||||||
|
unified_inventory.register_button("privman", {
|
||||||
|
type = "image",
|
||||||
|
image = "ui_skins_button.png", -- generic; falls back gracefully if missing
|
||||||
|
tooltip = "Privileges Manager",
|
||||||
|
action = function(player)
|
||||||
|
if priviledges_manager.privs.can_use(player:get_player_name()) then
|
||||||
|
priviledges_manager.show(player:get_player_name())
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
condition = function(player)
|
||||||
|
return priviledges_manager.privs.can_use(player:get_player_name())
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
-- Player discovery: online players, plus every account the auth backend
|
||||||
|
-- knows about (so offline players can be managed too).
|
||||||
|
|
||||||
|
priviledges_manager.players = {}
|
||||||
|
|
||||||
|
local storage = minetest.get_mod_storage()
|
||||||
|
local STORE_KEY = "seen_players"
|
||||||
|
|
||||||
|
-- A fallback set of names we have personally seen join. This is only used
|
||||||
|
-- when the active auth handler does not support iterate() (most custom
|
||||||
|
-- auth handlers). The builtin handler does support it, covering everyone.
|
||||||
|
local seen = minetest.deserialize(storage:get_string(STORE_KEY)) or {}
|
||||||
|
|
||||||
|
local function persist()
|
||||||
|
storage:set_string(STORE_KEY, minetest.serialize(seen))
|
||||||
|
end
|
||||||
|
|
||||||
|
local function remember(name)
|
||||||
|
if name and name ~= "" and not seen[name] then
|
||||||
|
seen[name] = true
|
||||||
|
persist()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
priviledges_manager.players.remember = remember
|
||||||
|
|
||||||
|
minetest.register_on_joinplayer(function(player)
|
||||||
|
remember(player:get_player_name())
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Returns a set { [name] = true } of every account we can discover.
|
||||||
|
local function all_known_names()
|
||||||
|
local names = {}
|
||||||
|
|
||||||
|
-- 1. Currently connected players.
|
||||||
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
|
names[player:get_player_name()] = true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 2. Offline accounts via the auth handler, if it supports iteration.
|
||||||
|
local handler = minetest.get_auth_handler and minetest.get_auth_handler()
|
||||||
|
if handler and handler.iterate then
|
||||||
|
-- iterate() returns the full pairs() triple (generator, state, control);
|
||||||
|
-- capture all three so the for-loop has its iterator state.
|
||||||
|
local ok, gen, state, control = pcall(handler.iterate)
|
||||||
|
if ok and type(gen) == "function" then
|
||||||
|
for name in gen, state, control do
|
||||||
|
names[name] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 3. Anyone we have remembered ourselves (fallback / extra safety).
|
||||||
|
for name in pairs(seen) do
|
||||||
|
names[name] = true
|
||||||
|
end
|
||||||
|
|
||||||
|
return names
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Returns a sorted array of { name = string, online = bool } filtered by
|
||||||
|
-- a case-insensitive substring query. Online players are listed first.
|
||||||
|
function priviledges_manager.players.list(query)
|
||||||
|
query = (query or ""):lower()
|
||||||
|
|
||||||
|
local online = {}
|
||||||
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
|
online[player:get_player_name()] = true
|
||||||
|
end
|
||||||
|
|
||||||
|
local result = {}
|
||||||
|
for name in pairs(all_known_names()) do
|
||||||
|
if query == "" or name:lower():find(query, 1, true) then
|
||||||
|
result[#result + 1] = { name = name, online = online[name] == true }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
table.sort(result, function(a, b)
|
||||||
|
if a.online ~= b.online then
|
||||||
|
return a.online -- online players bubble to the top
|
||||||
|
end
|
||||||
|
return a.name:lower() < b.name:lower()
|
||||||
|
end)
|
||||||
|
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
-- True if the account exists in the auth database (used to warn when a
|
||||||
|
-- never-seen name is opened, which would create a fresh account on grant).
|
||||||
|
function priviledges_manager.players.exists(name)
|
||||||
|
local handler = minetest.get_auth_handler and minetest.get_auth_handler()
|
||||||
|
if handler and handler.get_auth then
|
||||||
|
local ok, auth = pcall(handler.get_auth, name)
|
||||||
|
if ok and auth then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return seen[name] == true or minetest.get_player_by_name(name) ~= nil
|
||||||
|
end
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
-- Privilege model: which privileges exist, who may grant them, and the
|
||||||
|
-- safe online/offline grant + revoke operations.
|
||||||
|
|
||||||
|
priviledges_manager.privs = {}
|
||||||
|
|
||||||
|
-- Sorted array of { name = string, def = table } for every registered
|
||||||
|
-- privilege. Works on any game because privileges are an engine concept.
|
||||||
|
function priviledges_manager.privs.all()
|
||||||
|
local list = {}
|
||||||
|
for name, def in pairs(minetest.registered_privileges) do
|
||||||
|
list[#list + 1] = { name = name, def = def }
|
||||||
|
end
|
||||||
|
table.sort(list, function(a, b)
|
||||||
|
return a.name < b.name
|
||||||
|
end)
|
||||||
|
return list
|
||||||
|
end
|
||||||
|
|
||||||
|
-- The set of privileges a "basic_privs" holder is allowed to manage.
|
||||||
|
local function basic_set()
|
||||||
|
local set = {}
|
||||||
|
local conf = minetest.settings:get("basic_privs") or "interact,shout"
|
||||||
|
for _, priv in ipairs(conf:split(",")) do
|
||||||
|
set[priv:trim()] = true
|
||||||
|
end
|
||||||
|
return set
|
||||||
|
end
|
||||||
|
priviledges_manager.privs.basic_set = basic_set
|
||||||
|
|
||||||
|
-- May `granter` toggle privilege `priv`? Mirrors the engine's /grant rules:
|
||||||
|
-- * "privs" -> may manage any privilege
|
||||||
|
-- * "basic_privs" -> may manage only privileges in the basic_privs setting
|
||||||
|
function priviledges_manager.privs.can_grant(granter, priv)
|
||||||
|
local gp = minetest.get_player_privs(granter)
|
||||||
|
if gp.privs then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
if gp.basic_privs then
|
||||||
|
return basic_set()[priv] == true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- May `name` open the manager at all? (Has any granting capability.)
|
||||||
|
function priviledges_manager.privs.can_use(name)
|
||||||
|
local gp = minetest.get_player_privs(name)
|
||||||
|
return gp.privs == true or gp.basic_privs == true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Apply a single privilege change. `value` true = grant, false = revoke.
|
||||||
|
-- Works for offline players via the auth handler. set_player_privs runs the
|
||||||
|
-- registered on_grant / on_revoke callbacks itself, so we must not double-run.
|
||||||
|
function priviledges_manager.privs.set(target, priv, value, caller)
|
||||||
|
local privs = minetest.get_player_privs(target)
|
||||||
|
|
||||||
|
-- Revoking must remove the key entirely; the engine warns on a `false`
|
||||||
|
-- value passed through set_player_privs.
|
||||||
|
privs[priv] = value and true or nil
|
||||||
|
minetest.set_player_privs(target, privs)
|
||||||
|
|
||||||
|
-- Keep our own seen-list in sync so freshly created accounts show up.
|
||||||
|
priviledges_manager.players.remember(target)
|
||||||
|
|
||||||
|
-- Notify the affected player if they are online.
|
||||||
|
if minetest.get_player_by_name(target) then
|
||||||
|
local verb = value and "granted to" or "revoked from"
|
||||||
|
minetest.chat_send_player(target,
|
||||||
|
minetest.colorize("#f5d76e",
|
||||||
|
("[Privileges] '%s' was %s you by %s."):format(priv, verb, caller)))
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.log("action",
|
||||||
|
("[priviledges_manager] %s %s '%s' for %s"):format(
|
||||||
|
caller, value and "granted" or "revoked", priv, target))
|
||||||
|
end
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
name: luacheck
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
luacheck:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@master
|
||||||
|
- name: Luacheck
|
||||||
|
uses: lunarmodules/luacheck@master
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
read_globals = {
|
||||||
|
"core",
|
||||||
|
"unifieddyes",
|
||||||
|
"default"
|
||||||
|
}
|
||||||
|
|
||||||
|
globals = {
|
||||||
|
"unifiedbricks"
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
unifiedbricks
|
||||||
|
|
||||||
|
Code license: WTFPL
|
||||||
|
Texture license: WTFPL
|
||||||
|
|
||||||
|
depends: unifieddyes, default
|
||||||
|
|
||||||
|
Adds configurable clay blocks, clay lumps, bricks, and brick blocks. Includes
|
||||||
|
all of the colors that unifieddyes offers (which amounts to 89 clayblocks, clay
|
||||||
|
lumps, bricks, brick blocks, leaving 356 total).
|
||||||
|
|
||||||
|
Now returns glass bottles and empty buckets when appropriate.
|
||||||
|
|
||||||
|
Settings at the top of init.lua:
|
||||||
|
SETTING_allow_default_coloring = 1
|
||||||
|
When set to 1, default clay + unifieddyes dye = unifiedbricks clay lump
|
||||||
|
SETTING_allow_hues = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
|
||||||
|
Each number represents a hue (red, orange, yellow ...). When a value is
|
||||||
|
set to 0, that hue is disabled.
|
||||||
|
SETTING_allow_types = {1,1,1,1}
|
||||||
|
Same, except these represent clay blocks, clay lumps, etc.
|
||||||
|
SETTING_allow_saturation = {1,1}
|
||||||
|
Represents low saturation and full saturation, respectively.
|
||||||
|
SETTING_allow_darkness = {1,1,1,1}
|
||||||
|
Represents dark, medium, bright, and light colors, respectively.
|
||||||
|
|
||||||
|
Furthermore, a list of names is included below that, from which you can
|
||||||
|
change, for example, "red" to "mahogany".
|
||||||
|
|
||||||
|
WARNING: if you remove something important, such as clay lumps, you'll have to
|
||||||
|
cheat to get some items.
|
||||||
|
|
||||||
|
If you don't like what I did, tell me or use one of github's fancy features or
|
||||||
|
do it yourself or whatever. Hint: I would absolutely love to have some better
|
||||||
|
looking textures, especially the brick and clay textures.
|
||||||
|
|
||||||
|
Used VanessaE's gentextures.sh to change the texture colors.
|
||||||
@@ -0,0 +1,379 @@
|
|||||||
|
--Unified Bricks by Vsevolod Borislav (wowiamdiamonds)
|
||||||
|
--
|
||||||
|
--License: WTFPL
|
||||||
|
--
|
||||||
|
--Depends: default, bucket, unifieddyes, vessels
|
||||||
|
--
|
||||||
|
--Obviously, offers the same colors in unifieddyes.
|
||||||
|
--Thanks go to VanessaE for making unifieddyes, gentextures.sh, etc.
|
||||||
|
|
||||||
|
unifiedbricks = {}
|
||||||
|
unifiedbricks.old_static_list = {}
|
||||||
|
unifiedbricks.old_static_list_formals = {}
|
||||||
|
|
||||||
|
core.register_alias("unifieddyes:white","unifieddyes:white_paint")
|
||||||
|
core.register_alias("unifieddyes:lightgrey","unifieddyes:lightgrey_paint")
|
||||||
|
core.register_alias("unifieddyes:grey","unifieddyes:grey_paint")
|
||||||
|
core.register_alias("unifieddyes:darkgrey","unifieddyes:darkgrey_paint")
|
||||||
|
|
||||||
|
local HUES = {
|
||||||
|
"red",
|
||||||
|
"orange",
|
||||||
|
"yellow",
|
||||||
|
"lime",
|
||||||
|
"green",
|
||||||
|
"aqua",
|
||||||
|
"cyan",
|
||||||
|
"skyblue",
|
||||||
|
"blue",
|
||||||
|
"violet",
|
||||||
|
"magenta",
|
||||||
|
"redviolet",
|
||||||
|
"black",
|
||||||
|
"darkgrey",
|
||||||
|
"grey",
|
||||||
|
"lightgrey",
|
||||||
|
"white"
|
||||||
|
}
|
||||||
|
local SATURATION = {
|
||||||
|
"_s50",
|
||||||
|
""
|
||||||
|
}
|
||||||
|
local DARKNESS = {
|
||||||
|
"dark_",
|
||||||
|
"medium_",
|
||||||
|
"",
|
||||||
|
"light_"
|
||||||
|
}
|
||||||
|
--formal versions
|
||||||
|
local FORMALHUES = {
|
||||||
|
"Red",
|
||||||
|
"Orange",
|
||||||
|
"Yellow",
|
||||||
|
"Lime",
|
||||||
|
"Green",
|
||||||
|
"Aqua",
|
||||||
|
"Cyan",
|
||||||
|
"Sky blue",
|
||||||
|
"Blue",
|
||||||
|
"Violet",
|
||||||
|
"Magenta",
|
||||||
|
"Red violet",
|
||||||
|
"Black",
|
||||||
|
"Dark grey",
|
||||||
|
"Grey",
|
||||||
|
"Light grey",
|
||||||
|
"White"
|
||||||
|
}
|
||||||
|
local FORMALSATURATION = {
|
||||||
|
" (low saturation)",
|
||||||
|
""
|
||||||
|
}
|
||||||
|
local FORMALDARKNESS = {
|
||||||
|
"Dark ",
|
||||||
|
"Medium ",
|
||||||
|
"Bright ",
|
||||||
|
"Light "
|
||||||
|
}
|
||||||
|
|
||||||
|
-- param2-coloring-enabled nodes
|
||||||
|
|
||||||
|
core.register_node("unifiedbricks:brickblock", {
|
||||||
|
description = "Brick Block",
|
||||||
|
tiles = {
|
||||||
|
"unifiedbricks_brickblock.png"
|
||||||
|
},
|
||||||
|
overlay_tiles = {
|
||||||
|
{ name = "unifiedbricks_mortar.png", color = "white" }
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "color",
|
||||||
|
palette = "unifieddyes_palette_extended.png",
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {cracky=3, not_in_creative_inventory=1, ud_param2_colorable = 1},
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
on_construct = unifieddyes.on_construct,
|
||||||
|
preserve_metadata = unifieddyes.preserve_metadata,
|
||||||
|
on_dig = not unifieddyes.preserve_metadata and unifieddyes.on_dig or nil
|
||||||
|
})
|
||||||
|
|
||||||
|
core.override_item("default:brick", {
|
||||||
|
palette = "unifieddyes_palette_extended.png",
|
||||||
|
airbrush_replacement_node = "unifiedbricks:brickblock",
|
||||||
|
groups = {cracky = 3, ud_param2_colorable = 1},
|
||||||
|
})
|
||||||
|
|
||||||
|
core.register_node("unifiedbricks:clayblock", {
|
||||||
|
description = "Clay Block",
|
||||||
|
tiles = {
|
||||||
|
"unifiedbricks_clayblock.png",
|
||||||
|
},
|
||||||
|
paramtype2 = "color",
|
||||||
|
palette = "unifieddyes_palette_extended.png",
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {crumbly=3, not_in_creative_inventory=1, ud_param2_colorable = 1},
|
||||||
|
sounds = default.node_sound_dirt_defaults({
|
||||||
|
footstep = "",
|
||||||
|
}),
|
||||||
|
on_construct = unifieddyes.on_construct,
|
||||||
|
preserve_metadata = unifieddyes.preserve_metadata,
|
||||||
|
on_dig = not unifieddyes.preserve_metadata and unifieddyes.on_dig or nil
|
||||||
|
})
|
||||||
|
|
||||||
|
core.override_item("default:clay", {
|
||||||
|
palette = "unifieddyes_palette_extended.png",
|
||||||
|
airbrush_replacement_node = "unifiedbricks:clayblock",
|
||||||
|
groups = {crumbly = 3, ud_param2_colorable = 1},
|
||||||
|
})
|
||||||
|
|
||||||
|
core.register_node("unifiedbricks:brickblock_multicolor_dark", {
|
||||||
|
description = "Brick block (dark multicolor)",
|
||||||
|
tiles = {
|
||||||
|
"unifiedbricks_brickblock_multicolor_dark.png",
|
||||||
|
},
|
||||||
|
overlay_tiles = {
|
||||||
|
{ name = "unifiedbricks_mortar.png", color = "white" }
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "color",
|
||||||
|
palette = "unifieddyes_palette_extended.png",
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {cracky=3, ud_param2_colorable = 1},
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
on_construct = unifieddyes.on_construct,
|
||||||
|
preserve_metadata = unifieddyes.preserve_metadata,
|
||||||
|
on_dig = not unifieddyes.preserve_metadata and unifieddyes.on_dig or nil
|
||||||
|
})
|
||||||
|
|
||||||
|
core.register_node("unifiedbricks:brickblock_multicolor_medium", {
|
||||||
|
description = "Brick block (medium multicolor)",
|
||||||
|
tiles = {
|
||||||
|
"unifiedbricks_brickblock_multicolor_medium.png"
|
||||||
|
},
|
||||||
|
overlay_tiles = {
|
||||||
|
{ name = "unifiedbricks_mortar.png", color = "white" }
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "color",
|
||||||
|
palette = "unifieddyes_palette_extended.png",
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {cracky=3, ud_param2_colorable = 1},
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
on_construct = unifieddyes.on_construct,
|
||||||
|
preserve_metadata = unifieddyes.preserve_metadata,
|
||||||
|
on_dig = not unifieddyes.preserve_metadata and unifieddyes.on_dig or nil
|
||||||
|
})
|
||||||
|
|
||||||
|
core.register_node("unifiedbricks:brickblock_multicolor_light", {
|
||||||
|
description = "Brick block (light multicolor)",
|
||||||
|
tiles = {
|
||||||
|
"unifiedbricks_brickblock_multicolor_light.png"
|
||||||
|
},
|
||||||
|
overlay_tiles = {
|
||||||
|
{ name = "unifiedbricks_mortar.png", color = "white" }
|
||||||
|
},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "color",
|
||||||
|
palette = "unifieddyes_palette_extended.png",
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {cracky=3, ud_param2_colorable = 1},
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
on_construct = unifieddyes.on_construct,
|
||||||
|
preserve_metadata = unifieddyes.preserve_metadata,
|
||||||
|
on_dig = not unifieddyes.preserve_metadata and unifieddyes.on_dig or nil
|
||||||
|
})
|
||||||
|
|
||||||
|
core.register_craft( {
|
||||||
|
type = "shapeless",
|
||||||
|
output = "unifiedbricks:brickblock_multicolor_dark",
|
||||||
|
recipe = {
|
||||||
|
"default:brick",
|
||||||
|
"unifieddyes:grey",
|
||||||
|
"unifieddyes:dark_grey",
|
||||||
|
"unifieddyes:dark_grey"
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
core.register_craft( {
|
||||||
|
type = "shapeless",
|
||||||
|
output = "unifiedbricks:brickblock_multicolor_medium",
|
||||||
|
recipe = {
|
||||||
|
"default:brick",
|
||||||
|
"unifieddyes:white",
|
||||||
|
"unifieddyes:grey",
|
||||||
|
"unifieddyes:dark_grey"
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
core.register_craft( {
|
||||||
|
type = "shapeless",
|
||||||
|
output = "unifiedbricks:brickblock_multicolor_light",
|
||||||
|
recipe = {
|
||||||
|
"default:brick",
|
||||||
|
"unifieddyes:white",
|
||||||
|
"unifieddyes:white",
|
||||||
|
"unifieddyes:grey"
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
unifieddyes.register_color_craft({
|
||||||
|
output = "unifiedbricks:brickblock",
|
||||||
|
palette = "extended",
|
||||||
|
neutral_node = "default:brick",
|
||||||
|
type = "shapeless",
|
||||||
|
recipe = {
|
||||||
|
"NEUTRAL_NODE",
|
||||||
|
"MAIN_DYE"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
unifieddyes.register_color_craft({
|
||||||
|
output = "unifiedbricks:clayblock",
|
||||||
|
palette = "extended",
|
||||||
|
neutral_node = "default:clay",
|
||||||
|
type = "shapeless",
|
||||||
|
recipe = {
|
||||||
|
"NEUTRAL_NODE",
|
||||||
|
"MAIN_DYE"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
unifieddyes.register_color_craft({
|
||||||
|
output = "unifiedbricks:brickblock_multicolor_dark",
|
||||||
|
palette = "extended",
|
||||||
|
neutral_node = "unifiedbricks:brickblock_multicolor_dark",
|
||||||
|
type = "shapeless",
|
||||||
|
recipe = {
|
||||||
|
"NEUTRAL_NODE",
|
||||||
|
"MAIN_DYE"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
unifieddyes.register_color_craft({
|
||||||
|
output = "unifiedbricks:brickblock_multicolor_medium",
|
||||||
|
palette = "extended",
|
||||||
|
neutral_node = "unifiedbricks:brickblock_multicolor_medium",
|
||||||
|
type = "shapeless",
|
||||||
|
recipe = {
|
||||||
|
"NEUTRAL_NODE",
|
||||||
|
"MAIN_DYE"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
unifieddyes.register_color_craft({
|
||||||
|
output = "unifiedbricks:brickblock_multicolor_light",
|
||||||
|
palette = "extended",
|
||||||
|
neutral_node = "unifiedbricks:brickblock_multicolor_light",
|
||||||
|
type = "shapeless",
|
||||||
|
recipe = {
|
||||||
|
"NEUTRAL_NODE",
|
||||||
|
"MAIN_DYE"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
-- static nodes
|
||||||
|
|
||||||
|
unifiedbricks.register_old_static_block = function(name, formalname, blocktype)
|
||||||
|
table.insert(unifiedbricks.old_static_list, "unifiedbricks:"..blocktype.."_"..name)
|
||||||
|
table.insert(unifiedbricks.old_static_list_formals, formalname)
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, color in ipairs(HUES) do
|
||||||
|
table.insert(unifiedbricks.old_static_list, "unifiedbricks:multicolor_dark_"..color)
|
||||||
|
table.insert(unifiedbricks.old_static_list, "unifiedbricks:multicolor_medium_"..color)
|
||||||
|
table.insert(unifiedbricks.old_static_list, "unifiedbricks:multicolor_light_"..color)
|
||||||
|
end
|
||||||
|
|
||||||
|
table.insert(unifiedbricks.old_static_list, "unifiedbricks:multicolor_darkgrey")
|
||||||
|
table.insert(unifiedbricks.old_static_list, "unifiedbricks:multicolor_grey")
|
||||||
|
table.insert(unifiedbricks.old_static_list, "unifiedbricks:multicolor_lightgrey")
|
||||||
|
|
||||||
|
--REGISTERS ALL STATIC NODES EXCEPT MULTICOLOR BRICK BLOCKS
|
||||||
|
for i = 1,17 do
|
||||||
|
for j = 1,4 do
|
||||||
|
if i > 12 then
|
||||||
|
local formalname = FORMALHUES[i]
|
||||||
|
local name = HUES[i]
|
||||||
|
if j == 1 then
|
||||||
|
unifiedbricks.register_old_static_block(name, formalname, "clayblock")
|
||||||
|
elseif j == 4 then
|
||||||
|
unifiedbricks.register_old_static_block(name, formalname, "brickblock")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
for k = 1,4 do
|
||||||
|
local formalname, name
|
||||||
|
if k == 4 then
|
||||||
|
formalname = FORMALDARKNESS[k] .. FORMALHUES[i]
|
||||||
|
name = DARKNESS[k] .. HUES[i]
|
||||||
|
if j == 1 then
|
||||||
|
unifiedbricks.register_old_static_block(name, formalname, "clayblock")
|
||||||
|
elseif j == 4 then
|
||||||
|
unifiedbricks.register_old_static_block(name, formalname, "brickblock")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
for l = 1,2 do
|
||||||
|
formalname = FORMALDARKNESS[k] .. FORMALHUES[i] .. FORMALSATURATION[l]
|
||||||
|
name = DARKNESS[k] .. HUES[i] .. SATURATION[l]
|
||||||
|
if j == 1 then
|
||||||
|
unifiedbricks.register_old_static_block(name, formalname, "clayblock")
|
||||||
|
elseif j == 4 then
|
||||||
|
unifiedbricks.register_old_static_block(name, formalname, "brickblock")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- convert in-map static nodes to use param2 coloring
|
||||||
|
|
||||||
|
core.register_lbm({
|
||||||
|
name = "unifiedbricks:convert_brickblocks",
|
||||||
|
label = "Convert clay blocks and single-color brick blocks to use param2 color",
|
||||||
|
run_at_every_load = false,
|
||||||
|
nodenames = unifiedbricks.old_static_list,
|
||||||
|
action = function(pos, node)
|
||||||
|
|
||||||
|
local name = node.name
|
||||||
|
local t = string.find(name, "_")
|
||||||
|
local type = string.sub(name, 1, t - 1)
|
||||||
|
local color1 = string.sub(name, t + 1)
|
||||||
|
|
||||||
|
local color2 = string.gsub(color1, "grey", "_grey")
|
||||||
|
if color2 == "_grey" then color2 = "grey" end
|
||||||
|
|
||||||
|
local paletteidx, hue = unifieddyes.getpaletteidx("unifieddyes:"..color2, "extended")
|
||||||
|
if not paletteidx or not hue then return end
|
||||||
|
|
||||||
|
if string.find(type, "multicolor") then
|
||||||
|
|
||||||
|
local newpalette = (hue*8)+1
|
||||||
|
local shade
|
||||||
|
|
||||||
|
if string.find(name, "dark") then
|
||||||
|
shade = "dark"
|
||||||
|
elseif string.find(name, "medium")
|
||||||
|
or name == "unifiedbricks:multicolor_grey" then
|
||||||
|
shade = "medium"
|
||||||
|
else
|
||||||
|
shade = "light"
|
||||||
|
end
|
||||||
|
if string.find(name, "grey") then
|
||||||
|
newpalette = 2
|
||||||
|
end
|
||||||
|
|
||||||
|
core.set_node(pos, { name = "unifiedbricks:brickblock_multicolor_"..shade, param2 = newpalette })
|
||||||
|
|
||||||
|
elseif string.find(type, "brickblock") then
|
||||||
|
core.set_node(pos, { name = "unifiedbricks:brickblock", param2 = paletteidx })
|
||||||
|
elseif string.find(type, "clayblock") then
|
||||||
|
core.set_node(pos, { name = "unifiedbricks:clayblock", param2 = paletteidx })
|
||||||
|
end
|
||||||
|
local meta = core.get_meta(pos)
|
||||||
|
meta:set_string("dye", "unifieddyes:"..color1)
|
||||||
|
meta:set_string("palette", "ext")
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
print("[UnifiedBricks] Loaded!")
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
name = unifiedbricks
|
||||||
|
description = This mod allows the user to re-color default bricks using Unified Dyes, and provides some pattern variations as well.
|
||||||
|
depends = default, bucket, unifieddyes, vessels
|
||||||
|
After Width: | Height: | Size: 88 KiB |
|
After Width: | Height: | Size: 110 B |
|
After Width: | Height: | Size: 209 B |
|
After Width: | Height: | Size: 216 B |
|
After Width: | Height: | Size: 219 B |
|
After Width: | Height: | Size: 264 B |
|
After Width: | Height: | Size: 170 B |
@@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
name: luacheck
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: apt
|
||||||
|
run: sudo apt-get install -y luarocks
|
||||||
|
- name: luacheck install
|
||||||
|
run: luarocks install --local luacheck
|
||||||
|
- name: luacheck run
|
||||||
|
run: $HOME/.luarocks/bin/luacheck ./
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
unused_args = false
|
||||||
|
allow_defined_top = true
|
||||||
|
|
||||||
|
exclude_files = {".luacheckrc"}
|
||||||
|
|
||||||
|
globals = {
|
||||||
|
"minetest", "core",
|
||||||
|
|
||||||
|
--mod provided
|
||||||
|
"unifieddyes",
|
||||||
|
}
|
||||||
|
|
||||||
|
read_globals = {
|
||||||
|
string = {fields = {"split"}},
|
||||||
|
table = {fields = {"copy", "getn"}},
|
||||||
|
|
||||||
|
--luac
|
||||||
|
"math", "table",
|
||||||
|
|
||||||
|
-- Builtin
|
||||||
|
"vector", "ItemStack", "dump", "DIR_DELIM", "VoxelArea", "Settings", "PcgRandom", "VoxelManip", "PseudoRandom",
|
||||||
|
|
||||||
|
--mod produced
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
### API
|
||||||
|
|
||||||
|
This section details the Unified Dyes API and how to use it with your mods.
|
||||||
|
|
||||||
|
In your node definition, you must include a few things to interface with Unified Dyes. Here is an example:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
minetest.register_node("mymod:colored_node", {
|
||||||
|
description = "My custom colored node",
|
||||||
|
tiles = { "mymod_custom_colored_node.png" },
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "color",
|
||||||
|
palette = "unifieddyes_palette_extended.png",
|
||||||
|
groups = {snappy = 1, cracky = 2, ud_param2_colorable = 1},
|
||||||
|
airbrush_replacement_node = "mymod:my_other_colored_node",
|
||||||
|
preserve_metadata = unifieddyes.preserve_metadata
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
`paramtype2` must be one of:
|
||||||
|
- "color": this is an 89-color or 256-color node
|
||||||
|
- "colorwallmounted": this is a 32-color node using "wallmounted" mode
|
||||||
|
- "colorfacedir": this node uses one of the "split" 89-color palettes.
|
||||||
|
|
||||||
|
`palette` must be set to match the `paramtype2` setting, and must be one of:
|
||||||
|
- "unifieddyes_palette.png"
|
||||||
|
- "unifieddyes_palette_extended.png"
|
||||||
|
- "unifieddyes_palette_colorwallmounted.png"
|
||||||
|
- or one of the "split" hues palettes (see below).
|
||||||
|
|
||||||
|
`groups`: If your node can be colored by using the airbrush, its groups entry must contain the key ud_param2_colorable = 1, among whatever else you'd normally put there. If the node is software-controlled, as might be the case for some mesecons-digilines aware node, then this group key should be omitted.
|
||||||
|
|
||||||
|
If your node if of the kind where you need the split palette, but you need to put the *full color name* into the node name, as opposed to just the hue, then add the keys `ud_color_start` and `ud_color_end` and set them to the positions of the first and last characters of the color name (where 1 is the first character of the mod name at the start of the node name, i.e. "mymod:foo_bar_orange_baz" would have the start set to 15 and the end at 20).
|
||||||
|
|
||||||
|
`airbrush_replacement_node`: The node to swap in when the airbrush is used on this node. For example, you could `minetest.override_item()` on some default node to add this field, pointing to a colorable node of your own, so that when the default node is painted, it's replaced with yours in the new color.
|
||||||
|
|
||||||
|
#### Function calls
|
||||||
|
|
||||||
|
**`unifieddyes.preserve_metadata(pos, oldnode, oldmeta, drops)`**
|
||||||
|
|
||||||
|
Set in a node definition's `preserve_metadata` callback, this makes sure that if the player digs a neutral node, i.e. a colorable node that was left uncolored/white after placing, they receive a version of that item that has been stripped of its itemstack color setting, so that it is identical to what would have been in their inventory when that node was originally placed. This prevents the engine splitting stacks of that item due to technically-different but visually-identical itemstack coloring. This function is only needed in the definition of colorable versions of a node, not any uncolored counterparts. For example, if you have a mod that has a simple, wooden chair, and the mod turns it into one with a colored seat cushion when you airbrush or craft it with dye, then only that latter colored-seat version needs this function.
|
||||||
|
|
||||||
|
**`unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)`
|
||||||
|
`unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)`**
|
||||||
|
|
||||||
|
These two are used to re-orient `wallmounted` nodes after placing. The former allows positioning to floor, ceiling, and four walls, while the latter restricts the rotation to just the four walls. The latter is most often used with a node whose model is designed so that the four wall positions actually place the model "upright", facing +/- X or Z. This is a hacky way to make a node look like it has basic `facedir` capability, while being able to use the 32-color palette.
|
||||||
|
|
||||||
|
**`unifieddyes.fix_after_screwdriver_nsew(pos, node, user, mode, new_param2)`**
|
||||||
|
|
||||||
|
This serves the same purpose as the `fix_rotation_nsew`, but is used to restrict the node's rotation after it's been hit with the screwdriver.
|
||||||
|
|
||||||
|
**`unifieddyes.is_buildable_to(placer_name, ...)`**
|
||||||
|
|
||||||
|
Again, another obvious one, returns whether or not the pointed node is `buildable_to` (can be overwritten by another node).
|
||||||
|
|
||||||
|
**`unifieddyes.get_hsv(name)`**
|
||||||
|
|
||||||
|
Accepts an item name, and returns the corresponding hue, saturation, and value (in that order), as strings.
|
||||||
|
|
||||||
|
If the item name is a color (not greyscale), then `hue` will be the basic hue for that color, saturation will be empty string for high saturation or "\_s50" for low, and value will be "dark_", "medium_", "light_", or an empty string if it's full color.
|
||||||
|
|
||||||
|
If the item name is greyscale, then `hue` will contain "white", "light_grey", "grey", "dark_grey", or "black", saturation will (ironically) be an empty string, and value will be "light_", "dark_", or empty string to correspond with the contents of `hue`.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
* "mymod:mynode_red" would return ("red", "", "")
|
||||||
|
* "mymod:mynode_light_blue" would return ("blue", "", "light_")
|
||||||
|
* "mymod:mynode_dark_yellow_s50" would return ("yellow", "_s50", "dark_")
|
||||||
|
* "mymod:mynode_dark_grey" would return ("dark_grey", "", "dark_")
|
||||||
|
|
||||||
|
**`unifieddyes.getpaletteidx(color, palette_type)`**
|
||||||
|
|
||||||
|
When given a `color` string (in the form of "dye:foo" or "unifieddyes:foo") and `palette_type` (either a boolean or string), this function returns the numerical index into that palette, and the hue name as a string.
|
||||||
|
* `false` or `nil`: the 89-color palette
|
||||||
|
* `true`: 89 color "split" palette mode, for nodes that need full `facedir` support. In this case, the returned hue will be the color of whichever of the 13 "split" palettes the node is using, and the index will be 1-7, representing the shade within that palette. See my coloredwoods mod for more information on how this mode is used. If the node is black, white, or grey, the hue will be set to 0.
|
||||||
|
* `wallmounted`: the 32-color palette, for nodes using `colorwallmounted` mode.
|
||||||
|
* `extended`: the 256-color "extended" palette
|
||||||
|
|
||||||
|
**`unifieddyes.color_to_name(param2, def)`**
|
||||||
|
|
||||||
|
This function will attempt to return the name of the color indicated by `param2`. `palette` tells the function which palette filename was used with that param2 value. The returned value should be suitable as a dye item name when prefixed with "dye:".
|
||||||
|
|
||||||
|
**`unifieddyes.on_airbrush(itemstack, player, pointed_thing)`**
|
||||||
|
|
||||||
|
This is called when a node is punched while wielding the airbrush.
|
||||||
|
|
||||||
|
**`unifieddyes.show_airbrush_form(player)`**
|
||||||
|
|
||||||
|
This one does just what it sounds like - it shows the color selector formspec.
|
||||||
|
|
||||||
|
**`unifieddyes.register_color_craft(recipe)`**
|
||||||
|
|
||||||
|
This will loop through all of Unified Dyes' color lists, generating one recipe for every color in the palette given in the call. Example usage:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
unifieddyes.register_color_craft({
|
||||||
|
output = "mymod:colored_node 6",
|
||||||
|
palette = "extended",
|
||||||
|
neutral_node = "mymod:my_base_node_material",
|
||||||
|
recipe = {
|
||||||
|
{ "NEUTRAL_NODE", "MAIN_DYE", "NEUTRAL_NODE" },
|
||||||
|
{ "MAIN_DYE", "NEUTRAL_NODE", "MAIN_DYE" },
|
||||||
|
{ "NEUTRAL_NODE", "MAIN_DYE", "NEUTRAL_NODE" }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
`output` is a standard item string as in the normal `minetest.register_craft()` call.
|
||||||
|
|
||||||
|
`palette` specifies the palette type to iterate through ("extended" and "wallmounted" are obvious, and if not specified, it'll use the 89 color palette).
|
||||||
|
|
||||||
|
`type` can be "shapeless" or unspecified/`nil`, and works the same as in the normal call.
|
||||||
|
|
||||||
|
`neutral_node` should specify the name of whatever item or node serves as the base, neutrally-colored material in your recipe. This really only applies if your node is just made from one item (or more than one of the same item), plus one or more dyes. If your node is just made from a collection of assorted items and no one item is really the neutral material, or anyway if you don't need this substitution, you must set it to an empty string.
|
||||||
|
|
||||||
|
`recipe` is the same as in the normal call, except that Unified Dyes will replace all instances of the string "NEUTRAL_NODE" with the item specified in the preceding `neutral_node` field. Every instance of "MAIN_DYE" will be replaced with a portion of dye, as Unified Dyes' recipe helper works through its color lists (i.e. this field will become whatever dye is needed for each recipe).
|
||||||
|
|
||||||
|
`output_prefix` and `output_suffix`, if specified (must use both if at all), will cause the recipe registration to set to the output item to `output_prefix` + (hue) + `output_suffix` + `output`. Used for mods that use the split 89-color palette. `hue` will thus be one of the 12 hues, or "grey", as defined by the split palettes. In this situation, you can set `output` to your recipe yield (with a leading space) if needed. For example, if the prefix is "foo:bar", the suffix is "baz", and the output is set to " 3", then the craft helper will generate output item strings of the form "foo:bar_COLOR_baz 3", for each color in the table.
|
||||||
|
|
||||||
|
**`unifieddyes.make_colored_itemstack(itemstack, palette, color)`**
|
||||||
|
|
||||||
|
Makes a colored itemstack out of the given `itemstack` and `color` (as a dye, e.g. "dye:dark_red_s50"), setting the correct index per the `palette` field, which works as described above for `unifieddyes.getpaletteidx()`. Said itemstack is returned as a string suitable for use as the output field of a craft recipe, equal in size to the itemstack passed into the function (e.g. if you give it "mymod:colored_node 7", it'll return a stack of 7 colored items).
|
||||||
|
|
||||||
|
**`unifieddyes.generate_split_palette_nodes(name, def, drop)`**
|
||||||
|
|
||||||
|
Does just what it sounds like - it registers all the nodes that are needed for a given base node (`def`) to be able to use the split palette, each named according to `name`, with the palette hue appended. If a custom drop is needed, it can be passed along (only a string is allowed here, specifying a single item).
|
||||||
|
|
||||||
|
**`unifieddyes.on_dig(pos, node, digger)`** _(Deprecated)_
|
||||||
|
|
||||||
|
Don't use this. It is superseded by `unifieddyes.preserve_metadata`.
|
||||||
|
|
||||||
|
#### Tables
|
||||||
|
|
||||||
|
In addition to the above API calls, Unified Dyes provides several useful tables
|
||||||
|
|
||||||
|
`unifieddyes.HUES` contains a list of the 12 hues used by the 89-color palette.
|
||||||
|
|
||||||
|
`unifieddyes.HUES_EXTENDED` contains a list of the 24 hues in the 256-color palette. Each line contains the color name and its RGB value expressed as three numbers (rather than the usual `#RRGGBB` string).
|
||||||
|
|
||||||
|
`unifieddyes.base_color_crafts` contains a condensed list of crafting recipes for all 24 basic hues, plus black and white, most of which have multiple alternative recipes. Each line contains the name of the color, up to five dye itemstrings (with `nil` in each unused space), and the yield for that craft.
|
||||||
|
|
||||||
|
`unifieddyes.shade_crafts` contains recipes for each of the 10 shades a hue can take on, used with one or two portions of the dye corresponding to that hue. Each line contains the shade name with trailing "_", the saturation name (either "_s50" or empty string), up to three dye item strings, and the yield for that craft.
|
||||||
|
|
||||||
|
`unifieddyes.greymixes` contains the recipes for the 14 shades of grey. Each line contains the grey shade number from 1-14, up to four dye item names, and the yield for that craft.
|
||||||
|
|
||||||
|
#### Converting an old mod
|
||||||
|
|
||||||
|
If your mod used the old paradigm where you craft a neutral-colored item, place it, and punch with dye to color it, and you wish to convert it to colored itemstacks, take the following actions for each node:
|
||||||
|
|
||||||
|
* Remove these keys from your node definition:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
place_param2 = 240,
|
||||||
|
after_dig_node = unifieddyes.after_dig_node,
|
||||||
|
ud_replacement_node = "mod:some_node",
|
||||||
|
on_dig = unifieddyes.on_dig
|
||||||
|
```
|
||||||
|
|
||||||
|
* Add the `airbrush_replacement_node` key to the node definition, if needed.
|
||||||
|
|
||||||
|
* Add a call to `unifieddyes.register_color_craft(recipe)`, the create-all-the-recipes helper described above (of course, you don't have to register any recipes if you don't want to, or you can roll your own, your choice).
|
||||||
|
|
||||||
|
**If your mod never has never used Unified Dyes at all**
|
||||||
|
|
||||||
|
* Remove all of your various colored node definitions, keeping only the one for the white version of your node, or delete them all, and keep whatever node you consider to be "neutral colored".
|
||||||
|
|
||||||
|
* Delete all of the colored texture files too, except keep the brightest, highest-contrast, most detailed one - whichever color that happens to be. Most likely, red or green will be the best one.
|
||||||
|
|
||||||
|
* Convert that remaining texture to grayscale, enhance its contrast as much as you can without distorting it, and rename it and the node it'll be used to something neutral-sounding.
|
||||||
|
|
||||||
|
* Add the `palette` key to your neutral node definition, for example:
|
||||||
|
|
||||||
|
`palette = "unifieddyes_palette_extended.png",`
|
||||||
|
|
||||||
|
* Adjust your node's groups to specify that the node can be colored. Example (note the last item):
|
||||||
|
|
||||||
|
`groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3, ud_param2_colorable = 1},`
|
||||||
|
|
||||||
|
* Remove all crafting recipes for all colored versions of that node, keeping only the one that makes the "neutral" one.
|
||||||
|
|
||||||
|
* Add the above recipes helper call (which replaces those delted recipes)
|
||||||
|
|
||||||
|
* If your colored node is based on someone else's neutral node, for example if you made a mod that creates multiple colors of minetest_game's default clay, you may find it best to create a single "stand-in" node that's identical to the neutral node, but named for your mod, hidden from the creative inventory, and which has a properly-prepared grayscale texture image in addition to the above keys. Use `minetest.override_item()` to add the `palette` and `airbrush_replacement_node` keys, and the `ud_param2_colorable` group, to that "someone else's" node. Then use that node and your custom, hidden node in the craft helper call.
|
||||||
|
|
||||||
|
* You will need to write a run-only-once LBM to convert your old statically-colored nodes to use hardware coloring. See above for functions that will help reduce the work required for this part.
|
||||||
|
|
||||||
|
**If your mod has no colorable items**
|
||||||
|
|
||||||
|
If you wish to expand your mod to support color, just follow the above "never used" section, skipping the "remove/delete this and that" items, and of course omitting the LBM.
|
||||||
@@ -0,0 +1,282 @@
|
|||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Lesser General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
VanessaE's Unified Dyes
|
||||||
|
=======================
|
||||||
|
|
||||||
|
The purpose of this mod originally was to supply a complete set of colors for Minetest mod authors to use for colorized nodes, or to reference in recipes. Since the advent of the default dyes mod in minetest_game, this mod has become more of an extension of the default mod. Since the advent of param2 colorization, it has also become a library for general color handling.
|
||||||
|
|
||||||
|
Unified Dyes expands the standard dye set from 15 colors to 32, 89, or 256 (see the API and usage info).
|
||||||
|
|
||||||
|
Dependencies: Minetest engine version 0.4.16 or higher and a corresponding copy of minetest_game.
|
||||||
|
|
||||||
|
License: GPL 2.0 or higher.
|
||||||
|
|
||||||
|
Install: Unzip the distribution file, rename the resultant folder to just "unifieddyes", move it into Minetest's mods folder, and enable it in your world configuration.
|
||||||
|
|
||||||
|
Usage: for detailed usage information, please see [the Unified Dyes Thread](https://forum.minetest.net/viewtopic.php?f=11&t=2178&p=28399) on the Minetest forum.
|
||||||
|
|
||||||
|
API: the full API is documented here: https://github.com/mt-mods/unifieddyes/blob/master/API.md
|
||||||
@@ -0,0 +1,512 @@
|
|||||||
|
-- This file supplies all the code related to the airbrush
|
||||||
|
|
||||||
|
local S = minetest.get_translator("unifieddyes")
|
||||||
|
|
||||||
|
function unifieddyes.on_airbrush(itemstack, player, pointed_thing)
|
||||||
|
local player_name = player:get_player_name()
|
||||||
|
local painting_with = nil
|
||||||
|
|
||||||
|
if unifieddyes.player_current_dye[player_name] then
|
||||||
|
painting_with = unifieddyes.player_current_dye[player_name]
|
||||||
|
end
|
||||||
|
|
||||||
|
if not painting_with then
|
||||||
|
minetest.chat_send_player(player_name, "*** You need to set a color first.")
|
||||||
|
minetest.chat_send_player(player_name, "*** Right-click any random node to open the color selector,")
|
||||||
|
minetest.chat_send_player(player_name, "*** or shift+right-click a colorized node to use its color.")
|
||||||
|
minetest.chat_send_player(player_name, "*** Be sure to click \"Accept\", or the color you select will be ignored.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local pos = minetest.get_pointed_thing_position(pointed_thing)
|
||||||
|
if not pos then
|
||||||
|
local look_angle = player:get_look_vertical()
|
||||||
|
if look_angle > -1.55 then
|
||||||
|
minetest.chat_send_player(player_name, "*** No node selected")
|
||||||
|
else
|
||||||
|
local hexcolor = unifieddyes.get_color_from_dye_name(painting_with)
|
||||||
|
if hexcolor then
|
||||||
|
local r = tonumber(string.sub(hexcolor,1,2),16)
|
||||||
|
local g = tonumber(string.sub(hexcolor,3,4),16)
|
||||||
|
local b = tonumber(string.sub(hexcolor,5,6),16)
|
||||||
|
player:set_sky({r=r,g=g,b=b,a=255},"plain")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
local def = minetest.registered_items[node.name]
|
||||||
|
if not def then return end
|
||||||
|
|
||||||
|
if minetest.is_protected(pos, player_name) then
|
||||||
|
minetest.chat_send_player(player_name, "*** Sorry, someone else owns that node.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if not (def.groups and def.groups.ud_param2_colorable and def.groups.ud_param2_colorable > 0) then
|
||||||
|
minetest.chat_send_player(player_name, "*** That node can't be colored.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local palette
|
||||||
|
local fdir = 0
|
||||||
|
if not def or not def.palette then
|
||||||
|
minetest.chat_send_player(player_name, "*** That node can't be colored -- it's either undefined or has no palette.")
|
||||||
|
return
|
||||||
|
elseif def.palette == "unifieddyes_palette_extended.png" then
|
||||||
|
palette = "extended"
|
||||||
|
elseif def.palette == "unifieddyes_palette_colorwallmounted.png" then
|
||||||
|
palette = "wallmounted"
|
||||||
|
fdir = node.param2 % 8
|
||||||
|
elseif def.palette ~= "unifieddyes_palette_extended.png"
|
||||||
|
and def.palette ~= "unifieddyes_palette_colorwallmounted.png"
|
||||||
|
and string.find(def.palette, "unifieddyes_palette_") then
|
||||||
|
palette = "split"
|
||||||
|
fdir = node.param2 % 32
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(player_name, "*** That node can't be colored -- it has an invalid color mode.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local idx, hue = unifieddyes.getpaletteidx(painting_with, palette)
|
||||||
|
local inv = player:get_inventory()
|
||||||
|
if (not minetest.is_creative_enabled(player_name)) and not inv:contains_item("main", painting_with) then
|
||||||
|
local suff = ""
|
||||||
|
if not idx then
|
||||||
|
suff = " Besides, "..string.sub(painting_with, 5).." can't be applied to that node."
|
||||||
|
end
|
||||||
|
minetest.chat_send_player(
|
||||||
|
player_name,
|
||||||
|
"*** You're in survival mode, and you're out of "..string.sub(painting_with, 5).."."..suff
|
||||||
|
)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if not idx then
|
||||||
|
minetest.chat_send_player(player_name, "*** "..string.sub(painting_with, 5).." can't be applied to that node.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local oldidx = node.param2 - fdir
|
||||||
|
local name = def.airbrush_replacement_node or node.name
|
||||||
|
|
||||||
|
if palette == "split" then
|
||||||
|
|
||||||
|
local modname = string.sub(name, 1, string.find(name, ":")-1)
|
||||||
|
local nodename2 = string.sub(name, string.find(name, ":")+1)
|
||||||
|
local oldcolor
|
||||||
|
local newcolor
|
||||||
|
|
||||||
|
if def.ud_color_start and def.ud_color_end then
|
||||||
|
oldcolor = string.sub(node.name, def.ud_color_start, def.ud_color_end)
|
||||||
|
newcolor = string.sub(painting_with, 5)
|
||||||
|
else
|
||||||
|
if hue ~= 0 then
|
||||||
|
newcolor = unifieddyes.HUES_EXTENDED[hue][1]
|
||||||
|
else
|
||||||
|
newcolor = "grey"
|
||||||
|
end
|
||||||
|
|
||||||
|
if def.airbrush_replacement_node then
|
||||||
|
oldcolor = "grey"
|
||||||
|
else
|
||||||
|
local s = string.sub(def.palette, 21)
|
||||||
|
oldcolor = string.sub(s, 1, string.find(s, "s.png")-1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
name = modname..":"..string.gsub(nodename2, oldcolor, newcolor)
|
||||||
|
|
||||||
|
if not minetest.registered_items[name] then
|
||||||
|
minetest.chat_send_player(player_name, "*** "..string.sub(painting_with, 5).." can't be applied to that node.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
elseif idx == oldidx then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
minetest.swap_node(pos, {name = name, param2 = fdir + idx})
|
||||||
|
if not minetest.is_creative_enabled(player_name) then
|
||||||
|
inv:remove_item("main", painting_with)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local hps = 0.6 -- horizontal position scale
|
||||||
|
local vps = 1.3 -- vertical position scale
|
||||||
|
local vs = 0.1 -- vertical shift/offset
|
||||||
|
|
||||||
|
local color_button_size = ";0.75,0.75;"
|
||||||
|
local color_square_size = ";0.69,0.69;"
|
||||||
|
|
||||||
|
function unifieddyes.make_readable_color(color)
|
||||||
|
-- is this a low saturation color?
|
||||||
|
local has_low_saturtation = string.find(color, "s50");
|
||||||
|
|
||||||
|
-- remove _s50 tag, we care about that later again
|
||||||
|
local s = string.gsub(color, "_s50", "")
|
||||||
|
|
||||||
|
-- replace underscores with spaces to make it look nicer
|
||||||
|
s = string.gsub(s, "_", " ")
|
||||||
|
|
||||||
|
-- capitalize words, you know, looks nicer ;)
|
||||||
|
s = string.gsub(s, "(%l)(%w*)", function(a,b) return string.upper(a)..b end)
|
||||||
|
|
||||||
|
-- add the word dye, this is what the translations expect
|
||||||
|
s = s.." Dye"
|
||||||
|
|
||||||
|
-- if it is a low sat color, append an appropriate string
|
||||||
|
if has_low_saturtation then
|
||||||
|
s = s.." (low saturation)"
|
||||||
|
end
|
||||||
|
|
||||||
|
return s
|
||||||
|
end
|
||||||
|
|
||||||
|
function unifieddyes.make_colored_square(hexcolor, colorname, showall, creative, painting_with, nodepalette, hp, v2,
|
||||||
|
selindic, inv, explist)
|
||||||
|
|
||||||
|
local dye = "dye:"..colorname
|
||||||
|
|
||||||
|
local overlay = ""
|
||||||
|
local colorize = minetest.formspec_escape("^[colorize:#"..hexcolor..":255")
|
||||||
|
|
||||||
|
if not creative and inv:contains_item("main", dye) then
|
||||||
|
overlay = "^unifieddyes_onhand_overlay.png"
|
||||||
|
end
|
||||||
|
|
||||||
|
local unavail_overlay = ""
|
||||||
|
if not showall and not unifieddyes.palette_has_color[nodepalette.."_"..colorname]
|
||||||
|
or (explist and not explist[colorname]) then
|
||||||
|
if overlay == "" then
|
||||||
|
unavail_overlay = "^unifieddyes_unavailable_overlay.png"
|
||||||
|
else
|
||||||
|
unavail_overlay = "^unifieddyes_onhand_unavailable_overlay.png"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local tooltip = "tooltip["..colorname..";"..
|
||||||
|
S(unifieddyes.make_readable_color(colorname))..
|
||||||
|
"\n(dye:"..colorname..")]"
|
||||||
|
|
||||||
|
if dye == painting_with then
|
||||||
|
overlay = "^unifieddyes_select_overlay.png"
|
||||||
|
selindic = "unifieddyes_white_square.png"..colorize..overlay..unavail_overlay.."]"..tooltip
|
||||||
|
end
|
||||||
|
|
||||||
|
local form
|
||||||
|
if unavail_overlay == "" then
|
||||||
|
form = "image_button["..
|
||||||
|
(hp*hps)..","..(v2*vps+vs)..
|
||||||
|
color_button_size..
|
||||||
|
"unifieddyes_white_square.png"..colorize..overlay..unavail_overlay..";"..
|
||||||
|
colorname..";]"..
|
||||||
|
tooltip
|
||||||
|
else
|
||||||
|
form = "image["..
|
||||||
|
(hp*hps)..","..(v2*vps+vs)..
|
||||||
|
color_square_size..
|
||||||
|
"unifieddyes_white_square.png"..colorize..overlay..unavail_overlay.."]"..
|
||||||
|
tooltip
|
||||||
|
end
|
||||||
|
|
||||||
|
return form, selindic
|
||||||
|
end
|
||||||
|
|
||||||
|
function unifieddyes.show_airbrush_form(player)
|
||||||
|
if not player then return end
|
||||||
|
|
||||||
|
local t = {}
|
||||||
|
|
||||||
|
local player_name = player:get_player_name()
|
||||||
|
local painting_with = unifieddyes.player_selected_dye[player_name] or unifieddyes.player_current_dye[player_name]
|
||||||
|
local creative = minetest.is_creative_enabled(player_name)
|
||||||
|
local inv = player:get_inventory()
|
||||||
|
local nodepalette = "extended"
|
||||||
|
local showall = unifieddyes.player_showall[player_name]
|
||||||
|
|
||||||
|
t[1] = "size[14.5,8.5]label[7,-0.3;"..S("Select a color:").."]"
|
||||||
|
local selindic = "unifieddyes_select_overlay.png^unifieddyes_question.png]"
|
||||||
|
|
||||||
|
local last_right_click = unifieddyes.player_last_right_clicked[player_name]
|
||||||
|
if last_right_click then
|
||||||
|
if not last_right_click.def then
|
||||||
|
last_right_click.def = {}
|
||||||
|
last_right_click.undef = true
|
||||||
|
elseif last_right_click.def.palette then
|
||||||
|
if last_right_click.def.palette == "unifieddyes_palette_colorwallmounted.png" then
|
||||||
|
nodepalette = "wallmounted"
|
||||||
|
elseif last_right_click.def.palette == "unifieddyes_palette_extended.png" then
|
||||||
|
t[#t+1] = "label[0.5,8.25;"..S("(Right-clicked a node that supports all 256 colors, showing them all)").."]"
|
||||||
|
showall = true
|
||||||
|
elseif last_right_click.def.palette ~= "unifieddyes_palette_extended.png"
|
||||||
|
and last_right_click.def.palette ~= "unifieddyes_palette_colorwallmounted.png"
|
||||||
|
and string.find(last_right_click.def.palette, "unifieddyes_palette_") then
|
||||||
|
nodepalette = "split"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if last_right_click.undef then
|
||||||
|
t[#t+1] = "label[0.5,8.25;"..S("(Right-clicked an undefined node, showing all colors)").."]"
|
||||||
|
elseif not last_right_click.def.groups
|
||||||
|
or not last_right_click.def.groups.ud_param2_colorable
|
||||||
|
or not last_right_click.def.palette
|
||||||
|
or not string.find(last_right_click.def.palette, "unifieddyes_palette_") then
|
||||||
|
t[#t+1] = "label[0.5,8.25;"..S("(Right-clicked a node not supported by the Airbrush, showing all colors)").."]"
|
||||||
|
end
|
||||||
|
|
||||||
|
local explist = last_right_click.def.explist
|
||||||
|
|
||||||
|
for v = 0, 6 do
|
||||||
|
local val = unifieddyes.VALS_EXTENDED[v+1]
|
||||||
|
|
||||||
|
local sat = ""
|
||||||
|
local v2=(v/2)
|
||||||
|
|
||||||
|
for hi, h in ipairs(unifieddyes.HUES_EXTENDED) do
|
||||||
|
local hue = h[1]
|
||||||
|
local hp=hi-1
|
||||||
|
|
||||||
|
local r = h[2]
|
||||||
|
local g = h[3]
|
||||||
|
local b = h[4]
|
||||||
|
|
||||||
|
local factor = 40
|
||||||
|
if v > 3 then
|
||||||
|
factor = 75
|
||||||
|
v2 = (v-2)
|
||||||
|
end
|
||||||
|
|
||||||
|
local r2 = math.max(math.min(r + (4-v)*factor, 255), 0)
|
||||||
|
local g2 = math.max(math.min(g + (4-v)*factor, 255), 0)
|
||||||
|
local b2 = math.max(math.min(b + (4-v)*factor, 255), 0)
|
||||||
|
|
||||||
|
local hexcolor = string.format("%02x", r2)..string.format("%02x", g2)..string.format("%02x", b2)
|
||||||
|
local f
|
||||||
|
f, selindic = unifieddyes.make_colored_square(hexcolor, val..hue..sat, showall, creative, painting_with, nodepalette,
|
||||||
|
hp, v2, selindic, inv, explist)
|
||||||
|
t[#t+1] = f
|
||||||
|
end
|
||||||
|
|
||||||
|
if v > 3 then
|
||||||
|
sat = "_s50"
|
||||||
|
v2 = (v-1.5)
|
||||||
|
|
||||||
|
for hi, h in ipairs(unifieddyes.HUES_EXTENDED) do
|
||||||
|
local hue = h[1]
|
||||||
|
local hp=hi-1
|
||||||
|
|
||||||
|
local r = h[2]
|
||||||
|
local g = h[3]
|
||||||
|
local b = h[4]
|
||||||
|
|
||||||
|
local factor = 75
|
||||||
|
|
||||||
|
local pr = 0.299
|
||||||
|
local pg = 0.587
|
||||||
|
local pb = 0.114
|
||||||
|
|
||||||
|
local r2 = math.max(math.min(r + (4-v)*factor, 255), 0)
|
||||||
|
local g2 = math.max(math.min(g + (4-v)*factor, 255), 0)
|
||||||
|
local b2 = math.max(math.min(b + (4-v)*factor, 255), 0)
|
||||||
|
|
||||||
|
local p = math.sqrt(r2*r2*pr + g2*g2*pg + b2*b2*pb)
|
||||||
|
local r3 = math.floor(p+(r2-p)*0.5)
|
||||||
|
local g3 = math.floor(p+(g2-p)*0.5)
|
||||||
|
local b3 = math.floor(p+(b2-p)*0.5)
|
||||||
|
|
||||||
|
local hexcolor = string.format("%02x", r3)..string.format("%02x", g3)..string.format("%02x", b3)
|
||||||
|
local f
|
||||||
|
f, selindic = unifieddyes.make_colored_square(hexcolor, val..hue..sat, showall, creative, painting_with,
|
||||||
|
nodepalette, hp, v2, selindic, inv, explist)
|
||||||
|
t[#t+1] = f
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local v2=5
|
||||||
|
for y = 0, 15 do
|
||||||
|
|
||||||
|
local hp=15-y
|
||||||
|
|
||||||
|
local hexgrey = string.format("%02x", y*17)..string.format("%02x", y*17)..string.format("%02x", y*17)
|
||||||
|
local grey = "grey_"..y
|
||||||
|
|
||||||
|
if y == 0 then grey = "black"
|
||||||
|
elseif y == 4 then grey = "dark_grey"
|
||||||
|
elseif y == 8 then grey = "grey"
|
||||||
|
elseif y == 11 then grey = "light_grey"
|
||||||
|
elseif y == 15 then grey = "white"
|
||||||
|
end
|
||||||
|
|
||||||
|
local f
|
||||||
|
f, selindic = unifieddyes.make_colored_square(hexgrey, grey, showall, creative, painting_with, nodepalette, hp, v2,
|
||||||
|
selindic, inv, explist)
|
||||||
|
t[#t+1] = f
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if not creative then
|
||||||
|
t[#t+1] = "image[10,"
|
||||||
|
t[#t+1] = (vps*5.55+vs)
|
||||||
|
t[#t+1] = color_button_size
|
||||||
|
t[#t+1] = "unifieddyes_onhand_overlay.png]label[10.7,"
|
||||||
|
t[#t+1] = (vps*5.51+vs)
|
||||||
|
t[#t+1] = ";"..S("Dyes").."]"
|
||||||
|
t[#t+1] = "label[10.7,"
|
||||||
|
t[#t+1] = (vps*5.67+vs)
|
||||||
|
t[#t+1] = ";on hand]"
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
t[#t+1] = "image[10,"
|
||||||
|
t[#t+1] = (vps*5+vs)
|
||||||
|
t[#t+1] = color_button_size
|
||||||
|
t[#t+1] = selindic
|
||||||
|
|
||||||
|
if painting_with then
|
||||||
|
t[#t+1] = "label[10.7,"
|
||||||
|
t[#t+1] = (vps*4.90+vs)
|
||||||
|
t[#t+1] = ";"..S("Your selection:").."]"
|
||||||
|
t[#t+1] = "label[10.7,"
|
||||||
|
t[#t+1] = (vps*5.07+vs)
|
||||||
|
t[#t+1] = ";"
|
||||||
|
t[#t+1] = S(unifieddyes.make_readable_color(string.sub(painting_with, 5)))
|
||||||
|
t[#t+1] = "]label[10.7,"
|
||||||
|
t[#t+1] = (vps*5.24+vs)
|
||||||
|
t[#t+1] = ";("
|
||||||
|
t[#t+1] = painting_with
|
||||||
|
t[#t+1] = ")]"
|
||||||
|
else
|
||||||
|
t[#t+1] = "label[10.7,"
|
||||||
|
t[#t+1] = (vps*5.07+vs)
|
||||||
|
t[#t+1] = ";"..S("Your selection").."]"
|
||||||
|
end
|
||||||
|
|
||||||
|
t[#t+1] = "button_exit[10.5,8;2,1;cancel;"..S("Cancel").."]button_exit[12.5,8;2,1;accept;"..S("Accept").."]"
|
||||||
|
|
||||||
|
|
||||||
|
if last_right_click and last_right_click.def and nodepalette ~= "extended" then
|
||||||
|
if showall then
|
||||||
|
t[#t+1] = "button[0,8;2,1;show_avail;"..S("Show Available").."]"
|
||||||
|
t[#t+1] = "label[2,8.25;"..S("(Currently showing all 256 colors)").."]"
|
||||||
|
else
|
||||||
|
t[#t+1] = "button[0,8;2,1;show_all;"..S("Show All Colors").."]"
|
||||||
|
t[#t+1] = "label[2,8.25;"..S("(Currently only showing what the right-clicked node can use)").."]"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.show_formspec(player_name, "unifieddyes:dye_select_form", table.concat(t))
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
|
|
||||||
|
if formname == "unifieddyes:dye_select_form" then
|
||||||
|
|
||||||
|
local player_name = player:get_player_name()
|
||||||
|
local nodepalette = "extended"
|
||||||
|
local showall = unifieddyes.player_showall[player_name]
|
||||||
|
|
||||||
|
local last_right_click = unifieddyes.player_last_right_clicked[player_name]
|
||||||
|
if last_right_click and last_right_click.def then
|
||||||
|
if last_right_click.def.palette then
|
||||||
|
if last_right_click.def.palette == "unifieddyes_palette_colorwallmounted.png" then
|
||||||
|
nodepalette = "wallmounted"
|
||||||
|
elseif last_right_click.def.palette ~= "unifieddyes_palette_extended.png" then
|
||||||
|
nodepalette = "split"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if fields.show_all then
|
||||||
|
unifieddyes.player_showall[player_name] = true
|
||||||
|
unifieddyes.show_airbrush_form(player)
|
||||||
|
return
|
||||||
|
elseif fields.show_avail then
|
||||||
|
unifieddyes.player_showall[player_name] = false
|
||||||
|
unifieddyes.show_airbrush_form(player)
|
||||||
|
return
|
||||||
|
elseif fields.quit then
|
||||||
|
if fields.accept then
|
||||||
|
local dye = unifieddyes.player_selected_dye[player_name]
|
||||||
|
if not dye then
|
||||||
|
minetest.chat_send_player(player_name, "*** Clicked \"Accept\", but no color was selected!")
|
||||||
|
return
|
||||||
|
elseif not showall
|
||||||
|
and not unifieddyes.palette_has_color[nodepalette.."_"..string.sub(dye, 5)] then
|
||||||
|
minetest.chat_send_player(player_name, "*** Clicked \"Accept\", but the selected color can't be used on the")
|
||||||
|
minetest.chat_send_player(player_name, "*** node that was right-clicked (and \"Show All\" wasn't in effect).")
|
||||||
|
if unifieddyes.player_current_dye[player_name] then
|
||||||
|
minetest.chat_send_player(player_name, "*** Ignoring it and sticking with "
|
||||||
|
..string.sub(unifieddyes.player_current_dye[player_name], 5)..".")
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(player_name, "*** Ignoring it.")
|
||||||
|
end
|
||||||
|
return
|
||||||
|
else
|
||||||
|
unifieddyes.player_current_dye[player_name] = dye
|
||||||
|
unifieddyes.player_selected_dye[player_name] = nil
|
||||||
|
minetest.chat_send_player(player_name, "*** Selected "..string.sub(dye, 5).." for the airbrush.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
else -- assume "Cancel" or Esc.
|
||||||
|
unifieddyes.player_selected_dye[player_name] = nil
|
||||||
|
return
|
||||||
|
end
|
||||||
|
else
|
||||||
|
local color, _ = next(fields)
|
||||||
|
|
||||||
|
local inv = player:get_inventory()
|
||||||
|
local creative = minetest.is_creative_enabled(player_name)
|
||||||
|
local dye = "dye:"..color
|
||||||
|
|
||||||
|
if (showall or unifieddyes.palette_has_color[nodepalette.."_"..color]) and
|
||||||
|
(creative or inv:contains_item("main", dye)) then
|
||||||
|
unifieddyes.player_selected_dye[player_name] = dye
|
||||||
|
unifieddyes.show_airbrush_form(player)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
minetest.register_tool("unifieddyes:airbrush", {
|
||||||
|
description = S("Dye Airbrush"),
|
||||||
|
inventory_image = "unifieddyes_airbrush.png",
|
||||||
|
use_texture_alpha = core.features.use_texture_alpha_string_modes and "opaque" or true,
|
||||||
|
tool_capabilities = {
|
||||||
|
full_punch_interval=0.1,
|
||||||
|
},
|
||||||
|
range = 12,
|
||||||
|
on_use = unifieddyes.on_airbrush,
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
local keys = placer:get_player_control()
|
||||||
|
local player_name = placer:get_player_name()
|
||||||
|
local pos = minetest.get_pointed_thing_position(pointed_thing)
|
||||||
|
local node
|
||||||
|
local def
|
||||||
|
|
||||||
|
if pos then node = minetest.get_node(pos) end
|
||||||
|
if node then def = minetest.registered_items[node.name] end
|
||||||
|
|
||||||
|
if keys.sneak and def and def.on_rightclick then
|
||||||
|
return def.on_rightclick(pos, node, placer, itemstack, pointed_thing)
|
||||||
|
end
|
||||||
|
|
||||||
|
unifieddyes.player_last_right_clicked[player_name] = {pos = pos, node = node, def = def}
|
||||||
|
|
||||||
|
if not keys.aux1 then
|
||||||
|
unifieddyes.show_airbrush_form(placer)
|
||||||
|
elseif keys.aux1 then
|
||||||
|
if not pos or not def then return end
|
||||||
|
local newcolor = unifieddyes.color_to_name(node.param2, def)
|
||||||
|
|
||||||
|
if newcolor and string.find(def.paramtype2, "color") then
|
||||||
|
minetest.chat_send_player(player_name, "*** Switching to "..newcolor.." for the airbrush, to match that node.")
|
||||||
|
unifieddyes.player_current_dye[player_name] = "dye:"..newcolor
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(player_name, "*** That node is uncolored.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
if minetest.get_modpath("dye") then
|
||||||
|
minetest.register_alias("dye:light_red", "dye:pink")
|
||||||
|
minetest.register_alias("dye:medium_orange", "dye:brown")
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_alias("unifieddyes:black", "dye:black")
|
||||||
|
minetest.register_alias("unifieddyes:dark_grey", "dye:dark_grey")
|
||||||
|
minetest.register_alias("unifieddyes:grey", "dye:grey")
|
||||||
|
minetest.register_alias("unifieddyes:light_grey", "dye:light_grey")
|
||||||
|
minetest.register_alias("unifieddyes:white", "dye:white")
|
||||||
|
|
||||||
|
minetest.register_alias("unifieddyes:grey_0", "dye:black")
|
||||||
|
minetest.register_alias("unifieddyes:grey_4", "dye:dark_grey")
|
||||||
|
minetest.register_alias("unifieddyes:grey_8", "dye:grey")
|
||||||
|
minetest.register_alias("unifieddyes:grey_11", "dye:light_grey")
|
||||||
|
minetest.register_alias("unifieddyes:grey_15", "dye:white")
|
||||||
|
|
||||||
|
minetest.register_alias("unifieddyes:white_paint", "dye:white")
|
||||||
|
minetest.register_alias("unifieddyes:titanium_dioxide", "dye:white")
|
||||||
|
minetest.register_alias("unifieddyes:lightgrey_paint", "dye:light_grey")
|
||||||
|
minetest.register_alias("unifieddyes:grey_paint", "dye:grey")
|
||||||
|
minetest.register_alias("unifieddyes:darkgrey_paint", "dye:dark_grey")
|
||||||
|
minetest.register_alias("unifieddyes:carbon_black", "dye:black")
|
||||||
|
|
||||||
|
minetest.register_alias("unifieddyes:brown", "dye:brown")
|
||||||
@@ -0,0 +1,612 @@
|
|||||||
|
-- This file supplies the majority of Unified Dyes' API
|
||||||
|
|
||||||
|
unifieddyes.player_current_dye = {}
|
||||||
|
unifieddyes.player_selected_dye = {}
|
||||||
|
unifieddyes.player_last_right_clicked = {}
|
||||||
|
unifieddyes.palette_has_color = {}
|
||||||
|
unifieddyes.player_showall = {}
|
||||||
|
|
||||||
|
-- if a node with a palette is placed in the world,
|
||||||
|
-- but the itemstack used to place it has no palette_index (color byte),
|
||||||
|
-- create something appropriate to make it officially white.
|
||||||
|
|
||||||
|
minetest.register_on_placenode(
|
||||||
|
function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
|
||||||
|
local def = minetest.registered_items[newnode.name]
|
||||||
|
|
||||||
|
if not def
|
||||||
|
or not def.palette
|
||||||
|
or def.after_place_node
|
||||||
|
or not placer then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
if not string.find(itemstack:to_string(), "palette_index") then
|
||||||
|
local param2
|
||||||
|
local color = 0
|
||||||
|
|
||||||
|
if def.palette == "unifieddyes_palette_extended.png"
|
||||||
|
and def.paramtype2 == "color" then
|
||||||
|
param2 = 240
|
||||||
|
color = 240
|
||||||
|
elseif def.palette == "unifieddyes_palette_colorwallmounted.png"
|
||||||
|
and def.paramtype2 == "colorwallmounted" then
|
||||||
|
param2 = newnode.param2 % 8
|
||||||
|
elseif string.find(def.palette, "unifieddyes_palette_")
|
||||||
|
and def.paramtype2 == "colorfacedir" then -- it's a split palette
|
||||||
|
param2 = newnode.param2 % 32
|
||||||
|
end
|
||||||
|
|
||||||
|
if param2 then
|
||||||
|
minetest.swap_node(pos, {name = newnode.name, param2 = param2})
|
||||||
|
minetest.get_meta(pos):set_int("palette_index", color)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
-- The complementary function: strip-off the color if the node being dug is still white/neutral
|
||||||
|
-- adapted from
|
||||||
|
-- https://github.com/minetest/minetest/blob/fe8d04d0b3c2e3af7c406fb6527f1b5230a30137/builtin/game/item.lua#L460-L562
|
||||||
|
local function node_dig_without_color(pos, node, digger)
|
||||||
|
if not digger then return false end
|
||||||
|
local diggername = digger:get_player_name()
|
||||||
|
|
||||||
|
local def = ItemStack(node.name):get_definition()
|
||||||
|
-- Copy pos because the callback could modify it
|
||||||
|
if not def.diggable or (def.can_dig and not def.can_dig(vector.copy(pos), digger)) then
|
||||||
|
minetest.log("info", diggername .. " tried to dig "
|
||||||
|
.. node.name .. " which is not diggable "
|
||||||
|
.. minetest.pos_to_string(pos))
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
if minetest.is_protected(pos, diggername) then
|
||||||
|
minetest.log("action", diggername
|
||||||
|
.. " tried to dig " .. node.name
|
||||||
|
.. " at protected position "
|
||||||
|
.. minetest.pos_to_string(pos))
|
||||||
|
minetest.record_protection_violation(pos, diggername)
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.log('action', diggername .. " digs "
|
||||||
|
.. node.name .. " at " .. minetest.pos_to_string(pos))
|
||||||
|
|
||||||
|
local wielded = digger and digger:get_wielded_item()
|
||||||
|
local drops = core.get_node_drops(node, wielded and wielded:get_name(),
|
||||||
|
wielded and ItemStack(wielded), digger, vector.copy(pos))
|
||||||
|
|
||||||
|
if wielded then
|
||||||
|
local wdef = wielded:get_definition()
|
||||||
|
local tp = wielded:get_tool_capabilities()
|
||||||
|
local dp = minetest.get_dig_params(def and def.groups, tp, wielded:get_wear())
|
||||||
|
if wdef and wdef.after_use then
|
||||||
|
wielded = wdef.after_use(wielded, digger, node, dp) or wielded
|
||||||
|
else
|
||||||
|
-- Wear out tool
|
||||||
|
if not minetest.is_creative_enabled(diggername) then
|
||||||
|
wielded:add_wear(dp.wear)
|
||||||
|
if wielded:get_count() == 0 and wdef.sound and wdef.sound.breaks then
|
||||||
|
minetest.sound_play(wdef.sound.breaks, {
|
||||||
|
pos = pos,
|
||||||
|
gain = 0.5
|
||||||
|
}, true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
digger:set_wielded_item(wielded)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check to see if metadata should be preserved.
|
||||||
|
if def then
|
||||||
|
local oldmeta = minetest.get_meta(pos):to_table().fields
|
||||||
|
-- Copy pos and node because the callback can modify them.
|
||||||
|
local pos_copy = vector.copy(pos)
|
||||||
|
local node_copy = { name = node.name, param1 = node.param1, param2 = node.param2 }
|
||||||
|
local drop_stacks = {}
|
||||||
|
for k, v in pairs(drops) do
|
||||||
|
local stack = ItemStack(v)
|
||||||
|
stack:get_meta():set_string("palette_index", "")
|
||||||
|
drop_stacks[k] = stack
|
||||||
|
end
|
||||||
|
drops = drop_stacks
|
||||||
|
if def.preserve_metadata then
|
||||||
|
def.preserve_metadata(pos_copy, node_copy, oldmeta, drops)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Handle drops
|
||||||
|
minetest.handle_node_drops(pos, drops, digger)
|
||||||
|
|
||||||
|
local oldmetadata
|
||||||
|
if def and def.after_dig_node then
|
||||||
|
oldmetadata = minetest.get_meta(pos):to_table()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Remove node and update
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
|
||||||
|
-- Play sound if it was done by a player
|
||||||
|
if diggername ~= "" and def and def.sounds and def.sounds.dug then
|
||||||
|
minetest.sound_play(def.sounds.dug, {
|
||||||
|
pos = pos,
|
||||||
|
exclude_player = diggername,
|
||||||
|
}, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Run callback
|
||||||
|
if def and def.after_dig_node then
|
||||||
|
-- Copy pos and node because callback can modify them
|
||||||
|
local pos_copy = vector.copy(pos)
|
||||||
|
local node_copy = { name = node.name, param1 = node.param1, param2 = node.param2 }
|
||||||
|
def.after_dig_node(pos_copy, node_copy, oldmetadata, digger)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Run script hook
|
||||||
|
for _, callback in ipairs(minetest.registered_on_dignodes) do
|
||||||
|
local origin = minetest.callback_origins[callback]
|
||||||
|
minetest.set_last_run_mod(origin.mod)
|
||||||
|
|
||||||
|
-- Copy pos and node because callback can modify them
|
||||||
|
local pos_copy = vector.copy(pos)
|
||||||
|
local node_copy = { name = node.name, param1 = node.param1, param2 = node.param2 }
|
||||||
|
callback(pos_copy, node_copy, digger)
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.after(0, function()
|
||||||
|
for k, v in pairs(minetest.registered_nodes) do
|
||||||
|
if v.on_dig == unifieddyes.on_dig then
|
||||||
|
minetest.log("warning", "["..k.."] `on_dig = unifieddyes.on_dig` is deprecated. "
|
||||||
|
.."Use `preserve_metadata = unifieddyes.preserve_metadata` instead.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
function unifieddyes.on_dig(pos, node, digger)
|
||||||
|
local param2 = minetest.get_node(pos).param2
|
||||||
|
local def = minetest.registered_items[node.name]
|
||||||
|
local del_color
|
||||||
|
|
||||||
|
if def.paramtype2 == "color" and param2 == 240 and def.palette == "unifieddyes_palette_extended.png" then
|
||||||
|
del_color = true
|
||||||
|
elseif (def.paramtype2 == "colorwallmounted" or def.paramtype2 == "colorfacedir")
|
||||||
|
and minetest.strip_param2_color(param2, def.paramtype2) == 0
|
||||||
|
and string.find(def.palette, "unifieddyes_palette_")
|
||||||
|
then
|
||||||
|
del_color = true
|
||||||
|
end
|
||||||
|
|
||||||
|
if del_color then
|
||||||
|
return node_dig_without_color(pos, node, digger)
|
||||||
|
else
|
||||||
|
return minetest.node_dig(pos, node, digger)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function unifieddyes.preserve_metadata(pos, oldnode, oldmeta, drops)
|
||||||
|
local param2 = oldnode.param2
|
||||||
|
local def = minetest.registered_items[oldnode.name]
|
||||||
|
local del_color
|
||||||
|
|
||||||
|
if def.paramtype2 == "color" and param2 == 240 and def.palette == "unifieddyes_palette_extended.png" then
|
||||||
|
del_color = true
|
||||||
|
elseif (def.paramtype2 == "colorwallmounted" or def.paramtype2 == "colorfacedir")
|
||||||
|
and minetest.strip_param2_color(param2, def.paramtype2) == 0
|
||||||
|
and string.find(def.palette, "unifieddyes_palette_")
|
||||||
|
then
|
||||||
|
del_color = true
|
||||||
|
end
|
||||||
|
|
||||||
|
if del_color then
|
||||||
|
for i, stack in ipairs(drops) do
|
||||||
|
stack:get_meta():set_string("palette_index", "")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- just stubs to keep old mods from crashing when expecting auto-coloring
|
||||||
|
-- or getting back the dye on dig.
|
||||||
|
|
||||||
|
function unifieddyes.recolor_on_place(foo)
|
||||||
|
end
|
||||||
|
|
||||||
|
function unifieddyes.after_dig_node(foo)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- This helper function creates multiple copies of the passed node,
|
||||||
|
-- for the split palette - one per hue, plus grey - and assigns
|
||||||
|
-- proper palettes and other attributes
|
||||||
|
|
||||||
|
function unifieddyes.generate_split_palette_nodes(name, def, drop)
|
||||||
|
for _, color in ipairs(unifieddyes.HUES_WITH_GREY) do
|
||||||
|
local def2 = table.copy(def)
|
||||||
|
local desc_color = string.gsub(string.upper(string.sub(color, 1, 1))..string.sub(color, 2), "_", " ")
|
||||||
|
if string.sub(def2.description, -1) == ")" then
|
||||||
|
def2.description = string.sub(def2.description, 1, -2)..", "..desc_color.." shades)"
|
||||||
|
else
|
||||||
|
def2.description = def2.description.."("..desc_color.." shades)"
|
||||||
|
end
|
||||||
|
def2.palette = "unifieddyes_palette_"..color.."s.png"
|
||||||
|
def2.paramtype2 = "colorfacedir"
|
||||||
|
def2.groups.ud_param2_colorable = 1
|
||||||
|
def2.is_ground_content = false
|
||||||
|
|
||||||
|
if drop then
|
||||||
|
def2.drop = {
|
||||||
|
items = {
|
||||||
|
{items = {drop.."_"..color}, inherit_color = true },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node(":"..name.."_"..color, def2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- This helper function creates a colored itemstack
|
||||||
|
|
||||||
|
function unifieddyes.make_colored_itemstack(item, palette, color)
|
||||||
|
local paletteidx = unifieddyes.getpaletteidx(color, palette)
|
||||||
|
local stack = ItemStack(item)
|
||||||
|
stack:get_meta():set_int("palette_index", paletteidx)
|
||||||
|
return stack:to_string(),paletteidx
|
||||||
|
end
|
||||||
|
|
||||||
|
-- these helper functions register all of the recipes needed to create colored
|
||||||
|
-- nodes with any of the dyes supported by that node's palette.
|
||||||
|
|
||||||
|
local function register_c(craft, h, sat, val)
|
||||||
|
local hue = (type(h) == "table") and h[1] or h
|
||||||
|
local color
|
||||||
|
if val then
|
||||||
|
if craft.palette == "wallmounted" then
|
||||||
|
color = val..hue..sat
|
||||||
|
else
|
||||||
|
color = val..hue..sat
|
||||||
|
end
|
||||||
|
else
|
||||||
|
color = hue -- if val is nil, then it's grey.
|
||||||
|
end
|
||||||
|
|
||||||
|
local dye = "dye:"..color
|
||||||
|
local recipe = minetest.serialize(craft.recipe)
|
||||||
|
recipe = string.gsub(recipe, "MAIN_DYE", dye)
|
||||||
|
recipe = string.gsub(recipe, "NEUTRAL_NODE", craft.neutral_node)
|
||||||
|
local newrecipe = minetest.deserialize(recipe)
|
||||||
|
|
||||||
|
local coutput = craft.output or ""
|
||||||
|
local output = coutput
|
||||||
|
if craft.output_prefix then
|
||||||
|
if craft.palette ~= "split" then
|
||||||
|
output = craft.output_prefix..color..craft.output_suffix..coutput
|
||||||
|
else
|
||||||
|
if hue == "white" or hue == "black" or string.find(hue, "grey") then
|
||||||
|
output = craft.output_prefix.."grey"..craft.output_suffix..coutput
|
||||||
|
elseif hue == "pink" then
|
||||||
|
dye = "dye:light_red"
|
||||||
|
output = craft.output_prefix.."red"..craft.output_suffix..coutput
|
||||||
|
else
|
||||||
|
output = craft.output_prefix..hue..craft.output_suffix..coutput
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local colored_itemstack =
|
||||||
|
unifieddyes.make_colored_itemstack(output, craft.palette, dye)
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = colored_itemstack,
|
||||||
|
type = craft.type,
|
||||||
|
recipe = newrecipe
|
||||||
|
})
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function unifieddyes.register_color_craft(craft)
|
||||||
|
local hues_table = unifieddyes.HUES_EXTENDED
|
||||||
|
local sats_table = unifieddyes.SATS
|
||||||
|
local vals_table = unifieddyes.VALS_SPLIT
|
||||||
|
local greys_table = unifieddyes.GREYS
|
||||||
|
|
||||||
|
if craft.palette == "wallmounted" then
|
||||||
|
register_c(craft, "green", "", "light_")
|
||||||
|
register_c(craft, "blue", "", "light_")
|
||||||
|
hues_table = unifieddyes.HUES_WALLMOUNTED
|
||||||
|
sats_table = {""}
|
||||||
|
vals_table = unifieddyes.VALS
|
||||||
|
elseif craft.palette == "extended" then
|
||||||
|
vals_table = unifieddyes.VALS_EXTENDED
|
||||||
|
greys_table = unifieddyes.GREYS_EXTENDED
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, hue in ipairs(hues_table) do
|
||||||
|
for _, val in ipairs(vals_table) do
|
||||||
|
for _, sat in ipairs(sats_table) do
|
||||||
|
|
||||||
|
if sat == "_s50" and val ~= "" and val ~= "medium_" and val ~= "dark_" then break end
|
||||||
|
register_c(craft, hue, sat, val)
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, grey in ipairs(greys_table) do
|
||||||
|
register_c(craft, grey)
|
||||||
|
end
|
||||||
|
|
||||||
|
register_c(craft, "pink")
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- code borrowed from homedecor
|
||||||
|
-- call this function to reset the rotation of a "wallmounted" object on place
|
||||||
|
|
||||||
|
function unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
local colorbits = node.param2 - (node.param2 % 8)
|
||||||
|
|
||||||
|
local yaw = placer:get_look_horizontal()
|
||||||
|
local dir = minetest.yaw_to_dir(yaw) -- -1.5)
|
||||||
|
local pitch = placer:get_look_vertical()
|
||||||
|
|
||||||
|
local fdir = minetest.dir_to_wallmounted(dir)
|
||||||
|
|
||||||
|
if pitch < -(math.pi/8) then
|
||||||
|
fdir = 0
|
||||||
|
elseif pitch > math.pi/8 then
|
||||||
|
fdir = 1
|
||||||
|
end
|
||||||
|
minetest.swap_node(pos, { name = node.name, param2 = fdir+colorbits })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- use this when you have a "wallmounted" node that should never be oriented
|
||||||
|
-- to floor or ceiling...
|
||||||
|
|
||||||
|
function unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
local colorbits = node.param2 - (node.param2 % 8)
|
||||||
|
local yaw = placer:get_look_horizontal()
|
||||||
|
local dir = minetest.yaw_to_dir(yaw+1.5)
|
||||||
|
local fdir = minetest.dir_to_wallmounted(dir)
|
||||||
|
|
||||||
|
minetest.swap_node(pos, { name = node.name, param2 = fdir+colorbits })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- ... and use this one to force that kind of node off of floor/ceiling
|
||||||
|
-- orientation after the screwdriver rotates it.
|
||||||
|
|
||||||
|
function unifieddyes.fix_after_screwdriver_nsew(pos, node, user, mode, new_param2)
|
||||||
|
local new_fdir = new_param2 % 8
|
||||||
|
local color = new_param2 - new_fdir
|
||||||
|
if new_fdir < 2 then
|
||||||
|
new_fdir = 2
|
||||||
|
minetest.swap_node(pos, { name = node.name, param2 = new_fdir + color })
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function unifieddyes.is_buildable_to(placer_name, ...)
|
||||||
|
for _, pos in ipairs({...}) do
|
||||||
|
local node = minetest.get_node_or_nil(pos)
|
||||||
|
local def = node and minetest.registered_nodes[node.name]
|
||||||
|
if not (def and def.buildable_to) or minetest.is_protected(pos, placer_name) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function unifieddyes.get_hsv(name) -- expects a node/item name
|
||||||
|
local hue = ""
|
||||||
|
local a
|
||||||
|
for _, i in ipairs(unifieddyes.HUES_EXTENDED) do
|
||||||
|
a,_ = string.find(name, "_"..i[1])
|
||||||
|
if a then
|
||||||
|
hue = i[1]
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if string.find(name, "_light_grey") then hue = "light_grey"
|
||||||
|
elseif string.find(name, "_lightgrey") then hue = "light_grey"
|
||||||
|
elseif string.find(name, "_dark_grey") then hue = "dark_grey"
|
||||||
|
elseif string.find(name, "_darkgrey") then hue = "dark_grey"
|
||||||
|
elseif string.find(name, "_grey") then hue = "grey"
|
||||||
|
elseif string.find(name, "_white") then hue = "white"
|
||||||
|
elseif string.find(name, "_black") then hue = "black"
|
||||||
|
end
|
||||||
|
|
||||||
|
local sat = ""
|
||||||
|
if string.find(name, "_s50") then sat = "_s50" end
|
||||||
|
|
||||||
|
local val = ""
|
||||||
|
if string.find(name, "dark_") then val = "dark_" end
|
||||||
|
if string.find(name, "medium_") then val = "medium_" end
|
||||||
|
if string.find(name, "light_") then val = "light_" end
|
||||||
|
|
||||||
|
return hue, sat, val
|
||||||
|
end
|
||||||
|
|
||||||
|
-- code partially borrowed from cheapie's plasticbox mod
|
||||||
|
|
||||||
|
-- in the function below, color is just a color string, while
|
||||||
|
-- palette_type can be:
|
||||||
|
--
|
||||||
|
-- "extended" = 256 color palette
|
||||||
|
-- "split" = 200 color palette split into pieces for colorfacedir
|
||||||
|
-- "wallmounted" = 32-color abridged palette
|
||||||
|
|
||||||
|
function unifieddyes.getpaletteidx(color, palette_type)
|
||||||
|
|
||||||
|
if string.sub(color,1,4) == "dye:" then
|
||||||
|
color = string.sub(color,5,-1)
|
||||||
|
elseif string.sub(color,1,12) == "unifieddyes:" then
|
||||||
|
color = string.sub(color,13,-1)
|
||||||
|
else
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if palette_type == "wallmounted" then
|
||||||
|
if unifieddyes.gpidx_grayscale_wallmounted[color] then
|
||||||
|
return (unifieddyes.gpidx_grayscale_wallmounted[color] * 8), 0
|
||||||
|
end
|
||||||
|
elseif palette_type == "split" then
|
||||||
|
if unifieddyes.gpidx_grayscale[color] then
|
||||||
|
return (unifieddyes.gpidx_grayscale[color] * 32), 0
|
||||||
|
end
|
||||||
|
elseif palette_type == "extended" then
|
||||||
|
if unifieddyes.gpidx_grayscale_extended[color] then
|
||||||
|
return unifieddyes.gpidx_grayscale_extended[color]+240, 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local shade = "" -- assume full
|
||||||
|
if string.sub(color,1,6) == "faint_" then
|
||||||
|
shade = "faint"
|
||||||
|
color = string.sub(color,7,-1)
|
||||||
|
elseif string.sub(color,1,7) == "pastel_" then
|
||||||
|
shade = "pastel"
|
||||||
|
color = string.sub(color,8,-1)
|
||||||
|
elseif string.sub(color,1,6) == "light_" then
|
||||||
|
shade = "light"
|
||||||
|
color = string.sub(color,7,-1)
|
||||||
|
elseif string.sub(color,1,7) == "bright_" then
|
||||||
|
shade = "bright"
|
||||||
|
color = string.sub(color,8,-1)
|
||||||
|
elseif string.sub(color,1,7) == "medium_" then
|
||||||
|
shade = "medium"
|
||||||
|
color = string.sub(color,8,-1)
|
||||||
|
elseif string.sub(color,1,5) == "dark_" then
|
||||||
|
shade = "dark"
|
||||||
|
color = string.sub(color,6,-1)
|
||||||
|
end
|
||||||
|
if string.sub(color,-4,-1) == "_s50" then
|
||||||
|
shade = shade.."s50"
|
||||||
|
color = string.sub(color,1,-5)
|
||||||
|
end
|
||||||
|
|
||||||
|
if palette_type == "wallmounted" then
|
||||||
|
if color == "green" and shade == "light" then return 48,3
|
||||||
|
elseif color == "brown" then return 17,1
|
||||||
|
elseif color == "pink" then return 56,7
|
||||||
|
elseif color == "blue" and shade == "light" then return 40,5
|
||||||
|
elseif unifieddyes.gpidx_hues_wallmounted[color] and unifieddyes.gpidx_shades_wallmounted[shade] then
|
||||||
|
return (unifieddyes.gpidx_shades_wallmounted[shade] * 64 + unifieddyes.gpidx_hues_wallmounted[color] * 8),
|
||||||
|
unifieddyes.gpidx_hues_wallmounted[color]
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if color == "brown" then
|
||||||
|
color = "orange"
|
||||||
|
shade = "medium"
|
||||||
|
elseif color == "pink" then
|
||||||
|
color = "red"
|
||||||
|
shade = "light"
|
||||||
|
end
|
||||||
|
if palette_type == "split" then -- it's colorfacedir
|
||||||
|
if unifieddyes.gpidx_hues_extended[color] and unifieddyes.gpidx_shades_split[shade] then
|
||||||
|
return (unifieddyes.gpidx_shades_split[shade] * 32), unifieddyes.gpidx_hues_extended[color]+1
|
||||||
|
end
|
||||||
|
elseif palette_type == "extended" then
|
||||||
|
if unifieddyes.gpidx_hues_extended[color] and unifieddyes.gpidx_shades_extended[shade] then
|
||||||
|
return (unifieddyes.gpidx_hues_extended[color] + unifieddyes.gpidx_shades_extended[shade]*24),
|
||||||
|
unifieddyes.gpidx_hues_extended[color]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function unifieddyes.get_color_from_dye_name(name)
|
||||||
|
if name == "dye:black" then
|
||||||
|
return "000000"
|
||||||
|
elseif name == "dye:white" then
|
||||||
|
return "ffffff"
|
||||||
|
elseif name == "dye:brown" then
|
||||||
|
return "b43500"
|
||||||
|
elseif name == "dye:pink" then
|
||||||
|
return "ff5050"
|
||||||
|
end
|
||||||
|
local item = minetest.registered_items[name]
|
||||||
|
if not item then return end
|
||||||
|
local inv_image = item.inventory_image
|
||||||
|
if not inv_image then return end
|
||||||
|
return string.match(inv_image,"colorize:#(......):200")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- get a node's dye color based on its palette and param2
|
||||||
|
|
||||||
|
function unifieddyes.color_to_name(param2, def)
|
||||||
|
if not param2 or not def or not def.palette then return end
|
||||||
|
|
||||||
|
if def.palette == "unifieddyes_palette_extended.png" then
|
||||||
|
local color = param2
|
||||||
|
|
||||||
|
local v = 0
|
||||||
|
local s = 1
|
||||||
|
if color < 24 then v = 1
|
||||||
|
elseif color > 23 and color < 48 then v = 2
|
||||||
|
elseif color > 47 and color < 72 then v = 3
|
||||||
|
elseif color > 71 and color < 96 then v = 4
|
||||||
|
elseif color > 95 and color < 120 then v = 5
|
||||||
|
elseif color > 119 and color < 144 then v = 5 s = 2
|
||||||
|
elseif color > 143 and color < 168 then v = 6
|
||||||
|
elseif color > 167 and color < 192 then v = 6 s = 2
|
||||||
|
elseif color > 191 and color < 216 then v = 7
|
||||||
|
elseif color > 215 and color < 240 then v = 7 s = 2
|
||||||
|
end
|
||||||
|
|
||||||
|
if color > 239 then
|
||||||
|
if color == 240 then return "white"
|
||||||
|
elseif color == 244 then return "light_grey"
|
||||||
|
elseif color == 247 then return "grey"
|
||||||
|
elseif color == 251 then return "dark_grey"
|
||||||
|
elseif color == 255 then return "black"
|
||||||
|
else return "grey_"..15-(color-240)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
local h = color - math.floor(color/24)*24
|
||||||
|
return unifieddyes.VALS_EXTENDED[v]..unifieddyes.HUES_EXTENDED[h+1][1]..unifieddyes.SATS[s]
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif def.palette == "unifieddyes_palette_colorwallmounted.png" then
|
||||||
|
local color = math.floor(param2 / 8)
|
||||||
|
if color == 0 then return "white"
|
||||||
|
elseif color == 1 then return "light_grey"
|
||||||
|
elseif color == 2 then return "grey"
|
||||||
|
elseif color == 3 then return "dark_grey"
|
||||||
|
elseif color == 4 then return "black"
|
||||||
|
elseif color == 5 then return "light_blue"
|
||||||
|
elseif color == 6 then return "light_green"
|
||||||
|
elseif color == 7 then return "pink"
|
||||||
|
end
|
||||||
|
local v = math.floor(color/8)
|
||||||
|
local h = color - v * 8
|
||||||
|
return unifieddyes.VALS[v]..unifieddyes.HUES_WALLMOUNTED[h+1]
|
||||||
|
|
||||||
|
elseif string.find(def.palette, "unifieddyes_palette") then -- it's the split palette
|
||||||
|
-- palette names in this mode are always "unifieddyes_palette_COLORs.png"
|
||||||
|
|
||||||
|
local s = string.sub(def.palette, 21)
|
||||||
|
local color = string.sub(s, 1, string.find(s, "s.png")-1)
|
||||||
|
|
||||||
|
local v = math.floor(param2/32)
|
||||||
|
if color ~= "grey" then
|
||||||
|
if v == 0 then return "faint_"..color
|
||||||
|
elseif v == 1 then return color
|
||||||
|
elseif v == 2 then return color.."_s50"
|
||||||
|
elseif v == 3 then return "light_"..color
|
||||||
|
elseif v == 4 then return "medium_"..color
|
||||||
|
elseif v == 5 then return "medium_"..color.."_s50"
|
||||||
|
elseif v == 6 then return "dark_"..color
|
||||||
|
elseif v == 7 then return "dark_"..color.."_s50"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if v > 0 and v < 6 then return unifieddyes.GREYS[v]
|
||||||
|
else return "white"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
After Width: | Height: | Size: 292 B |
@@ -0,0 +1,101 @@
|
|||||||
|
Changelog
|
||||||
|
---------
|
||||||
|
|
||||||
|
2013-04-30: Multiple changes
|
||||||
|
|
||||||
|
* Refactored the code to use default "common" dyes
|
||||||
|
rather than directly from flowers.
|
||||||
|
|
||||||
|
* This mod now depends on "default" and "dye" from the Minetest common
|
||||||
|
sub-game. Since the default dye mod uses default flowers, this mod no
|
||||||
|
longer checks for what version of flowers you're using, or even depends
|
||||||
|
on it.
|
||||||
|
|
||||||
|
* Bottle-based textures have been replaced with piles of dye powder, based
|
||||||
|
on the default red dye texture.
|
||||||
|
|
||||||
|
* All dyes are obtained by crafting, not cooking, for consistency with the
|
||||||
|
default dye mod.
|
||||||
|
|
||||||
|
* The somewhat-complicated method using separate "pigment" powders, glass
|
||||||
|
bottles and "liquid dye base" has been done away with. Now it's just
|
||||||
|
dry dye powders, as with the default dye mod.
|
||||||
|
|
||||||
|
* Also, got rid of the whole paint scheme, in favor of dry powders.
|
||||||
|
|
||||||
|
* All old dyes, paints, and Unified Dyes pigment powders have been aliased
|
||||||
|
back to the standard dye powders.
|
||||||
|
|
||||||
|
2012-07-26: Added a "version" check for the flowers dependency: If the
|
||||||
|
flowers mod defines "flowers:flower_geranium" (as is the case with my
|
||||||
|
update of 2012-08-01), then those will be used to get blue pigment
|
||||||
|
powder, and violas will produce violet powder, both of which can be
|
||||||
|
directly used to create their respective liquid dye colors. If it is
|
||||||
|
not defined (e.g. the user has an older version of the flowers mod),
|
||||||
|
then violas produce blue dye powder. Violet dye can still be formed by
|
||||||
|
mixing blue and magenta or blue and red dyes, as before.
|
||||||
|
|
||||||
|
2012-07-26: Better bottle textures. Note that these are blended against
|
||||||
|
the 50% grey field they normally appear on in the inventory display, so
|
||||||
|
they will show artifacts if you try to wield them. Don't do that. :-)
|
||||||
|
|
||||||
|
2012-07-26: Split off glass bottles into a separate mod, "Vessels".
|
||||||
|
This mod now depends on it.
|
||||||
|
|
||||||
|
2012-07-25 (almost immediately after): Fixed a copy&paste error for
|
||||||
|
black dye.
|
||||||
|
|
||||||
|
2012-07-25: Replaced missing craftitem entries and got rid of some
|
||||||
|
redundant code left over from last update. Added group settings for all
|
||||||
|
dyes according to recently-published standard. Fixed a few typos in
|
||||||
|
item descriptions, and straightened up capitalization.
|
||||||
|
|
||||||
|
2012-07-24: Added some extra steps to the dye-making process, added
|
||||||
|
recommendation that empty bottles be given back to the player on use.
|
||||||
|
Dyes are still easy to make, they just require a more realistic (and
|
||||||
|
this, harder) process now.
|
||||||
|
|
||||||
|
2012-07-16 (a bit later): fixed a minor error in generation of medium
|
||||||
|
grey.
|
||||||
|
|
||||||
|
2012-07-16: Added a new set of colors, "light" (brightness of 150%
|
||||||
|
versus the 'full' shade), for a total of 89. No 50% saturation version
|
||||||
|
of this set. Added a palette image showing the full set of colors.
|
||||||
|
|
||||||
|
2012-07-13: Fixed some missing commas.
|
||||||
|
|
||||||
|
2012-07-13: Added a script to aid in the generation of new textures for
|
||||||
|
mods that depend on unifieddyes. Moved this changelog from the forum
|
||||||
|
into the distribution directory. Rewrote the README to contain
|
||||||
|
everything from the forum post, and expanded it to document the new
|
||||||
|
generation script.
|
||||||
|
|
||||||
|
2012-07-12 (a bit later): added groups = {dye=1}, to each
|
||||||
|
register_craftitem call, to make it easier for other mods to identify
|
||||||
|
the dyes and categorize them.
|
||||||
|
|
||||||
|
2012-07-12: moved project to github.
|
||||||
|
|
||||||
|
2012-07-11 (continuing): Tweaked the script to remove titanium dioxide
|
||||||
|
from the output, since it isn't intended to be directly used as a
|
||||||
|
dye/paint (but rather, to make paint that can then be used).
|
||||||
|
Regenerated colors.txt.
|
||||||
|
|
||||||
|
2012-07-11 (immediately after): The script was reading the wrong pixel
|
||||||
|
from the image, resulting in lighter-than-correct colors. Fixed it and
|
||||||
|
regenerated the colors.txt file.
|
||||||
|
|
||||||
|
2012-07-11: Added a script to list all of the colors and their RGB
|
||||||
|
values and texture filenames, and a text file containing the output
|
||||||
|
thereof.
|
||||||
|
|
||||||
|
2012-07-08 (a bit later): deleted a few unused files (copy&paste error).
|
||||||
|
|
||||||
|
2012-07-08: Major boost in the number of available colors - was 8, now
|
||||||
|
77. Should cover pretty much the entire spectrum of colors one might
|
||||||
|
use in this game.
|
||||||
|
|
||||||
|
2012-07-02: Deleted a few redundant files (leftovers from when I wanted
|
||||||
|
to merge in flowers and then changed my mind).
|
||||||
|
|
||||||
|
2012-06-26: Initial upload.
|
||||||
@@ -0,0 +1,219 @@
|
|||||||
|
|
||||||
|
-- the names of the various colors here came from http://www.procato.com/rgb+index/
|
||||||
|
|
||||||
|
unifieddyes.HUES_EXTENDED = {
|
||||||
|
{ "red", 0xff, 0x00, 0x00 },
|
||||||
|
{ "vermilion", 0xff, 0x40, 0x00 },
|
||||||
|
{ "orange", 0xff, 0x80, 0x00 },
|
||||||
|
{ "amber", 0xff, 0xbf, 0x00 },
|
||||||
|
{ "yellow", 0xff, 0xff, 0x00 },
|
||||||
|
{ "lime", 0xbf, 0xff, 0x00 },
|
||||||
|
{ "chartreuse", 0x80, 0xff, 0x00 },
|
||||||
|
{ "harlequin", 0x40, 0xff, 0x00 },
|
||||||
|
{ "green", 0x00, 0xff, 0x00 },
|
||||||
|
{ "malachite", 0x00, 0xff, 0x40 },
|
||||||
|
{ "spring", 0x00, 0xff, 0x80 },
|
||||||
|
{ "turquoise", 0x00, 0xff, 0xbf },
|
||||||
|
{ "cyan", 0x00, 0xff, 0xff },
|
||||||
|
{ "cerulean", 0x00, 0xbf, 0xff },
|
||||||
|
{ "azure", 0x00, 0x80, 0xff },
|
||||||
|
{ "sapphire", 0x00, 0x40, 0xff },
|
||||||
|
{ "blue", 0x00, 0x00, 0xff },
|
||||||
|
{ "indigo", 0x40, 0x00, 0xff },
|
||||||
|
{ "violet", 0x80, 0x00, 0xff },
|
||||||
|
{ "mulberry", 0xbf, 0x00, 0xff },
|
||||||
|
{ "magenta", 0xff, 0x00, 0xff },
|
||||||
|
{ "fuchsia", 0xff, 0x00, 0xbf },
|
||||||
|
{ "rose", 0xff, 0x00, 0x80 },
|
||||||
|
{ "crimson", 0xff, 0x00, 0x40 }
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.HUES_WITH_GREY = {}
|
||||||
|
|
||||||
|
for _,i in ipairs(unifieddyes.HUES_EXTENDED) do
|
||||||
|
table.insert(unifieddyes.HUES_WITH_GREY, i[1])
|
||||||
|
end
|
||||||
|
table.insert(unifieddyes.HUES_WITH_GREY, "grey")
|
||||||
|
|
||||||
|
unifieddyes.HUES_WALLMOUNTED = {
|
||||||
|
"red",
|
||||||
|
"orange",
|
||||||
|
"yellow",
|
||||||
|
"green",
|
||||||
|
"cyan",
|
||||||
|
"blue",
|
||||||
|
"violet",
|
||||||
|
"magenta"
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.SATS = {
|
||||||
|
"",
|
||||||
|
"_s50"
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.VALS = {
|
||||||
|
"",
|
||||||
|
"medium_",
|
||||||
|
"dark_"
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.VALS_SPLIT = {
|
||||||
|
"faint_",
|
||||||
|
"light_",
|
||||||
|
"",
|
||||||
|
"medium_",
|
||||||
|
"dark_"
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.VALS_EXTENDED = {
|
||||||
|
"faint_",
|
||||||
|
"pastel_",
|
||||||
|
"light_",
|
||||||
|
"bright_",
|
||||||
|
"",
|
||||||
|
"medium_",
|
||||||
|
"dark_"
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.GREYS = {
|
||||||
|
"white",
|
||||||
|
"light_grey",
|
||||||
|
"grey",
|
||||||
|
"dark_grey",
|
||||||
|
"black"
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.GREYS_EXTENDED = table.copy(unifieddyes.GREYS)
|
||||||
|
|
||||||
|
for i = 1, 14 do
|
||||||
|
if i ~= 0 and i ~= 4 and i ~= 8 and i ~= 11 and i ~= 15 then
|
||||||
|
table.insert(unifieddyes.GREYS_EXTENDED, "grey_"..i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- reverse lookups for getpaletteidx()
|
||||||
|
|
||||||
|
unifieddyes.gpidx_aliases = {
|
||||||
|
["pink"] = "light_red",
|
||||||
|
["brown"] = "medium_orange",
|
||||||
|
["azure"] = "light_blue"
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.gpidx_grayscale = {
|
||||||
|
["white"] = 1,
|
||||||
|
["light_grey"] = 2,
|
||||||
|
["grey"] = 3,
|
||||||
|
["dark_grey"] = 4,
|
||||||
|
["black"] = 5,
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.gpidx_grayscale_extended = {
|
||||||
|
["white"] = 0,
|
||||||
|
["grey_14"] = 1,
|
||||||
|
["grey_13"] = 2,
|
||||||
|
["grey_12"] = 3,
|
||||||
|
["light_grey"] = 4,
|
||||||
|
["grey_11"] = 4,
|
||||||
|
["grey_10"] = 5,
|
||||||
|
["grey_9"] = 6,
|
||||||
|
["grey_8"] = 7,
|
||||||
|
["grey"] = 7,
|
||||||
|
["grey_7"] = 8,
|
||||||
|
["grey_6"] = 9,
|
||||||
|
["grey_5"] = 10,
|
||||||
|
["grey_4"] = 11,
|
||||||
|
["dark_grey"] = 11,
|
||||||
|
["grey_3"] = 12,
|
||||||
|
["grey_2"] = 13,
|
||||||
|
["grey_1"] = 14,
|
||||||
|
["black"] = 15,
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.gpidx_grayscale_wallmounted = {
|
||||||
|
["white"] = 0,
|
||||||
|
["light_grey"] = 1,
|
||||||
|
["grey"] = 2,
|
||||||
|
["dark_grey"] = 3,
|
||||||
|
["black"] = 4,
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.gpidx_hues_extended = {
|
||||||
|
["red"] = 0,
|
||||||
|
["vermilion"] = 1,
|
||||||
|
["orange"] = 2,
|
||||||
|
["amber"] = 3,
|
||||||
|
["yellow"] = 4,
|
||||||
|
["lime"] = 5,
|
||||||
|
["chartreuse"] = 6,
|
||||||
|
["harlequin"] = 7,
|
||||||
|
["green"] = 8,
|
||||||
|
["malachite"] = 9,
|
||||||
|
["spring"] = 10,
|
||||||
|
["aqua"] = 10,
|
||||||
|
["turquoise"] = 11,
|
||||||
|
["cyan"] = 12,
|
||||||
|
["cerulean"] = 13,
|
||||||
|
["azure"] = 14,
|
||||||
|
["skyblue"] = 14,
|
||||||
|
["sapphire"] = 15,
|
||||||
|
["blue"] = 16,
|
||||||
|
["indigo"] = 17,
|
||||||
|
["violet"] = 18,
|
||||||
|
["mulberry"] = 19,
|
||||||
|
["magenta"] = 20,
|
||||||
|
["fuchsia"] = 21,
|
||||||
|
["rose"] = 22,
|
||||||
|
["redviolet"] = 22,
|
||||||
|
["crimson"] = 23,
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.gpidx_hues_wallmounted = {
|
||||||
|
["red"] = 0,
|
||||||
|
["orange"] = 1,
|
||||||
|
["yellow"] = 2,
|
||||||
|
["green"] = 3,
|
||||||
|
["cyan"] = 4,
|
||||||
|
["blue"] = 5,
|
||||||
|
["violet"] = 6,
|
||||||
|
["magenta"] = 7
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.gpidx_shades = {
|
||||||
|
[""] = 1,
|
||||||
|
["s50"] = 2,
|
||||||
|
["light"] = 3,
|
||||||
|
["medium"] = 4,
|
||||||
|
["mediums50"] = 5,
|
||||||
|
["dark"] = 6,
|
||||||
|
["darks50"] = 7,
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.gpidx_shades_split = {
|
||||||
|
["faint"] = 0,
|
||||||
|
[""] = 1,
|
||||||
|
["s50"] = 2,
|
||||||
|
["light"] = 3,
|
||||||
|
["medium"] = 4,
|
||||||
|
["mediums50"] = 5,
|
||||||
|
["dark"] = 6,
|
||||||
|
["darks50"] = 7,
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.gpidx_shades_extended = {
|
||||||
|
["faint"] = 0,
|
||||||
|
["pastel"] = 1,
|
||||||
|
["light"] = 2,
|
||||||
|
["bright"] = 3,
|
||||||
|
[""] = 4,
|
||||||
|
["s50"] = 5,
|
||||||
|
["medium"] = 6,
|
||||||
|
["mediums50"] = 7,
|
||||||
|
["dark"] = 8,
|
||||||
|
["darks50"] = 9
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.gpidx_shades_wallmounted = {
|
||||||
|
[""] = 1,
|
||||||
|
["medium"] = 2,
|
||||||
|
["dark"] = 3
|
||||||
|
}
|
||||||
@@ -0,0 +1,326 @@
|
|||||||
|
-- crafting!
|
||||||
|
|
||||||
|
-- Generate all dyes that are not part of the default minetest_game dyes mod
|
||||||
|
|
||||||
|
local S = minetest.get_translator("unifieddyes")
|
||||||
|
|
||||||
|
for _, h in ipairs(unifieddyes.HUES_EXTENDED) do
|
||||||
|
local hue = h[1]
|
||||||
|
local r = h[2]
|
||||||
|
local g = h[3]
|
||||||
|
local b = h[4]
|
||||||
|
|
||||||
|
for v = 0, 6 do
|
||||||
|
local val = unifieddyes.VALS_EXTENDED[v+1]
|
||||||
|
|
||||||
|
local factor = 40
|
||||||
|
if v > 3 then factor = 75 end
|
||||||
|
|
||||||
|
local r2 = math.max(math.min(r + (4-v)*factor, 255), 0)
|
||||||
|
local g2 = math.max(math.min(g + (4-v)*factor, 255), 0)
|
||||||
|
local b2 = math.max(math.min(b + (4-v)*factor, 255), 0)
|
||||||
|
|
||||||
|
-- full-sat color
|
||||||
|
|
||||||
|
local desc = hue:gsub("%a", string.upper, 1).." Dye"
|
||||||
|
|
||||||
|
if val ~= "" then
|
||||||
|
desc = val:sub(1, -2):gsub("%a", string.upper, 1) .." "..desc
|
||||||
|
end
|
||||||
|
|
||||||
|
local color = string.format("%02x", r2)..string.format("%02x", g2)..string.format("%02x", b2)
|
||||||
|
if minetest.registered_items["dye:"..val..hue] then
|
||||||
|
minetest.override_item("dye:"..val..hue, {
|
||||||
|
inventory_image = "unifieddyes_dye.png^[colorize:#"..color..":200",
|
||||||
|
})
|
||||||
|
else
|
||||||
|
if (val..hue) ~= "medium_orange"
|
||||||
|
and (val..hue) ~= "light_red" then
|
||||||
|
minetest.register_craftitem(":dye:"..val..hue, {
|
||||||
|
description = S(desc),
|
||||||
|
inventory_image = "unifieddyes_dye.png^[colorize:#"..color..":200",
|
||||||
|
groups = { dye=1, not_in_creative_inventory=1 },
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
minetest.register_alias("unifieddyes:"..val..hue, "dye:"..val..hue)
|
||||||
|
|
||||||
|
if v > 3 then -- also register the low-sat version
|
||||||
|
|
||||||
|
local pr = 0.299
|
||||||
|
local pg = 0.587
|
||||||
|
local pb = 0.114
|
||||||
|
|
||||||
|
local p = math.sqrt(r2*r2*pr + g2*g2*pg + b2*b2*pb)
|
||||||
|
local r3 = math.floor(p+(r2-p)*0.5)
|
||||||
|
local g3 = math.floor(p+(g2-p)*0.5)
|
||||||
|
local b3 = math.floor(p+(b2-p)*0.5)
|
||||||
|
|
||||||
|
local ccolor = string.format("%02x", r3)..string.format("%02x", g3)..string.format("%02x", b3)
|
||||||
|
|
||||||
|
minetest.register_craftitem(":dye:"..val..hue.."_s50", {
|
||||||
|
description = S(desc.." (low saturation)"),
|
||||||
|
inventory_image = "unifieddyes_dye.png^[colorize:#"..ccolor..":200",
|
||||||
|
groups = { dye=1, not_in_creative_inventory=1 },
|
||||||
|
})
|
||||||
|
minetest.register_alias("unifieddyes:"..val..hue.."_s50", "dye:"..val..hue.."_s50")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- register the greyscales too :P
|
||||||
|
|
||||||
|
for y = 1, 14 do -- colors 0 and 15 are black and white, default dyes
|
||||||
|
|
||||||
|
if y ~= 4 and y ~= 8 and y~= 11 then -- don't register the three greys, they're done separately.
|
||||||
|
|
||||||
|
local rgb = string.format("%02x", y*17)..string.format("%02x", y*17)..string.format("%02x", y*17)
|
||||||
|
local name = "grey_"..y
|
||||||
|
local desc = "Grey Dye #"..y
|
||||||
|
|
||||||
|
minetest.register_craftitem(":dye:"..name, {
|
||||||
|
description = S(desc),
|
||||||
|
inventory_image = "unifieddyes_dye.png^[colorize:#"..rgb..":200",
|
||||||
|
groups = { dye=1, not_in_creative_inventory=1 },
|
||||||
|
})
|
||||||
|
minetest.register_alias("unifieddyes:"..name, "dye:"..name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if minetest.get_modpath("dye") then
|
||||||
|
minetest.override_item("dye:grey", {
|
||||||
|
inventory_image = "unifieddyes_dye.png^[colorize:#888888:200",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.override_item("dye:dark_grey", {
|
||||||
|
inventory_image = "unifieddyes_dye.png^[colorize:#444444:200",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem(":dye:light_grey", {
|
||||||
|
description = S("Light grey Dye"),
|
||||||
|
inventory_image = "unifieddyes_dye.png^[colorize:#cccccc:200",
|
||||||
|
groups = { dye=1, not_in_creative_inventory=1 },
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Conflicting recipe: violet for dye; magenta for unifieddyes
|
||||||
|
minetest.clear_craft( {
|
||||||
|
type = "shapeless",
|
||||||
|
recipe = {
|
||||||
|
"dye:red", "dye:blue"
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Conflicting recipe: dark green for dye; medium green for unifieddyes
|
||||||
|
minetest.clear_craft( {
|
||||||
|
type = "shapeless",
|
||||||
|
recipe = {
|
||||||
|
"dye:green", "dye:black"
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- build a table of color <-> palette associations to reduce the need for
|
||||||
|
-- realtime lookups with getpaletteidx()
|
||||||
|
|
||||||
|
for _, palette in ipairs({"extended", "split", "wallmounted"}) do
|
||||||
|
local palette2 = palette
|
||||||
|
|
||||||
|
for i in ipairs(unifieddyes.SATS) do
|
||||||
|
local sat = (palette == "wallmounted") and "" or unifieddyes.SATS[i]
|
||||||
|
for _, hue in ipairs(unifieddyes.HUES_EXTENDED) do
|
||||||
|
for _, val in ipairs(unifieddyes.VALS_EXTENDED) do
|
||||||
|
local color = val..hue[1]..sat
|
||||||
|
if unifieddyes.getpaletteidx("dye:"..color, palette2) then
|
||||||
|
unifieddyes.palette_has_color[palette.."_"..color] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for y = 0, 15 do
|
||||||
|
local grey = "grey_"..y
|
||||||
|
|
||||||
|
if y == 0 then grey = "black"
|
||||||
|
elseif y == 4 then grey = "dark_grey"
|
||||||
|
elseif y == 8 then grey = "grey"
|
||||||
|
elseif y == 11 then grey = "light_grey"
|
||||||
|
elseif y == 15 then grey = "white"
|
||||||
|
end
|
||||||
|
if unifieddyes.getpaletteidx("dye:"..grey, palette2) then
|
||||||
|
unifieddyes.palette_has_color[palette.."_"..grey] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
unifieddyes.palette_has_color["wallmounted_light_red"] = true
|
||||||
|
|
||||||
|
unifieddyes.base_color_crafts = {
|
||||||
|
{ "red", "flowers:rose", nil, nil, nil, nil, 4 },
|
||||||
|
{ "vermilion", "dye:red", "dye:orange", nil, nil, nil, 2 },
|
||||||
|
{ "orange", "flowers:tulip", nil, nil, nil, nil, 4 },
|
||||||
|
{ "orange", "dye:red", "dye:yellow", nil, nil, nil, 2 },
|
||||||
|
{ "amber", "dye:orange", "dye:yellow", nil, nil, nil, 2 },
|
||||||
|
{ "yellow", "flowers:dandelion_yellow", nil, nil, nil, nil, 4 },
|
||||||
|
{ "lime", "dye:yellow", "dye:chartreuse", nil, nil, nil, 2 },
|
||||||
|
{ "lime", "dye:yellow", "dye:yellow", "dye:green", nil, nil, 3 },
|
||||||
|
{ "chartreuse", "dye:yellow", "dye:green", nil, nil, nil, 2 },
|
||||||
|
{ "harlequin", "dye:chartreuse", "dye:green", nil, nil, nil, 2 },
|
||||||
|
{ "harlequin", "dye:yellow", "dye:green", "dye:green", nil, nil, 3 },
|
||||||
|
{ "green", "default:cactus", nil, nil, nil, nil, 4 },
|
||||||
|
{ "green", "dye:yellow", "dye:blue", nil, nil, nil, 2 },
|
||||||
|
{ "malachite", "dye:green", "dye:spring", nil, nil, nil, 2 },
|
||||||
|
{ "malachite", "dye:green", "dye:green", "dye:cyan", nil, nil, 3 },
|
||||||
|
{ "malachite", "dye:green", "dye:green", "dye:green", "dye:blue", nil, 4 },
|
||||||
|
{ "spring", "dye:green", "dye:cyan", nil, nil, nil, 2 },
|
||||||
|
{ "spring", "dye:green", "dye:green", "dye:blue", nil, nil, 3 },
|
||||||
|
{ "turquoise", "dye:spring", "dye:cyan", nil, nil, nil, 2 },
|
||||||
|
{ "turquoise", "dye:green", "dye:cyan", "dye:cyan", nil, nil, 3 },
|
||||||
|
{ "turquoise", "dye:green", "dye:green", "dye:green", "dye:blue", "dye:blue", 5 },
|
||||||
|
{ "cyan", "dye:green", "dye:blue", nil, nil, nil, 2 },
|
||||||
|
{ "cerulean", "dye:cyan", "dye:azure", nil, nil, nil, 2 },
|
||||||
|
{ "cerulean", "dye:cyan", "dye:cyan", "dye:blue", nil, nil, 3 },
|
||||||
|
{ "cerulean", "dye:green", "dye:green", "dye:blue", "dye:blue", "dye:blue", 5 },
|
||||||
|
{ "azure", "dye:cyan", "dye:blue", nil, nil, nil, 2 },
|
||||||
|
{ "azure", "dye:green", "dye:blue", "dye:blue", nil, nil, 3 },
|
||||||
|
{ "sapphire", "dye:azure", "dye:blue", nil, nil, nil, 2 },
|
||||||
|
{ "sapphire", "dye:cyan", "dye:blue", "dye:blue", nil, nil, 3 },
|
||||||
|
{ "sapphire", "dye:green", "dye:blue", "dye:blue", "dye:blue", nil, 4 },
|
||||||
|
{ "blue", "flowers:geranium", nil, nil, nil, nil, 4 },
|
||||||
|
{ "indigo", "dye:blue", "dye:violet", nil, nil, nil, 2 },
|
||||||
|
{ "violet", "flowers:viola", nil, nil, nil, nil, 4 },
|
||||||
|
{ "violet", "dye:blue", "dye:magenta", nil, nil, nil, 2 },
|
||||||
|
{ "mulberry", "dye:violet", "dye:magenta", nil, nil, nil, 2 },
|
||||||
|
{ "mulberry", "dye:violet", "dye:blue", "dye:red", nil, nil, 3 },
|
||||||
|
{ "magenta", "dye:blue", "dye:red", nil, nil, nil, 2 },
|
||||||
|
{ "fuchsia", "dye:magenta", "dye:rose", nil, nil, nil, 2 },
|
||||||
|
{ "fuchsia", "dye:blue", "dye:red", "dye:rose", nil, nil, 3 },
|
||||||
|
{ "fuchsia", "dye:red", "dye:violet", nil, nil, nil, 2 },
|
||||||
|
{ "rose", "dye:magenta", "dye:red", nil, nil, nil, 2 },
|
||||||
|
{ "rose", "dye:red", "dye:red", "dye:blue", nil, nil, 3 },
|
||||||
|
{ "crimson", "dye:rose", "dye:red", nil, nil, nil, 2 },
|
||||||
|
{ "crimson", "dye:magenta", "dye:red", "dye:red", nil, nil, 3 },
|
||||||
|
{ "crimson", "dye:red", "dye:red", "dye:red", "dye:blue", nil, 4 },
|
||||||
|
|
||||||
|
{ "black", "default:coal_lump", nil, nil, nil, nil, 4 },
|
||||||
|
{ "white", "flowers:dandelion_white", nil, nil, nil, nil, 4 },
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.shade_crafts = {
|
||||||
|
{ "faint_", "", "dye:white", "dye:white", "dye:white", 4 },
|
||||||
|
{ "pastel_", "", "dye:white", "dye:white", nil, 3 },
|
||||||
|
{ "light_", "", "dye:white", nil, nil, 2 },
|
||||||
|
{ "bright_", "", "color", "dye:white", nil, 3 },
|
||||||
|
{ "", "_s50", "dye:light_grey", nil, nil, 2 },
|
||||||
|
{ "", "_s50", "dye:black", "dye:white", "dye:white", 3 },
|
||||||
|
{ "medium_", "", "dye:black", nil, nil, 2 },
|
||||||
|
{ "medium_", "_s50", "dye:grey", nil, nil, 2 },
|
||||||
|
{ "medium_", "_s50", "dye:black", "dye:white", nil, 3 },
|
||||||
|
{ "dark_", "", "dye:black", "dye:black", nil, 3 },
|
||||||
|
{ "dark_", "_s50", "dye:dark_grey", nil, nil, 2 },
|
||||||
|
{ "dark_", "_s50", "dye:black", "dye:black", "dye:white", 4 },
|
||||||
|
}
|
||||||
|
|
||||||
|
for _,i in ipairs(unifieddyes.base_color_crafts) do
|
||||||
|
local color = i[1]
|
||||||
|
local yield = i[7]
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
type = "shapeless",
|
||||||
|
output = "dye:"..color.." "..yield,
|
||||||
|
recipe = {
|
||||||
|
i[2],
|
||||||
|
i[3],
|
||||||
|
i[4],
|
||||||
|
i[5],
|
||||||
|
i[6],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
for _,j in ipairs(unifieddyes.shade_crafts) do
|
||||||
|
local firstdye = j[3]
|
||||||
|
if firstdye == "color" then firstdye = "dye:"..color end
|
||||||
|
|
||||||
|
-- ignore black, white, anything containing the word "grey"
|
||||||
|
|
||||||
|
if color ~= "black" and color ~= "white" and not string.find(color, "grey") then
|
||||||
|
minetest.register_craft( {
|
||||||
|
type = "shapeless",
|
||||||
|
output = "dye:"..j[1]..color..j[2].." "..j[6],
|
||||||
|
recipe = {
|
||||||
|
"dye:"..color,
|
||||||
|
firstdye,
|
||||||
|
j[4],
|
||||||
|
j[5]
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- greys
|
||||||
|
|
||||||
|
unifieddyes.greymixes = {
|
||||||
|
{ 1, "dye:black", "dye:black", "dye:black", "dye:dark_grey", 4 },
|
||||||
|
{ 2, "dye:black", "dye:black", "dye:dark_grey", nil, 3 },
|
||||||
|
{ 3, "dye:black", "dye:dark_grey", nil, nil, 2 },
|
||||||
|
{ 4, "dye:white", "dye:black", "dye:black", nil, 3 },
|
||||||
|
{ 5, "dye:dark_grey", "dye:dark_grey", "dye:grey", nil, 3 },
|
||||||
|
{ 6, "dye:dark_grey", "dye:grey", nil, nil, 2 },
|
||||||
|
{ 7, "dye:dark_grey", "dye:grey", "dye:grey", nil, 3 },
|
||||||
|
{ 8, "dye:white", "dye:black", nil, nil, 2 },
|
||||||
|
{ 9, "dye:grey", "dye:grey", "dye:light_grey", nil, 3 },
|
||||||
|
{ 10, "dye:grey", "dye:light_grey", "dye:light_grey", nil, 3 },
|
||||||
|
{ 11, "dye:white", "dye:white", "dye:black", nil, 3 },
|
||||||
|
{ 12, "dye:light_grey", "dye:light_grey", "dye:white", nil, 3 },
|
||||||
|
{ 13, "dye:light_grey", "dye:white", nil, nil, 2 },
|
||||||
|
{ 14, "dye:white", "dye:white", "dye:light_grey", nil, 3 },
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, i in ipairs(unifieddyes.greymixes) do
|
||||||
|
local shade = i[1]
|
||||||
|
local dye1 = i[2]
|
||||||
|
local dye2 = i[3]
|
||||||
|
local dye3 = i[4]
|
||||||
|
local dye4 = i[5]
|
||||||
|
local yield = i[6]
|
||||||
|
local color = "grey_"..shade
|
||||||
|
if shade == 4 then
|
||||||
|
color = "dark_grey"
|
||||||
|
elseif shade == 8 then
|
||||||
|
color = "grey"
|
||||||
|
elseif shade == 11 then
|
||||||
|
color = "light_grey"
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
type = "shapeless",
|
||||||
|
output = "dye:"..color.." "..yield,
|
||||||
|
recipe = {
|
||||||
|
dye1,
|
||||||
|
dye2,
|
||||||
|
dye3,
|
||||||
|
dye4,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- other crafts
|
||||||
|
-- we can't make dark orange anymore because brown/medium orange conflicts
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
type = "shapeless",
|
||||||
|
output = "dye:dark_orange",
|
||||||
|
recipe = {
|
||||||
|
"dye:brown",
|
||||||
|
"dye:brown"
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
output = "unifieddyes:airbrush",
|
||||||
|
recipe = {
|
||||||
|
{ "basic_materials:brass_ingot", "", "basic_materials:plastic_sheet" },
|
||||||
|
{ "", "default:steel_ingot", "" },
|
||||||
|
{ "", "", "default:steel_ingot" }
|
||||||
|
},
|
||||||
|
})
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
--[[
|
||||||
|
|
||||||
|
Unified Dyes
|
||||||
|
|
||||||
|
This mod provides an extension to the Minetest dye system
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
Copyright (C) 2012-2013, Vanessa Dannenberg
|
||||||
|
Email: vanessa.e.dannenberg@gmail.com
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 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 General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
--]]
|
||||||
|
|
||||||
|
--=====================================================================
|
||||||
|
|
||||||
|
unifieddyes = {}
|
||||||
|
|
||||||
|
local modpath=minetest.get_modpath(minetest.get_current_modname())
|
||||||
|
|
||||||
|
dofile(modpath.."/color-tables.lua")
|
||||||
|
dofile(modpath.."/api.lua")
|
||||||
|
dofile(modpath.."/airbrush.lua")
|
||||||
|
dofile(modpath.."/dyes-crafting.lua")
|
||||||
|
dofile(modpath.."/aliases.lua")
|
||||||
|
|
||||||
|
print("[UnifiedDyes] Loaded!")
|
||||||
|
unifieddyes.init = true
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
# textdomain: unifieddyes
|
||||||
|
|
||||||
|
# Template
|
||||||
|
|
||||||
|
Lime Dye=
|
||||||
|
Aqua Dye=
|
||||||
|
Sky-blue Dye=
|
||||||
|
Red-violet Dye=
|
||||||
|
Light Grey Dye=
|
||||||
|
|
||||||
|
Dark Red Dye (low saturation)=
|
||||||
|
Dark Orange Dye (low saturation)=
|
||||||
|
Dark Yellow Dye (low saturation)=
|
||||||
|
Dark Lime Dye (low saturation)=
|
||||||
|
Dark Green Dye (low saturation)=
|
||||||
|
Dark Aqua Dye (low saturation)=
|
||||||
|
Dark Cyan Dye (low saturation)=
|
||||||
|
Dark Sky-blue Dye (low saturation)=
|
||||||
|
Dark Blue Dye (low saturation)=
|
||||||
|
Dark Violet Dye (low saturation)=
|
||||||
|
Dark Magenta Dye (low saturation)=
|
||||||
|
Dark Red-violet Dye (low saturation)=
|
||||||
|
|
||||||
|
Dark Red Dye=
|
||||||
|
Dark Orange Dye=
|
||||||
|
Dark Yellow Dye=
|
||||||
|
Dark Lime Dye=
|
||||||
|
Dark Green Dye=
|
||||||
|
Dark Aqua Dye=
|
||||||
|
Dark Cyan Dye=
|
||||||
|
Dark Sky-blue Dye=
|
||||||
|
Dark Blue Dye=
|
||||||
|
Dark Violet Dye=
|
||||||
|
Dark Magenta Dye=
|
||||||
|
Dark Red-violet Dye=
|
||||||
|
|
||||||
|
Medium Red Dye (low saturation)=
|
||||||
|
Medium Orange Dye (low saturation)=
|
||||||
|
Medium Yellow Dye (low saturation)=
|
||||||
|
Medium Lime Dye (low saturation)=
|
||||||
|
Medium Green Dye (low saturation)=
|
||||||
|
Medium Aqua Dye (low saturation)=
|
||||||
|
Medium Cyan Dye (low saturation)=
|
||||||
|
Medium Sky-blue Dye (low saturation)=
|
||||||
|
Medium Blue Dye (low saturation)=
|
||||||
|
Medium Violet Dye (low saturation)=
|
||||||
|
Medium Magenta Dye (low saturation)=
|
||||||
|
Medium Red-violet Dye (low saturation)=
|
||||||
|
|
||||||
|
Medium Red Dye=
|
||||||
|
Medium Orange Dye=
|
||||||
|
Medium Yellow Dye=
|
||||||
|
Medium Lime Dye=
|
||||||
|
Medium Green Dye=
|
||||||
|
Medium Aqua Dye=
|
||||||
|
Medium Cyan Dye=
|
||||||
|
Medium Sky-blue=
|
||||||
|
Medium Blue Dye=
|
||||||
|
Medium Violet Dye=
|
||||||
|
Medium Magenta Dye=
|
||||||
|
Medium Red-violet Dye=
|
||||||
|
|
||||||
|
Red Dye (low saturation)=
|
||||||
|
Orange Dye (low saturation)=
|
||||||
|
Yellow Dye (low saturation)=
|
||||||
|
Lime Dye (low saturation)=
|
||||||
|
Green Dye (low saturation)=
|
||||||
|
Aqua Dye (low saturation)=
|
||||||
|
Cyan Dye (low saturation)=
|
||||||
|
Sky-blue Dye (low saturation)=
|
||||||
|
Blue Dye (low saturation)=
|
||||||
|
Violet Dye (low saturation)=
|
||||||
|
Magenta Dye (low saturation)=
|
||||||
|
Red-violet Dye (low saturation)=
|
||||||
|
|
||||||
|
Red Dye=
|
||||||
|
Orange Dye=
|
||||||
|
Yellow Dye=
|
||||||
|
Lime Dye=
|
||||||
|
Green Dye=
|
||||||
|
Aqua Dye=
|
||||||
|
Cyan Dye=
|
||||||
|
Sky-blue Dye=
|
||||||
|
Blue Dye=
|
||||||
|
Violet Dye=
|
||||||
|
Magenta Dye=
|
||||||
|
Red-violet Dye=
|
||||||
|
|
||||||
|
[UnifiedDyes] Loaded!=
|
||||||
|
|
||||||
|
Dye Airbrush=
|
||||||
|
|
||||||
|
Select a color:=
|
||||||
|
(Right-clicked a node that supports all 256 colors, showing them all)=
|
||||||
|
(Right-clicked a node not supported by the Airbrush, showing all colors)=
|
||||||
|
Dyes=
|
||||||
|
Your selection=
|
||||||
|
Your selection:=
|
||||||
|
Cancel=
|
||||||
|
Accept=
|
||||||
|
Show Available=
|
||||||
|
(Currently showing all 256 colors)=
|
||||||
|
Show All Colors=
|
||||||
|
(Currently only showing what the right-clicked node can use)=
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
# textdomain: unifieddyes
|
||||||
|
|
||||||
|
# Translation by Xanthin
|
||||||
|
|
||||||
|
Lime Dye=Gelbgruener Farbstoff (Gelbgruen)
|
||||||
|
Aqua Dye=Aqua Farbstoff
|
||||||
|
Sky-blue Dye=Himmelblauer Farbstoff
|
||||||
|
Red-violet Dye=Rotvioletter Farbstoff
|
||||||
|
Light Grey Dye=Hellgrauer Farbstoff
|
||||||
|
|
||||||
|
Dark Red Dye (low saturation)=Dunkelroter Farbstoff (geringe Saettigung)
|
||||||
|
Dark Orange Dye (low saturation)=Dunkeloranger Farbstoff (geringe Saettigung)
|
||||||
|
Dark Yellow Dye (low saturation)=Dunkelgelber Farbstoff (geringe Saettigung)
|
||||||
|
Dark Lime Dye (low saturation)=Gelbgruenerlime Farbstoff (geringe Saettigung)
|
||||||
|
Dark Green Dye (low saturation)=Dunkelgruener Farbstoff (geringe Saettigung)
|
||||||
|
Dark Aqua Dye (low saturation)=Dunkelaqua Farbstoff (geringe Saettigung)
|
||||||
|
Dark Cyan Dye (low saturation)=Dunkeltuerkiser Farbstoff (geringe Saettigung)
|
||||||
|
Dark Sky-blue Dye (low saturation)=Dunkelhimmelblauer Farbstoff (geringe Saettigung)
|
||||||
|
Dark Blue Dye (low saturation)=Dunkelblauer Farbstoff (geringe Saettigung)
|
||||||
|
Dark Violet Dye (low saturation)=Dunkelvioletter Farbstoff (geringe Saettigung)
|
||||||
|
Dark Magenta Dye (low saturation)=Dunkelmagenta Farbstoff (geringe Saettigung)
|
||||||
|
Dark Red-violet Dye (low saturation)=Dunkelrotvioletter Farbstoff (geringe Saettigung)
|
||||||
|
|
||||||
|
Dark Red Dye=Dunkelroter Farbstoff
|
||||||
|
Dark Orange Dye=Dunkeloranger Farbstoff
|
||||||
|
Dark Yellow Dye=Dunkelgelber Farbstoff
|
||||||
|
Dark Lime Dye=Dunkelgelbgruener Farbstoff
|
||||||
|
Dark Green Dye=Dunkelgruener Farbstoff
|
||||||
|
Dark Aqua Dye=Dunkelaqua Farbstoff
|
||||||
|
Dark Cyan Dye=Dunkeltuerkiser Farbstoff
|
||||||
|
Dark Sky-blue Dye=Dunkelhimmelblauer Farbstoff
|
||||||
|
Dark Blue Dye=Dunkelblauer Farbstoff
|
||||||
|
Dark Violet Dye=Dunkelvioletter Farbstoff
|
||||||
|
Dark Magenta Dye=Dunkelmagenta Farbstoff
|
||||||
|
Dark Red-violet Dye=Dunkelrotvioletter Farbstoff
|
||||||
|
|
||||||
|
Medium Red Dye (low saturation)=Mittelroter Farbstoff (geringe Saettigung)
|
||||||
|
Medium Orange Dye (low saturation)=Mitteloranger Farbstoff (geringe Saettigung)
|
||||||
|
Medium Yellow Dye (low saturation)=Mittelgelber Farbstoff (geringe Saettigung)
|
||||||
|
Medium Lime Dye (low saturation)=Mittelgelbgruener Farbstoff (geringe Saettigung)
|
||||||
|
Medium Green Dye (low saturation)=Mittelgruener Farbstoff (geringe Saettigung)
|
||||||
|
Medium Aqua Dye (low saturation)=Mittelaqua Farbstoff (geringe Saettigung)
|
||||||
|
Medium Cyan Dye (low saturation)=Mitteltuerkiser Farbstoff (geringe Saettigung)
|
||||||
|
Medium Sky-blue Dye (low saturation)=Mittelhimmelblauer Farbstoff (geringe Saettigung)
|
||||||
|
Medium Blue Dye (low saturation)=Mittelblauer Farbstoff (geringe Saettigung)
|
||||||
|
Medium Violet Dye (low saturation)=Mittelvioletter Farbstoff (geringe Saettigung)
|
||||||
|
Medium Magenta Dye (low saturation)=Mittelmagenta Farbstoff (geringe Saettigung)
|
||||||
|
Medium Red-violet Dye (low saturation)=Mittelrotvioletter Farbstoff (geringe Saettigung)
|
||||||
|
|
||||||
|
Medium Red Dye=Mittelroter Farbstoff
|
||||||
|
Medium Orange Dye=Mitteloranger Farbstoff
|
||||||
|
Medium Yellow Dye=Mittelgelber Farbstoff
|
||||||
|
Medium Lime Dye=Mittelgelbgruener Farbstoff
|
||||||
|
Medium Green Dye=Mittelgruener Farbstoff
|
||||||
|
Medium Aqua Dye=Mittelaqua Farbstoff
|
||||||
|
Medium Cyan Dye=Mitteltuerkiser Farbstoff
|
||||||
|
Medium Sky-blue=Mittelhimmelblauer Farbstoff
|
||||||
|
Medium Blue Dye=Mittelblauer Farbstoff
|
||||||
|
Medium Violet Dye=Mittelvioletter Farbstoff
|
||||||
|
Medium Magenta Dye=Mittelmagenta Farbstoff
|
||||||
|
Medium Red-violet Dye=Mittelrotvioletter Farbstoff
|
||||||
|
|
||||||
|
Red Dye (low saturation)=Roter Farbstoff (geringe Saettigung)
|
||||||
|
Orange Dye (low saturation)=Oranger Farbstoff (geringe Saettigung)
|
||||||
|
Yellow Dye (low saturation)=Gelber Farbstoff (geringe Saettigung)
|
||||||
|
Lime Dye (low saturation)=Gelbgruener Farbstoff (geringe Saettigung)
|
||||||
|
Green Dye (low saturation)=Gruener Farbstoff (geringe Saettigung)
|
||||||
|
Aqua Dye (low saturation)=Aqua Farbstoff (geringe Saettigung)
|
||||||
|
Cyan Dye (low saturation)=Tuerkiser Farbstoff (geringe Saettigung)
|
||||||
|
Sky-blue Dye (low saturation)=Himmelblauer Farbstoff (geringe Saettigung)
|
||||||
|
Blue Dye (low saturation)=Blauer Farbstoff (geringe Saettigung)
|
||||||
|
Violet Dye (low saturation)=Violetter Farbstoff (geringe Saettigung)
|
||||||
|
Magenta Dye (low saturation)=Magenta Farbstoff (geringe Saettigung) lila
|
||||||
|
Red-violet Dye (low saturation)=Rotvioletter Farbstoff (geringe Saettigung)
|
||||||
|
|
||||||
|
[UnifiedDyes] Loaded!=[UnifiedDyes] geladen!
|
||||||
|
|
||||||
|
Dye Airbrush=Farbstroff Airbrush
|
||||||
|
|
||||||
|
Select a color:=Wähle eine Farbe
|
||||||
|
(Right-clicked a node that supports all 256 colors, showing them all)=(Angeklickter Block unterstützt alle 256 Farben, zeige alle)
|
||||||
|
(Right-clicked a node not supported by the Airbrush, showing all colors)=(Angeklickter Block unterstützt kein Airbrush, zeige alle Farben)
|
||||||
|
Dyes=Farbstoffe
|
||||||
|
Your selection=Deine Auswahl
|
||||||
|
Your selection:=Deine Auswahl:
|
||||||
|
Cancel=Abbrechen
|
||||||
|
Accept=Übernehmen
|
||||||
|
Show Available=Zeige verfügbare
|
||||||
|
(Currently showing all 256 colors)=(Zeige alle 256 Farben)
|
||||||
|
Show All Colors=Zeige alle Farben
|
||||||
|
(Currently only showing what the right-clicked node can use)=(Zeige alle, die der angeklickte Block verwenden kann)
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
# textdomain: unifieddyes
|
||||||
|
|
||||||
|
# Traducido por Carlos Barraza
|
||||||
|
|
||||||
|
Lime Dye=Colorante Lima
|
||||||
|
Aqua Dye=Colorante Agua
|
||||||
|
Sky-blue Dye=Colorante Azul Cielo
|
||||||
|
Red-violet Dye=Colorante Rojo Violeta
|
||||||
|
Light Grey Dye=Colorante Gris Claro
|
||||||
|
|
||||||
|
Dark Red Dye (low saturation)=Colorante Rojo Oscuro (baja saturación)
|
||||||
|
Dark Orange Dye (low saturation)=Colorante Naranja Oscuro (baja saturación)
|
||||||
|
Dark Yellow Dye (low saturation)=Colorante Amarillo Oscuro (baja saturación)
|
||||||
|
Dark Lime Dye (low saturation)=Colorante Lima Oscuro (baja saturación)
|
||||||
|
Dark Green Dye (low saturation)=Colorante Verde Oscuro (baja saturación)
|
||||||
|
Dark Aqua Dye (low saturation)=Colorante Agua Oscuro (baja saturación)
|
||||||
|
Dark Cyan Dye (low saturation)=Colorante Cian Oscuro (baja saturación)
|
||||||
|
Dark Sky-blue Dye (low saturation)=Colorante Azul Cielo Oscuro (baja saturación)
|
||||||
|
Dark Blue Dye (low saturation)=Colorante Azul Oscuro (baja saturación)
|
||||||
|
Dark Violet Dye (low saturation)=Colorante Violeta Oscuro (baja saturación)
|
||||||
|
Dark Magenta Dye (low saturation)=Colorante Magenta Oscuro (baja saturación)
|
||||||
|
Dark Red-violet Dye (low saturation)=Colorante Rojo Violeta Oscuro (baja saturación)
|
||||||
|
|
||||||
|
Dark Red Dye=Colorante Rojo Oscuro
|
||||||
|
Dark Orange Dye=Colorante Naranja Oscuro
|
||||||
|
Dark Yellow Dye=Colorante Amarillo Oscuro
|
||||||
|
Dark Lime Dye=Colorante Lima Oscuro
|
||||||
|
Dark Green Dye=Colorante Verde Oscuro
|
||||||
|
Dark Aqua Dye=Colorante Agua Oscuro
|
||||||
|
Dark Cyan Dye=Colorante Cian Oscuro
|
||||||
|
Dark Sky-blue Dye=Colorante Azul Cielo Oscuro
|
||||||
|
Dark Blue Dye=Colorante Azul Oscuro
|
||||||
|
Dark Violet Dye=Colorante Violeta Oscuro
|
||||||
|
Dark Magenta Dye=Colorante Magenta Oscuro
|
||||||
|
Dark Red-violet Dye=Colorante Rojo Violeta Oscuro
|
||||||
|
|
||||||
|
Medium Red Dye (low saturation)=Colorante Rojo Claro (baja saturación)
|
||||||
|
Medium Orange Dye (low saturation)=Colorante Naranja Claro (baja saturación)
|
||||||
|
Medium Yellow Dye (low saturation)=Colorante Amarillo Claro (baja saturación)
|
||||||
|
Medium Lime Dye (low saturation)=Colorante Lima Claro (baja saturación)
|
||||||
|
Medium Green Dye (low saturation)=Colorante Verde Claro (baja saturación)
|
||||||
|
Medium Aqua Dye (low saturation)=Colorante Agua Claro (baja saturación)
|
||||||
|
Medium Cyan Dye (low saturation)=Colorante Cian Claro (baja saturación)
|
||||||
|
Medium Sky-blue Dye (low saturation)=Colorante Azul Cielo Claro (baja saturación)
|
||||||
|
Medium Blue Dye (low saturation)=Colorante Azul Claro (baja saturación)
|
||||||
|
Medium Violet Dye (low saturation)=Colorante Violeta Claro (baja saturación)
|
||||||
|
Medium Magenta Dye (low saturation)=Colorante Magenta Claro (baja saturación)
|
||||||
|
Medium Red-violet Dye (low saturation)=Colorante Rojo Violeta Claro (baja saturación)
|
||||||
|
|
||||||
|
Medium Red Dye=Colorante Rojo Claro
|
||||||
|
Medium Orange Dye=Colorante Naranja Claro
|
||||||
|
Medium Yellow Dye=Colorante Amarillo Claro
|
||||||
|
Medium Lime Dye=Colorante Lima Claro
|
||||||
|
Medium Green Dye=Colorante Verde Claro
|
||||||
|
Medium Aqua Dye=Colorante Agua Claro
|
||||||
|
Medium Cyan Dye=Colorante Cian Claro
|
||||||
|
Medium Sky-blue=Colorante Azul Cielo Claro
|
||||||
|
Medium Blue Dye=Colorante Azul Claro
|
||||||
|
Medium Violet Dye=Colorante Violeta Claro
|
||||||
|
Medium Magenta Dye=Colorante Magenta Claro
|
||||||
|
Medium Red-violet Dye=Colorante Rojo Violeta Claro
|
||||||
|
|
||||||
|
Red Dye (low saturation)=Colorante Rojo (baja saturación)
|
||||||
|
Orange Dye (low saturation)=Colorante Naranja (baja saturación)
|
||||||
|
Yellow Dye (low saturation)=Colorante Amarillo (baja saturación)
|
||||||
|
Lime Dye (low saturation)=Colorante Lima (baja saturación)
|
||||||
|
Green Dye (low saturation)=Colorante Verde (baja saturación)
|
||||||
|
Aqua Dye (low saturation)=Colorante Agua (baja saturación)
|
||||||
|
Cyan Dye (low saturation)=Colorante Cian (baja saturación)
|
||||||
|
Sky-blue Dye (low saturation)=Colorante Azul Cielo (baja saturación)
|
||||||
|
Blue Dye (low saturation)=Colorante Azul (baja saturación)
|
||||||
|
Violet Dye (low saturation)=Colorante Violeta (baja saturación)
|
||||||
|
Magenta Dye (low saturation)=Colorante Magenta (baja saturación)
|
||||||
|
Red-violet Dye (low saturation)=Colorante Rojo Violeta (baja saturación)
|
||||||
|
|
||||||
|
Red Dye=Colorante Rojo
|
||||||
|
Orange Dye=Colorante Naranja
|
||||||
|
Yellow Dye=Colorante Amarillo
|
||||||
|
Lime Dye=Colorante Lima
|
||||||
|
Green Dye=Colorante Verde
|
||||||
|
Aqua Dye=Colorante Agua
|
||||||
|
Cyan Dye=Colorante Cian
|
||||||
|
Sky-blue Dye=Colorante Azul Cielo
|
||||||
|
Blue Dye=Colorante Azul
|
||||||
|
Violet Dye=Colorante Violeta
|
||||||
|
Magenta Dye=Colorante Magenta
|
||||||
|
Red-violet Dye=Colorante Rojo Violeta
|
||||||
|
|
||||||
|
[UnifiedDyes] Loaded!=[ColorantesUnificados] Cargado.
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
# textdomain: unifieddyes
|
||||||
|
|
||||||
|
# Template
|
||||||
|
|
||||||
|
Lime Dye=Teinture citron-vert
|
||||||
|
Aqua Dye=Teinture aqua
|
||||||
|
Sky-blue Dye=Teinture bleu ciel
|
||||||
|
Red-violet Dye=Teinture rouge-violet
|
||||||
|
Light Grey Dye=Teinture gris clair
|
||||||
|
|
||||||
|
Dark Red Dye (low saturation)=Teinture rouge foncé (basse saturation)
|
||||||
|
Dark Orange Dye (low saturation)=Teinture orange foncé (basse saturation)
|
||||||
|
Dark Yellow Dye (low saturation)=Teinture jaune foncé (basse saturation)
|
||||||
|
Dark Lime Dye (low saturation)=Teinture citron-vert foncé (basse saturation)
|
||||||
|
Dark Green Dye (low saturation)=Teinture vert foncé (basse saturation)
|
||||||
|
Dark Aqua Dye (low saturation)=Teinture aqua foncé (basse saturation)
|
||||||
|
Dark Cyan Dye (low saturation)=Teinture cyan foncé (basse saturation)
|
||||||
|
Dark Sky-blue Dye (low saturation)=Teinture bleu ciel foncé (basse saturation)
|
||||||
|
Dark Blue Dye (low saturation)=Teinture bleu foncé (basse saturation)
|
||||||
|
Dark Violet Dye (low saturation)=Teinture violet foncé (basse saturation)
|
||||||
|
Dark Magenta Dye (low saturation)=Teinture magenta foncé (basse saturation)
|
||||||
|
Dark Red-violet Dye (low saturation)=Teinture rouge-violet foncé (basse saturation)
|
||||||
|
|
||||||
|
Dark Red Dye=Teinture rouge foncé
|
||||||
|
Dark Orange Dye=Teinture orange foncé
|
||||||
|
Dark Yellow Dye=Teinture jaune foncé
|
||||||
|
Dark Lime Dye=Teinture citron-vert foncé
|
||||||
|
Dark Green Dye=Teinture vert foncé
|
||||||
|
Dark Aqua Dye=Teinture aqua foncé
|
||||||
|
Dark Cyan Dye=Teinture cyan foncé
|
||||||
|
Dark Sky-blue Dye=Teinture bleu ciel foncé
|
||||||
|
Dark Blue Dye=Teinture bleu foncé
|
||||||
|
Dark Violet Dye=Teinture violet foncé
|
||||||
|
Dark Magenta Dye=Teinture magenta foncé
|
||||||
|
Dark Red-violet Dye=Teinture rouge-violet foncé
|
||||||
|
|
||||||
|
Medium Red Dye (low saturation)=Teinture rouge moyen (basse saturation)
|
||||||
|
Medium Orange Dye (low saturation)=Teinture orange moyen (basse saturation)
|
||||||
|
Medium Yellow Dye (low saturation)=Teinture jaune moyen (basse saturation)
|
||||||
|
Medium Lime Dye (low saturation)=Teinture citron-vert moyen (basse saturation)
|
||||||
|
Medium Green Dye (low saturation)=Teinture vert moyen (basse saturation)
|
||||||
|
Medium Aqua Dye (low saturation)=Teinture aqua moyen (basse saturation)
|
||||||
|
Medium Cyan Dye (low saturation)=Teinture cyan moyen (basse saturation)
|
||||||
|
Medium Sky-blue Dye (low saturation)=Teinture bleu ciel moyen (basse saturation)
|
||||||
|
Medium Blue Dye (low saturation)=Teinture bleu moyen (basse saturation)
|
||||||
|
Medium Violet Dye (low saturation)=Teinture violet moyen (basse saturation)
|
||||||
|
Medium Magenta Dye (low saturation)=Teinture magenta moyen (basse saturation)
|
||||||
|
Medium Red-violet Dye (low saturation)=Teinture rouge-violet moyen (basse saturation)
|
||||||
|
|
||||||
|
Medium Red Dye=Teinture rouge moyen
|
||||||
|
Medium Orange Dye=Teinture orange moyen
|
||||||
|
Medium Yellow Dye=Teinture jaune moyen
|
||||||
|
Medium Lime Dye=Teinture citron-vert moyen
|
||||||
|
Medium Green Dye=Teinture vert moyen
|
||||||
|
Medium Aqua Dye=Teinture aqua moyen
|
||||||
|
Medium Cyan Dye=Teinture cyan moyen
|
||||||
|
Medium Sky-blue=Teinture bleu ciel moyen
|
||||||
|
Medium Blue Dye=Teinture bleu moyen
|
||||||
|
Medium Violet Dye=Teinture violet moyen
|
||||||
|
Medium Magenta Dye=Teinture magenta moyen
|
||||||
|
Medium Red-violet Dye=Teinture rouge-violet moyen
|
||||||
|
|
||||||
|
Red Dye (low saturation)=Teinture rouge (basse saturation)
|
||||||
|
Orange Dye (low saturation)=Teinture orange (basse saturation)
|
||||||
|
Yellow Dye (low saturation)=Teinture jaune (basse saturation)
|
||||||
|
Lime Dye (low saturation)=Teinture citron-vert (basse saturation)
|
||||||
|
Green Dye (low saturation)=Teinture vert (basse saturation)
|
||||||
|
Aqua Dye (low saturation)=Teinture aqua (basse saturation)
|
||||||
|
Cyan Dye (low saturation)=Teinture cyan (basse saturation)
|
||||||
|
Sky-blue Dye (low saturation)=Teinture bleu ciel (basse saturation)
|
||||||
|
Blue Dye (low saturation)=Teinture bleu (basse saturation)
|
||||||
|
Violet Dye (low saturation)=Teinture violet (basse saturation)
|
||||||
|
Magenta Dye (low saturation)=Teinture magenta (basse saturation)
|
||||||
|
Red-violet Dye (low saturation)=Teinture rouge-violet (basse saturation)
|
||||||
|
|
||||||
|
Red Dye=Teinture rouge
|
||||||
|
Orange Dye=Teinture orange
|
||||||
|
Yellow Dye=Teinture jaune
|
||||||
|
Lime Dye=Teinture citron-vert
|
||||||
|
Green Dye=Teinture vert
|
||||||
|
Aqua Dye=Teinture aqua
|
||||||
|
Cyan Dye=Teinture cyan
|
||||||
|
Sky-blue Dye=Teinture bleu ciel
|
||||||
|
Blue Dye=Teinture bleu
|
||||||
|
Violet Dye=Teinture violet
|
||||||
|
Magenta Dye=Teinture magenta
|
||||||
|
Red-violet Dye=Teinture rouge-violet
|
||||||
|
|
||||||
|
[UnifiedDyes] Loaded!=[UnifiedDyes] chargé !
|
||||||
|
|
||||||
|
Dye Airbrush=Aérographe à colorants
|
||||||
|
|
||||||
|
Select a color:=Choisissez une couleur
|
||||||
|
(Right-clicked a node that supports all 256 colors, showing them all)=(Le bloc supporte toutes les 256 couleurs, affichage de toutes celles-ci)
|
||||||
|
(Right-clicked a node not supported by the Airbrush, showing all colors)=(Le bloc n’est pas supporté par l’aérographe, affichage de toutes les couleurs)
|
||||||
|
Dyes=Teintures
|
||||||
|
Your selection=Votre sélection
|
||||||
|
Your selection:=Votre sélection :
|
||||||
|
Cancel=Annuler
|
||||||
|
Accept=Valider
|
||||||
|
Show Available=Voir dispo.
|
||||||
|
(Currently showing all 256 colors)=(Actuellement en train d’afficher toutes les 256 couleurs)
|
||||||
|
Show All Colors=Voir toutes
|
||||||
|
(Currently only showing what the right-clicked node can use)=(Actuellement en train d’afficher uniquement ce que le bloc peut utiliser)
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
# textdomain: unifieddyes
|
||||||
|
|
||||||
|
# Malay translation by MuhdNurHidayat
|
||||||
|
|
||||||
|
Lime Dye=Pewarna Hijau Pucuk Pisang
|
||||||
|
Aqua Dye=Pewarna Akuamarin
|
||||||
|
Sky-blue Dye=Pewarna Biru Langit
|
||||||
|
Red-violet Dye=Pewarna Merah Lembayung
|
||||||
|
Light Grey Dye=Pewarna Kelabu Muda
|
||||||
|
|
||||||
|
Dark Red Dye (low saturation)=Pewarna Merah Tua (penepuan rendah)
|
||||||
|
Dark Orange Dye (low saturation)=Pewarna Jingga Tua (penepuan rendah)
|
||||||
|
Dark Yellow Dye (low saturation)=Pewarna Kuning Tua (penepuan rendah)
|
||||||
|
Dark Lime Dye (low saturation)=Pewarna Hijau Pucuk Pisang Tua (penepuan rendah)
|
||||||
|
Dark Green Dye (low saturation)=Pewarna Hijau Tua (penepuan rendah)
|
||||||
|
Dark Aqua Dye (low saturation)=Pewarna Akuamarin Tua (penepuan rendah)
|
||||||
|
Dark Cyan Dye (low saturation)=Pewarna Sian Tua (penepuan rendah)
|
||||||
|
Dark Sky-blue Dye (low saturation)=Pewarna Biru Langit Tua (penepuan rendah)
|
||||||
|
Dark Blue Dye (low saturation)=Pewarna Biru Tua (penepuan rendah)
|
||||||
|
Dark Violet Dye (low saturation)=Pewarna Lembayung Tua (penepuan rendah)
|
||||||
|
Dark Magenta Dye (low saturation)=Pewarna Magenta Tua (penepuan rendah)
|
||||||
|
Dark Red-violet Dye (low saturation)=Pewarna Merah Lembayung Tua (penepuan rendah)
|
||||||
|
|
||||||
|
Dark Red Dye=Pewarna Merah Tua
|
||||||
|
Dark Orange Dye=Pewarna Jingga Tua
|
||||||
|
Dark Yellow Dye=Pewarna Kuning Tua
|
||||||
|
Dark Lime Dye=Pewarna Hijau Pucuk Pisang Tua
|
||||||
|
Dark Green Dye=Pewarna Hijau Tua
|
||||||
|
Dark Aqua Dye=Pewarna Akuamarin Tua
|
||||||
|
Dark Cyan Dye=Pewarna Sian Tua
|
||||||
|
Dark Sky-blue Dye=Pewarna Biru Langit Tua
|
||||||
|
Dark Blue Dye=Pewarna Biru Tua
|
||||||
|
Dark Violet Dye=Pewarna Lembayung Tua
|
||||||
|
Dark Magenta Dye=Pewarna Magenta Tua
|
||||||
|
Dark Red-violet Dye=Pewarna Merah Lembayung Tua
|
||||||
|
|
||||||
|
Medium Red Dye (low saturation)=Pewarna Merah Sederhana (penepuan rendah)
|
||||||
|
Medium Orange Dye (low saturation)=Pewarna Jingga Sederhana (penepuan rendah)
|
||||||
|
Medium Yellow Dye (low saturation)=Pewarna Kuning Sederhana (penepuan rendah)
|
||||||
|
Medium Lime Dye (low saturation)=Pewarna Hijau Pucuk Pisang Sederhana (penepuan rendah)
|
||||||
|
Medium Green Dye (low saturation)=Pewarna Hijau Sederhana (penepuan rendah)
|
||||||
|
Medium Aqua Dye (low saturation)=Pewarna Akuamarin Sederhana (penepuan rendah)
|
||||||
|
Medium Cyan Dye (low saturation)=Pewarna Sian Sederhana (penepuan rendah)
|
||||||
|
Medium Sky-blue Dye (low saturation)=Pewarna Biru Langit Sederhana (penepuan rendah)
|
||||||
|
Medium Blue Dye (low saturation)=Pewarna Biru Sederhana (penepuan rendah)
|
||||||
|
Medium Violet Dye (low saturation)=Pewarna Lembayung Sederhana (penepuan rendah)
|
||||||
|
Medium Magenta Dye (low saturation)=Pewarna Magenta Sederhana (penepuan rendah)
|
||||||
|
Medium Red-violet Dye (low saturation)=Pewarna Merah Lembayung Sederhana (penepuan rendah)
|
||||||
|
|
||||||
|
Medium Red Dye=Pewarna Merah Sederhana
|
||||||
|
Medium Orange Dye=Pewarna Jingga Sederhana
|
||||||
|
Medium Yellow Dye=Pewarna Kuning Sederhana
|
||||||
|
Medium Lime Dye=Pewarna Hijau Pucuk Pisang Sederhana
|
||||||
|
Medium Green Dye=Pewarna Hijau Sederhana
|
||||||
|
Medium Aqua Dye=Pewarna Akuamarin Sederhana
|
||||||
|
Medium Cyan Dye=Pewarna Sian Sederhana
|
||||||
|
Medium Sky-blue=Pewarna Biru Langit Sederhana
|
||||||
|
Medium Blue Dye=Pewarna Biru Sederhana
|
||||||
|
Medium Violet Dye=Pewarna Lembayung Sederhana
|
||||||
|
Medium Magenta Dye=Pewarna Magenta Sederhana
|
||||||
|
Medium Red-violet Dye=Pewarna Merah Lembayung Sederhana
|
||||||
|
|
||||||
|
Red Dye (low saturation)=Pewarna Merah (penepuan rendah)
|
||||||
|
Orange Dye (low saturation)=Pewarna Jingga (penepuan rendah)
|
||||||
|
Yellow Dye (low saturation)=Pewarna Kuning (penepuan rendah)
|
||||||
|
Lime Dye (low saturation)=Pewarna Hijau Pucuk Pisang (penepuan rendah)
|
||||||
|
Green Dye (low saturation)=Pewarna Hijau (penepuan rendah)
|
||||||
|
Aqua Dye (low saturation)=Pewarna Akuamarin (penepuan rendah)
|
||||||
|
Cyan Dye (low saturation)=Pewarna Sian (penepuan rendah)
|
||||||
|
Sky-blue Dye (low saturation)=Pewarna Biru Langit (penepuan rendah)
|
||||||
|
Blue Dye (low saturation)=Pewarna Biru (penepuan rendah)
|
||||||
|
Violet Dye (low saturation)=Pewarna Lembayung (penepuan rendah)
|
||||||
|
Magenta Dye (low saturation)=Pewarna Magenta (penepuan rendah)
|
||||||
|
Red-violet Dye (low saturation)=Pewarna Merah Lembayung(penepuan rendah)
|
||||||
|
|
||||||
|
Red Dye=Pewarna Merah
|
||||||
|
Orange Dye=Pewarna Jingga
|
||||||
|
Yellow Dye=Pewarna Kuning
|
||||||
|
Lime Dye=Pewarna Hijau Pucuk Pisang
|
||||||
|
Green Dye=Pewarna Hijau
|
||||||
|
Aqua Dye=Pewarna Akuamarin
|
||||||
|
Cyan Dye=Pewarna Sian
|
||||||
|
Sky-blue Dye=Pewarna Biru Langit
|
||||||
|
Blue Dye=Pewarna Biru
|
||||||
|
Violet Dye=Pewarna Lembayung
|
||||||
|
Magenta Dye=Pewarna Magenta
|
||||||
|
Red-violet Dye=Pewarna Merah Lembayung
|
||||||
|
|
||||||
|
[UnifiedDyes] Loaded!=[UnifiedDyes] Telah Dimuatkan!
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
# textdomain: unifieddyes
|
||||||
|
|
||||||
|
Lime Dye=Corante Lima
|
||||||
|
Aqua Dye=Corante Água
|
||||||
|
Sky-blue Dye=Corante Azul-Céu
|
||||||
|
Red-violet Dye=Corante Vermelho-Violeta
|
||||||
|
Light Grey Dye=Corante Cinza Claro
|
||||||
|
|
||||||
|
Dark Red Dye (low saturation)=Corante Vermelho Escuro (baixa saturação)
|
||||||
|
Dark Orange Dye (low saturation)=Corante Laranja Escuro (baixa saturação)
|
||||||
|
Dark Yellow Dye (low saturation)=Corante Amarelo Escuro (baixa saturação)
|
||||||
|
Dark Lime Dye (low saturation)=Corante Lima Escuro (baixa saturação)
|
||||||
|
Dark Green Dye (low saturation)=Corante Verde Escuro (baixa saturação)
|
||||||
|
Dark Aqua Dye (low saturation)=Corante Água Escuro (baixa saturação)
|
||||||
|
Dark Cyan Dye (low saturation)=Corante Ciano Escuro (baixa saturação)
|
||||||
|
Dark Sky-blue Dye (low saturation)=Corante Azul-Céu Escuro (baixa saturação)
|
||||||
|
Dark Blue Dye (low saturation)=Corante Azul Escuro (baixa saturação)
|
||||||
|
Dark Violet Dye (low saturation)=Corante Violeta Escuro (baixa saturação)
|
||||||
|
Dark Magenta Dye (low saturation)=Corante Magenta Escuro (baixa saturação)
|
||||||
|
Dark Red-violet Dye (low saturation)=Corante Vermelho-Violeta Escuro (baixa saturação)
|
||||||
|
|
||||||
|
Dark Red Dye=Corante Vermelho Escuro
|
||||||
|
Dark Orange Dye=Corante Laranja Escuro
|
||||||
|
Dark Yellow Dye=Corante Amarelo Escuro
|
||||||
|
Dark Lime Dye=Corante Lima Escuro
|
||||||
|
Dark Green Dye=Corante Verde Escuro
|
||||||
|
Dark Aqua Dye=Corante Água Escuro
|
||||||
|
Dark Cyan Dye=Corante Ciano Escuro
|
||||||
|
Dark Sky-blue Dye=Corante Azul-Céu Escuro
|
||||||
|
Dark Blue Dye=Corante Azul Escuro
|
||||||
|
Dark Violet Dye=Corante Violeta Escuro
|
||||||
|
Dark Magenta Dye=Corante Magenta Escuro
|
||||||
|
Dark Red-violet Dye=Corante Vermelho-Violeta Escuro
|
||||||
|
|
||||||
|
Medium Red Dye (low saturation)=Corante Vermelho Médio (baixa saturação)
|
||||||
|
Medium Orange Dye (low saturation)=Corante Laranja Médio (baixa saturação)
|
||||||
|
Medium Yellow Dye (low saturation)=Corante Amarelo Médio (baixa saturação)
|
||||||
|
Medium Lime Dye (low saturation)=Corante Lima Médio (baixa saturação)
|
||||||
|
Medium Green Dye (low saturation)=Corante Verde Médio (baixa saturação)
|
||||||
|
Medium Aqua Dye (low saturation)=Corante Água Médio (baixa saturação)
|
||||||
|
Medium Cyan Dye (low saturation)=Corante Ciano Médio (baixa saturação)
|
||||||
|
Medium Sky-blue Dye (low saturation)=Corante Azul-Céu Médio (baixa saturação)
|
||||||
|
Medium Blue Dye (low saturation)=Corante Azul Médio (baixa saturação)
|
||||||
|
Medium Violet Dye (low saturation)=Corante Violeta Médio (baixa saturação)
|
||||||
|
Medium Magenta Dye (low saturation)=Corante Magenta Médio (baixa saturação)
|
||||||
|
Medium Red-violet Dye (low saturation)=Corante Vermelho-Violeta Médio (baixa saturação)
|
||||||
|
|
||||||
|
Medium Red Dye=Corante Vermelho Médio
|
||||||
|
Medium Orange Dye=Corante Laranja Médio
|
||||||
|
Medium Yellow Dye=Corante Amarelo Médio
|
||||||
|
Medium Lime Dye=Corante Lima Médio
|
||||||
|
Medium Green Dye=Corante Verde Médio
|
||||||
|
Medium Aqua Dye=Corante Água Médio
|
||||||
|
Medium Cyan Dye=Corante Ciano Médio
|
||||||
|
Medium Sky-blue=Corante Azul-Céu Médio
|
||||||
|
Medium Blue Dye=Corante Azul Médio
|
||||||
|
Medium Violet Dye=Corante Violeta Médio
|
||||||
|
Medium Magenta Dye=Corante Magenta Médio
|
||||||
|
Medium Red-violet Dye=Corante Vermelho-Violeta Médio
|
||||||
|
|
||||||
|
Red Dye (low saturation)=Corante Vermelho (baixa saturação)
|
||||||
|
Orange Dye (low saturation)=Corante Laranja (baixa saturação)
|
||||||
|
Yellow Dye (low saturation)=Corante Amarelo (baixa saturação)
|
||||||
|
Lime Dye (low saturation)=Corante Lima (baixa saturação)
|
||||||
|
Green Dye (low saturation)=Corante Vermelho (baixa saturação)
|
||||||
|
Aqua Dye (low saturation)=Corante Água (baixa saturação)
|
||||||
|
Cyan Dye (low saturation)=Corante Ciano (baixa saturação)
|
||||||
|
Sky-blue Dye (low saturation)=Corante Azul-Céu (baixa saturação)
|
||||||
|
Blue Dye (low saturation)=Corante Azul (baixa saturação)
|
||||||
|
Violet Dye (low saturation)=Corante Violeta (baixa saturação)
|
||||||
|
Magenta Dye (low saturation)=Corante Magenta (baixa saturação)
|
||||||
|
Red-violet Dye (low saturation)=Corante Vermelho-Violeta (baixa saturação)
|
||||||
|
|
||||||
|
Red Dye=Corante Vermelho
|
||||||
|
Orange Dye=Corante Laranja
|
||||||
|
Yellow Dye=Corante Amarelo
|
||||||
|
Lime Dye=Corante Lima
|
||||||
|
Green Dye=Corante Verde
|
||||||
|
Aqua Dye=Corante Água
|
||||||
|
Cyan Dye=Corano Ciano
|
||||||
|
Sky-blue Dye=Corante Azul-Céu
|
||||||
|
Blue Dye=Corante Azul
|
||||||
|
Violet Dye=Corante Violeta
|
||||||
|
Magenta Dye=Corante Magenta
|
||||||
|
Red-violet Dye=Corante Vermelho-Violeta
|
||||||
|
|
||||||
|
[UnifiedDyes] Loaded!=[UnifiedDyes] Carregado!
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
# textdomain: unifieddyes
|
||||||
|
|
||||||
|
# Translation by @drakes_journey
|
||||||
|
|
||||||
|
Lime Dye=Лаймовая краска
|
||||||
|
Aqua Dye=Аквамариновая краска
|
||||||
|
Sky-blue Dye=Голубая краска
|
||||||
|
Red-violet Dye=Красно-фиолетовая краска
|
||||||
|
Light Grey Dye=Светло-серая краска
|
||||||
|
|
||||||
|
Dark Red Dye (low saturation)=Темная красная краска (низкая насыщенность)
|
||||||
|
Dark Orange Dye (low saturation)=Темная оранжевая краска (низкая насыщенность)
|
||||||
|
Dark Yellow Dye (low saturation)=Темная желтая краска (низкая насыщенность)
|
||||||
|
Dark Lime Dye (low saturation)=Темная лаймовая краска (низкая насыщенность)
|
||||||
|
Dark Green Dye (low saturation)=Темная зеленая краска (низкая насыщенность)
|
||||||
|
Dark Aqua Dye (low saturation)=Темная аквамариновая краска (низкая насыщенность)
|
||||||
|
Dark Cyan Dye (low saturation)=Темная бирюзовая краска (низкая насыщенность)
|
||||||
|
Dark Sky-blue Dye (low saturation)=Темная голубая краска (низкая насыщенность)
|
||||||
|
Dark Blue Dye (low saturation)=Темная синяя краска (низкая насыщенность)
|
||||||
|
Dark Violet Dye (low saturation)=Темная фиолетовая краска (низкая насыщенность)
|
||||||
|
Dark Magenta Dye (low saturation)=Темная пурпурная краска (низкая насыщенность)
|
||||||
|
Dark Red-violet Dye (low saturation)=Темная краснофиолетовая краска (низкая насыщенность)
|
||||||
|
|
||||||
|
Dark Red Dye=Темная красная краска
|
||||||
|
Dark Orange Dye=Темная оранжевая краска
|
||||||
|
Dark Yellow Dye=Темная желтая краска
|
||||||
|
Dark Lime Dye=Темная зеленая краска
|
||||||
|
Dark Green Dye=Темная зеленая краска
|
||||||
|
Dark Aqua Dye=Темная аквамариновая краска
|
||||||
|
Dark Cyan Dye=Темная бирюзовая краска
|
||||||
|
Dark Sky-blue Dye=Темная голубая краска
|
||||||
|
Dark Blue Dye=Темная синяя краска
|
||||||
|
Dark Violet Dye=Темная фиолетовая краска
|
||||||
|
Dark Magenta Dye=Темная пурпурная краска
|
||||||
|
Dark Red-violet Dye=Темная красно-фиолетовая краска
|
||||||
|
|
||||||
|
Medium Red Dye (low saturation)=Средне-красная краска (низкая насыщенность)
|
||||||
|
Medium Orange Dye (low saturation)=Средне-оранжевая краска (низкая насыщенность)
|
||||||
|
Medium Yellow Dye (low saturation)=Средне-желтая краска (низкая насыщенность)
|
||||||
|
Medium Lime Dye (low saturation)=Средне-зеленая краска (низкая насыщенность)
|
||||||
|
Medium Green Dye (low saturation)=Средне-зеленая краска (низкая насыщенность)
|
||||||
|
Medium Aqua Dye (low saturation)=Средне-аквамариновая краска (низкая насыщенность)
|
||||||
|
Medium Cyan Dye (low saturation)=Средне-бирюзовая краска (низкая насыщенность)
|
||||||
|
Medium Sky-blue Dye (low saturation)=Средне-голубая краска (низкая насыщенность)
|
||||||
|
Medium Blue Dye (low saturation)=Средне-синяя краска (низкая насыщенность)
|
||||||
|
Medium Violet Dye (low saturation)=Средне-фиолетовая краска (низкая насыщенность)
|
||||||
|
Medium Magenta Dye (low saturation)=Средне-пурпурная краска (низкая насыщенность)
|
||||||
|
Medium Red-violet Dye (low saturation)=Средне-краснофиолетовая краска (низкая насыщенность)
|
||||||
|
|
||||||
|
Medium Red Dye=Средне-красная краска
|
||||||
|
Medium Orange Dye=Средне-оранжевая краска
|
||||||
|
Medium Yellow Dye=Средне-желтая краска
|
||||||
|
Medium Lime Dye=Средне-лаймовая краска
|
||||||
|
Medium Green Dye=Средне-зеленая краска
|
||||||
|
Medium Aqua Dye=Средне-аквамариновая краска
|
||||||
|
Medium Cyan Dye=Средне-бирюзовая краска
|
||||||
|
Medium Sky-blue=Средне-голубая краска
|
||||||
|
Medium Blue Dye=Средне-синяя краска
|
||||||
|
Medium Violet Dye=Средне-фиолетовая краска
|
||||||
|
Medium Magenta Dye=Средне-пурпурная краска
|
||||||
|
Medium Red-violet Dye=Средне-краснофиолетовая краска
|
||||||
|
|
||||||
|
Red Dye (low saturation)=Красная краска (низкая насыщенность)
|
||||||
|
Orange Dye (low saturation)=Оранжевая краска (низкая насыщенность)
|
||||||
|
Yellow Dye (low saturation)=Желтая краска (низкая насыщенность)
|
||||||
|
Lime Dye (low saturation)=Лаймовая краска (низкая насыщенность)
|
||||||
|
Green Dye (low saturation)=Зеленая краска (низкая насыщенность)
|
||||||
|
Aqua Dye (low saturation)=Аквамариновая краска (низкая насыщенность)
|
||||||
|
Cyan Dye (low saturation)=Бирюзовая краска (низкая насыщенность)
|
||||||
|
Sky-blue Dye (low saturation)=Голубая краска (низкая насыщенность)
|
||||||
|
Blue Dye (low saturation)=Синяя краска (низкая насыщенность)
|
||||||
|
Violet Dye (low saturation)=Фиолетовая краска (низкая насыщенность)
|
||||||
|
Magenta Dye (low saturation)=Пурпурная краска (низкая насыщенность)
|
||||||
|
Red-violet Dye (low saturation)=Краснофиолетовая краска (низкая насыщенность)
|
||||||
|
|
||||||
|
[UnifiedDyes] Loaded!=[UnifiedDyes] загружен!
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
# textdomain: unifieddyes
|
||||||
|
|
||||||
|
# TUrkish translation
|
||||||
|
# Mahmutelmas06@hotmail.com
|
||||||
|
|
||||||
|
Lime Dye=Limon Yeşili Boya
|
||||||
|
Aqua Dye=Deniz mavisi Boya
|
||||||
|
Sky-blue Dye=Gök-Mavi Boya
|
||||||
|
Red-violet Dye=Kırmızılı Boya
|
||||||
|
Light Grey Dye=Açık Grey Boya
|
||||||
|
|
||||||
|
Dark Red Dye (low saturation)=Koyu Kırmızı Boya (düşük doygunluk)
|
||||||
|
Dark Orange Dye (low saturation)=Koyu Turuncu Boya (düşük doygunluk)
|
||||||
|
Dark Yellow Dye (low saturation)=Koyu Sarı Boya (düşük doygunluk)
|
||||||
|
Dark Lime Dye (low saturation)=Koyu Limon Yeşili Boya (düşük doygunluk)
|
||||||
|
Dark Green Dye (low saturation)=Koyu Yeşil Boya (düşük doygunluk)
|
||||||
|
Dark Aqua Dye (low saturation)=Koyu Deniz mavisi boya (düşük doygunluk)
|
||||||
|
Dark Cyan Dye (low saturation)=Koyu Cam göbeği Boya (düşük doygunluk)
|
||||||
|
Dark Sky-blue Dye (low saturation)=Koyu Gök-Mavi Boya (düşük doygunluk)
|
||||||
|
Dark Blue Dye (low saturation)=Koyu Mavi Boya (düşük doygunluk)
|
||||||
|
Dark Violet Dye (low saturation)=Koyu mor Boya (düşük doygunluk)
|
||||||
|
Dark Magenta Dye (low saturation)=Koyu Kızılımsı Mor Boya (düşük doygunluk)
|
||||||
|
Dark Red-violet Dye (low saturation)=Koyu Kırmızılı Boya (düşük doygunluk)
|
||||||
|
|
||||||
|
Dark Red Dye=Koyu Kırmızı Boya
|
||||||
|
Dark Orange Dye=Koyu Turuncu Boya
|
||||||
|
Dark Yellow Dye=Koyu Sarı Boya
|
||||||
|
Dark Lime Dye=Koyu Limon Yeşili Boya
|
||||||
|
Dark Green Dye=Koyu Yeşil Boya
|
||||||
|
Dark Aqua Dye=Koyu Deniz mavisi Boya
|
||||||
|
Dark Cyan Dye=Koyu Cam göbeği Boya
|
||||||
|
Dark Sky-blue Dye=Koyu Gök-Mavi Boya
|
||||||
|
Dark Blue Dye=Koyu Mavi Boya
|
||||||
|
Dark Violet Dye=Koyu mor Boya
|
||||||
|
Dark Magenta Dye=Koyu Kızılımsı Mor Boya
|
||||||
|
Dark Red-violet Dye=Koyu Kırmızılı Boya
|
||||||
|
|
||||||
|
Medium Red Dye (low saturation)=Kırmızı Boya (düşük doygunluk)
|
||||||
|
Medium Orange Dye (low saturation)=Turuncu Boya (düşük doygunluk)
|
||||||
|
Medium Yellow Dye (low saturation)=Sarı Boya (düşük doygunluk)
|
||||||
|
Medium Lime Dye (low saturation)=Limon Yeşili Boya (düşük doygunluk)
|
||||||
|
Medium Green Dye (low saturation)=Yeşil Boya (düşük doygunluk)
|
||||||
|
Medium Aqua Dye (low saturation)=Deniz mavisi Boya (düşük doygunluk)
|
||||||
|
Medium Cyan Dye (low saturation)=Cam göbeği Boya (düşük doygunluk)
|
||||||
|
Medium Sky-blue Dye (low saturation)=Gök-Mavi Boya (düşük doygunluk)
|
||||||
|
Medium Blue Dye (low saturation)=Mavi Boya (düşük doygunluk)
|
||||||
|
Medium Violet Dye (low saturation)=Koyu mor Boya (düşük doygunluk)
|
||||||
|
Medium Magenta Dye (low saturation)=Kızılımsı Mor Boya (düşük doygunluk)
|
||||||
|
Medium Red-violet Dye (low saturation)=Kırmızılı Boya (düşük doygunluk)
|
||||||
|
|
||||||
|
Medium Red Dye=Kırmızı Boya
|
||||||
|
Medium Orange Dye=Turuncu Boya
|
||||||
|
Medium Yellow Dye=Sarı Boya
|
||||||
|
Medium Lime Dye=Limon Yeşili Boya
|
||||||
|
Medium Green Dye=Yeşil Boya
|
||||||
|
Medium Aqua Dye=Deniz mavisi Boya
|
||||||
|
Medium Cyan Dye=Cam göbeği Boya
|
||||||
|
Medium Sky-blue=Gök-Mavi
|
||||||
|
Medium Blue Dye=Mavi Boya
|
||||||
|
Medium Violet Dye=Koyu mor Boya
|
||||||
|
Medium Magenta Dye=Kızılımsı Mor Boya
|
||||||
|
Medium Red-violet Dye=Kırmızılı Boya
|
||||||
|
|
||||||
|
Red Dye (low saturation)=Kırmızı Boya (düşük doygunluk)
|
||||||
|
Orange Dye (low saturation)=Turuncu Boya (düşük doygunluk)
|
||||||
|
Yellow Dye (low saturation)=Sarı Boya (düşük doygunluk)
|
||||||
|
Lime Dye (low saturation)=Limon Yeşili Boya (düşük doygunluk)
|
||||||
|
Green Dye (low saturation)=Yeşil Boya (düşük doygunluk)
|
||||||
|
Aqua Dye (low saturation)=Deniz mavisi Boya (düşük doygunluk)
|
||||||
|
Cyan Dye (low saturation)=Cam göbeği Boya (düşük doygunluk)
|
||||||
|
Sky-blue Dye (low saturation)=Gök-Mavi Boya (düşük doygunluk)
|
||||||
|
Blue Dye (low saturation)=Mavi Boya (düşük doygunluk)
|
||||||
|
Violet Dye (low saturation)=Koyu mor Boya (düşük doygunluk)
|
||||||
|
Magenta Dye (low saturation)=Kızılımsı Mor Boya (düşük doygunluk)
|
||||||
|
Red-violet Dye (low saturation)=Kırmızılı Boya (düşük doygunluk)
|
||||||
|
|
||||||
|
Red Dye=Kırmızı Boya
|
||||||
|
Orange Dye=Turuncu Boya
|
||||||
|
Yellow Dye=Sarı Boya
|
||||||
|
Lime Dye=Limon Yeşili Boya
|
||||||
|
Green Dye=Yeşil Boya
|
||||||
|
Aqua Dye=Deniz mavisi Boya
|
||||||
|
Cyan Dye=Cam göbeği Boya
|
||||||
|
Sky-blue Dye=Gök-Mavi Boya
|
||||||
|
Blue Dye=Mavi Boya
|
||||||
|
Violet Dye=Koyu mor Boya
|
||||||
|
Magenta Dye=Kızılımsı Mor Boya
|
||||||
|
Red-violet Dye=Kırmızılı Boya
|
||||||
|
|
||||||
|
[UnifiedDyes] Loaded!=[UnifiedBoyas] yüklendi!
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
# textdomain: unifieddyes
|
||||||
|
|
||||||
|
# Translation by W0rr1z
|
||||||
|
|
||||||
|
Lime Dye=柠檬黄染料
|
||||||
|
Aqua Dye=水蓝染料
|
||||||
|
Sky-blue Dye=天蓝染料
|
||||||
|
Red-violet Dye=红紫染料
|
||||||
|
Light Grey Dye=浅灰染料
|
||||||
|
|
||||||
|
Dark Red Dye (low saturation)=深红染料(低饱和度)
|
||||||
|
Dark Orange Dye (low saturation)=深橙染料(低饱和度)
|
||||||
|
Dark Yellow Dye (low saturation)=深黄染料(低饱和度)
|
||||||
|
Dark Lime Dye (low saturation)=深柠檬黄染料(低饱和度)
|
||||||
|
Dark Green Dye (low saturation)=深绿染料(低饱和度)
|
||||||
|
Dark Aqua Dye (low saturation)=深水蓝染料(低饱和度)
|
||||||
|
Dark Cyan Dye (low saturation)=深青蓝染料(低饱和度)
|
||||||
|
Dark Sky-blue Dye (low saturation)=深天蓝染料(低饱和度)
|
||||||
|
Dark Blue Dye (low saturation)=深蓝染料(低饱和度)
|
||||||
|
Dark Violet Dye (low saturation)=深紫染料(低饱和度)
|
||||||
|
Dark Magenta Dye (low saturation)=深品红染料(低饱和度)
|
||||||
|
Dark Red-violet Dye (low saturation)=深红紫染料(低饱和度)
|
||||||
|
|
||||||
|
Dark Red Dye=深红染料
|
||||||
|
Dark Orange Dye=深橙染料
|
||||||
|
Dark Yellow Dye=深黄染料
|
||||||
|
Dark Lime Dye=深柠檬黄染料
|
||||||
|
Dark Green Dye=深绿染料
|
||||||
|
Dark Aqua Dye=深水蓝染料
|
||||||
|
Dark Cyan Dye=深青蓝染料
|
||||||
|
Dark Sky-blue Dye=深天蓝染料
|
||||||
|
Dark Blue Dye=深蓝染料
|
||||||
|
Dark Violet Dye=深紫染料
|
||||||
|
Dark Magenta Dye=深品红染料
|
||||||
|
Dark Red-violet Dye=深红紫染料
|
||||||
|
|
||||||
|
Medium Red Dye (low saturation)=中红染料(低饱和度)
|
||||||
|
Medium Orange Dye (low saturation)=中橙染料(低饱和度)
|
||||||
|
Medium Yellow Dye (low saturation)=中黄染料(低饱和度)
|
||||||
|
Medium Lime Dye (low saturation)=中柠檬黄染料(低饱和度)
|
||||||
|
Medium Green Dye (low saturation)=中绿染料(低饱和度)
|
||||||
|
Medium Aqua Dye (low saturation)=中水蓝染料(低饱和度)
|
||||||
|
Medium Cyan Dye (low saturation)=中青蓝染料(低饱和度)
|
||||||
|
Medium Sky-blue Dye (low saturation)=中天蓝染料(低饱和度)
|
||||||
|
Medium Blue Dye (low saturation)=中蓝染料(低饱和度)
|
||||||
|
Medium Violet Dye (low saturation)=中紫染料(低饱和度)
|
||||||
|
Medium Magenta Dye (low saturation)=中品红染料(低饱和度)
|
||||||
|
Medium Red-violet Dye (low saturation)=中红紫染料(低饱和度)
|
||||||
|
|
||||||
|
Medium Red Dye=中红染料
|
||||||
|
Medium Orange Dye=中橙染料
|
||||||
|
Medium Yellow Dye=中黄染料
|
||||||
|
Medium Lime Dye=中柠檬黄染料
|
||||||
|
Medium Green Dye=中绿染料
|
||||||
|
Medium Aqua Dye=中水蓝染料
|
||||||
|
Medium Cyan Dye=中青蓝染料
|
||||||
|
Medium Sky-blue=中天蓝染料
|
||||||
|
Medium Blue Dye=中蓝染料
|
||||||
|
Medium Violet Dye=中紫染料
|
||||||
|
Medium Magenta Dye=中品红染料
|
||||||
|
Medium Red-violet Dye=中红紫染料
|
||||||
|
|
||||||
|
Red Dye (low saturation)=红染料(低饱和度)
|
||||||
|
Orange Dye (low saturation)=橙染料(低饱和度)
|
||||||
|
Yellow Dye (low saturation)=黄染料(低饱和度)
|
||||||
|
Lime Dye (low saturation)=柠檬黄染料(低饱和度)
|
||||||
|
Green Dye (low saturation)=绿染料(低饱和度)
|
||||||
|
Aqua Dye (low saturation)=水蓝染料(低饱和度)
|
||||||
|
Cyan Dye (low saturation)=青蓝染料(低饱和度)
|
||||||
|
Sky-blue Dye (low saturation)=天蓝染料(低饱和度)
|
||||||
|
Blue Dye (low saturation)=蓝染料(低饱和度)
|
||||||
|
Violet Dye (low saturation)=紫染料(低饱和度)
|
||||||
|
Magenta Dye (low saturation)=品红染料(低饱和度)
|
||||||
|
Red-violet Dye (low saturation)=红紫染料(低饱和度)
|
||||||
|
|
||||||
|
[UnifiedDyes] Loaded!=[UnifiedDyes] 已加载!
|
||||||
|
|
||||||
|
Dye Airbrush=染料喷枪
|
||||||
|
|
||||||
|
Select a color:=选择颜色:
|
||||||
|
(Right-clicked a node that supports all 256 colors, showing them all)=(已右键支持256色的方块,显示全部颜色)
|
||||||
|
(Right-clicked a node not supported by the Airbrush, showing all colors)=(已右键不支持喷枪的方块,显示全部颜色)
|
||||||
|
Dyes=染料
|
||||||
|
Your selection=当前选择
|
||||||
|
Your selection:=当前选择:
|
||||||
|
Cancel=取消
|
||||||
|
Accept=应用
|
||||||
|
Show Available=显示可用颜色
|
||||||
|
(Currently showing all 256 colors)=(当前显示全部256色)
|
||||||
|
Show All Colors=显示所有颜色
|
||||||
|
(Currently only showing what the right-clicked node can use)=(当前仅显示右键方块可用颜色)
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
name = unifieddyes
|
||||||
|
description = Unified Dyes expands the standard dye set from 15 to 90 colors.
|
||||||
|
optional_depends = default, dye, basic_materials
|
||||||
|
min_minetest_version = 5.5.0
|
||||||
|
After Width: | Height: | Size: 418 B |
|
After Width: | Height: | Size: 150 B |
|
After Width: | Height: | Size: 140 B |
|
After Width: | Height: | Size: 319 B |
|
After Width: | Height: | Size: 93 B |
|
After Width: | Height: | Size: 99 B |
|
After Width: | Height: | Size: 91 B |
|
After Width: | Height: | Size: 91 B |
|
After Width: | Height: | Size: 93 B |
|
After Width: | Height: | Size: 91 B |
|
After Width: | Height: | Size: 133 B |
|
After Width: | Height: | Size: 91 B |
|
After Width: | Height: | Size: 91 B |
|
After Width: | Height: | Size: 290 B |
|
After Width: | Height: | Size: 93 B |
|
After Width: | Height: | Size: 91 B |
|
After Width: | Height: | Size: 90 B |
|
After Width: | Height: | Size: 91 B |
|
After Width: | Height: | Size: 91 B |
|
After Width: | Height: | Size: 93 B |
|
After Width: | Height: | Size: 91 B |
|
After Width: | Height: | Size: 91 B |
|
After Width: | Height: | Size: 93 B |
|
After Width: | Height: | Size: 91 B |
|
After Width: | Height: | Size: 91 B |
|
After Width: | Height: | Size: 91 B |
|
After Width: | Height: | Size: 91 B |
|
After Width: | Height: | Size: 91 B |
|
After Width: | Height: | Size: 93 B |
|
After Width: | Height: | Size: 91 B |
|
After Width: | Height: | Size: 91 B |
|
After Width: | Height: | Size: 91 B |
|
After Width: | Height: | Size: 917 B |
|
After Width: | Height: | Size: 176 B |
|
After Width: | Height: | Size: 266 B |
|
After Width: | Height: | Size: 101 B |
@@ -2,25 +2,63 @@
|
|||||||
package.path = (arg[0]:match("@?(.*/)") or arg[0]:match("@?(.*\\)")) .. "lib" .. package.config:sub(1, 1) .. "?.lua;" .. package.path
|
package.path = (arg[0]:match("@?(.*/)") or arg[0]:match("@?(.*\\)")) .. "lib" .. package.config:sub(1, 1) .. "?.lua;" .. package.path
|
||||||
local utility = require "utility"
|
local utility = require "utility"
|
||||||
|
|
||||||
local mods = {}
|
local data = utility.load_data("info.json")
|
||||||
local blacklist = { ".DS_Store", }
|
|
||||||
utility.list("mods", function(file_name)
|
local check_dependencies = function(pack_name)
|
||||||
for _, item in ipairs(blacklist) do
|
local pack_mods = data.packs[pack_name].mods
|
||||||
if item == file_name then
|
|
||||||
|
local provided_mods = {}
|
||||||
|
|
||||||
|
for mod_name in pairs(pack_mods) do
|
||||||
|
local function loop()
|
||||||
|
local selected_mod = data.mods[mod_name]
|
||||||
|
if not selected_mod then
|
||||||
|
print("Error: " .. mod_name .. " is not defined!")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if selected_mod.provides then
|
||||||
|
for _, name_provided in ipairs(selected_mod.provides) do
|
||||||
|
provided_mods[name_provided] = mod_name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
loop()
|
||||||
end
|
end
|
||||||
|
|
||||||
mods[file_name] = true
|
for mod_name in pairs(pack_mods) do
|
||||||
end)
|
local function loop()
|
||||||
|
local selected_mod = data.mods[mod_name]
|
||||||
|
if not selected_mod then return end
|
||||||
|
|
||||||
local data = {
|
if selected_mod.required then
|
||||||
packs = {
|
for _, name_required in ipairs(selected_mod.required) do
|
||||||
["Unnamed Luanti TechAge Pack"] = {
|
if not (pack_mods[name_required] or provided_mods[name_required]) then
|
||||||
mods = mods
|
print("Missing: " .. mod_name .. " requires " .. name_required)
|
||||||
}
|
end
|
||||||
},
|
end
|
||||||
mods = mods,
|
end
|
||||||
}
|
end
|
||||||
|
loop()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
utility.save_data(data, "info.json")
|
local standardize_data = function()
|
||||||
|
for name, data in pairs(data.mods) do
|
||||||
|
local function loop()
|
||||||
|
if not (type(data) == "table") then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if data.optional then table.sort(data.optional) end
|
||||||
|
if data.provides then table.sort(data.provides) end
|
||||||
|
if data.required then table.sort(data.required) end
|
||||||
|
end
|
||||||
|
loop()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
check_dependencies("Unnamed Luanti TechAge Pack")
|
||||||
|
|
||||||
|
standardize_data()
|
||||||
|
utility.save_data(data)
|
||||||
|
|||||||