From f2b7392a300357ce9f317642208e9b747c4c7960 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 6 Jan 2020 13:02:30 +0100 Subject: [PATCH] Use "minetest" instead of "core" table --- mods/ENTITIES/mcl_falling_nodes/init.lua | 6 +++--- mods/ENTITIES/mcl_item_entity/init.lua | 26 ++++++++++++------------ mods/ITEMS/REDSTONE/mesecons/util.lua | 2 +- mods/ITEMS/mcl_anvils/init.lua | 2 +- mods/ITEMS/mcl_banners/patterncraft.lua | 2 +- mods/ITEMS/mcl_books/init.lua | 8 ++++---- mods/ITEMS/mcl_core/craftitems.lua | 2 +- mods/ITEMS/mcl_core/nodes_misc.lua | 4 ++-- mods/MISC/mcl_commands/init.lua | 2 +- 9 files changed, 27 insertions(+), 27 deletions(-) diff --git a/mods/ENTITIES/mcl_falling_nodes/init.lua b/mods/ENTITIES/mcl_falling_nodes/init.lua index 71478bfe48..5e1168ca9e 100644 --- a/mods/ENTITIES/mcl_falling_nodes/init.lua +++ b/mods/ENTITIES/mcl_falling_nodes/init.lua @@ -79,7 +79,7 @@ minetest.register_entity(":__builtin:falling_node", { meta = {}, set_node = function(self, node, meta) - local def = core.registered_nodes[node.name] + local def = minetest.registered_nodes[node.name] -- Change falling node if definition tells us to if def and def._mcl_falling_node_alternative then node.name = def._mcl_falling_node_alternative @@ -90,9 +90,9 @@ minetest.register_entity(":__builtin:falling_node", { -- Set correct entity yaw if def and node.param2 ~= 0 then if (def.paramtype2 == "facedir" or def.paramtype2 == "colorfacedir") then - self.object:set_yaw(core.dir_to_yaw(core.facedir_to_dir(node.param2))) + self.object:set_yaw(minetest.dir_to_yaw(minetest.facedir_to_dir(node.param2))) elseif (def.paramtype2 == "wallmounted" or def.paramtype2 == "colorwallmounted") then - self.object:set_yaw(core.dir_to_yaw(core.wallmounted_to_dir(node.param2))) + self.object:set_yaw(minetest.dir_to_yaw(minetest.wallmounted_to_dir(node.param2))) end if def.light_source then glow = def.light_source diff --git a/mods/ENTITIES/mcl_item_entity/init.lua b/mods/ENTITIES/mcl_item_entity/init.lua index 8ee1c955b7..3c4810340b 100644 --- a/mods/ENTITIES/mcl_item_entity/init.lua +++ b/mods/ENTITIES/mcl_item_entity/init.lua @@ -260,7 +260,7 @@ function minetest.handle_node_drops(pos, drops, digger) dpos.y = dpos.y + 1 end -- Spawn item and apply random speed - local obj = core.add_item(dpos, drop_item) + local obj = minetest.add_item(dpos, drop_item) if obj ~= nil then local x = math.random(1, 5) if math.random(1,2) == 1 then @@ -286,7 +286,7 @@ function minetest.item_drop(itemstack, dropper, pos) cs = 1 end local item = itemstack:take_item(cs) - local obj = core.add_item(p, item) + local obj = minetest.add_item(p, item) if obj then v.x = v.x*4 v.y = v.y*4 + 2 @@ -306,7 +306,7 @@ if not time_to_live then time_to_live = 300 end -core.register_entity(":__builtin:item", { +minetest.register_entity(":__builtin:item", { initial_properties = { hp_max = 1, physical = true, @@ -360,12 +360,12 @@ core.register_entity(":__builtin:item", { end local item_texture = nil local item_type = "" - if core.registered_items[itemname] then - item_texture = core.registered_items[itemname].inventory_image - item_type = core.registered_items[itemname].type - description = core.registered_items[itemname].description + if minetest.registered_items[itemname] then + item_texture = minetest.registered_items[itemname].inventory_image + item_type = minetest.registered_items[itemname].type + description = minetest.registered_items[itemname].description end - local ndef = core.registered_items[itemname] + local ndef = minetest.registered_items[itemname] local glow if ndef then glow = ndef.light_source @@ -405,7 +405,7 @@ core.register_entity(":__builtin:item", { end, get_staticdata = function(self) - return core.serialize({ + return minetest.serialize({ itemstring = self.itemstring, always_collect = self.always_collect, age = self.age, @@ -417,7 +417,7 @@ core.register_entity(":__builtin:item", { on_activate = function(self, staticdata, dtime_s) if string.sub(staticdata, 1, string.len("return")) == "return" then - local data = core.deserialize(staticdata) + local data = minetest.deserialize(staticdata) if data and type(data) == "table" then self.itemstring = data.itemstring self.always_collect = data.always_collect @@ -522,7 +522,7 @@ core.register_entity(":__builtin:item", { end local p = self.object:get_pos() - local node = core.get_node_or_nil(p) + local node = minetest.get_node_or_nil(p) local in_unloaded = (node == nil) -- If no collector was found for a long enough time, declare the magnet as disabled @@ -677,11 +677,11 @@ core.register_entity(":__builtin:item", { local nn = minetest.get_node({x=p.x, y=p.y-0.5, z=p.z}).name local v = self.object:get_velocity() - if not core.registered_nodes[nn] or core.registered_nodes[nn].walkable and v.y == 0 then + if not minetest.registered_nodes[nn] or minetest.registered_nodes[nn].walkable and v.y == 0 then if self.physical_state then local own_stack = ItemStack(self.object:get_luaentity().itemstring) -- Merge with close entities of the same item - for _, object in ipairs(core.get_objects_inside_radius(p, 0.8)) do + for _, object in ipairs(minetest.get_objects_inside_radius(p, 0.8)) do local obj = object:get_luaentity() if obj and obj.name == "__builtin:item" and obj.physical_state == false then diff --git a/mods/ITEMS/REDSTONE/mesecons/util.lua b/mods/ITEMS/REDSTONE/mesecons/util.lua index 91da1e951a..b6602526ab 100644 --- a/mods/ITEMS/REDSTONE/mesecons/util.lua +++ b/mods/ITEMS/REDSTONE/mesecons/util.lua @@ -366,7 +366,7 @@ function mesecon.vm_get_node(pos) local tbl = vm_get_or_create_entry(pos) local index = tbl.va:indexp(pos) local node_value = tbl.data[index] - if node_value == core.CONTENT_IGNORE then + if node_value == minetest.CONTENT_IGNORE then return nil else local node_param1 = tbl.param1[index] diff --git a/mods/ITEMS/mcl_anvils/init.lua b/mods/ITEMS/mcl_anvils/init.lua index b2608cd88b..a12a13cd4d 100644 --- a/mods/ITEMS/mcl_anvils/init.lua +++ b/mods/ITEMS/mcl_anvils/init.lua @@ -179,7 +179,7 @@ local function update_anvil_slots(meta) else -- Custom name set. Colorize it! -- This makes the name visually different from unnamed items - meta:set_string("description", core.colorize(NAME_COLOR, new_name)) + meta:set_string("description", minetest.colorize(NAME_COLOR, new_name)) end -- Save the raw name internally, too meta:set_string("name", new_name) diff --git a/mods/ITEMS/mcl_banners/patterncraft.lua b/mods/ITEMS/mcl_banners/patterncraft.lua index 3f161267db..e1f05ff11b 100644 --- a/mods/ITEMS/mcl_banners/patterncraft.lua +++ b/mods/ITEMS/mcl_banners/patterncraft.lua @@ -281,7 +281,7 @@ mcl_banners.make_advanced_banner_description = function(description, layers) -- Final string concatenations: Just a list of strings local append = table.concat(layerstrings, "\n") - description = description .. "\n" .. core.colorize("#8F8F8F", append) + description = description .. "\n" .. minetest.colorize("#8F8F8F", append) return description end end diff --git a/mods/ITEMS/mcl_books/init.lua b/mods/ITEMS/mcl_books/init.lua index 87ca31949f..1cc0ef3d5f 100644 --- a/mods/ITEMS/mcl_books/init.lua +++ b/mods/ITEMS/mcl_books/init.lua @@ -60,7 +60,7 @@ local make_description = function(title, author, generation) else desc = S("Tattered Book") end - desc = desc .. "\n" .. core.colorize("#AAAAAA", S("by @1", author)) + desc = desc .. "\n" .. minetest.colorize("#AAAAAA", S("by @1", author)) return desc end @@ -102,7 +102,7 @@ local read = function(itemstack, user, pointed_thing) local text = get_text(itemstack) local formspec = "size[8,9]".. "background[-0.5,-0.5;9,10;mcl_books_book_bg.png]".. - "textarea[0.75,0.1;7.25,9;;"..core.colorize("#000000", minetest.formspec_escape(text))..";]".. + "textarea[0.75,0.1;7.25,9;;"..minetest.colorize("#000000", minetest.formspec_escape(text))..";]".. "button_exit[2.25,7.95;3,1;ok;"..minetest.formspec_escape(S("Done")).."]" minetest.show_formspec(user:get_player_name(), "mcl_books:written_book", formspec) end @@ -136,8 +136,8 @@ minetest.register_on_player_receive_fields(function ( player, formname, fields ) local name = player:get_player_name() local formspec = "size[8,9]".. "background[-0.5,-0.5;9,10;mcl_books_book_bg.png]".. - "field[0.75,1;7.25,1;title;"..minetest.formspec_escape(core.colorize("#000000", S("Enter book title:")))..";]".. - "label[0.75,1.5;"..minetest.formspec_escape(core.colorize("#404040", S("by @1", name))).."]".. + "field[0.75,1;7.25,1;title;"..minetest.formspec_escape(minetest.colorize("#000000", S("Enter book title:")))..";]".. + "label[0.75,1.5;"..minetest.formspec_escape(minetest.colorize("#404040", S("by @1", name))).."]".. "button_exit[0.75,7.95;3,1;sign;"..minetest.formspec_escape(S("Sign and Close")).."]".. "tooltip[sign;"..minetest.formspec_escape(S("Note: The book will no longer be editable after signing")).."]".. "button[4.25,7.95;3,1;cancel;"..minetest.formspec_escape(S("Cancel")).."]" diff --git a/mods/ITEMS/mcl_core/craftitems.lua b/mods/ITEMS/mcl_core/craftitems.lua index 42b6210ed2..3b980f1d84 100644 --- a/mods/ITEMS/mcl_core/craftitems.lua +++ b/mods/ITEMS/mcl_core/craftitems.lua @@ -146,7 +146,7 @@ minetest.register_craftitem("mcl_core:apple", { -- TODO: Status effects minetest.register_craftitem("mcl_core:apple_gold", { - description = core.colorize("#55FFFF", S("Golden Apple")), + description = minetest.colorize("#55FFFF", S("Golden Apple")), _doc_items_longdesc = S("Golden apples are precious food items which can be eaten."), wield_image = "mcl_core_apple_golden.png", inventory_image = "mcl_core_apple_golden.png", diff --git a/mods/ITEMS/mcl_core/nodes_misc.lua b/mods/ITEMS/mcl_core/nodes_misc.lua index 800d7442a4..b7709d13d3 100644 --- a/mods/ITEMS/mcl_core/nodes_misc.lua +++ b/mods/ITEMS/mcl_core/nodes_misc.lua @@ -199,7 +199,7 @@ minetest.register_node("mcl_core:realm_barrier", { -- Prevent placement to protect player from screwing up the world, because the node is not pointable and hard to get rid of. node_placement_prediction = "", on_place = function(pos, placer, itemstack, pointed_thing) - minetest.chat_send_player(placer:get_player_name(), core.colorize("#FF0000", "You can't just place a realm barrier by hand!")) + minetest.chat_send_player(placer:get_player_name(), minetest.colorize("#FF0000", "You can't just place a realm barrier by hand!")) return end, }) @@ -229,7 +229,7 @@ minetest.register_node("mcl_core:void", { -- Prevent placement to protect player from screwing up the world, because the node is not pointable and hard to get rid of. node_placement_prediction = "", on_place = function(pos, placer, itemstack, pointed_thing) - minetest.chat_send_player(placer:get_player_name(), core.colorize("#FF0000", "You can't just place the void by hand!")) + minetest.chat_send_player(placer:get_player_name(), minetest.colorize("#FF0000", "You can't just place the void by hand!")) return end, drop = "", diff --git a/mods/MISC/mcl_commands/init.lua b/mods/MISC/mcl_commands/init.lua index c77b30816a..0532108f98 100644 --- a/mods/MISC/mcl_commands/init.lua +++ b/mods/MISC/mcl_commands/init.lua @@ -141,7 +141,7 @@ if minecraftaliases then description = S("List bans"), privs = minetest.chatcommands["ban"].privs, func = function(name) - return true, S("Ban list: @1", core.get_ban_list()) + return true, S("Ban list: @1", minetest.get_ban_list()) end, }) end