aboutsummaryrefslogtreecommitdiff
path: root/games/minimal/mods/default
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2013-05-25 00:51:02 +0200
committerKahrl <kahrl@gmx.net>2013-05-25 00:51:02 +0200
commitab433775777c4f5055bcf4d2a1cffc506c4f9961 (patch)
tree9f80c74c95cbb1efa15c0c36df8d5e35235e5554 /games/minimal/mods/default
parent865f380c91ced850d1a499c91aa2ab5489624802 (diff)
downloadminetest-ab433775777c4f5055bcf4d2a1cffc506c4f9961.tar.gz
minetest-ab433775777c4f5055bcf4d2a1cffc506c4f9961.tar.bz2
minetest-ab433775777c4f5055bcf4d2a1cffc506c4f9961.zip
Move scriptapi to separate folder (by sapier)
On the lua side, notably minetest.env:<function>(<args>) should now be replaced by minetest.<function>(<args>). 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)
Diffstat (limited to 'games/minimal/mods/default')
-rw-r--r--games/minimal/mods/default/init.lua40
-rw-r--r--games/minimal/mods/default/mapgen.lua16
2 files changed, 28 insertions, 28 deletions
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",
diff --git a/games/minimal/mods/default/mapgen.lua b/games/minimal/mods/default/mapgen.lua
index 478567d0a..7209cb6b3 100644
--- a/games/minimal/mods/default/mapgen.lua
+++ b/games/minimal/mods/default/mapgen.lua
@@ -104,17 +104,17 @@ minetest.register_on_generated(function(minp, maxp, seed)
for divz=0+1,divs-1-1 do
local cx = minp.x + math.floor((divx+0.5)*divlen)
local cz = minp.z + math.floor((divz+0.5)*divlen)
- if minetest.env:get_node({x=cx,y=1,z=cz}).name == "default:water_source" and
- minetest.env:get_node({x=cx,y=0,z=cz}).name == "default:sand" then
+ if minetest.get_node({x=cx,y=1,z=cz}).name == "default:water_source" and
+ minetest.get_node({x=cx,y=0,z=cz}).name == "default:sand" then
local is_shallow = true
local num_water_around = 0
- if minetest.env:get_node({x=cx-divlen*2,y=1,z=cz+0}).name == "default:water_source" then
+ if minetest.get_node({x=cx-divlen*2,y=1,z=cz+0}).name == "default:water_source" then
num_water_around = num_water_around + 1 end
- if minetest.env:get_node({x=cx+divlen*2,y=1,z=cz+0}).name == "default:water_source" then
+ if minetest.get_node({x=cx+divlen*2,y=1,z=cz+0}).name == "default:water_source" then
num_water_around = num_water_around + 1 end
- if minetest.env:get_node({x=cx+0,y=1,z=cz-divlen*2}).name == "default:water_source" then
+ if minetest.get_node({x=cx+0,y=1,z=cz-divlen*2}).name == "default:water_source" then
num_water_around = num_water_around + 1 end
- if minetest.env:get_node({x=cx+0,y=1,z=cz+divlen*2}).name == "default:water_source" then
+ if minetest.get_node({x=cx+0,y=1,z=cz+divlen*2}).name == "default:water_source" then
num_water_around = num_water_around + 1 end
if num_water_around >= 2 then
is_shallow = false
@@ -122,8 +122,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
if is_shallow then
for x1=-divlen,divlen do
for z1=-divlen,divlen do
- if minetest.env:get_node({x=cx+x1,y=0,z=cz+z1}).name == "default:sand" then
- minetest.env:set_node({x=cx+x1,y=0,z=cz+z1}, {name="default:clay"})
+ if minetest.get_node({x=cx+x1,y=0,z=cz+z1}).name == "default:sand" then
+ minetest.set_node({x=cx+x1,y=0,z=cz+z1}, {name="default:clay"})
end
end
end