aboutsummaryrefslogtreecommitdiff
path: root/games
diff options
context:
space:
mode:
authorWeblate <42@minetest.ru>2013-06-01 13:18:52 +0200
committerWeblate <42@minetest.ru>2013-06-01 13:18:52 +0200
commit1dfc2e02b3c358af4bb20bb3cb60ac7bd3ed1124 (patch)
tree54660f353f3342f89b6259ea6a5dfedfa20dc16f /games
parentec039a3d123120f9918812b13f5971e94546b9af (diff)
parent64627817fcca52f20948c24b60ce192b218f6ce2 (diff)
downloadminetest-1dfc2e02b3c358af4bb20bb3cb60ac7bd3ed1124.tar.gz
minetest-1dfc2e02b3c358af4bb20bb3cb60ac7bd3ed1124.tar.bz2
minetest-1dfc2e02b3c358af4bb20bb3cb60ac7bd3ed1124.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'games')
-rw-r--r--games/minimal/mods/bucket/init.lua10
-rw-r--r--games/minimal/mods/default/init.lua46
-rw-r--r--games/minimal/mods/default/mapgen.lua16
-rw-r--r--games/minimal/mods/experimental/init.lua52
-rw-r--r--games/minimal/mods/legacy/init.lua4
5 files changed, 62 insertions, 66 deletions
diff --git a/games/minimal/mods/bucket/init.lua b/games/minimal/mods/bucket/init.lua
index 6aa0921d5..dcd59ed38 100644
--- a/games/minimal/mods/bucket/init.lua
+++ b/games/minimal/mods/bucket/init.lua
@@ -41,13 +41,13 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image)
return
end
-- Check if pointing to a liquid
- n = minetest.env:get_node(pointed_thing.under)
+ n = minetest.get_node(pointed_thing.under)
if bucket.liquids[n.name] == nil then
-- Not a liquid
- minetest.env:add_node(pointed_thing.above, {name=source})
+ minetest.add_node(pointed_thing.above, {name=source})
elseif n.name ~= source then
-- It's a liquid
- minetest.env:add_node(pointed_thing.under, {name=source})
+ minetest.add_node(pointed_thing.under, {name=source})
end
return {name="bucket:bucket_empty"}
end
@@ -65,10 +65,10 @@ minetest.register_craftitem("bucket:bucket_empty", {
return
end
-- Check if pointing to a liquid source
- n = minetest.env:get_node(pointed_thing.under)
+ n = minetest.get_node(pointed_thing.under)
liquiddef = bucket.liquids[n.name]
if liquiddef ~= nil and liquiddef.source == n.name and liquiddef.itemname ~= nil then
- minetest.env:add_node(pointed_thing.under, {name="air"})
+ minetest.add_node(pointed_thing.under, {name="air"})
return {name=liquiddef.itemname}
end
end,
diff --git a/games/minimal/mods/default/init.lua b/games/minimal/mods/default/init.lua
index d8067d211..9f9db5ac7 100644
--- a/games/minimal/mods/default/init.lua
+++ b/games/minimal/mods/default/init.lua
@@ -741,7 +741,7 @@ minetest.register_node("default:dirt_with_grass", {
description = "Dirt with grass",
tiles ={"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
is_ground_content = true,
- groups = {crumbly=3},
+ groups = {crumbly=3, soil=1},
drop = 'default:dirt',
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
@@ -752,7 +752,7 @@ minetest.register_node("default:dirt_with_grass_footsteps", {
description = "Dirt with grass and footsteps",
tiles ={"default_grass_footsteps.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
is_ground_content = true,
- groups = {crumbly=3},
+ groups = {crumbly=3, soil=1},
drop = 'default:dirt',
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
@@ -763,7 +763,7 @@ minetest.register_node("default:dirt", {
description = "Dirt",
tiles ={"default_dirt.png"},
is_ground_content = true,
- groups = {crumbly=3},
+ groups = {crumbly=3, soil=1},
sounds = default.node_sound_dirt_defaults(),
})
@@ -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
diff --git a/games/minimal/mods/experimental/init.lua b/games/minimal/mods/experimental/init.lua
index 6fce9698a..3e2e7787b 100644
--- a/games/minimal/mods/experimental/init.lua
+++ b/games/minimal/mods/experimental/init.lua
@@ -66,7 +66,7 @@ test_sound()
function on_step(dtime)
-- print("experimental on_step")
--[[
- objs = minetest.env:get_objects_inside_radius({x=0,y=0,z=0}, 10)
+ objs = minetest.get_objects_inside_radius({x=0,y=0,z=0}, 10)
for k, obj in pairs(objs) do
name = obj:get_player_name()
if name then
@@ -86,17 +86,17 @@ function on_step(dtime)
experimental.t1 = experimental.t1 + dtime
if experimental.t1 >= 2 then
experimental.t1 = experimental.t1 - 2
- minetest.log("time of day is "..minetest.env:get_timeofday())
+ minetest.log("time of day is "..minetest.get_timeofday())
if experimental.day then
minetest.log("forcing day->night")
experimental.day = false
- minetest.env:set_timeofday(0.0)
+ minetest.set_timeofday(0.0)
else
minetest.log("forcing night->day")
experimental.day = true
- minetest.env:set_timeofday(0.5)
+ minetest.set_timeofday(0.5)
end
- minetest.log("time of day is "..minetest.env:get_timeofday())
+ minetest.log("time of day is "..minetest.get_timeofday())
end
--]]
end
@@ -133,8 +133,8 @@ minetest.register_node("experimental:tnt", {
minetest.register_on_punchnode(function(p, node)
if node.name == "experimental:tnt" then
- minetest.env:remove_node(p)
- minetest.env:add_entity(p, "experimental:tnt")
+ minetest.remove_node(p)
+ minetest.add_entity(p, "experimental:tnt")
nodeupdate(p)
end
end)
@@ -262,7 +262,7 @@ minetest.register_on_chat_message(function(name, message)
minetest.chat_send_player(name, "you don't have permission to interact")
return true -- Handled chat message
end
- local player = minetest.env:get_player_by_name(name)
+ local player = minetest.get_player_by_name(name)
if player == nil then
print("Unable to spawn entity, player is nil")
return true -- Handled chat message
@@ -270,7 +270,7 @@ minetest.register_on_chat_message(function(name, message)
local entityname = "experimental:dummyball"
local p = player:getpos()
p.y = p.y + 1
- minetest.env:add_entity(p, entityname)
+ minetest.add_entity(p, entityname)
minetest.chat_send_player(name, '"'..entityname
..'" spawned.');
return true -- Handled chat message
@@ -323,7 +323,7 @@ end)
minetest.register_on_generated(function(minp, maxp)
--print("on_generated: minp="..dump(minp).." maxp="..dump(maxp))
--cp = {x=(minp.x+maxp.x)/2, y=(minp.y+maxp.y)/2, z=(minp.z+maxp.z)/2}
- --minetest.env:add_node(cp, {name="sand"})
+ --minetest.add_node(cp, {name="sand"})
end)
-- Example setting get
@@ -353,7 +353,7 @@ end)
action = function(pos, node, active_object_count, active_object_count_wider)
print("TNT ABM action")
pos.y = pos.y + 1
- minetest.env:add_node(pos, {name="papyrus"})
+ minetest.add_node(pos, {name="papyrus"})
end,
})]]
@@ -364,7 +364,7 @@ end)
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
print("ABM: Sign text changed")
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_text("foo")
end,
})]]
@@ -395,7 +395,7 @@ minetest.register_abm({
end
pos.y = pos.y + 1
- n = minetest.env:get_node(pos)
+ n = minetest.get_node(pos)
print(dump(n))
if n.name ~= "air" then
return
@@ -404,7 +404,7 @@ minetest.register_abm({
pos.y = pos.y + 2
ncpos = pos
nctime = os.clock()
- minetest.env:add_node(ncpos, {name="nyancat"})
+ minetest.add_node(ncpos, {name="nyancat"})
end
})
@@ -431,12 +431,12 @@ minetest.register_abm({
p2 = {x = p1.x + s1[2], y = p1.y, z = p1.z + s1[3]}
table.insert(ncold, 1, p0)
while #ncold >= 10 do
- minetest.env:add_node(ncold[#ncold], {name="air"})
+ minetest.add_node(ncold[#ncold], {name="air"})
table.remove(ncold, #ncold)
end
- minetest.env:add_node(p0, {name="nyancat_rainbow"})
- minetest.env:add_node(p1, {name="nyancat", param1=s0[4]})
- minetest.env:add_node(p2, {name="air"})
+ minetest.add_node(p0, {name="nyancat_rainbow"})
+ minetest.add_node(p1, {name="nyancat", param1=s0[4]})
+ minetest.add_node(p2, {name="air"})
ncpos = p1
end
end,
@@ -448,20 +448,20 @@ minetest.register_node("experimental:tester_node_1", {
groups = {oddly_breakable_by_hand=2},
sounds = default.node_sound_wood_defaults(),
-- This was known to cause a bug in minetest.item_place_node() when used
- -- via minetest.env:place_node(), causing a placer with no position
+ -- via minetest.place_node(), causing a placer with no position
paramtype2 = "facedir",
on_construct = function(pos)
experimental.print_to_everything("experimental:tester_node_1:on_construct("..minetest.pos_to_string(pos)..")")
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
meta:set_string("mine", "test")
- local timer = minetest.env:get_node_timer(pos)
+ local timer = minetest.get_node_timer(pos)
timer:start(4, 3)
end,
after_place_node = function(pos, placer)
experimental.print_to_everything("experimental:tester_node_1:after_place_node("..minetest.pos_to_string(pos)..")")
- local meta = minetest.env:get_meta(pos)
+ local meta = minetest.get_meta(pos)
if meta:get_string("mine") == "test" then
experimental.print_to_everything("correct metadata found")
else
@@ -493,14 +493,14 @@ minetest.register_craftitem("experimental:tester_tool_1", {
on_use = function(itemstack, user, pointed_thing)
--print(dump(pointed_thing))
if pointed_thing.type == "node" then
- if minetest.env:get_node(pointed_thing.under).name == "experimental:tester_node_1" then
+ if minetest.get_node(pointed_thing.under).name == "experimental:tester_node_1" then
local p = pointed_thing.under
minetest.log("action", "Tester tool used at "..minetest.pos_to_string(p))
- minetest.env:dig_node(p)
+ minetest.dig_node(p)
else
local p = pointed_thing.above
minetest.log("action", "Tester tool used at "..minetest.pos_to_string(p))
- minetest.env:place_node(p, {name="experimental:tester_node_1"})
+ minetest.place_node(p, {name="experimental:tester_node_1"})
end
end
end,
@@ -556,7 +556,7 @@ minetest.register_chatcommand("test1", {
params = "",
description = "Test 1: Modify player's inventory view",
func = function(name, param)
- local player = minetest.env:get_player_by_name(name)
+ local player = minetest.get_player_by_name(name)
if not player then
return
end
diff --git a/games/minimal/mods/legacy/init.lua b/games/minimal/mods/legacy/init.lua
index 7f9088ce0..98ad69be0 100644
--- a/games/minimal/mods/legacy/init.lua
+++ b/games/minimal/mods/legacy/init.lua
@@ -79,14 +79,12 @@ minetest.register_craftitem(":rat", {
description = "Rat",
inventory_image = "rat.png",
on_drop = function(item, dropper, pos)
- minetest.env:add_rat(pos)
item:take_item()
return item
end,
on_place = function(item, dropped, pointed)
pos = minetest.get_pointed_thing_position(pointed, true)
if pos ~= nil then
- minetest.env:add_rat(pos)
item:take_item()
return item
end
@@ -103,14 +101,12 @@ minetest.register_craftitem(":firefly", {
description = "Firefly",
inventory_image = "firefly.png",
on_drop = function(item, dropper, pos)
- minetest.env:add_firefly(pos)
item:take_item()
return item
end,
on_place = function(item, dropped, pointed)
pos = minetest.get_pointed_thing_position(pointed, true)
if pos ~= nil then
- minetest.env:add_firefly(pos)
item:take_item()
return item
end