1
0
Fork 0

Use "minetest" instead of "core" table

This commit is contained in:
Wuzzy 2020-01-06 13:02:30 +01:00
parent 05152589fa
commit f2b7392a30
9 changed files with 27 additions and 27 deletions

View File

@ -79,7 +79,7 @@ minetest.register_entity(":__builtin:falling_node", {
meta = {}, meta = {},
set_node = function(self, 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 -- Change falling node if definition tells us to
if def and def._mcl_falling_node_alternative then if def and def._mcl_falling_node_alternative then
node.name = def._mcl_falling_node_alternative node.name = def._mcl_falling_node_alternative
@ -90,9 +90,9 @@ minetest.register_entity(":__builtin:falling_node", {
-- Set correct entity yaw -- Set correct entity yaw
if def and node.param2 ~= 0 then if def and node.param2 ~= 0 then
if (def.paramtype2 == "facedir" or def.paramtype2 == "colorfacedir") 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 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 end
if def.light_source then if def.light_source then
glow = def.light_source glow = def.light_source

View File

@ -260,7 +260,7 @@ function minetest.handle_node_drops(pos, drops, digger)
dpos.y = dpos.y + 1 dpos.y = dpos.y + 1
end end
-- Spawn item and apply random speed -- 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 if obj ~= nil then
local x = math.random(1, 5) local x = math.random(1, 5)
if math.random(1,2) == 1 then if math.random(1,2) == 1 then
@ -286,7 +286,7 @@ function minetest.item_drop(itemstack, dropper, pos)
cs = 1 cs = 1
end end
local item = itemstack:take_item(cs) local item = itemstack:take_item(cs)
local obj = core.add_item(p, item) local obj = minetest.add_item(p, item)
if obj then if obj then
v.x = v.x*4 v.x = v.x*4
v.y = v.y*4 + 2 v.y = v.y*4 + 2
@ -306,7 +306,7 @@ if not time_to_live then
time_to_live = 300 time_to_live = 300
end end
core.register_entity(":__builtin:item", { minetest.register_entity(":__builtin:item", {
initial_properties = { initial_properties = {
hp_max = 1, hp_max = 1,
physical = true, physical = true,
@ -360,12 +360,12 @@ core.register_entity(":__builtin:item", {
end end
local item_texture = nil local item_texture = nil
local item_type = "" local item_type = ""
if core.registered_items[itemname] then if minetest.registered_items[itemname] then
item_texture = core.registered_items[itemname].inventory_image item_texture = minetest.registered_items[itemname].inventory_image
item_type = core.registered_items[itemname].type item_type = minetest.registered_items[itemname].type
description = core.registered_items[itemname].description description = minetest.registered_items[itemname].description
end end
local ndef = core.registered_items[itemname] local ndef = minetest.registered_items[itemname]
local glow local glow
if ndef then if ndef then
glow = ndef.light_source glow = ndef.light_source
@ -405,7 +405,7 @@ core.register_entity(":__builtin:item", {
end, end,
get_staticdata = function(self) get_staticdata = function(self)
return core.serialize({ return minetest.serialize({
itemstring = self.itemstring, itemstring = self.itemstring,
always_collect = self.always_collect, always_collect = self.always_collect,
age = self.age, age = self.age,
@ -417,7 +417,7 @@ core.register_entity(":__builtin:item", {
on_activate = function(self, staticdata, dtime_s) on_activate = function(self, staticdata, dtime_s)
if string.sub(staticdata, 1, string.len("return")) == "return" then 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 if data and type(data) == "table" then
self.itemstring = data.itemstring self.itemstring = data.itemstring
self.always_collect = data.always_collect self.always_collect = data.always_collect
@ -522,7 +522,7 @@ core.register_entity(":__builtin:item", {
end end
local p = self.object:get_pos() 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) local in_unloaded = (node == nil)
-- If no collector was found for a long enough time, declare the magnet as disabled -- 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 nn = minetest.get_node({x=p.x, y=p.y-0.5, z=p.z}).name
local v = self.object:get_velocity() 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 if self.physical_state then
local own_stack = ItemStack(self.object:get_luaentity().itemstring) local own_stack = ItemStack(self.object:get_luaentity().itemstring)
-- Merge with close entities of the same item -- 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() local obj = object:get_luaentity()
if obj and obj.name == "__builtin:item" if obj and obj.name == "__builtin:item"
and obj.physical_state == false then and obj.physical_state == false then

View File

@ -366,7 +366,7 @@ function mesecon.vm_get_node(pos)
local tbl = vm_get_or_create_entry(pos) local tbl = vm_get_or_create_entry(pos)
local index = tbl.va:indexp(pos) local index = tbl.va:indexp(pos)
local node_value = tbl.data[index] local node_value = tbl.data[index]
if node_value == core.CONTENT_IGNORE then if node_value == minetest.CONTENT_IGNORE then
return nil return nil
else else
local node_param1 = tbl.param1[index] local node_param1 = tbl.param1[index]

View File

@ -179,7 +179,7 @@ local function update_anvil_slots(meta)
else else
-- Custom name set. Colorize it! -- Custom name set. Colorize it!
-- This makes the name visually different from unnamed items -- 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 end
-- Save the raw name internally, too -- Save the raw name internally, too
meta:set_string("name", new_name) meta:set_string("name", new_name)

View File

@ -281,7 +281,7 @@ mcl_banners.make_advanced_banner_description = function(description, layers)
-- Final string concatenations: Just a list of strings -- Final string concatenations: Just a list of strings
local append = table.concat(layerstrings, "\n") local append = table.concat(layerstrings, "\n")
description = description .. "\n" .. core.colorize("#8F8F8F", append) description = description .. "\n" .. minetest.colorize("#8F8F8F", append)
return description return description
end end
end end

View File

@ -60,7 +60,7 @@ local make_description = function(title, author, generation)
else else
desc = S("Tattered Book") desc = S("Tattered Book")
end end
desc = desc .. "\n" .. core.colorize("#AAAAAA", S("by @1", author)) desc = desc .. "\n" .. minetest.colorize("#AAAAAA", S("by @1", author))
return desc return desc
end end
@ -102,7 +102,7 @@ local read = function(itemstack, user, pointed_thing)
local text = get_text(itemstack) local text = get_text(itemstack)
local formspec = "size[8,9]".. local formspec = "size[8,9]"..
"background[-0.5,-0.5;9,10;mcl_books_book_bg.png]".. "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")).."]" "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) minetest.show_formspec(user:get_player_name(), "mcl_books:written_book", formspec)
end end
@ -136,8 +136,8 @@ minetest.register_on_player_receive_fields(function ( player, formname, fields )
local name = player:get_player_name() local name = player:get_player_name()
local formspec = "size[8,9]".. local formspec = "size[8,9]"..
"background[-0.5,-0.5;9,10;mcl_books_book_bg.png]".. "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:")))..";]".. "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(core.colorize("#404040", S("by @1", name))).."]".. "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")).."]".. "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")).."]".. "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")).."]" "button[4.25,7.95;3,1;cancel;"..minetest.formspec_escape(S("Cancel")).."]"

View File

@ -146,7 +146,7 @@ minetest.register_craftitem("mcl_core:apple", {
-- TODO: Status effects -- TODO: Status effects
minetest.register_craftitem("mcl_core:apple_gold", { 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."), _doc_items_longdesc = S("Golden apples are precious food items which can be eaten."),
wield_image = "mcl_core_apple_golden.png", wield_image = "mcl_core_apple_golden.png",
inventory_image = "mcl_core_apple_golden.png", inventory_image = "mcl_core_apple_golden.png",

View File

@ -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. -- 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 = "", node_placement_prediction = "",
on_place = function(pos, placer, itemstack, pointed_thing) 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 return
end, 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. -- 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 = "", node_placement_prediction = "",
on_place = function(pos, placer, itemstack, pointed_thing) 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 return
end, end,
drop = "", drop = "",

View File

@ -141,7 +141,7 @@ if minecraftaliases then
description = S("List bans"), description = S("List bans"),
privs = minetest.chatcommands["ban"].privs, privs = minetest.chatcommands["ban"].privs,
func = function(name) 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,
}) })
end end