From 8056fa6c182ea091c28ee5ad80f8c45e7af269f3 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Sun, 30 Nov 2014 12:15:49 -0500 Subject: [PATCH] minetest.env:* --> minetest.* --- barter.lua | 12 ++++++------ shop.lua | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/barter.lua b/barter.lua index 81b571e..dad2e4a 100644 --- a/barter.lua +++ b/barter.lua @@ -61,7 +61,7 @@ barter.chest.update_formspec = function(meta) end barter.chest.give_inventory = function(inv,list,playername) - player = minetest.env:get_player_by_name(playername) + player = minetest.get_player_by_name(playername) if player then for k,v in ipairs(inv:get_list(list)) do player:get_inventory():add_item("main",v) @@ -110,7 +110,7 @@ minetest.register_node("currency:barter", { groups = {choppy=2,oddly_breakable_by_hand=2}, 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("infotext", "Barter Table") meta:set_string("pl1","") meta:set_string("pl2","") @@ -120,7 +120,7 @@ minetest.register_node("currency:barter", { inv:set_size("pl2", 3*4) end, on_receive_fields = function(pos, formname, fields, sender) - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) pl_receive_fields = function(n) if fields[n.."_start"] and meta:get_string(n) == "" then meta:set_string(n,sender:get_player_name()) @@ -147,18 +147,18 @@ minetest.register_node("currency:barter", { barter.chest.update_formspec(meta) 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 barter.chest.check_privilege(from_list,player:get_player_name(),meta) then return 0 end if not barter.chest.check_privilege(to_list,player:get_player_name(),meta) then return 0 end 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 barter.chest.check_privilege(listname,player:get_player_name(),meta) then return 0 end 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 barter.chest.check_privilege(listname,player:get_player_name(),meta) then return 0 end return stack:get_count() end, diff --git a/shop.lua b/shop.lua index da5ee5e..5d3faaa 100644 --- a/shop.lua +++ b/shop.lua @@ -53,7 +53,7 @@ end default.shop.give_inventory = function(inv,list,playername) - player = minetest.env:get_player_by_name(playername) + player = minetest.get_player_by_name(playername) if player then for k,v in ipairs(inv:get_list(list)) do player:get_inventory():add_item("main",v) @@ -94,7 +94,7 @@ minetest.register_node("currency:shop", { sounds = default.node_sound_wood_defaults(), after_place_node = function(pos, placer, itemstack) local owner = placer:get_player_name() - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) meta:set_string("infotext", "Exchange shop (owned by "..owner..")") meta:set_string("owner",owner) --[[meta:set_string("pl1","") @@ -109,7 +109,7 @@ minetest.register_node("currency:shop", { clicker:get_inventory():set_size("customer_gives", 3*2) clicker:get_inventory():set_size("customer_gets", 3*2) default.shop.current_shop[clicker:get_player_name()] = pos - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) if clicker:get_player_name() == meta:get_string("owner") and not clicker:get_player_control().aux1 then minetest.show_formspec(clicker:get_player_name(),"currency:shop_formspec",default.shop.formspec.owner(pos)) else @@ -117,22 +117,22 @@ minetest.register_node("currency:shop", { end 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 player:get_player_name() ~= meta:get_string("owner") then return 0 end 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 player:get_player_name() ~= meta:get_string("owner") then return 0 end 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 player:get_player_name() ~= meta:get_string("owner") then return 0 end return stack:get_count() 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("stock") and inv:is_empty("customers_gave") and inv:is_empty("owner_wants") and inv:is_empty("owner_gives") end @@ -143,7 +143,7 @@ minetest.register_on_player_receive_fields(function(sender, formname, fields) if formname == "currency:shop_formspec" and fields.exchange ~= nil and fields.exchange ~= "" then local name = sender:get_player_name() local pos = default.shop.current_shop[name] - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) if meta:get_string("owner") == name then minetest.chat_send_player(name,"This is your own shop, you can't exchange to yourself !") else