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