Skip to content

Commit

Permalink
Effects Int: Potions: add translations and basic descriptions. Relate…
Browse files Browse the repository at this point in the history
…s to 1731
  • Loading branch information
alek13 committed Oct 27, 2024
1 parent 2984f56 commit 094ba9c
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 29 deletions.
30 changes: 30 additions & 0 deletions mods/lord/Tools/lord_potions/locale/lord_potions.en.tr
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
# textdomain: lord_potions

Potion "@1"@2=Potion "@1"@2
(Power: @1)=(Power: @1)


Elixir of Athelas=Elixir of Athelas
An ancient elixir from the West=An ancient elixir from the West
that restores health and heals wounds.= that restores health and heals wounds.

Orcish Brew=Orcish Brew
Thick toxic brew based on orc pus, corroding both body and spirit.=Thick toxic brew based on orc pus, corroding both body and spirit.
Corrodes the body from the inside and covers it with wounds from the outside.=Corrodes the body from the inside and covers it with wounds from the outside.


Ent Draught=Ent Draught
An extremely refreshing and invigorating drink=An extremely refreshing and invigorating drink
made from the waters of the Metedras springs.= made from the waters of the Metedras springs.
A unique drink that grants the speed of the ancient trees.=A unique drink that grants the speed of the ancient trees.

Shelob's Bonds=Shelob's Bonds
Created from the venom of Shelob's web,=Created from the venom of Shelob's web,
which she uses to paralyze enemies.= which she uses to paralyze enemies.
A venomous potion that binds the body like Shelob’s web.=A venomous potion that binds the body like Shelob’s web.


Miruvor=Miruvor
А strong stimulating drink of the elves.=А strong stimulating drink of the elves.
A potion that allows you to jump higher,=A potion that allows you to jump higher,
as if invisible wings were lifting you into the air.= as if invisible wings were lifting you into the air.

Dol Guldur\'s Fetters=Dol Guldur\'s Fetters

31 changes: 31 additions & 0 deletions mods/lord/Tools/lord_potions/locale/lord_potions.ru.tr
Original file line number Diff line number Diff line change
@@ -1,4 +1,35 @@
# textdomain: lord_potions

Potion "@1"@2=Зелье "@1"@2
(Power: @1)=(Сила: @1)


Elixir of Athelas=Эликсир Ателаса
An ancient elixir from the West=Древний эликсир Запада,
that restores health and heals wounds.= восстанавливающий здоровье и исцеляющий раны.

Orcish Brew=Орочий Отвар
Thick toxic brew based on orc pus, corroding both body and spirit.=Густой ядовитый отвар на основе орочьего гноя.
Corrodes the body from the inside and covers it with wounds from the outside.=Разъедает тело изнутри и покрывает его ранами снаружи.


Ent Draught=Напиток Энтов
An extremely refreshing and invigorating drink=Необычайно освежающее и ободряющее питьё,
made from the waters of the Metedras springs.= сделанное из вод родников Метедраса.
A unique drink that grants the speed of the ancient trees.=Уникальный напиток, дарующий скорость древних деревьев.

Shelob's Bonds=Путы Шелоб
Created from the venom of Shelob's web,=Создано на основе яда паутины Шелоб,
which she uses to paralyze enemies.= применяемый ей для парализации врагов.
A venomous potion that binds the body like Shelob’s web.=Ядовитое зелье, сковывающее тело, как паутина Шелоб.


Miruvor=Мирувор
А strong stimulating drink of the elves.=Сильный стимулирующий напиток эльфов.
A potion that allows you to jump higher,=Зелье, позволяющее прыгать выше,
as if invisible wings were lifting you into the air.= словно невидимые крылья поднимают тебя в воздух.

Dol Guldur's Fetters=Оковы Дол Гулдура
A dark potion that binds the body=Мрачное зелье, сковывающее тело,
like the heavy chains of the dungeons of Dol Guldur.= словно тяжёлые цепи темниц Дол Гулдура.
It weighs down your legs, making jumping impossible.=Утяжеляет ноги, делая прыжки невозможными.
51 changes: 30 additions & 21 deletions mods/lord/Tools/lord_potions/src/lord_potions/api.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local S = minetest.get_translator('lord_potion')
local S = minetest.get_translator(minetest.get_current_modname())
local colorize = minetest.colorize


