Compare commits
5 Commits
1ba22e2574
...
92578c3875
Author | SHA1 | Date |
---|---|---|
Vanessa Dannenberg | 92578c3875 | |
Louis Royer | e8e73180e2 | |
Louis Royer | 3291703c60 | |
VanessaE | e92916b8af | |
VanessaE | a5788f4661 |
|
@ -56,6 +56,3 @@ stairs:slab_cobble default:stick stairs:slab_cobble
|
|||
|
||||
- Bitbucket:
|
||||
- <https://bitbucket.org/g00g01/new_campfire>
|
||||
|
||||
- Intllib:
|
||||
- https://github.com/minetest-mods/intllib
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
You can craft and use better campfire.
|
44
init.lua
44
init.lua
|
@ -1,16 +1,16 @@
|
|||
-- Translation support
|
||||
local S = minetest.get_translator("new_campfire")
|
||||
|
||||
-- VARIABLES
|
||||
new_campfire_cooking = 1 -- nil - not cooked, 1 - cooked
|
||||
new_campfire_limit = 1 -- nil - unlimited campfire, 1 - limited
|
||||
new_campfire_ttl = 30 -- Time in seconds until a fire burns down into embers
|
||||
new_campfire_flare_up = 2 -- seconds from adding a stick to embers before it flares into a fire again
|
||||
new_campfire_embers_ttl = 60 -- seconds until embers burn out completely leaving ash and an empty fireplace.
|
||||
new_campfire_stick_time = new_campfire_ttl/2; -- How long does the stick increase. In sec.
|
||||
|
||||
new_campfire = {}
|
||||
|
||||
-- Load support for intllib.
|
||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||
local S, NS = dofile(MP.."/intllib.lua")
|
||||
new_campfire.cooking = 1 -- nil - not cooked, 1 - cooked
|
||||
new_campfire.limited = 1 -- nil - unlimited campfire, 1 - limited
|
||||
new_campfire.flames_ttl = 30 -- Time in seconds until a fire burns down into embers
|
||||
new_campfire.embers_ttl = 60 -- seconds until embers burn out completely leaving ash and an empty fireplace.
|
||||
new_campfire.flare_up = 2 -- seconds from adding a stick to embers before it flares into a fire again
|
||||
new_campfire.stick_time = new_campfire.flames_ttl/2; -- How long does the stick increase. In sec.
|
||||
|
||||
-- FUNCTIONS
|
||||
local function fire_particles_on(pos) -- 3 layers of fire
|
||||
|
@ -122,13 +122,13 @@ end
|
|||
local function infotext_edit(meta)
|
||||
local infotext = S("Active campfire")
|
||||
|
||||
if new_campfire_limit and new_campfire_ttl > 0 then
|
||||
if new_campfire.limited and new_campfire.flames_ttl > 0 then
|
||||
local it_val = meta:get_int("it_val");
|
||||
infotext = infotext..indicator(new_campfire_ttl, it_val)
|
||||
infotext = infotext..indicator(new_campfire.flames_ttl, it_val)
|
||||
end
|
||||
|
||||
local cooked_time = meta:get_int('cooked_time');
|
||||
if new_campfire_cooking and cooked_time ~= 0 then
|
||||
if new_campfire.cooking and cooked_time ~= 0 then
|
||||
local cooked_cur_time = meta:get_int('cooked_cur_time');
|
||||
infotext = infotext.."\n"..S("Cooking")..indicator(cooked_time, cooked_cur_time)
|
||||
end
|
||||
|
@ -141,7 +141,7 @@ local function cooking(pos, itemstack)
|
|||
local cooked, _ = minetest.get_craft_result({method = "cooking", width = 1, items = {itemstack}})
|
||||
local cookable = cooked.time ~= 0
|
||||
|
||||
if cookable and new_campfire_cooking then
|
||||
if cookable and new_campfire.cooking then
|
||||
local eat_y = ItemStack(cooked.item:to_table().name):get_definition().on_use
|
||||
if string.find(minetest.serialize(eat_y), "do_item_eat") and meta:get_int("cooked_time") == 0 then
|
||||
meta:set_int('cooked_time', cooked.time);
|
||||
|
@ -190,7 +190,7 @@ local function add_stick(pos, itemstack)
|
|||
local meta = minetest.get_meta(pos)
|
||||
local name = itemstack:get_name()
|
||||
if itemstack:get_definition().groups.stick == 1 then
|
||||
local it_val = meta:get_int("it_val") + (new_campfire_ttl);
|
||||
local it_val = meta:get_int("it_val") + (new_campfire.flames_ttl);
|
||||
meta:set_int('it_val', it_val);
|
||||
effect(
|
||||
pos,
|
||||
|
@ -364,7 +364,7 @@ minetest.register_node('new_campfire:campfire_active', {
|
|||
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int('it_val', new_campfire_ttl)
|
||||
meta:set_int('it_val', new_campfire.flames_ttl)
|
||||
meta:set_int("em_val", 0)
|
||||
infotext_edit(meta)
|
||||
minetest.get_node_timer(pos):start(2)
|
||||
|
@ -411,7 +411,7 @@ minetest.register_node('new_campfire:fireplace_with_embers', {
|
|||
local a=add_stick(pos, itemstack)
|
||||
if a then
|
||||
minetest.swap_node(pos, {name = "new_campfire:campfire"})
|
||||
minetest.after(new_campfire_flare_up, function()
|
||||
minetest.after(new_campfire.flare_up, function()
|
||||
if minetest.get_meta(pos):get_int("it_val") > 0 then
|
||||
minetest.swap_node(pos, {name="new_campfire:campfire_active"})
|
||||
end
|
||||
|
@ -425,7 +425,7 @@ minetest.register_node('new_campfire:fireplace_with_embers', {
|
|||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("it_val", 0)
|
||||
meta:set_int("em_val", new_campfire_embers_ttl)
|
||||
meta:set_int("em_val", new_campfire.embers_ttl)
|
||||
meta:set_string('infotext', S("Fireplace with embers"));
|
||||
end,
|
||||
})
|
||||
|
@ -471,7 +471,7 @@ minetest.register_node('new_campfire:fireplace_with_embers_with_grille', {
|
|||
local a=add_stick(pos, itemstack)
|
||||
if a then
|
||||
minetest.swap_node(pos, {name = "new_campfire:campfire_with_grille"})
|
||||
minetest.after(new_campfire_flare_up, function()
|
||||
minetest.after(new_campfire.flare_up, function()
|
||||
if minetest.get_meta(pos):get_int("it_val") > 0 then
|
||||
minetest.swap_node(pos, {name="new_campfire:campfire_active_with_grille"})
|
||||
end
|
||||
|
@ -482,7 +482,7 @@ minetest.register_node('new_campfire:fireplace_with_embers_with_grille', {
|
|||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("it_val", 0)
|
||||
meta:set_int("em_val", new_campfire_embers_ttl)
|
||||
meta:set_int("em_val", new_campfire.embers_ttl)
|
||||
meta:set_string('infotext', S("Fireplace with embers"));
|
||||
end,
|
||||
})
|
||||
|
@ -623,7 +623,7 @@ minetest.register_node('new_campfire:campfire_active_with_grille', {
|
|||
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int('it_val', new_campfire_ttl);
|
||||
meta:set_int('it_val', new_campfire.flames_ttl);
|
||||
meta:set_int("em_val", 0)
|
||||
infotext_edit(meta)
|
||||
minetest.get_node_timer(pos):start(2)
|
||||
|
@ -691,7 +691,7 @@ minetest.register_abm({
|
|||
local meta = minetest.get_meta(pos)
|
||||
local it_val = meta:get_int("it_val") - 1;
|
||||
|
||||
if new_campfire_limit and new_campfire_ttl > 0 then
|
||||
if new_campfire.limited and new_campfire.flames_ttl > 0 then
|
||||
if it_val <= 0 then
|
||||
burn_out(pos, node)
|
||||
return
|
||||
|
@ -699,7 +699,7 @@ minetest.register_abm({
|
|||
meta:set_int('it_val', it_val);
|
||||
end
|
||||
|
||||
if new_campfire_cooking then
|
||||
if new_campfire.cooking then
|
||||
if meta:get_int('cooked_cur_time') <= meta:get_int('cooked_time') then
|
||||
meta:set_int('cooked_cur_time', meta:get_int('cooked_cur_time') + 1);
|
||||
else
|
||||
|
|
45
intllib.lua
45
intllib.lua
|
@ -1,45 +0,0 @@
|
|||
|
||||
-- Fallback functions for when `intllib` is not installed.
|
||||
-- Code released under Unlicense <http://unlicense.org>.
|
||||
|
||||
-- Get the latest version of this file at:
|
||||
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
|
||||
|
||||
local function format(str, ...)
|
||||
local args = { ... }
|
||||
local function repl(escape, open, num, close)
|
||||
if escape == "" then
|
||||
local replacement = tostring(args[tonumber(num)])
|
||||
if open == "" then
|
||||
replacement = replacement..close
|
||||
end
|
||||
return replacement
|
||||
else
|
||||
return "@"..open..num..close
|
||||
end
|
||||
end
|
||||
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
|
||||
end
|
||||
|
||||
local gettext, ngettext
|
||||
if minetest.get_modpath("intllib") then
|
||||
if intllib.make_gettext_pair then
|
||||
-- New method using gettext.
|
||||
gettext, ngettext = intllib.make_gettext_pair()
|
||||
else
|
||||
-- Old method using text files.
|
||||
gettext = intllib.Getter()
|
||||
end
|
||||
end
|
||||
|
||||
-- Fill in missing functions.
|
||||
|
||||
gettext = gettext or function(msgid, ...)
|
||||
return format(msgid, ...)
|
||||
end
|
||||
|
||||
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
|
||||
return format(n==1 and msgid or msgid_plural, ...)
|
||||
end
|
||||
|
||||
return gettext, ngettext
|
|
@ -0,0 +1,16 @@
|
|||
# textdomain: new_campfire
|
||||
|
||||
|
||||
### init.lua ###
|
||||
|
||||
Active campfire=Feu de camp allumé
|
||||
Active campfire with grille=Feu de camp allumé avec une grille
|
||||
Ash=Cendres
|
||||
Campfire=Feu de camp
|
||||
Campfire with grille=Feu de camp avec une grille
|
||||
Cooking=Cuisson
|
||||
Fireplace=Foyer
|
||||
Fireplace with embers=Foyer avec des braises
|
||||
Fireplace with embers and grille=Foyer avec des braises et une grille
|
||||
Fireplace with grille=Foyer avec une grille
|
||||
Metal Grille=Grille en métal
|
|
@ -0,0 +1,16 @@
|
|||
# textdomain: new_campfire
|
||||
|
||||
|
||||
### init.lua ###
|
||||
|
||||
Active campfire=Горящий костер
|
||||
Active campfire with grille=
|
||||
Ash=Пепел
|
||||
Campfire=Костер
|
||||
Campfire with grille=
|
||||
Cooking=Приготовление
|
||||
Fireplace=Кострище
|
||||
Fireplace with embers=
|
||||
Fireplace with embers and grille=
|
||||
Fireplace with grille=
|
||||
Metal Grille=
|
|
@ -0,0 +1,16 @@
|
|||
# textdomain: new_campfire
|
||||
|
||||
|
||||
### init.lua ###
|
||||
|
||||
Active campfire=Палаюче багаття
|
||||
Active campfire with grille=
|
||||
Ash=Попіл
|
||||
Campfire=Багаття
|
||||
Campfire with grille=
|
||||
Cooking=Готування
|
||||
Fireplace=Місце від багаття
|
||||
Fireplace with embers=
|
||||
Fireplace with embers and grille=
|
||||
Fireplace with grille=
|
||||
Metal Grille=
|
38
locale/ru.po
38
locale/ru.po
|
@ -1,38 +0,0 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-04-22 20:24+0300\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: init.lua:119 init.lua:260
|
||||
msgid "Active campfire"
|
||||
msgstr "Горящий костер"
|
||||
|
||||
#: init.lua:129
|
||||
msgid "Cooking"
|
||||
msgstr "Приготовление"
|
||||
|
||||
#: init.lua:193 init.lua:211
|
||||
msgid "Fireplace"
|
||||
msgstr "Кострище"
|
||||
|
||||
#: init.lua:216 init.lua:236
|
||||
msgid "Campfire"
|
||||
msgstr "Костер"
|
||||
|
||||
#: init.lua:382
|
||||
msgid "Ash"
|
||||
msgstr "Пепел"
|
|
@ -1,38 +0,0 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-04-22 20:24+0300\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: init.lua:119 init.lua:260
|
||||
msgid "Active campfire"
|
||||
msgstr ""
|
||||
|
||||
#: init.lua:129
|
||||
msgid "Cooking"
|
||||
msgstr ""
|
||||
|
||||
#: init.lua:193 init.lua:211
|
||||
msgid "Fireplace"
|
||||
msgstr ""
|
||||
|
||||
#: init.lua:216 init.lua:236
|
||||
msgid "Campfire"
|
||||
msgstr ""
|
||||
|
||||
#: init.lua:382
|
||||
msgid "Ash"
|
||||
msgstr ""
|
|
@ -0,0 +1,16 @@
|
|||
# textdomain: new_campfire
|
||||
|
||||
|
||||
### init.lua ###
|
||||
|
||||
Active campfire=
|
||||
Active campfire with grille=
|
||||
Ash=
|
||||
Campfire=
|
||||
Campfire with grille=
|
||||
Cooking=
|
||||
Fireplace=
|
||||
Fireplace with embers=
|
||||
Fireplace with embers and grille=
|
||||
Fireplace with grille=
|
||||
Metal Grille=
|
38
locale/ua.po
38
locale/ua.po
|
@ -1,38 +0,0 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-04-22 20:24+0300\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: init.lua:119 init.lua:260
|
||||
msgid "Active campfire"
|
||||
msgstr "Палаюче багаття"
|
||||
|
||||
#: init.lua:129
|
||||
msgid "Cooking"
|
||||
msgstr "Готування"
|
||||
|
||||
#: init.lua:193 init.lua:211
|
||||
msgid "Fireplace"
|
||||
msgstr "Місце від багаття"
|
||||
|
||||
#: init.lua:216 init.lua:236
|
||||
msgid "Campfire"
|
||||
msgstr "Багаття"
|
||||
|
||||
#: init.lua:382
|
||||
msgid "Ash"
|
||||
msgstr "Попіл"
|
Loading…
Reference in New Issue