12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- decals = {}
- decals.on_punch = function(pos, node, puncher, pointed_thing)
- local player = puncher:get_player_name()
- if minetest.check_player_privs(player, { creative = true }) then
- minetest.swap_node(pos, {name = node.name, param2 = node.param2-32})
- end
- end
- decals.on_rightclick = function(pos, node, clicker)
- local player = clicker:get_player_name()
- if minetest.check_player_privs(player, { creative = true }) then
- minetest.swap_node(pos, {name = node.name, param2 = node.param2+32})
- end
- end
- function decals.register_decal(name, desc)
- minetest.register_node('decals:'..name, {
- description = desc,
- drawtype = 'mesh',
- mesh = 'decals_mesh.obj',
- tiles = {'decals_'..name..'.png'},
- inventory_image = 'decals_'..name..'.png',
- wield_image = 'decals_'..name..'.png',
- paramtype = 'light',
- paramtype2 = 'colorfacedir',
- palette = 'decals_color_palette.png',
- sunlight_propagates = true,
- selection_box = {
- type = 'fixed',
- fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
- },
- collision_box = {
- type = 'fixed',
- fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
- },
- groups = {breakable=1},
- on_place = minetest.rotate_and_place,
- on_rightclick = decals.on_rightclick,
- on_punch = decals.on_punch,
- })
- end
- dofile(minetest.get_modpath('decals')..'/alphanumeric.lua')
- dofile(minetest.get_modpath('decals')..'/shapes.lua')
|