Add function mod.get_translator to any mod with serveral lua files

M  mods/beds/beds.lua
M  mods/beds/init.lua
M  mods/carts/cart_entity.lua
M  mods/carts/init.lua
M  mods/carts/rails.lua
M  mods/creative/init.lua
M  mods/creative/inventory.lua
M  mods/default/chests.lua
M  mods/default/craftitems.lua
M  mods/default/furnace.lua
M  mods/default/init.lua
M  mods/default/nodes.lua
M  mods/default/tools.lua
M  mods/default/torch.lua
M  mods/default/trees.lua
M  mods/farming/api.lua
M  mods/farming/hoes.lua
M  mods/farming/init.lua
M  mods/farming/nodes.lua
This commit is contained in:
Zweihorn 2019-05-21 22:55:13 +02:00
parent 7fa0bb07ed
commit e7fb094fe1
19 changed files with 43 additions and 40 deletions

View File

@ -1,7 +1,7 @@
-- beds/beds.lua
-- Load support for MT game translation.
local S = minetest.get_translator()
-- support for MT game translation.
local S = beds.get_translator
-- Fancy shaped bed

View File

@ -9,6 +9,7 @@ beds.player = {}
beds.bed_position = {}
beds.pos = {}
beds.spawn = {}
beds.get_translator = S
beds.formspec = "size[8,11;true]" ..
"no_prepend[]" ..

View File

@ -1,8 +1,7 @@
-- carts/cart_entity.lua
-- Load support for MT game translation.
local S = minetest.get_translator()
-- support for MT game translation.
local S = carts.get_translator
local cart_entity = {
initial_properties = {

View File

@ -1,7 +1,12 @@
-- carts/init.lua
-- Load support for MT game translation.
local S = minetest.get_translator()
carts = {}
carts.modpath = minetest.get_modpath("carts")
carts.railparams = {}
carts.get_translator = S
-- Maximal speed of the cart in m/s (min = -1)
carts.speed_max = 7

View File

@ -1,7 +1,7 @@
-- carts/rails.lua
-- Load support for MT game translation.
local S = minetest.get_translator()
-- support for MT game translation.
local S = carts.get_translator
carts:register_rail("carts:rail", {
description = S("Rail"),

View File

@ -3,8 +3,8 @@
-- Load support for MT game translation.
local S = minetest.get_translator()
creative = {}
creative.get_translator = S
local function update_sfinv(name)
minetest.after(0, function()

View File

@ -1,8 +1,7 @@
-- creative/inventory.lua
-- Load support for MT game translation.
local S = minetest.get_translator()
-- support for MT game translation.
local S = creative.get_translator
local player_inventory = {}
local inventory_cache = {}

View File

@ -1,7 +1,7 @@
default.chest = {}
-- Load support for MT game translation.
local S = minetest.get_translator()
-- support for MT game translation.
local S = default.get_translator
function default.chest.get_chest_formspec(pos)
local spos = pos.x .. "," .. pos.y .. "," .. pos.z

View File

@ -1,7 +1,7 @@
-- mods/default/craftitems.lua
-- Load support for MT game translation.
local S = minetest.get_translator()
-- support for MT game translation.
local S = default.get_translator
minetest.register_craftitem("default:stick", {
description = S("Stick"),

View File

@ -1,8 +1,7 @@
-- default/furnace.lua
-- Load support for MT game translation.
local S = minetest.get_translator()
-- support for MT game translation.
local S = default.get_translator
--
-- Formspecs

View File

@ -3,10 +3,14 @@
-- The API documentation in here was moved into game_api.txt
-- Load support for MT game translation.
local S = minetest.get_translator()
-- Definitions made by this mod that other mods can use too
default = {}
default.LIGHT_MAX = 14
default.get_translator = S
-- GUI related stuff
minetest.register_on_joinplayer(function(player)

View File

@ -1,8 +1,7 @@
-- mods/default/nodes.lua
-- Load support for MT game translation.
local S = minetest.get_translator()
-- support for MT game translation.
local S = default.get_translator
--[[ Node name convention:

View File

@ -1,7 +1,7 @@
-- mods/default/tools.lua
-- Load support for MT game translation.
local S = minetest.get_translator()
-- support for MT game translation.
local S = default.get_translator
-- The hand
minetest.register_item(":", {

View File

@ -1,7 +1,7 @@
-- default/torch.lua
-- Load support for MT game translation.
local S = minetest.get_translator()
-- support for MT game translation.
local S = default.get_translator
local function on_flood(pos, oldnode, newnode)
minetest.add_item(pos, ItemStack("default:torch 1"))

View File

@ -1,8 +1,7 @@
-- default/trees.lua
-- Load support for MT game translation.
local S = minetest.get_translator()
-- support for MT game translation.
local S = default.get_translator
local random = math.random

View File

@ -1,7 +1,7 @@
-- farming/api.lua
-- Load support for MT game translation.
local S = minetest.get_translator()
-- support for MT game translation.
local S = farming.get_translator
-- Wear out hoes, place soil
-- TODO Ignore group:flower

View File

@ -1,7 +1,7 @@
-- farming/hoes.lua
-- Load support for MT game translation.
local S = minetest.get_translator()
-- support for MT game translation.
local S = farming.get_translator
farming.register_hoe(":farming:hoe_wood", {
description = S("Wooden Hoe"),

View File

@ -1,10 +1,13 @@
-- farming/init.lua
-- Load support for MT game translation.
local S = minetest.get_translator()
-- Global farming namespace
farming = {}
farming.path = minetest.get_modpath("farming")
farming.get_translator = S
-- Load files
@ -13,10 +16,6 @@ dofile(farming.path .. "/nodes.lua")
dofile(farming.path .. "/hoes.lua")
-- Load support for MT game translation.
local S = minetest.get_translator()
-- WHEAT
farming.register_plant("farming:wheat", {

View File

@ -1,8 +1,7 @@
-- farming/nodes.lua
-- Load support for MT game translation.
local S = minetest.get_translator()
-- support for MT game translation.
local S = farming.get_translator
minetest.override_item("default:dirt", {
soil = {