local potions = {
Expand All @@ -18,27 +19,36 @@ local function add_existing(node_name)
end

--- default groups: default: { dig_immediate = 3, attached_node = 1, vessel = 1, potions = 1 }
--- @param item_name_start string technical item/node name (`"<mod>:<node>"`).
--- @param title string prefix to description of item or will extracted from `item_name` (`title`.." Potion")
--- @param groups table additional or overwrite groups
local function register_potion(item_name_start, title, color, effect, amount, duration, power, groups)
local power_abs = math.abs(power)
local item_name = item_name_start .. '_' .. power_abs
local sub_name = item_name:split(':')[2]
title = title and title:first_to_upper() or sub_name:first_to_upper()
--- @param name_prefix string technical item/node name (`"<mod>:<node>"`) prefix (will be name_prefix..'_'..power_abs).
--- @param title string prefix to description of item or will extracted from `item_name` (`title`.." Potion").
--- @param description string some words you want to displayed in tooltip before properties of power.
--- @param color string color of potion liquid (bottle contents).
--- @param effect string one of registered `lord_effects.<CONST>` names.
--- @param power lord_potions.PotionPower
--- @param groups table additional or overwrite groups for item definition groups.
local function register_potion(name_prefix, title, description, color, effect, power, level, groups)
local power_abs = math.abs(level)
local item_name = name_prefix .. '_' .. power_abs
local sub_name = item_name:split(':')[2]
title = title and title:first_to_upper() or sub_name:first_to_upper()
level = level or 0

local power_overlay_opacity = tonumber(power) > 0
local content_opacity_by_level = tonumber(level) >= 0
and (120 - power_abs * 40)
or (150 - power_abs * 50)
local contents_img = '(' ..
or (150 - power_abs * 50)
local bottle_contents_img = '(' ..
'lord_potions_bottle_content_mask.png' ..
'^[colorize:' .. color .. ':170' ..
'^[colorize:#000:' .. power_overlay_opacity ..
'^[colorize:#000:' .. content_opacity_by_level ..
')'
local texture = contents_img .. '^(lord_potions_bottle.png)'
local texture = bottle_contents_img .. '^(lord_potions_bottle.png)'

minetest.register_node(item_name, {
description = S('Potion of @1 (Power: @2)', title, power),
description = S('Potion "@1"@2',
colorize('#ee8', title),
level ~= 0 and ' '..S('(Power: @1)', level) or ''
),
_tt_help = description and colorize('#aaa', '\n'..description),
inventory_image = texture,
tiles = { texture },
selection_box = { type = 'fixed', fixed = { -0.25, -0.5, -0.25, 0.25, 0.3, 0.25 } },
Expand All @@ -48,7 +58,7 @@ local function register_potion(item_name_start, title, color, effect, amount, du
drawtype = 'plantlike',
paramtype = 'light',
on_use = function(itemstack, user, pointed_thing)
effects.for_player(user):apply(effect, amount, duration)
effects.for_player(user):apply(effect, power.amount, power.duration)
end
})

Expand All @@ -58,15 +68,15 @@ end

--- @param group lord_potions.PotionGroup
local function register_potion_group(group)
for power_name, power in pairs(group.powers) do
for level, power in pairs(group.powers) do
register_potion(
group.item_name,
group.title,
group.description,
power.color or group.color,
group.effect,
power.amount,
power.duration,
power_name
power,
level
)
end
end
Expand All @@ -76,7 +86,6 @@ return {
add_existing = add_existing,
register_potion = register_potion,
register_potion_group = register_potion_group,
--- @return NodeDefinition[]
get_all_items = function() return potions.all_items end,
get_lord_items = function() return potions.lord_items end,
}
44 changes: 36 additions & 8 deletions mods/lord/Tools/lord_potions/src/lord_potions/config.lua
Original file line number Diff line number Diff line change
@@ -1,34 +1,46 @@
local S = minetest.get_translator(minetest.get_current_modname())


--- @class lord_potions.PotionPower
--- @field amount number applying effect value (depends on effect).
--- @field duration number time in seconds.

--- @class lord_potions.PotionGroup
--- @field item_name string
--- @field title string
--- @field color string
--- @field effect string one of `lord_effects.<CONST>`
--- @field powers table<string,{amount:number,duration:number}>
--- @field item_name string technical item/node name (`"<mod>:<node>"`).
--- @field title string prefix to description of item.
--- @field description string some words you want to displayed in tooltip before properties.
--- @field color string color of potion liquid (bottle contents).
--- @field effect string one of registered `lord_effects.<CONST>` names.
--- @field powers table<string,lord_potions.PotionPower>


--- @type lord_potions.PotionGroup[]
local config = {
-- HEALTH
{
item_name = 'lord_potions:athelas_brew', title = S('Athelas Brew'), color = '#bf0',
item_name = 'lord_potions:athelas_elixir', title = S('Elixir of Athelas'), color = '#bf0',
effect = lord_effects.HEALTH,
powers = {
['+1'] = { amount = 1, duration = 20, },
['+2'] = { amount = 2, duration = 50, },
['+3'] = { amount = 4, duration = 100, },
},
description =
S('An ancient elixir from the West')..'\n'..
S(' that restores health and heals wounds.')
,
},
{
item_name = 'lord_potions:orc_draught', title = S('Orc Draught'), color = '#200',
item_name = 'lord_potions:orcish_brew', title = S('Orcish Brew'), color = '#400',
effect = lord_effects.HEALTH,
powers = {
['-1'] = { amount = -1, duration = 20, },
['-2'] = { amount = -2, duration = 50, },
['-3'] = { amount = -3, duration = 100, },
},
description =
S('Thick toxic brew based on orc pus, corroding both body and spirit.')..'\n'..
S('Corrodes the body from the inside and covers it with wounds from the outside.')
},

-- SPEED
Expand All @@ -40,6 +52,10 @@ local config = {
['+2'] = { amount = 2, duration = 50, },
['+3'] = { amount = 3, duration = 100, },
},
description =
S('An extremely refreshing and invigorating drink')..'\n'..
S(' made from the waters of the Metedras springs.')..'\n'..
S('A unique drink that grants the speed of the ancient trees.')
},
{
item_name = 'lord_potions:spider_poison', title = S('Shelob\'s Bonds'), color = '#462',
Expand All @@ -49,6 +65,10 @@ local config = {
['-2'] = { amount = -2, duration = 50, },
['-3'] = { amount = -3, duration = 100, },
},
description =
S('Created from the venom of Shelob\'s web,')..'\n'..
S(' which she uses to paralyze enemies.')..'\n'..
S('A venomous potion that binds the body like Shelob’s web.')
},

-- JUMP
Expand All @@ -60,15 +80,23 @@ local config = {
['+2'] = { amount = 2, duration = 50, },
['+3'] = { amount = 4, duration = 100, },
},
description =
S('А strong stimulating drink of the elves.')..'\n'..
S('A potion that allows you to jump higher,')..'\n'..
S(' as if invisible wings were lifting you into the air.')
},
{
item_name = 'lord_potions:dol_guldur_fetters', title = S('Dol Guldur\'s Fetters'), color = '#404',
item_name = 'lord_potions:dol_guldur_fetters', title = S('Dol Guldur\'s Fetters'), color = '#505',
effect = lord_effects.JUMP,
powers = {
['-1'] = { amount = -1, duration = 20, },
['-2'] = { amount = -2, duration = 50, },
['-3'] = { amount = -3, duration = 100, },
},
description =
S('A dark potion that binds the body')..'\n'..
S(' like the heavy chains of the dungeons of Dol Guldur.')..'\n'..
S('It weighs down your legs, making jumping impossible.')
},
}

Expand Down

0 comments on commit 094ba9c

Please sign in to comment.