2015-12-17 19:05:34 +01:00
|
|
|
--
|
|
|
|
-- Lumien mod
|
|
|
|
-- By Kaadmy, for Pixture
|
|
|
|
--
|
|
|
|
|
2016-02-10 22:18:54 +01:00
|
|
|
local lumien_on_radius = 2
|
|
|
|
local lumien_off_radius = 4
|
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_node(
|
2015-12-17 19:05:34 +01:00
|
|
|
"lumien:crystal_on",
|
|
|
|
{
|
|
|
|
description = "Lumien Crystal",
|
|
|
|
inventory_image = "lumien_crystal.png",
|
|
|
|
tiles = {"lumien_block.png"},
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "wallmounted",
|
|
|
|
drawtype = "nodebox",
|
|
|
|
node_box = {
|
|
|
|
type = "wallmounted",
|
|
|
|
wall_top = {-4/16, 0.5-(4/16), -4/16, 4/16, 0.5, 4/16},
|
|
|
|
wall_side = {-0.5, -4/16, -4/16, -0.5+(4/16), 4/16, 4/16},
|
|
|
|
wall_bottom = {-4/16, -0.5, -4/16, 4/16, -0.5+(4/16), 4/16}
|
|
|
|
},
|
|
|
|
|
|
|
|
groups = {crumbly = 3},
|
|
|
|
light_source = 13,
|
|
|
|
drop = "lumien:crystal_off",
|
|
|
|
sounds = default.node_sound_glass_defaults(),
|
|
|
|
})
|
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_node(
|
2015-12-17 19:05:34 +01:00
|
|
|
"lumien:crystal_off",
|
|
|
|
{
|
|
|
|
description = "Lumien Crystal",
|
|
|
|
inventory_image = "lumien_crystal.png",
|
|
|
|
tiles = {"lumien_block.png"},
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "wallmounted",
|
|
|
|
drawtype = "nodebox",
|
|
|
|
node_box = {
|
|
|
|
type = "wallmounted",
|
|
|
|
wall_top = {-4/16, 0.5-(4/16), -4/16, 4/16, 0.5, 4/16},
|
|
|
|
wall_side = {-0.5, -4/16, -4/16, -0.5+(4/16), 4/16, 4/16},
|
|
|
|
wall_bottom = {-4/16, -0.5, -4/16, 4/16, -0.5+(4/16), 4/16}
|
|
|
|
},
|
|
|
|
|
|
|
|
groups = {crumbly = 3},
|
|
|
|
light_source = 2,
|
|
|
|
sounds = default.node_sound_glass_defaults(),
|
|
|
|
})
|
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_node(
|
2015-12-17 19:05:34 +01:00
|
|
|
"lumien:block",
|
|
|
|
{
|
|
|
|
description = "Lumien Block",
|
|
|
|
tiles = {"lumien_block.png"},
|
|
|
|
groups = {cracky = 1, stone = 1},
|
|
|
|
light_source = 14,
|
|
|
|
sounds = default.node_sound_stone_defaults(),
|
|
|
|
})
|
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_node(
|
2015-12-17 19:05:34 +01:00
|
|
|
"lumien:ore",
|
|
|
|
{
|
|
|
|
description = "Lumien Ore",
|
|
|
|
tiles = {"default_stone.png^lumien_mineral.png"},
|
|
|
|
groups = {cracky = 1, stone = 1},
|
|
|
|
drop = "lumien:block",
|
|
|
|
sounds = default.node_sound_stone_defaults(),
|
|
|
|
})
|
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_craft(
|
2015-12-19 21:38:40 +01:00
|
|
|
{
|
|
|
|
output = "lumien:crystal_off 9",
|
|
|
|
recipe = {"lumien:block"},
|
|
|
|
type = "shapeless",
|
|
|
|
})
|
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_craft(
|
2015-12-19 21:38:40 +01:00
|
|
|
{
|
|
|
|
output = "lumien:block",
|
|
|
|
recipe = {
|
|
|
|
{"lumien:crystal_off", "lumien:crystal_off", "lumien:crystal_off"},
|
|
|
|
{"lumien:crystal_off", "lumien:crystal_off", "lumien:crystal_off"},
|
|
|
|
{"lumien:crystal_off", "lumien:crystal_off", "lumien:crystal_off"}
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_ore(
|
2015-12-17 19:05:34 +01:00
|
|
|
{
|
|
|
|
ore_type = "scatter",
|
|
|
|
ore = "lumien:ore",
|
|
|
|
wherein = "default:stone",
|
|
|
|
clust_scarcity = 12*12*12,
|
|
|
|
clust_num_ores = 10,
|
|
|
|
clust_size = 10,
|
|
|
|
y_min = -256,
|
|
|
|
y_max = -64,
|
|
|
|
})
|
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_abm(
|
2015-12-17 19:05:34 +01:00
|
|
|
{
|
|
|
|
nodenames = {"lumien:crystal_on"},
|
|
|
|
interval = 1,
|
|
|
|
chance = 1,
|
|
|
|
action = function(pos, node)
|
|
|
|
util.nodefunc(
|
|
|
|
{x = pos.x-1, y = pos.y-1, z = pos.z-1},
|
|
|
|
{x = pos.x+1, y = pos.y+1, z = pos.z+1},
|
|
|
|
"tnt:tnt",
|
|
|
|
function(pos)
|
|
|
|
tnt.burn(pos)
|
|
|
|
end,
|
|
|
|
true
|
|
|
|
)
|
|
|
|
|
|
|
|
local ok = true
|
2017-05-12 04:29:55 +02:00
|
|
|
for _,object in ipairs(minetest.get_objects_inside_radius(pos, lumien_off_radius)) do
|
2015-12-17 19:05:34 +01:00
|
|
|
if object:is_player() then
|
|
|
|
ok = false
|
|
|
|
end
|
|
|
|
end
|
2017-05-10 19:19:28 +02:00
|
|
|
|
2015-12-17 19:05:34 +01:00
|
|
|
if ok then
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.set_node(
|
2015-12-17 19:05:34 +01:00
|
|
|
pos,
|
|
|
|
{
|
|
|
|
name = "lumien:crystal_off",
|
|
|
|
param = node.param,
|
|
|
|
param2 = node.param2
|
|
|
|
})
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
local function step(dtime)
|
2017-05-12 04:29:55 +02:00
|
|
|
for _, player in ipairs(minetest.get_connected_players()) do
|
2015-12-17 19:05:34 +01:00
|
|
|
local pos = player:getpos()
|
|
|
|
|
|
|
|
util.nodefunc(
|
2016-02-10 22:18:54 +01:00
|
|
|
{x = pos.x-lumien_on_radius, y = pos.y-lumien_on_radius, z = pos.z-lumien_on_radius},
|
|
|
|
{x = pos.x+lumien_on_radius, y = pos.y+lumien_on_radius, z = pos.z+lumien_on_radius},
|
2015-12-17 19:05:34 +01:00
|
|
|
"lumien:crystal_off",
|
|
|
|
function(pos)
|
2017-05-12 04:29:55 +02:00
|
|
|
local node = minetest.get_node(pos)
|
2015-12-17 19:05:34 +01:00
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.set_node(
|
2015-12-17 19:05:34 +01:00
|
|
|
pos,
|
|
|
|
{
|
|
|
|
name = "lumien:crystal_on",
|
|
|
|
param = node.param,
|
|
|
|
param2 = node.param2
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
true
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_globalstep(step)
|
2015-12-17 19:05:34 +01:00
|
|
|
|
2017-05-10 19:19:28 +02:00
|
|
|
-- Achievements
|
|
|
|
|
|
|
|
achievements.register_achievement(
|
|
|
|
"enlightened",
|
|
|
|
{
|
|
|
|
title = "Enlightened",
|
|
|
|
description = "Place 9 lumien crystals.",
|
|
|
|
times = 9,
|
|
|
|
plcenode = "lumien:lumien_crystal_off",
|
|
|
|
})
|
|
|
|
|
|
|
|
default.log("mod:lumien", "loaded")
|