2017-05-16 19:47:12 +02:00
|
|
|
|
2015-12-17 19:05:34 +01:00
|
|
|
--
|
|
|
|
-- Lumien mod
|
|
|
|
-- By Kaadmy, for Pixture
|
|
|
|
--
|
|
|
|
|
2019-08-28 17:31:41 +02:00
|
|
|
local S = minetest.get_translator("lumien")
|
|
|
|
|
2016-02-10 22:18:54 +01:00
|
|
|
local lumien_on_radius = 2
|
|
|
|
local lumien_off_radius = 4
|
|
|
|
|
2017-05-16 19:47:12 +02:00
|
|
|
local timer_interval = 1
|
|
|
|
local timer = 0
|
|
|
|
|
|
|
|
-- Update function
|
|
|
|
|
|
|
|
local function on_globalstep(dtime)
|
|
|
|
timer = timer + dtime
|
|
|
|
|
|
|
|
if timer < timer_interval then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
timer = 0
|
|
|
|
|
|
|
|
for _, player in ipairs(minetest.get_connected_players()) do
|
2019-03-20 15:04:20 +01:00
|
|
|
local pos = player:get_pos()
|
2017-05-16 19:47:12 +02:00
|
|
|
|
|
|
|
util.nodefunc(
|
2017-05-17 22:54:33 +02: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
|
|
|
|
},
|
2017-05-16 19:47:12 +02:00
|
|
|
"lumien:crystal_off",
|
|
|
|
function(pos)
|
|
|
|
local node = minetest.get_node(pos)
|
|
|
|
|
|
|
|
minetest.set_node(
|
|
|
|
pos,
|
|
|
|
{
|
|
|
|
name = "lumien:crystal_on",
|
|
|
|
param = node.param,
|
|
|
|
param2 = node.param2
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
true
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
minetest.register_globalstep(on_globalstep)
|
|
|
|
|
|
|
|
-- Nodes
|
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_node(
|
2015-12-17 19:05:34 +01:00
|
|
|
"lumien:crystal_on",
|
|
|
|
{
|
2019-08-28 17:31:41 +02:00
|
|
|
description = S("Glowing Lumien Crystal"),
|
2015-12-17 19:05:34 +01:00
|
|
|
inventory_image = "lumien_crystal.png",
|
|
|
|
tiles = {"lumien_block.png"},
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "wallmounted",
|
2019-08-29 14:52:32 +02:00
|
|
|
is_ground_content = false,
|
2015-12-17 19:05:34 +01:00
|
|
|
drawtype = "nodebox",
|
2017-05-16 19:47:12 +02:00
|
|
|
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}
|
|
|
|
},
|
2015-12-17 19:05:34 +01:00
|
|
|
|
2019-06-23 22:37:51 +02:00
|
|
|
groups = {crumbly = 3, not_in_creative_inventory = 1},
|
2017-05-16 19:47:12 +02:00
|
|
|
light_source = 12,
|
2015-12-17 19:05:34 +01:00
|
|
|
drop = "lumien:crystal_off",
|
|
|
|
sounds = default.node_sound_glass_defaults(),
|
2017-05-16 19:47:12 +02:00
|
|
|
})
|
2015-12-17 19:05:34 +01:00
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_node(
|
2015-12-17 19:05:34 +01:00
|
|
|
"lumien:crystal_off",
|
|
|
|
{
|
2019-08-28 17:31:41 +02:00
|
|
|
description = S("Lumien Crystal"),
|
2015-12-17 19:05:34 +01:00
|
|
|
inventory_image = "lumien_crystal.png",
|
|
|
|
tiles = {"lumien_block.png"},
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "wallmounted",
|
2019-08-29 14:52:32 +02:00
|
|
|
is_ground_content = false,
|
2015-12-17 19:05:34 +01:00
|
|
|
drawtype = "nodebox",
|
2017-05-16 19:47:12 +02:00
|
|
|
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}
|
|
|
|
},
|
2015-12-17 19:05:34 +01:00
|
|
|
|
|
|
|
groups = {crumbly = 3},
|
|
|
|
light_source = 2,
|
|
|
|
sounds = default.node_sound_glass_defaults(),
|
2017-05-16 19:47:12 +02:00
|
|
|
})
|
2015-12-17 19:05:34 +01:00
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_node(
|
2015-12-17 19:05:34 +01:00
|
|
|
"lumien:block",
|
|
|
|
{
|
2019-08-28 17:31:41 +02:00
|
|
|
description = S("Lumien Block"),
|
2015-12-17 19:05:34 +01:00
|
|
|
tiles = {"lumien_block.png"},
|
2017-05-16 19:47:12 +02:00
|
|
|
groups = {cracky = 1},
|
2015-12-17 19:05:34 +01:00
|
|
|
light_source = 14,
|
|
|
|
sounds = default.node_sound_stone_defaults(),
|
2017-05-16 19:47:12 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
-- Ores
|
2015-12-17 19:05:34 +01:00
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_node(
|
2017-05-17 22:54:33 +02:00
|
|
|
"lumien:stone_with_lumien",
|
2015-12-17 19:05:34 +01:00
|
|
|
{
|
2019-08-28 17:31:41 +02:00
|
|
|
description = S("Stone with Lumien"),
|
2017-05-17 22:54:33 +02:00
|
|
|
tiles = {"default_stone.png^lumien_mineral_lumien.png"},
|
2015-12-17 19:05:34 +01:00
|
|
|
groups = {cracky = 1, stone = 1},
|
|
|
|
drop = "lumien:block",
|
|
|
|
sounds = default.node_sound_stone_defaults(),
|
2017-05-16 19:47:12 +02:00
|
|
|
})
|
2015-12-19 21:38:40 +01:00
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_ore(
|
2015-12-17 19:05:34 +01:00
|
|
|
{
|
|
|
|
ore_type = "scatter",
|
2017-05-17 22:54:33 +02:00
|
|
|
ore = "lumien:stone_with_lumien",
|
2015-12-17 19:05:34 +01:00
|
|
|
wherein = "default:stone",
|
2017-05-17 22:54:33 +02:00
|
|
|
clust_scarcity = 5*5*5,
|
|
|
|
clust_num_ores = 8,
|
|
|
|
clust_size = 6,
|
|
|
|
y_min = -107,
|
|
|
|
y_max = -100,
|
2017-05-16 19:47:12 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
-- Update functions
|
2015-12-17 19:05:34 +01:00
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_abm(
|
2015-12-17 19:05:34 +01:00
|
|
|
{
|
2017-05-19 23:04:11 +02:00
|
|
|
label = "Lumien crystals",
|
2015-12-17 19:05:34 +01:00
|
|
|
nodenames = {"lumien:crystal_on"},
|
2017-05-16 19:47:12 +02:00
|
|
|
interval = timer_interval,
|
2015-12-17 19:05:34 +01:00
|
|
|
chance = 1,
|
|
|
|
action = function(pos, node)
|
2017-05-16 19:47:12 +02:00
|
|
|
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
|
|
|
|
|
|
|
|
for _,object in ipairs(minetest.get_objects_inside_radius(pos, lumien_off_radius)) do
|
|
|
|
if object:is_player() then
|
|
|
|
ok = false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if ok then
|
|
|
|
minetest.set_node(
|
|
|
|
pos,
|
|
|
|
{
|
|
|
|
name = "lumien:crystal_off",
|
|
|
|
param = node.param,
|
|
|
|
param2 = node.param2
|
|
|
|
})
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
})
|
2015-12-17 19:05:34 +01:00
|
|
|
|
2017-05-16 19:47:12 +02:00
|
|
|
-- Crafting
|
2015-12-17 19:05:34 +01:00
|
|
|
|
2017-05-16 19:47:12 +02:00
|
|
|
crafting.register_craft(
|
|
|
|
{
|
|
|
|
output = "lumien:crystal_off 9",
|
|
|
|
items = {
|
|
|
|
"lumien:block"
|
|
|
|
},
|
|
|
|
})
|
2015-12-17 19:05:34 +01:00
|
|
|
|
2017-05-16 19:47:12 +02:00
|
|
|
crafting.register_craft(
|
|
|
|
{
|
|
|
|
output = "lumien:block",
|
|
|
|
items = {
|
|
|
|
"lumien:crystal_off 9",
|
|
|
|
},
|
|
|
|
})
|
2015-12-17 19:05:34 +01:00
|
|
|
|
2017-05-10 19:19:28 +02:00
|
|
|
-- Achievements
|
|
|
|
|
|
|
|
achievements.register_achievement(
|
|
|
|
"enlightened",
|
|
|
|
{
|
2019-08-28 17:31:41 +02:00
|
|
|
title = S("Enlightened"),
|
|
|
|
description = S("Place 9 lumien crystals."),
|
2017-05-10 19:19:28 +02:00
|
|
|
times = 9,
|
2019-09-03 19:34:50 +02:00
|
|
|
placenode = "lumien:crystal_off",
|
2017-05-10 19:19:28 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
default.log("mod:lumien", "loaded")
|