Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print (" moredoors Mod Loading ")
- --
- --moredoors
- --
- --------------------------------------------------------------------------------
- local WALLMX = 3
- local WALLMZ = 5
- local WALLPX = 2
- local WALLPZ = 4
- --------------------------------------------------------------------------------
- minetest.register_alias('door_steel', 'moredoors:door_steel')
- minetest.register_alias('door_cobble', 'moredoors:door_cobble')
- use on_dig = function( 'moredoors:door_steel', {
- description = 'Steel Door',
- drawtype = 'signlike',
- tile_images = { 'door_steel.png' },
- inventory_image = 'door_steel.png',
- wield_image = 'door_steel.png',
- paramtype2 = 'wallmounted',
- selection_box = { type = 'wallmounted' },
- groups = { choppy=2, dig_immediate=2 },
- })
- minetest.register_craft( {
- output = 'moredoors:door_steel',
- recipe = {
- { 'default:steel', 'default:steel' },
- { 'default:steel', 'default:steel' },
- { 'default:steel', 'default:steel' },
- },
- })
- use on_dig = function( 'moredoors:door_cobble', {
- Description = 'Cobble door',
- drawtype = 'signlike',
- tile_images = { 'door_cobble.png' },
- inventory_image = 'door_cobble.png',
- paramtype = 'light',
- paramtype2 = 'wallmounted',
- walkable = true,
- selection_box = { type = "wallmounted", },
- groups = { choppy=2, dig_immediate=2 },
- legacy_wallmounted = true,
- drop = 'moredoors:door_cobble',
- })
- minetest.register_craft( {
- output = 'moredoors:door_cobble',
- recipe = {
- { 'default:cobble', 'default:cooble' },
- { 'default:cobble', 'default:cobble' },
- { 'default:cobble', 'default:cobble' },
- },
- })
- --------------------------------------------------------------------------------
- local round = function( n )
- if n >= 0 then
- return math.floor( n + 0.5 )
- else
- return math.ceil( n - 0.5 )
- end
- end
- local on_door_placed = function( pos, node, placer )
- if node.name ~= 'moredoors:door_steel' then return end
- upos = { x = pos.x, y = pos.y - 1, z = pos.z }
- apos = { x = pos.x, y = pos.y + 1, z = pos.z }
- und = minetest.env:get_node( upos )
- abv = minetest.env:get_node( apos )
- dir = placer:get_look_dir()
- if round( dir.x ) == 1 then
- newparam = WALLMX
- elseif round( dir.x ) == -1 then
- newparam = WALLPX
- elseif round( dir.z ) == 1 then
- newparam = WALLMZ
- elseif round( dir.z ) == -1 then
- newparam = WALLPZ
- end
- if und.name == 'air' then
- minetest.env:add_node( pos, { name = 'moredoors:door_steel', param2 = newparam } )
- minetest.env:add_node( upos, { name = 'moredoors:door_steel', param2 = newparam } )
- elseif abv.name == 'air' then
- minetest.env:add_node( pos, { name = 'moredoors:door_steel', param2 = newparam } )
- minetest.env:add_node( apos, { name = 'moredoors:door_steel', param2 = newparam } )
- else
- minetest.env:remove_node( pos )
- placer:get_inventory():add_item( "main", 'moredoors:door_steel' )
- minetest.chat_send_player( placer:get_player_name(), 'not enough space' )
- end
- end
- local on_door_punched = function( pos, node, puncher )
- if string.find( node.name, 'moredoors:door_steel' ) == nil then return end
- upos = { x = pos.x, y = pos.y - 1, z = pos.z }
- apos = { x = pos.x, y = pos.y + 1, z = pos.z }
- if string.find( node.name, '_c', -2 ) ~= nil then
- if node.param2 == WALLPX then
- newparam = WALLMZ
- elseif node.param2 == WALLMZ then
- newparam = WALLMX
- elseif node.param2 == WALLMX then
- newparam = WALLPZ
- elseif node.param2 == WALLPZ then
- newparam = WALLPX
- end
- elseif string.find( node.name, '_o', -2 ) ~= nil then
- if node.param2 == WALLMZ then
- newparam = WALLPX
- elseif node.param2 == WALLMX then
- newparam = WALLMZ
- elseif node.param2 == WALLPZ then
- newparam = WALLMX
- elseif node.param2 == WALLPX then
- newparam = WALLPZ
- end
- end
- local round = function( n )
- if n >= 0 then
- return math.floor( n + 0.5 )
- else
- return math.ceil( n - 0.5 )
- end
- end
- local on_door_placed = function( pos, node, placer )
- if node.name ~= 'moredoors:door_cobble' then return end
- upos = { x = pos.x, y = pos.y - 1, z = pos.z }
- apos = { x = pos.x, y = pos.y + 1, z = pos.z }
- und = minetest.env:get_node( upos )
- abv = minetest.env:get_node( apos )
- dir = placer:get_look_dir()
- if round( dir.x ) == 1 then
- newparam = WALLMX
- elseif round( dir.x ) == -1 then
- newparam = WALLPX
- elseif round( dir.z ) == 1 then
- newparam = WALLMZ
- elseif round( dir.z ) == -1 then
- newparam = WALLPZ
- end
- if und.name == 'air' then
- minetest.env:add_node( pos, { name = 'moredoors:door_cobble', param2 = newparam } )
- minetest.env:add_node( upos, { name = 'moredoors:door_cobble', param2 = newparam } )
- elseif abv.name == 'air' then
- minetest.env:add_node( pos, { name = 'moredoors:door_cobble', param2 = newparam } )
- minetest.env:add_node( apos, { name = 'moredoors:door_cobble', param2 = newparam } )
- else
- minetest.env:remove_node( pos )
- placer:get_inventory():add_item( "main", 'moredoors:door_cobble' )
- minetest.chat_send_player( placer:get_player_name(), 'not enough space' )
- end
- end
- local on_door_punched = function( pos, node, puncher )
- if string.find( node.name, 'moredoors:door_cobble' ) == nil then return end
- upos = { x = pos.x, y = pos.y - 1, z = pos.z }
- apos = { x = pos.x, y = pos.y + 1, z = pos.z }
- if string.find( node.name, '_c', -2 ) ~= nil then
- if node.param2 == WALLPX then
- newparam = WALLMZ
- elseif node.param2 == WALLMZ then
- newparam = WALLMX
- elseif node.param2 == WALLMX then
- newparam = WALLPZ
- elseif node.param2 == WALLPZ then
- newparam = WALLPX
- end
- elseif string.find( node.name, '_o', -2 ) ~= nil then
- if node.param2 == WALLMZ then
- newparam = WALLPX
- elseif node.param2 == WALLMX then
- newparam = WALLMZ
- elseif node.param2 == WALLPZ then
- newparam = WALLMX
- elseif node.param2 == WALLPX then
- newparam = WALLPZ
- end
- end
- end
- --------------------------------------------------------------------------------
- on_construct = func(pos),( on_door_placed )
- on_construct = func(pos),( on_door_punched )
- on_construct = func(pos),( on_door_digged )
- --------------------------------------------------------------------------------
- print (" moredoors Mod Loaded ")
- print (" Edited by Keegan ")
- print (" Lisence - LGPLv2 ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement