mirror of
https://github.com/Sokomine/travelnet.git
synced 2024-08-19 21:14:18 +02:00
Merge pull request #5 from VanessaE/master
minetest.env:* --> minetest.*
This commit is contained in:
commit
47ccc1059a
12
doors.lua
12
doors.lua
@ -28,7 +28,7 @@ minetest.register_node("travelnet:elevator_door_steel_open", {
|
||||
},
|
||||
drop = "travelnet:elevator_door_steel_closed",
|
||||
on_rightclick = function(pos, node, puncher)
|
||||
minetest.env:add_node(pos, {name = "travelnet:elevator_door_steel_closed", param2 = node.param2})
|
||||
minetest.add_node(pos, {name = "travelnet:elevator_door_steel_closed", param2 = node.param2})
|
||||
end,
|
||||
})
|
||||
|
||||
@ -55,7 +55,7 @@ minetest.register_node("travelnet:elevator_door_steel_closed", {
|
||||
},
|
||||
},
|
||||
on_rightclick = function(pos, node, puncher)
|
||||
minetest.env:add_node(pos, {name = "travelnet:elevator_door_steel_open", param2 = node.param2})
|
||||
minetest.add_node(pos, {name = "travelnet:elevator_door_steel_open", param2 = node.param2})
|
||||
end,
|
||||
})
|
||||
|
||||
@ -87,7 +87,7 @@ minetest.register_node("travelnet:elevator_door_glass_open", {
|
||||
},
|
||||
drop = "travelnet:elevator_door_glass_closed",
|
||||
on_rightclick = function(pos, node, puncher)
|
||||
minetest.env:add_node(pos, {name = "travelnet:elevator_door_glass_closed", param2 = node.param2})
|
||||
minetest.add_node(pos, {name = "travelnet:elevator_door_glass_closed", param2 = node.param2})
|
||||
end,
|
||||
})
|
||||
|
||||
@ -114,7 +114,7 @@ minetest.register_node("travelnet:elevator_door_glass_closed", {
|
||||
},
|
||||
},
|
||||
on_rightclick = function(pos, node, puncher)
|
||||
minetest.env:add_node(pos, {name = "travelnet:elevator_door_glass_open", param2 = node.param2})
|
||||
minetest.add_node(pos, {name = "travelnet:elevator_door_glass_open", param2 = node.param2})
|
||||
end,
|
||||
})
|
||||
|
||||
@ -135,8 +135,8 @@ minetest.register_craft({
|
||||
{"default:steel_ingot", "", "default:steel_ingot", }
|
||||
}
|
||||
})
|
||||
-- local old_node = minetest.env:get_node( pos );
|
||||
-- minetest.env:add_node(pos, {name = "travelnet:elevator_door_glass_closed", param2 = old_node.param2})
|
||||
-- local old_node = minetest.get_node( pos );
|
||||
-- minetest.add_node(pos, {name = "travelnet:elevator_door_glass_closed", param2 = old_node.param2})
|
||||
|
||||
|
||||
|
||||
|
@ -47,7 +47,7 @@ minetest.register_node("travelnet:elevator", {
|
||||
light_source = 10,
|
||||
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local meta = minetest.get_meta(pos);
|
||||
meta:set_string("infotext", "Elevator (unconfigured)");
|
||||
meta:set_string("station_name", "");
|
||||
meta:set_string("station_network","");
|
||||
@ -62,7 +62,7 @@ minetest.register_node("travelnet:elevator", {
|
||||
|
||||
local p = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
local p2 = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
minetest.env:add_node(p, {name="travelnet:elevator_top", paramtype2="facedir", param2=p2})
|
||||
minetest.add_node(p, {name="travelnet:elevator_top", paramtype2="facedir", param2=p2})
|
||||
end,
|
||||
|
||||
on_receive_fields = travelnet.on_receive_fields,
|
||||
@ -81,7 +81,7 @@ minetest.register_node("travelnet:elevator", {
|
||||
-- taken from VanessaEs homedecor fridge
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local pos = pointed_thing.above;
|
||||
local node = minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z});
|
||||
local node = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z});
|
||||
-- leftover elevator_top nodes can be removed by placing a new elevator underneath
|
||||
if( node ~= nil and node.name ~= "air" and node.name ~= 'travelnet:elevator_top') then
|
||||
minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place the travelnet box!' )
|
||||
@ -92,7 +92,7 @@ minetest.register_node("travelnet:elevator", {
|
||||
|
||||
on_destruct = function(pos)
|
||||
local p = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
minetest.env:remove_node(p)
|
||||
minetest.remove_node(p)
|
||||
end
|
||||
})
|
||||
|
||||
|
22
init.lua
22
init.lua
@ -106,9 +106,9 @@ end
|
||||
|
||||
travelnet.update_formspec = function( pos, puncher_name )
|
||||
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local meta = minetest.get_meta(pos);
|
||||
|
||||
local this_node = minetest.env:get_node( pos );
|
||||
local this_node = minetest.get_node( pos );
|
||||
local is_elevator = false;
|
||||
|
||||
if( this_node ~= nil and this_node.name == 'travelnet:elevator' ) then
|
||||
@ -287,7 +287,7 @@ end
|
||||
travelnet.add_target = function( station_name, network_name, pos, player_name, meta, owner_name )
|
||||
|
||||
-- if it is an elevator, determine the network name through x and z coordinates
|
||||
local this_node = minetest.env:get_node( pos );
|
||||
local this_node = minetest.get_node( pos );
|
||||
local is_elevator = false;
|
||||
|
||||
if( this_node.name == 'travelnet:elevator' ) then
|
||||
@ -389,7 +389,7 @@ end
|
||||
-- allow doors to open
|
||||
travelnet.open_close_door = function( pos, player, mode )
|
||||
|
||||
local this_node = minetest.env:get_node( pos );
|
||||
local this_node = minetest.get_node( pos );
|
||||
local pos2 = {x=pos.x,y=pos.y,z=pos.z};
|
||||
|
||||
if( this_node.param2 == 0 ) then pos2 = {x=pos.x,y=pos.y,z=(pos.z-1)};
|
||||
@ -398,7 +398,7 @@ travelnet.open_close_door = function( pos, player, mode )
|
||||
elseif( this_node.param2 == 3 ) then pos2 = {x=(pos.x+1),y=pos.y,z=pos.z};
|
||||
end
|
||||
|
||||
local door_node = minetest.env:get_node( pos2 );
|
||||
local door_node = minetest.get_node( pos2 );
|
||||
if( door_node ~= nil and door_node.name ~= 'ignore' and door_node.name ~= 'air' and minetest.registered_nodes[ door_node.name ] ~= nil and minetest.registered_nodes[ door_node.name ].on_rightclick ~= nil) then
|
||||
|
||||
-- at least for homedecor, same facedir would mean "door closed"
|
||||
@ -432,7 +432,7 @@ end
|
||||
|
||||
|
||||
travelnet.on_receive_fields = function(pos, formname, fields, player)
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local meta = minetest.get_meta(pos);
|
||||
|
||||
local name = player:get_player_name();
|
||||
|
||||
@ -480,7 +480,7 @@ travelnet.on_receive_fields = function(pos, formname, fields, player)
|
||||
end
|
||||
end
|
||||
|
||||
local this_node = minetest.env:get_node( pos );
|
||||
local this_node = minetest.get_node( pos );
|
||||
if( this_node ~= nil and this_node.name == 'travelnet:elevator' ) then
|
||||
for k,v in pairs( travelnet.targets[ owner_name ][ station_network ] ) do
|
||||
if( travelnet.targets[ owner_name ][ station_network ][ k ].nr --..' ('..tostring( travelnet.targets[ owner_name ][ station_network ][ k ].pos.y )..'m)'
|
||||
@ -511,7 +511,7 @@ travelnet.on_receive_fields = function(pos, formname, fields, player)
|
||||
minetest.sound_play("128590_7037-lq.mp3", {pos = pos, gain = 1.0, max_hear_distance = 10,})
|
||||
end
|
||||
if( travelnet.travelnet_effect_enabled ) then
|
||||
minetest.env:add_entity( {x=pos.x,y=pos.y+0.5,z=pos.z}, "travelnet:effect"); -- it self-destructs after 20 turns
|
||||
minetest.add_entity( {x=pos.x,y=pos.y+0.5,z=pos.z}, "travelnet:effect"); -- it self-destructs after 20 turns
|
||||
end
|
||||
|
||||
-- close the doors at the sending station
|
||||
@ -525,12 +525,12 @@ travelnet.on_receive_fields = function(pos, formname, fields, player)
|
||||
minetest.sound_play("travelnet_travel.wav", {pos = target_pos, gain = 1.0, max_hear_distance = 10,})
|
||||
end
|
||||
if( travelnet.travelnet_effect_enabled ) then
|
||||
minetest.env:add_entity( {x=target_pos.x,y=target_pos.y+0.5,z=target_pos.z}, "travelnet:effect"); -- it self-destructs after 20 turns
|
||||
minetest.add_entity( {x=target_pos.x,y=target_pos.y+0.5,z=target_pos.z}, "travelnet:effect"); -- it self-destructs after 20 turns
|
||||
end
|
||||
|
||||
|
||||
-- check if the box has at the other end has been removed.
|
||||
local node2 = minetest.env:get_node( target_pos );
|
||||
local node2 = minetest.get_node( target_pos );
|
||||
if( node2 ~= nil and node2.name ~= 'ignore' and node2.name ~= 'travelnet:travelnet' and node2.name ~= 'travelnet:elevator') then
|
||||
|
||||
-- provide information necessary to identify the removed box
|
||||
@ -613,7 +613,7 @@ travelnet.can_dig = function( pos, player, description )
|
||||
return true;
|
||||
end
|
||||
|
||||
local meta = minetest.env:get_meta( pos );
|
||||
local meta = minetest.get_meta( pos );
|
||||
local owner = meta:get_string('owner');
|
||||
|
||||
if( not( meta ) or not( owner) or owner=='') then
|
||||
|
@ -53,7 +53,7 @@ minetest.register_node("travelnet:travelnet", {
|
||||
light_source = 10,
|
||||
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
local meta = minetest.env:get_meta(pos);
|
||||
local meta = minetest.get_meta(pos);
|
||||
meta:set_string("infotext", "Travelnet-box (unconfigured)");
|
||||
meta:set_string("station_name", "");
|
||||
meta:set_string("station_network","");
|
||||
@ -84,7 +84,7 @@ minetest.register_node("travelnet:travelnet", {
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
|
||||
local pos = pointed_thing.above;
|
||||
if( minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" ) then
|
||||
if( minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" ) then
|
||||
|
||||
minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place the travelnet box!' )
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user