Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GLOWLIKE = function(nodeid,nodename,drawtype)
- if drawtype == nil then
- drawtype = 'glasslike'
- inv_image = minetest.inventorycube("riventest_"..nodeid..".png")
- else
- inv_image = "riventest_"..nodeid..".png"
- end
- minetest.register_node("riventest:"..nodeid, {
- description = nodename,
- drawtype = drawtype,
- tiles = {"riventest_"..nodeid..".png"},
- inventory_image = inv_image,
- light_propagates = true,
- paramtype = "light",
- sunlight_propagates = true,
- light_source = 15 ,
- is_ground_content = true,
- groups = {snappy=2,cracky=3},
- sounds = riventest.node_sound_glass_defaults(),
- node_box = {
- type = "fixed",
- fixed = {-0.125, -0.5, -0.125, 0.125, 0.3, 0.125}
- },
- selection_box = {
- type = "fixed",
- fixed = {-0.14, -0.5, -0.14, 0.14, 0.3, 0.14}
- },
- })
- end
- METALLIKE = function(nodeid, nodename,fence)
- minetest.register_node("riventest:"..nodeid, {
- description = nodename,
- tiles = {"riventest_"..nodeid..".png"},
- is_ground_content = true,
- groups = {bendy=2,cracky=1,melty=2},
- sounds = riventest.node_sound_metal_defaults()
- })
- if fence == true then
- minetest.register_node("riventest:"..nodeid.."_fence", {
- description = nodename.." fence",
- drawtype = "fencelike",
- tiles = {"riventest_"..nodeid..".png"},
- inventory_image = "riventest_"..nodeid.."_fence.png",
- wield_image = "riventest_"..nodeid.."_fence.png",
- paramtype = "light",
- is_ground_content = true,
- selection_box = {
- type = "fixed",
- fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
- },
- groups = {bendy=2,cracky=1,melty=2},
- sounds = riventest.node_sound_metal_defaults()
- })
- end
- end
- TREELIKE = function(nodeid, nodename,fence)
- minetest.register_node("riventest:"..nodeid, {
- description = nodename,
- tiles = {"riventest_"..nodeid..".png"},
- is_ground_content = true,
- groups = {snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
- sounds = riventest.node_sound_wood_defaults(),
- })
- if fence == true then
- minetest.register_node("riventest:"..nodeid.."_fence", {
- description = nodename.." fence",
- drawtype = "fencelike",
- tiles = {"riventest_"..nodeid..".png"},
- inventory_image = "riventest_"..nodeid.."_fence.png",
- wield_image = "riventest_"..nodeid.."_fence.png",
- paramtype = "light",
- is_ground_content = true,
- selection_box = {
- type = "fixed",
- fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
- },
- groups = {snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2,tree=1},
- sounds = riventest.node_sound_wood_defaults()
- })
- end
- end
- STONELIKE = function(nodeid, nodename)
- minetest.register_node("riventest:"..nodeid, {
- description = nodename,
- tiles = {"riventest_"..nodeid..".png"},
- is_ground_content = true,
- groups = {cracky=3, stone=1},
- sounds = riventest.node_sound_stone_defaults()
- })
- end
- local SOUNDS = {}
- SOUNDNODE = function(nodeid, nodename,drawtype)
- SOUNDS[nodeid] = {}
- SOUNDS[nodeid].sounds = {}
- local on_punch = function(pos,node)
- local sound = SOUNDS[nodeid].sounds[minetest.hash_node_position(pos)]
- if sound == nil then
- local wanted_sound = {name=nodeid, gain=1.5}
- SOUNDS[nodeid].sounds[minetest.hash_node_position(pos)] = { handle = minetest.sound_play(wanted_sound, {pos=pos, loop=true}), name = wanted_sound.name, }
- else
- minetest.sound_stop(sound.handle)
- SOUNDS[nodeid].sounds[minetest.hash_node_position(pos)] = nil
- end
- end
- after_dig_node = function(pos,node)
- local sound = SOUNDS[nodeid].sounds[minetest.hash_node_position(pos)]
- if sound ~= nil then
- minetest.sound_stop(sound.handle)
- SOUNDS[nodeid].sounds[minetest.hash_node_position(pos)] = nil
- nodeupdate(pos)
- end
- end
- if drawtype == 'signlike' then
- minetest.register_node("riventest:"..nodeid, {
- description = nodename,
- drawtype = "signlike",
- tiles = {"riventest_"..nodeid..'.png'},
- inventory_image = "riventest_"..nodeid..'.png',
- wield_image = "riventest_"..nodeid..'.png',
- paramtype = "light",
- paramtype2 = "wallmounted",
- sunlight_propagates = true,
- walkable = false,
- metadata_name = "sign",
- selection_box = {
- type = "wallmounted",
- },
- groups = {snappy=2,choppy=2,dig_immediate=2,flammable=2},
- legacy_wallmounted = true,
- sounds = riventest.node_sound_defaults(),
- on_punch = on_punch,
- after_dig_node = after_dig_node,
- })
- else
- minetest.register_node("riventest:"..nodeid, {
- description = nodename,
- drawtype = 'plantlike',
- tiles = {"riventest_"..nodeid..'.png'},
- inventory_image = "riventest_"..nodeid..'.png',
- wield_image = "riventest_"..nodeid..'.png',
- paramtype = "light",
- groups = {cracky=3},
- sounds = riventest.node_sound_stone_defaults(),
- on_punch = on_punch,
- after_dig_node = after_dig_node,
- })
- end
- end
- PLANTLIKE = function(nodeid, nodename,type,option)
- if option == nil then option = false end
- local params ={ description = nodename, drawtype = "plantlike", tiles = {"riventest_"..nodeid..'.png'},
- inventory_image = "riventest_"..nodeid..'.png', wield_image = "riventest_"..nodeid..'.png', paramtype = "light",
- sunlight_propagates=true,
- }
- if type == 'veg' then
- params.groups = {snappy=2,dig_immediate=3,flammable=2}
- params.sounds = riventest.node_sound_leaves_defaults()
- if option == false then params.walkable = false end
- elseif type == 'met' then -- metallic
- params.groups = {snappy=1,bendy=2,cracky=1,melty=2}
- params.sounds = riventest.node_sound_stone_defaults()
- elseif type == 'cri' then -- craft items
- params.groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3}
- params.sounds = riventest.node_sound_wood_defaults()
- if option == false then params.walkable = false end
- elseif type == 'eat' then -- edible
- params.groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3}
- params.sounds = riventest.node_sound_wood_defaults()
- params.walkable = false
- params.on_use = minetest.item_eat(option)
- end
- minetest.register_node("riventest:"..nodeid, params)
- end
- STONELIKE('rt1','inward-squared brownstone')
- METALLIKE('rt2','flower-patterned metal')
- STONELIKE('rt3','lined brownestone')
- METALLIKE('rt4','metal block')
- METALLIKE('rt5','golden block')
- PLANTLIKE('rt6_mushroom','mushroom','veg')
- STONELIKE('rt7','outward-squared brownstone')
- STONELIKE('rt8','cobble brightstone')
- GLOWLIKE('rt9_lamppost','turquiose lamppost','plantlike')
- GLOWLIKE('rt17_lamppost','orange lamppost','plantlike')
- GLOWLIKE('rt18_lamppost','green lamppost','plantlike')
- GLOWLIKE('rt19_lamppost','red lamppost','plantlike')
- METALLIKE('rt10','rusted metal block')
- STONELIKE('rt11','flower-patterned brightstone')
- STONELIKE('rt12','mosaic brightstone')
- SOUNDNODE('1','art (1)','signlike')
- SOUNDNODE('2','art (2)','signlike')
- SOUNDNODE('3','art (3)','signlike')
- TREELIKE('wood','wood')
- TREELIKE('woodblue','bluewood')
- STONELIKE('stone1','brownstone')
- STONELIKE('stone2','graystone')
- STONELIKE('stoneblue','bluestone')
- METALLIKE('metal','black metal')
- METALLIKE('bulkhead','metal bulkhead')
- STONELIKE('goldstone1','brightstone')
- STONELIKE('goldstone2','goldstone')
- minetest.register_node("riventest:rt15", {
- description = "stained glass",
- drawtype = "nodebox",
- tiles = {"riventest_rt15.png"},
- -- inventory_image = minetest.inventorycube("riventest_rt15.png"),
- paramtype = "light",
- paramtype2 = "facedir",
- light_source = LIGHT_MAX-1,
- sunlight_propagates = true,
- is_ground_content = true,
- groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
- sounds = riventest.node_sound_glass_defaults(),
- node_box = {
- type = "fixed",
- fixed = {
- {-0.5, -0.5, -0.1, 0.5,0.5, 0.1},
- -- {-0.1, -0.5, -0.5, 0.1, -0.1, 0.5},
- -- {-0.5, 0.4, 0, 0.5, 0.5, 0.5},
- -- {-0.1, -0.1, 0, 0.1, 0.4, 0.5},
- },
- },
- selection_box = {
- type = "fixed",
- fixed = {
- {-0.5, -0.5, -0.1, 0.5,0.5, 0.1},
- -- {-0.1, -0.5, -0.5, 0.1, -0.1, 0.5},
- -- {-0.5, 0.4, 0, 0.5, 0.5, 0.5},
- -- {-0.1, -0.1, 0, 0.1, 0.4, 0.5},
- },
- },
- })
- minetest.register_node("riventest:glass", {
- description = "glass",
- drawtype = "glasslike",
- tiles = {"riventest_glass.png"},
- inventory_image = minetest.inventorycube("riventest_glass.png"),
- paramtype = "light",
- sunlight_propagates = true,
- is_ground_content = true,
- groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
- sounds = riventest.node_sound_glass_defaults(),
- })
- minetest.register_node("riventest:rt16", {
- description = "puzzle book",
- drawtype = "signlike",
- tiles = {"riventest_rt16.png"},
- inventory_image = "riventest_rt16.png",
- wield_image = "riventest_rt16.png",
- paramtype = "light",
- paramtype2 = "wallmounted",
- light_propagates = true,
- sunlight_propagates = true,
- light_source = 10,
- walkable = false,
- selection_box = {
- type = "wallmounted",
- },
- groups = {choppy=2,dig_immediate=2,flammable=3},
- legacy_wallmounted = true,
- sounds = riventest.node_sound_defaults(),
- })
- extend_chain = function(pos)
- local upos = {x=pos.x,y=pos.y-1,z=pos.z}
- local apos = {x=pos.x,y=pos.y+1,z=pos.z}
- local unode = minetest.env:get_node(upos)
- local anode = minetest.env:get_node(apos)
- if unode.name == 'air' then
- minetest.env:add_node( upos, { name = 'riventest:chain'} )
- extend_chain(upos)
- end
- if anode.name == 'air' then
- minetest.env:add_node( apos, { name = 'riventest:chain'} )
- extend_chain(apos)
- end
- end
- minetest.register_node("riventest:chain", {
- description = "chain",
- drawtype = "plantlike",
- visual_scale = 1.0,
- tiles = {"riventest_chain.png"},
- inventory_image = "riventest_chain.png",
- wield_image = "riventest_chain.png",
- paramtype = "light",
- walkable = false,
- climbable = true,
- buildable_to = true,
- groups = {snappy=2,melty=2,dig_immediate=3},
- sounds = riventest.node_sound_wood_defaults(),
- after_place_node = extend_chain,
- })
- minetest.register_node("riventest:water_flowing", {
- description = "flowing water",
- inventory_image = minetest.inventorycube("riventest_altwater.png"),
- drawtype = "flowingliquid",
- tiles = {"riventest_altwater.png"},
- alpha = WATER_ALPHA,
- paramtype = "light",
- light_source = 0,
- walkable = false,
- pointable = false,
- diggable = false,
- buildable_to = true,
- drop = "",
- liquidtype = "flowing",
- liquid_alternative_flowing = "riventest:water_flowing",
- liquid_alternative_source = "riventest:water_source",
- liquid_viscosity = WATER_VISC,
- post_effect_color = {a=64, r=100, g=100, b=200},
- special_materials = {
- {image="riventest_altwater.png", backface_culling=false},
- {image="riventest_altwater.png", backface_culling=true},
- },
- groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1 },
- })
- minetest.register_node("riventest:water_source", {
- description = "water source",
- inventory_image = minetest.inventorycube("riventest_altwater.png"),
- drawtype = "liquid",
- tiles = {"riventest_altwater.png"},
- alpha = WATER_ALPHA,
- paramtype = "light",
- light_source = 0,
- walkable = false,
- pointable = false,
- diggable = false,
- buildable_to = true,
- drop = "",
- liquidtype = "source",
- liquid_alternative_flowing = "riventest:water_flowing",
- liquid_alternative_source = "riventest:water_source",
- liquid_viscosity = WATER_VISC,
- post_effect_color = {a=64, r=100, g=100, b=200},
- special_materials = {
- -- New-style water source material (mostly unused)
- {image="riventest_altwater.png", backface_culling=false},
- },
- groups = {water=3, liquid=3, puts_out_fire=1},
- })
- minetest.register_node("riventest:beetle", {
- description = "decorational beetle",
- drawtype = "signlike",
- tiles = {"riventest_beetle.png"},
- inventory_image = "riventest_beetle.png",
- wield_image = "riventest_beetle.png",
- paramtype = "light",
- paramtype2 = "wallmounted",
- light_propagates = true,
- sunlight_propagates = true,
- light_source = 10,
- walkable = false,
- selection_box = {
- type = "wallmounted",
- },
- groups = {choppy=2,dig_immediate=2},
- legacy_wallmounted = true,
- sounds = riventest.node_sound_defaults(),
- })
- minetest.register_node("riventest:dagger", {
- description = "decorational dagger",
- drawtype = "signlike",
- tiles = {"riventest_dagger.png"},
- inventory_image = "riventest_dagger.png",
- wield_image = "riventest_dagger.png",
- paramtype = "light",
- paramtype2 = "wallmounted",
- sunlight_propagates = true,
- walkable = false,
- metadata_name = "sign",
- selection_box = {
- type = "wallmounted",
- wall_top = {-0.5, 0.45, -0.1875, 0.5, 0.5, 0.1875},
- wall_bottom = {-0.5, -0.5, -0.1875, 0.5, -0.45, 0.1875},
- wall_side = {-0.5, -0.5, -0.1875, -0.45, 0.5, 0.1875},
- },
- groups = {choppy=2,dig_immediate=2},
- legacy_wallmounted = true,
- sounds = riventest.node_sound_defaults(),
- })
- minetest.register_tool("riventest:tool", {
- description = "dagger",
- inventory_image = "riventest_tool.png",
- tool_capabilities = {
- full_punch_interval = 0.5,
- max_drop_level=3,
- groupcaps={
- fleshy={times={[1]=6.00, [2]=3, [3]=1}, uses=10, maxlevel=3},
- cracky={times={[1]=0.1, [2]=0.1, [3]=0.1}, uses=5000, maxlevel=3},
- crumbly={times={[1]=0.1, [2]=0.1, [3]=0.1}, uses=5000, maxlevel=3},
- snappy={times={[1]=0.1, [2]=0.1, [3]=0.1}, uses=5000, maxlevel=3}
- }
- },
- })
- minetest.register_alias('rtt1', 'riventest:1')
- minetest.register_alias('rtt2', 'riventest:2')
- minetest.register_alias('rtt3', 'riventest:3')
- minetest.register_alias('rtbluewood', 'riventest:woodblue')
- minetest.register_alias('rtstone1', 'riventest:stone1')
- minetest.register_alias('rtstone2', 'riventest:stone2')
- minetest.register_alias('rtbluestone', 'riventest:stoneblue')
- minetest.register_alias('rtmetal', 'riventest:metal')
- minetest.register_alias('rtbulkhead', 'riventest:bulkhead')
- minetest.register_alias('rtgold1', 'riventest:goldstone1')
- minetest.register_alias('rtgold2', 'riventest:goldstone2')
- minetest.register_alias('rtglass', 'riventest:glass')
- minetest.register_alias('rtwood', 'riventest:wood')
- minetest.register_alias('rtchain', 'riventest:chain')
- minetest.register_alias('rtbeetle', 'riventest:beetle')
- minetest.register_alias('rtdagger', 'riventest:dagger')
- minetest.register_alias('rttool', 'riventest:tool')
- minetest.register_alias('rtwater', 'riventest:water_source')
- minetest.register_alias('bluebook', 'riventest:linkingbook')
- minetest.register_alias('redbook', 'riventest:plinkingbook')
- minetest.register_alias('blankbook', 'riventest:blinkingbook')
- minetest.register_alias('rttlamp', 'riventest:rt9_lamppost')
- minetest.register_alias('rtolamp', 'riventest:rt17_lamppost')
- minetest.register_alias('rtglamp', 'riventest:rt18_lamppost')
- minetest.register_alias('rtrlamp', 'riventest:rt19_lamppost')
- minetest.register_alias('rtpuzzle', 'riventest:rt16')
- minetest.register_alias('rtmushroom', 'riventest:rt6_mushroom')
Advertisement
Add Comment
Please, Sign In to add comment