-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Effects Int: Potions: add ingredients for potions. Closes #1779
- Loading branch information
Showing
13 changed files
with
128 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
local potion = require('lord_potions.api.potion') | ||
local ingredient = require('lord_potions.api.ingredient') | ||
|
||
|
||
return { | ||
potion = potion, | ||
ingredient = ingredient, | ||
} |
46 changes: 46 additions & 0 deletions
46
mods/lord/Tools/lord_potions/src/lord_potions/api/ingredient.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
local S = minetest.get_mod_translator() | ||
local colorize = minetest.colorize | ||
|
||
local ingredients = { | ||
--- @type table<string,NodeDefinition>|NodeDefinition[] | ||
all_items = {}, | ||
} | ||
|
||
|
||
--- default groups: default: { dig_immediate = 3, attached_node = 1, vessel = 1, ingredients = 1 } | ||
--- @param node_name string technical item/node name (`<mod>:<node>`). | ||
--- @param title string prefix to description of item or will extracted from `item_name` (`title`.." ingredient"). | ||
--- @param description string some words you want to displayed in tooltip. | ||
--- @param groups table additional or overwrite groups for item definition groups. | ||
local function register_ingredient(node_name, title, description, groups) | ||
local item_name = node_name | ||
local sub_name = item_name:split(':')[2] | ||
local texture = node_name:replace(':', '_') .. '.png^lord_potions_bottle.png' | ||
title = title and title:first_to_upper() or sub_name:first_to_upper() | ||
|
||
minetest.register_node(item_name, { | ||
description = S('Ingredient "@1"', colorize('#aa8', title)), | ||
_tt_help = description and colorize('#aaa', '\n' .. description), | ||
inventory_image = texture, | ||
wield_image = texture, | ||
drawtype = 'plantlike', | ||
use_texture_alpha = 'blend', | ||
tiles = { texture .. '^[opacity:160' }, | ||
selection_box = { type = 'fixed', fixed = { -0.25, -0.5, -0.25, 0.25, 0.4, 0.25 } }, | ||
walkable = false, | ||
paramtype = 'light', | ||
groups = table.overwrite( | ||
{ vessel = 1, dig_immediate = 3, attached_node = 1, ingredients = 1 }, | ||
groups or {} | ||
), | ||
sounds = default.node_sound_glass_defaults(), | ||
}) | ||
|
||
ingredients.all_items[item_name] = minetest.registered_nodes[item_name] | ||
end | ||
|
||
|
||
return { | ||
register = register_ingredient, | ||
get_all = function() return ingredients.all_items end, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
local potions = require('lord_potions.config.potions') | ||
local ingredients = require('lord_potions.config.ingredients') | ||
|
||
--- @class lord_potions.config | ||
--- @field potions lord_potions.PotionGroup[] | ||
--- @field ingredients lord_potions.Ingredient[] | ||
local config = { | ||
potions = potions, | ||
ingredients = ingredients, | ||
} | ||
|
||
|
||
return config |
40 changes: 40 additions & 0 deletions
40
mods/lord/Tools/lord_potions/src/lord_potions/config/ingredients.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
local S = minetest.get_mod_translator() | ||
|
||
--- @class lord_potions.Ingredient | ||
--- @field node_name string technical item/node name (`<mod>:<node>`). | ||
--- @field title string prefix to description of item or will extracted from `item_name` (`title`.." ingredient"). | ||
--- @field description string some words you want to displayed in tooltip. | ||
--- @field groups table additional or overwrite groups for item definition groups. | ||
|
||
|
||
--- @type lord_potions.Ingredient[] | ||
local config = { | ||
-- Base Ingredients | ||
{ | ||
node_name = "lord_potions:ingredient_mese", | ||
description = S("Glass Bottle (Mese Water)"), | ||
}, | ||
{ | ||
node_name = "lord_potions:ingredient_geodes", | ||
description = S("Glass Bottle (Geodes Crystal Water)"), | ||
}, | ||
{ | ||
node_name = "lord_potions:ingredient_seregon", | ||
description = S("Glass Bottle (Seregon Water)"), | ||
}, | ||
-- Negative Base Ingredients | ||
{ | ||
node_name = "lord_potions:ingredient_obsidian", | ||
description = S("Glass Bottle (Obsidian Water)"), | ||
}, | ||
{ | ||
node_name = "lord_potions:ingredient_bonedust", | ||
description = S("Glass Bottle (Bonedust Water)"), | ||
}, | ||
{ | ||
node_name = "lord_potions:ingredient_mordor", | ||
description = S("Glass Bottle (Mordor Water)"), | ||
}, | ||
} | ||
|
||
return config |
Binary file added
BIN
+238 Bytes
...rd/Tools/lord_potions/textures/ingredients/lord_potions_ingredient_bonedust.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+343 Bytes
...lord/Tools/lord_potions/textures/ingredients/lord_potions_ingredient_geodes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+303 Bytes
mods/lord/Tools/lord_potions/textures/ingredients/lord_potions_ingredient_mese.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+233 Bytes
...lord/Tools/lord_potions/textures/ingredients/lord_potions_ingredient_mordor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+225 Bytes
...rd/Tools/lord_potions/textures/ingredients/lord_potions_ingredient_obsidian.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+277 Bytes
...ord/Tools/lord_potions/textures/ingredients/lord_potions_ingredient_seregon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2 Bytes
(99%)
mods/lord/Tools/lord_potions/textures/lord_potions_bottle_content_mask.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.