add intllib support, improved texture fire

This commit is contained in:
Pavel Litvinoff 2017-02-08 17:07:34 +02:00
parent 35f36b18e7
commit 33cc94a578
8 changed files with 142 additions and 8 deletions

View File

@ -1,6 +1,6 @@
Minetest mod "New Campfire"
======================
Version: 0.1.0
Version: 0.1.1
# License of source code:
- Copyright (C) 2017 Pavel Litvinoff <googolgl@gmail.com>
@ -29,10 +29,16 @@ group:stone group:stick group:stone
#### [0.1.0] - 2017-02-07
- Release
#### [0.1.1] - 2017-02-08
- add initllib support
- improved texture fire
# Links:
- Forum Topic:
- <https://forum.minetest.net/>
- <https://forum.minetest.net/viewtopic.php?f=9&t=16611>
- Bitbucket:
- <https://bitbucket.org/g00g01/new_campfire>
- Intllib:
- https://github.com/minetest-mods/intllib

View File

@ -1,2 +1,3 @@
default
fire
intllib

View File

@ -1,3 +1,7 @@
-- Load support for intllib.
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
-- VARIABLES
new_campfire = {}
local id = {}
@ -20,7 +24,7 @@ local function fire_particles_on(pos) -- 3 layers of fire
maxsize = 4,
collisiondetection = false,
vertical = true,
texture = "fire.png",
texture = "cfire.png",
-- playername = "singleplayer"
})
-- print(id)
@ -41,7 +45,7 @@ local function fire_particles_on(pos) -- 3 layers of fire
maxsize = 0.7,
collisiondetection = false,
vertical = true,
texture = "fire.png",
texture = "cfire.png",
-- playername = "singleplayer" -- показывать только определенному игроку.
})
-- print(id)
@ -82,7 +86,7 @@ end
-- NODES
minetest.register_node('new_campfire:campfire', {
description = 'Campfire',
description = S("Campfire"),
drawtype = 'mesh',
mesh = 'contained_campfire.obj',
tiles = {
@ -102,7 +106,7 @@ minetest.register_node('new_campfire:campfire', {
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string('infotext', 'Campfire');
meta:set_string('infotext', S("Campfire"));
end,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
@ -131,7 +135,7 @@ minetest.register_node('new_campfire:campfire', {
})
minetest.register_node('new_campfire:campfire_active', {
description = 'Active campfire',
description = S("Active campfire"),
drawtype = 'mesh',
mesh = 'contained_campfire.obj',
tiles = {
@ -154,7 +158,7 @@ minetest.register_node('new_campfire:campfire_active', {
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string('infotext', 'Active campfire');
meta:set_string('infotext', S("Active campfire"));
minetest.get_node_timer(pos):start(2)
end,

45
intllib.lua Normal file
View File

@ -0,0 +1,45 @@
-- 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

26
locale/ru.po Normal file
View File

@ -0,0 +1,26 @@
# 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-02-08 16:03+0200\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:89 init.lua:109
msgid "Campfire"
msgstr "Костер"
#: init.lua:138 init.lua:161
msgid "Active campfire"
msgstr "Горящий костер"

26
locale/template.pot Normal file
View File

@ -0,0 +1,26 @@
# 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-02-08 16:06+0200\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:89 init.lua:109
msgid "Campfire"
msgstr ""
#: init.lua:138 init.lua:161
msgid "Active campfire"
msgstr ""

26
locale/ua.po Normal file
View File

@ -0,0 +1,26 @@
# 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-02-08 16:03+0200\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:89 init.lua:109
msgid "Campfire"
msgstr "Багаття"
#: init.lua:138 init.lua:161
msgid "Active campfire"
msgstr "Палаюче багаття"

BIN
textures/cfire.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B