mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-06-02 20:10:04 -04:00
Created individual namespaces to avoid messing with default functions
This commit is contained in:
parent
2dbee8123e
commit
e071a2adff
27 changed files with 45 additions and 32 deletions
|
@ -1,4 +1,4 @@
|
||||||
local S = beds.intllib
|
local S = ibeds.intllib
|
||||||
|
|
||||||
-- fancy shaped bed
|
-- fancy shaped bed
|
||||||
beds.register_bed("beds:fancy_bed", {
|
beds.register_bed("beds:fancy_bed", {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
local S = beds.intllib
|
local S = ibeds.intllib
|
||||||
|
|
||||||
local player_in_bed = 0
|
local player_in_bed = 0
|
||||||
local is_sp = minetest.is_singleplayer()
|
local is_sp = minetest.is_singleplayer()
|
||||||
|
|
|
@ -4,13 +4,14 @@ beds.pos = {}
|
||||||
beds.spawn = {}
|
beds.spawn = {}
|
||||||
|
|
||||||
-- Intllib
|
-- Intllib
|
||||||
|
ibeds = {}
|
||||||
local S
|
local S
|
||||||
if minetest.get_modpath("intllib") then
|
if minetest.get_modpath("intllib") then
|
||||||
S = intllib.Getter()
|
S = intllib.Getter()
|
||||||
else
|
else
|
||||||
S = function(s) return s end
|
S = function(s) return s end
|
||||||
end
|
end
|
||||||
beds.intllib = S
|
ibeds.intllib = S
|
||||||
|
|
||||||
beds.formspec = "size[8,15;true]"..
|
beds.formspec = "size[8,15;true]"..
|
||||||
"bgcolor[#080808BB; true]"..
|
"bgcolor[#080808BB; true]"..
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
-- Intllib
|
-- Intllib
|
||||||
boats = {}
|
iboats = {}
|
||||||
|
|
||||||
local S
|
local S
|
||||||
if minetest.get_modpath("intllib") then
|
if minetest.get_modpath("intllib") then
|
||||||
|
@ -7,7 +7,7 @@ if minetest.get_modpath("intllib") then
|
||||||
else
|
else
|
||||||
S = function(s) return s end
|
S = function(s) return s end
|
||||||
end
|
end
|
||||||
boats.intllib = S
|
iboats.intllib = S
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Helper functions
|
-- Helper functions
|
||||||
|
|
|
@ -4,13 +4,14 @@
|
||||||
bones = {}
|
bones = {}
|
||||||
|
|
||||||
-- Intllib
|
-- Intllib
|
||||||
|
ibones = {}
|
||||||
local S
|
local S
|
||||||
if minetest.get_modpath("intllib") then
|
if minetest.get_modpath("intllib") then
|
||||||
S = intllib.Getter()
|
S = intllib.Getter()
|
||||||
else
|
else
|
||||||
S = function(s) return s end
|
S = function(s) return s end
|
||||||
end
|
end
|
||||||
bones.intllib = S
|
ibones.intllib = S
|
||||||
|
|
||||||
local function is_owner(pos, name)
|
local function is_owner(pos, name)
|
||||||
local owner = minetest.get_meta(pos):get_string("owner")
|
local owner = minetest.get_meta(pos):get_string("owner")
|
||||||
|
|
|
@ -17,13 +17,14 @@ bucket = {}
|
||||||
bucket.liquids = {}
|
bucket.liquids = {}
|
||||||
|
|
||||||
-- Intllib
|
-- Intllib
|
||||||
|
ibucket = {}
|
||||||
local S
|
local S
|
||||||
if minetest.get_modpath("intllib") then
|
if minetest.get_modpath("intllib") then
|
||||||
S = intllib.Getter()
|
S = intllib.Getter()
|
||||||
else
|
else
|
||||||
S = function(s) return s end
|
S = function(s) return s end
|
||||||
end
|
end
|
||||||
bucket.intllib = S
|
ibucket.intllib = S
|
||||||
|
|
||||||
local function check_protection(pos, name, text)
|
local function check_protection(pos, name, text)
|
||||||
if minetest.is_protected(pos, name) then
|
if minetest.is_protected(pos, name) then
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
-- mods/default/craftitems.lua
|
-- mods/default/craftitems.lua
|
||||||
|
|
||||||
local S = default.intllib
|
local S = idefault.intllib
|
||||||
|
|
||||||
minetest.register_craftitem("default:stick", {
|
minetest.register_craftitem("default:stick", {
|
||||||
description = S("Stick"),
|
description = S("Stick"),
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
-- Formspecs
|
-- Formspecs
|
||||||
--
|
--
|
||||||
|
|
||||||
local S = default.intllib
|
local S = idefault.intllib
|
||||||
|
|
||||||
local function active_formspec(fuel_percent, item_percent)
|
local function active_formspec(fuel_percent, item_percent)
|
||||||
local formspec =
|
local formspec =
|
||||||
|
|
|
@ -7,13 +7,14 @@
|
||||||
default = {}
|
default = {}
|
||||||
|
|
||||||
-- Intllib
|
-- Intllib
|
||||||
|
idefault = {}
|
||||||
local S
|
local S
|
||||||
if minetest.get_modpath("intllib") then
|
if minetest.get_modpath("intllib") then
|
||||||
S = intllib.Getter()
|
S = intllib.Getter()
|
||||||
else
|
else
|
||||||
S = function(s) return s end
|
S = function(s) return s end
|
||||||
end
|
end
|
||||||
default.intllib = S
|
idefault.intllib = S
|
||||||
|
|
||||||
default.LIGHT_MAX = 14
|
default.LIGHT_MAX = 14
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ default:nyancat_rainbow
|
||||||
|
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
local S = default.intllib
|
local S = idefault.intllib
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Stone
|
-- Stone
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
-- mods/default/tools.lua
|
-- mods/default/tools.lua
|
||||||
|
|
||||||
local S = default.intllib
|
local S = idefault.intllib
|
||||||
|
|
||||||
-- The hand
|
-- The hand
|
||||||
minetest.register_item(":", {
|
minetest.register_item(":", {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
-- Grow trees
|
-- Grow trees
|
||||||
--
|
--
|
||||||
|
|
||||||
local S = default.intllib
|
local S = idefault.intllib
|
||||||
|
|
||||||
local random = math.random
|
local random = math.random
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
doors = {}
|
doors = {}
|
||||||
|
|
||||||
-- Intllib
|
-- Intllib
|
||||||
|
idoors = {}
|
||||||
local S
|
local S
|
||||||
if minetest.get_modpath("intllib") then
|
if minetest.get_modpath("intllib") then
|
||||||
S = intllib.Getter()
|
S = intllib.Getter()
|
||||||
else
|
else
|
||||||
S = function(s) return s end
|
S = function(s) return s end
|
||||||
end
|
end
|
||||||
doors.intllib = S
|
idoors.intllib = S
|
||||||
|
|
||||||
-- Registers a door
|
-- Registers a door
|
||||||
function doors.register_door(name, def)
|
function doors.register_door(name, def)
|
||||||
|
|
|
@ -9,13 +9,14 @@ dye.excolors = {"white", "lightgrey", "grey", "darkgrey", "black", "red", "orang
|
||||||
local dyelocal = {}
|
local dyelocal = {}
|
||||||
|
|
||||||
-- Intllib
|
-- Intllib
|
||||||
|
idye = {}
|
||||||
local S
|
local S
|
||||||
if minetest.get_modpath("intllib") then
|
if minetest.get_modpath("intllib") then
|
||||||
S = intllib.Getter()
|
S = intllib.Getter()
|
||||||
else
|
else
|
||||||
S = function(s) return s end
|
S = function(s) return s end
|
||||||
end
|
end
|
||||||
dye.intllib = S
|
idye.intllib = S
|
||||||
|
|
||||||
-- This collection of colors is partly a historic thing, partly something else.
|
-- This collection of colors is partly a historic thing, partly something else.
|
||||||
dyelocal.dyes = {
|
dyelocal.dyes = {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
local S = farming.intllib
|
local S = ifarming.intllib
|
||||||
|
|
||||||
farming.register_hoe(":farming:hoe_wood", {
|
farming.register_hoe(":farming:hoe_wood", {
|
||||||
description = S("Wooden Hoe"),
|
description = S("Wooden Hoe"),
|
||||||
|
|
|
@ -3,13 +3,14 @@ farming = {}
|
||||||
farming.path = minetest.get_modpath("farming")
|
farming.path = minetest.get_modpath("farming")
|
||||||
|
|
||||||
-- Intllib
|
-- Intllib
|
||||||
|
ifarming = {}
|
||||||
local S
|
local S
|
||||||
if minetest.get_modpath("intllib") then
|
if minetest.get_modpath("intllib") then
|
||||||
S = intllib.Getter()
|
S = intllib.Getter()
|
||||||
else
|
else
|
||||||
S = function(s) return s end
|
S = function(s) return s end
|
||||||
end
|
end
|
||||||
farming.intllib = S
|
ifarming.intllib = S
|
||||||
|
|
||||||
-- Load files
|
-- Load files
|
||||||
dofile(farming.path .. "/api.lua")
|
dofile(farming.path .. "/api.lua")
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
local S = farming.intllib
|
local S = ifarming.intllib
|
||||||
|
|
||||||
minetest.override_item("default:dirt", {
|
minetest.override_item("default:dirt", {
|
||||||
groups = {crumbly=3,soil=1},
|
groups = {crumbly=3,soil=1},
|
||||||
|
|
|
@ -3,13 +3,14 @@
|
||||||
fire = {}
|
fire = {}
|
||||||
|
|
||||||
-- Intllib
|
-- Intllib
|
||||||
|
ifire = {}
|
||||||
local S
|
local S
|
||||||
if minetest.get_modpath("intllib") then
|
if minetest.get_modpath("intllib") then
|
||||||
S = intllib.Getter()
|
S = intllib.Getter()
|
||||||
else
|
else
|
||||||
S = function(s) return s end
|
S = function(s) return s end
|
||||||
end
|
end
|
||||||
fire.intllib = S
|
ifire.intllib = S
|
||||||
|
|
||||||
minetest.register_node("fire:basic_flame", {
|
minetest.register_node("fire:basic_flame", {
|
||||||
description = S("Fire"),
|
description = S("Fire"),
|
||||||
|
|
|
@ -5,13 +5,14 @@
|
||||||
flowers = {}
|
flowers = {}
|
||||||
|
|
||||||
-- Intllib
|
-- Intllib
|
||||||
|
iflowers = {}
|
||||||
local S
|
local S
|
||||||
if minetest.get_modpath("intllib") then
|
if minetest.get_modpath("intllib") then
|
||||||
S = intllib.Getter()
|
S = intllib.Getter()
|
||||||
else
|
else
|
||||||
S = function(s) return s end
|
S = function(s) return s end
|
||||||
end
|
end
|
||||||
flowers.intllib = S
|
iflowers.intllib = S
|
||||||
|
|
||||||
-- Map Generation
|
-- Map Generation
|
||||||
dofile(minetest.get_modpath("flowers").."/mapgen.lua")
|
dofile(minetest.get_modpath("flowers").."/mapgen.lua")
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
-- Intllib
|
-- Intllib
|
||||||
give_initial_stuff = {}
|
igistuff = {}
|
||||||
|
|
||||||
local S
|
local S
|
||||||
if minetest.get_modpath("intllib") then
|
if minetest.get_modpath("intllib") then
|
||||||
|
@ -7,7 +7,7 @@ if minetest.get_modpath("intllib") then
|
||||||
else
|
else
|
||||||
S = function(s) return s end
|
S = function(s) return s end
|
||||||
end
|
end
|
||||||
give_initial_stuff.intllib = S
|
igistuff.intllib = S
|
||||||
|
|
||||||
minetest.register_on_newplayer(function(player)
|
minetest.register_on_newplayer(function(player)
|
||||||
--print("on_newplayer")
|
--print("on_newplayer")
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
screwdriver = {}
|
screwdriver = {}
|
||||||
|
|
||||||
-- Intllib
|
-- Intllib
|
||||||
|
isdriver = {}
|
||||||
local S
|
local S
|
||||||
if minetest.get_modpath("intllib") then
|
if minetest.get_modpath("intllib") then
|
||||||
S = intllib.Getter()
|
S = intllib.Getter()
|
||||||
else
|
else
|
||||||
S = function(s) return s end
|
S = function(s) return s end
|
||||||
end
|
end
|
||||||
screwdriver.intllib = S
|
isdriver.intllib = S
|
||||||
|
|
||||||
local function nextrange(x, max)
|
local function nextrange(x, max)
|
||||||
x = x + 1
|
x = x + 1
|
||||||
|
|
|
@ -2,7 +2,7 @@ local homes_file = minetest.get_worldpath() .. "/homes"
|
||||||
local homepos = {}
|
local homepos = {}
|
||||||
|
|
||||||
-- Intllib
|
-- Intllib
|
||||||
sethome = {}
|
isethome = {}
|
||||||
|
|
||||||
local S
|
local S
|
||||||
if minetest.get_modpath("intllib") then
|
if minetest.get_modpath("intllib") then
|
||||||
|
@ -10,7 +10,7 @@ if minetest.get_modpath("intllib") then
|
||||||
else
|
else
|
||||||
S = function(s) return s end
|
S = function(s) return s end
|
||||||
end
|
end
|
||||||
sethome.intllib = S
|
isethome.intllib = S
|
||||||
|
|
||||||
local function loadhomes()
|
local function loadhomes()
|
||||||
local input = io.open(homes_file, "r")
|
local input = io.open(homes_file, "r")
|
||||||
|
|
|
@ -4,13 +4,14 @@
|
||||||
stairs = {}
|
stairs = {}
|
||||||
|
|
||||||
-- Intllib
|
-- Intllib
|
||||||
|
istairs = {}
|
||||||
local S
|
local S
|
||||||
if minetest.get_modpath("intllib") then
|
if minetest.get_modpath("intllib") then
|
||||||
S = intllib.Getter()
|
S = intllib.Getter()
|
||||||
else
|
else
|
||||||
S = function(s) return s end
|
S = function(s) return s end
|
||||||
end
|
end
|
||||||
stairs.intllib = S
|
istairs.intllib = S
|
||||||
|
|
||||||
-- Node will be called stairs:stair_<subname>
|
-- Node will be called stairs:stair_<subname>
|
||||||
function stairs.register_stair(subname, recipeitem, groups, images, description, sounds)
|
function stairs.register_stair(subname, recipeitem, groups, images, description, sounds)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
-- Intllib
|
-- Intllib
|
||||||
tnt = {}
|
itnt = {}
|
||||||
|
|
||||||
local S
|
local S
|
||||||
if minetest.get_modpath("intllib") then
|
if minetest.get_modpath("intllib") then
|
||||||
|
@ -7,7 +7,7 @@ if minetest.get_modpath("intllib") then
|
||||||
else
|
else
|
||||||
S = function(s) return s end
|
S = function(s) return s end
|
||||||
end
|
end
|
||||||
tnt.intllib = S
|
itnt.intllib = S
|
||||||
|
|
||||||
-- Default to enabled in singleplayer and disabled in multiplayer
|
-- Default to enabled in singleplayer and disabled in multiplayer
|
||||||
local singleplayer = minetest.is_singleplayer()
|
local singleplayer = minetest.is_singleplayer()
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
-- See README.txt for licensing and other information.
|
-- See README.txt for licensing and other information.
|
||||||
|
|
||||||
-- Intllib
|
-- Intllib
|
||||||
vessels = {}
|
ivessels = {}
|
||||||
|
|
||||||
local S
|
local S
|
||||||
if minetest.get_modpath("intllib") then
|
if minetest.get_modpath("intllib") then
|
||||||
|
@ -10,7 +10,7 @@ if minetest.get_modpath("intllib") then
|
||||||
else
|
else
|
||||||
S = function(s) return s end
|
S = function(s) return s end
|
||||||
end
|
end
|
||||||
vessels.intllib = S
|
ivessels.intllib = S
|
||||||
|
|
||||||
local vessels_shelf_formspec =
|
local vessels_shelf_formspec =
|
||||||
"size[8,7;]"..
|
"size[8,7;]"..
|
||||||
|
|
|
@ -7,13 +7,14 @@ minetest.register_alias("wool:gold", "wool:yellow")
|
||||||
local wool = {}
|
local wool = {}
|
||||||
|
|
||||||
-- Intllib
|
-- Intllib
|
||||||
|
iwool = {}
|
||||||
local S
|
local S
|
||||||
if minetest.get_modpath("intllib") then
|
if minetest.get_modpath("intllib") then
|
||||||
S = intllib.Getter()
|
S = intllib.Getter()
|
||||||
else
|
else
|
||||||
S = function(s) return s end
|
S = function(s) return s end
|
||||||
end
|
end
|
||||||
wool.intllib = S
|
iwool.intllib = S
|
||||||
|
|
||||||
-- This uses a trick: you can first define the recipes using all of the base
|
-- This uses a trick: you can first define the recipes using all of the base
|
||||||
-- colors, and then some recipes using more specific colors for a few non-base
|
-- colors, and then some recipes using more specific colors for a few non-base
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
xpanes = {}
|
xpanes = {}
|
||||||
|
|
||||||
-- Intllib
|
-- Intllib
|
||||||
|
ixpanes = {}
|
||||||
local S
|
local S
|
||||||
if minetest.get_modpath("intllib") then
|
if minetest.get_modpath("intllib") then
|
||||||
S = intllib.Getter()
|
S = intllib.Getter()
|
||||||
else
|
else
|
||||||
S = function(s) return s end
|
S = function(s) return s end
|
||||||
end
|
end
|
||||||
xpanes.intllib = S
|
ixpanes.intllib = S
|
||||||
|
|
||||||
local function rshift(x, by)
|
local function rshift(x, by)
|
||||||
return math.floor(x / 2 ^ by)
|
return math.floor(x / 2 ^ by)
|
||||||
|
|
Loading…
Add table
Reference in a new issue