From ab433775777c4f5055bcf4d2a1cffc506c4f9961 Mon Sep 17 00:00:00 2001 From: sapier Date: Sat, 25 May 2013 00:51:02 +0200 Subject: Move scriptapi to separate folder (by sapier) On the lua side, notably minetest.env:() should now be replaced by minetest.(). The old way is and will stay supported for a long time. Also: Update and clean up lua_api.txt (by celeron55) Move EnvRef to lua and remove add_rat and add_firefly (by kahrl) Add separate src/util/CMakeLists.txt, other minor fixes (by kahrl) --- games/minimal/mods/default/init.lua | 40 ++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'games/minimal/mods/default/init.lua') diff --git a/games/minimal/mods/default/init.lua b/games/minimal/mods/default/init.lua index b375cda1e..9f9db5ac7 100644 --- a/games/minimal/mods/default/init.lua +++ b/games/minimal/mods/default/init.lua @@ -1133,14 +1133,14 @@ minetest.register_node("default:sign_wall", { legacy_wallmounted = true, sounds = default.node_sound_defaults(), on_construct = function(pos) - --local n = minetest.env:get_node(pos) - local meta = minetest.env:get_meta(pos) + --local n = minetest.get_node(pos) + local meta = minetest.get_meta(pos) meta:set_string("formspec", "field[text;;${text}]") meta:set_string("infotext", "\"\"") end, on_receive_fields = function(pos, formname, fields, sender) --print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields)) - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) fields.text = fields.text or "" print((sender:get_player_name() or "").." wrote \""..fields.text.. "\" to sign at "..minetest.pos_to_string(pos)) @@ -1158,7 +1158,7 @@ minetest.register_node("default:chest", { legacy_facedir_simple = true, sounds = default.node_sound_wood_defaults(), on_construct = function(pos) - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) meta:set_string("formspec", "size[8,9]".. "list[current_name;main;0,0;8,4;]".. @@ -1168,7 +1168,7 @@ minetest.register_node("default:chest", { inv:set_size("main", 8*4) end, can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); + local meta = minetest.get_meta(pos); local inv = meta:get_inventory() return inv:is_empty("main") end, @@ -1190,13 +1190,13 @@ minetest.register_node("default:chest_locked", { legacy_facedir_simple = true, sounds = default.node_sound_wood_defaults(), after_place_node = function(pos, placer) - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) meta:set_string("owner", placer:get_player_name() or "") meta:set_string("infotext", "Locked Chest (owned by ".. meta:get_string("owner")..")") end, on_construct = function(pos) - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) meta:set_string("formspec", "size[8,9]".. "list[current_name;main;0,0;8,4;]".. @@ -1207,12 +1207,12 @@ minetest.register_node("default:chest_locked", { inv:set_size("main", 8*4) end, can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); + local meta = minetest.get_meta(pos); local inv = meta:get_inventory() return inv:is_empty("main") end, allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) if not has_locked_chest_privilege(meta, player) then minetest.log("action", player:get_player_name().. " tried to access a locked chest belonging to ".. @@ -1223,7 +1223,7 @@ minetest.register_node("default:chest_locked", { return count end, allow_metadata_inventory_put = function(pos, listname, index, stack, player) - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) if not has_locked_chest_privilege(meta, player) then minetest.log("action", player:get_player_name().. " tried to access a locked chest belonging to ".. @@ -1234,7 +1234,7 @@ minetest.register_node("default:chest_locked", { return stack:get_count() end, allow_metadata_inventory_take = function(pos, listname, index, stack, player) - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) if not has_locked_chest_privilege(meta, player) then minetest.log("action", player:get_player_name().. " tried to access a locked chest belonging to ".. @@ -1275,7 +1275,7 @@ minetest.register_node("default:furnace", { legacy_facedir_simple = true, sounds = default.node_sound_stone_defaults(), on_construct = function(pos) - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) meta:set_string("formspec", default.furnace_inactive_formspec) meta:set_string("infotext", "Furnace") local inv = meta:get_inventory() @@ -1284,7 +1284,7 @@ minetest.register_node("default:furnace", { inv:set_size("dst", 4) end, can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); + local meta = minetest.get_meta(pos); local inv = meta:get_inventory() if not inv:is_empty("fuel") then return false @@ -1308,7 +1308,7 @@ minetest.register_node("default:furnace_active", { legacy_facedir_simple = true, sounds = default.node_sound_stone_defaults(), on_construct = function(pos) - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) meta:set_string("formspec", default.furnace_inactive_formspec) meta:set_string("infotext", "Furnace"); local inv = meta:get_inventory() @@ -1317,7 +1317,7 @@ minetest.register_node("default:furnace_active", { inv:set_size("dst", 4) end, can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); + local meta = minetest.get_meta(pos); local inv = meta:get_inventory() if not inv:is_empty("fuel") then return false @@ -1331,16 +1331,16 @@ minetest.register_node("default:furnace_active", { }) function hacky_swap_node(pos,name) - local node = minetest.env:get_node(pos) - local meta = minetest.env:get_meta(pos) + local node = minetest.get_node(pos) + local meta = minetest.get_meta(pos) local meta0 = meta:to_table() if node.name == name then return end node.name = name local meta0 = meta:to_table() - minetest.env:set_node(pos,node) - meta = minetest.env:get_meta(pos) + minetest.set_node(pos,node) + meta = minetest.get_meta(pos) meta:from_table(meta0) end @@ -1349,7 +1349,7 @@ minetest.register_abm({ interval = 1.0, chance = 1, action = function(pos, node, active_object_count, active_object_count_wider) - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) for i, name in ipairs({ "fuel_totaltime", "fuel_time", -- cgit v1.2.3