Initial commit
commit
21f9e44d86
|
@ -0,0 +1,28 @@
|
||||||
|
# API documentation for Cups mod
|
||||||
|
This mod provides a simple API for adding more cups.
|
||||||
|
|
||||||
|
## `cups.register_cup(subname, description, tiles, craftitem, craft_count, extra_groups, extra_sounds)`
|
||||||
|
Adds a new cup with itemstring `cups:cup_<subname>` and optionally a crafting recipe for this cup.
|
||||||
|
|
||||||
|
If `craftitem` is non-`nil`, the recipe follows this template:
|
||||||
|
|
||||||
|
C.C
|
||||||
|
.C.
|
||||||
|
.C.
|
||||||
|
|
||||||
|
C = `craftitem`
|
||||||
|
. = nothing
|
||||||
|
|
||||||
|
Yields `craft_count` cups.
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
* `subname`: Part of the name which will be used to create the cup's itemstring
|
||||||
|
* `description`: In-game description/tooltip of the cup
|
||||||
|
* `tiles`: Textures
|
||||||
|
* `craftitem`: The item source to be used in the crafting recipe. If `nil`, no crafting recipe will be generated
|
||||||
|
* `craft_count`: How many cups will be crafted at once (only has an effect if `craftitem ~= nil`)
|
||||||
|
* `extra_groups`: Table of additional groups to assign to this item (optional)
|
||||||
|
* `extra_sounds`: Table of additional sounds (`SimpleSoundSpec`) to assign to this item (optional)
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
Always `nil`.
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Cups [`cups`]
|
||||||
|
This mods adds a few decorative cups:
|
||||||
|
|
||||||
|
* Bronze Cup
|
||||||
|
* Silver Cup (requires `moreores` mod)
|
||||||
|
* Golden Cup
|
||||||
|
* Diamond Cup
|
||||||
|
|
||||||
|
## API
|
||||||
|
Programmers can add more cups by using the very simple API. See `API.md`.
|
||||||
|
|
||||||
|
## Credits and licenses
|
||||||
|
This mod is free software.
|
||||||
|
|
||||||
|
### Code
|
||||||
|
* Author: Wuzzy
|
||||||
|
* Licensed under: MIT License
|
||||||
|
|
||||||
|
### Graphics
|
||||||
|
All graphics are derivate works of Minetest Game textures.
|
||||||
|
They are licensed under [CC-BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/).
|
|
@ -0,0 +1,100 @@
|
||||||
|
local S = minetest.get_translator("cups")
|
||||||
|
local has_default = minetest.get_modpath("default") ~= nil
|
||||||
|
local has_moreores = minetest.get_modpath("moreores") ~= nil
|
||||||
|
local cups = {}
|
||||||
|
|
||||||
|
-- Nodeboxes
|
||||||
|
local cupnodebox = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.3,-0.5,-0.3,0.3,-0.4,0.3}, -- stand
|
||||||
|
{-0.1,-0.4,-0.1,0.1,0,0.1}, -- handle
|
||||||
|
{-0.3,0,-0.3,0.3,0.1,0.3}, -- cup (lower part)
|
||||||
|
-- the 4 sides of the upper part
|
||||||
|
{-0.2,0.1,-0.3,0.2,0.5,-0.2},
|
||||||
|
{-0.2,0.1,0.2,0.2,0.5,0.3},
|
||||||
|
{-0.3,0.1,-0.3,-0.2,0.5,0.3},
|
||||||
|
{0.2,0.1,-0.3,0.3,0.5,0.3},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
local cupselbox = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.3,-0.5,-0.3,0.3,-0.4,0.3}, -- stand
|
||||||
|
{-0.1,-0.4,-0.1,0.1,0,0.1}, -- handle
|
||||||
|
{-0.3,0,-0.3,0.3,0.5,0.3}, -- upper part
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-- API
|
||||||
|
cups.register_cup = function(subname, description, tiles, craftitem, craft_count, extra_groups, extra_sounds)
|
||||||
|
local groups = { dig_immediate=3, falling_node=1, }
|
||||||
|
if extra_groups then
|
||||||
|
for k,v in pairs(extra_groups) do
|
||||||
|
groups[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local sounds
|
||||||
|
if has_default then
|
||||||
|
if default.node_sound_metal_defaults then
|
||||||
|
sounds = default.node_sound_defaults({
|
||||||
|
footstep = { name = "default_metal_footstep", gain = 0.3 },
|
||||||
|
})
|
||||||
|
else
|
||||||
|
sounds = default.node_sound_defaults({
|
||||||
|
footstep = { name = "default_hard_footstep", gain = 0.3 },
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if extra_sounds then
|
||||||
|
for k,v in pairs(extra_sounds) do
|
||||||
|
sounds[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local itemstring = "cups:cup_"..subname
|
||||||
|
minetest.register_node(itemstring, {
|
||||||
|
description = description,
|
||||||
|
_doc_items_longdesc = S("A decorative item which can be placed."),
|
||||||
|
tiles = tiles,
|
||||||
|
paramtype = "light",
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = cupnodebox,
|
||||||
|
is_ground_content = false,
|
||||||
|
selection_box = cupselbox,
|
||||||
|
groups = groups,
|
||||||
|
sounds = sounds,
|
||||||
|
})
|
||||||
|
|
||||||
|
if craftitem ~= nil then
|
||||||
|
if craft_count == nil then craft_count = 1 end
|
||||||
|
|
||||||
|
if has_default then
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "cups:cup_"..subname.." "..craft_count,
|
||||||
|
recipe = {
|
||||||
|
{craftitem, "", craftitem},
|
||||||
|
{"", craftitem, ""},
|
||||||
|
{"", craftitem, ""},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Register cups
|
||||||
|
local sound_hard
|
||||||
|
if has_default then
|
||||||
|
sound_hard = default.node_sound_defaults({ footstep = { name = "default_hard_footstep", gain = 0.3 }})
|
||||||
|
end
|
||||||
|
cups.register_cup("bronze", S("Bronze Cup"), { "cups_bronze.png" }, "default:bronze_ingot", 2)
|
||||||
|
cups.register_cup("gold", S("Golden Cup"), { "cups_gold.png" }, "default:gold_ingot", 2)
|
||||||
|
cups.register_cup("diamond", S("Diamond Cup"), { "cups_diamond.png" }, "default:diamond", 1, nil, sound_hard)
|
||||||
|
if has_moreores then
|
||||||
|
cups.register_cup("silver", S("Silver Cup"), { "cups_silver.png" }, "moreores:silver_ingot", 2)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Legacy aliases
|
||||||
|
minetest.register_alias("mtg_plus:cup_bronze", "cups:cup_bronze")
|
||||||
|
minetest.register_alias("mtg_plus:cup_gold", "cups:cup_gold")
|
||||||
|
minetest.register_alias("mtg_plus:cup_diamond", "cups:cup_diamond")
|
|
@ -0,0 +1,6 @@
|
||||||
|
# textdomain:cups
|
||||||
|
A decorative item which can be placed.=Ein dekorativer Gegenstand, den man platzieren kann.
|
||||||
|
Bronze Cup=Bronzepokal
|
||||||
|
Golden Cup=Goldpokal
|
||||||
|
Diamond Cup=Diamantpokal
|
||||||
|
Silver Cup=Silberpokal
|
|
@ -0,0 +1,6 @@
|
||||||
|
# textdomain:cups
|
||||||
|
A decorative item which can be placed.=
|
||||||
|
Bronze Cup=
|
||||||
|
Golden Cup=
|
||||||
|
Diamond Cup=
|
||||||
|
Silver Cup=
|
|
@ -0,0 +1,3 @@
|
||||||
|
name=cups
|
||||||
|
description=Decorative cups.
|
||||||
|
optional_depends=default, moreores
|
Binary file not shown.
After Width: | Height: | Size: 51 KiB |
Binary file not shown.
After Width: | Height: | Size: 457 B |
Binary file not shown.
After Width: | Height: | Size: 591 B |
Binary file not shown.
After Width: | Height: | Size: 511 B |
Binary file not shown.
After Width: | Height: | Size: 216 B |
Loading…
Reference in New Issue