added lumien ore; may be buggy

This commit is contained in:
kaadmy 2015-12-17 10:05:34 -08:00
parent 4985d9b24c
commit 06e7795d30
11 changed files with 184 additions and 24 deletions

View File

@ -70,7 +70,6 @@ local function step(dtime)
local pos = player:getpos()
local name = player:get_player_name()
for soundname, sound in pairs(ambiance.sounds) do
if lastsound[name][soundname] then
lastsound[name][soundname] = lastsound[name][soundname] + dtime

9
mods/lumien/README.txt Normal file
View File

@ -0,0 +1,9 @@
Lumien mod
==========
By Kaadmy, for Pixture
Adds a new type of ore: Lumien.
Lumien crystals glow when a player's nearby.
Asset license: WTFPL
Source license: WTFPL

3
mods/lumien/depends.txt Normal file
View File

@ -0,0 +1,3 @@
default
tnt
util

142
mods/lumien/init.lua Normal file
View File

@ -0,0 +1,142 @@
--
-- Lumien mod
-- By Kaadmy, for Pixture
--
minetest.register_node(
"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(),
})
minetest.register_node(
"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(),
})
minetest.register_node(
"lumien:block",
{
description = "Lumien Block",
tiles = {"lumien_block.png"},
groups = {cracky = 1, stone = 1},
light_source = 14,
sounds = default.node_sound_stone_defaults(),
})
minetest.register_node(
"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(),
})
minetest.register_ore(
{
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,
})
minetest.register_abm(
{
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
for _,object in ipairs(minetest.get_objects_inside_radius(pos, 4)) 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,
})
local function step(dtime)
for _, player in ipairs(minetest.get_connected_players()) do
local pos = player:getpos()
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},
"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(step)
default.log("mod:lumien", "loaded")

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 538 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

View File

@ -1,3 +1,11 @@
--
-- TNT mod
-- By PilzAdam and ShadowNinja
-- Tweaked by Kaadmy, for Pixture
--
tnt = {}
-- Default to enabled in singleplayer and disabled in multiplayer
local singleplayer = minetest.is_singleplayer()
local setting = minetest.setting_getbool("tnt_enable")
@ -139,8 +147,8 @@ local function add_effects(pos, radius)
time = 1,
minpos = vector.subtract(pos, radius / 2),
maxpos = vector.add(pos, radius / 2),
minvel = {x=-20, y=-20, z=-20},
maxvel = {x=20, y=20, z=20},
minvel = {x = -20, y = -20, z = -20},
maxvel = {x = 20, y = 20, z = 20},
minacc = vector.new(),
maxacc = vector.new(),
minexptime = 0.2,
@ -151,11 +159,11 @@ local function add_effects(pos, radius)
})
end
local function burn(pos)
function tnt.burn(pos)
local name = minetest.get_node(pos).name
if name == "tnt:tnt" then
minetest.sound_play("tnt_ignite", {pos=pos})
minetest.set_node(pos, {name="tnt:tnt_burning"})
minetest.sound_play("tnt_ignite", {pos = pos})
minetest.set_node(pos, {name = "tnt:tnt_burning"})
minetest.get_node_timer(pos):start(2)
end
end
@ -179,27 +187,26 @@ local function explode(pos, radius)
for y = -radius, radius do
local vi = a:index(pos.x + (-radius), pos.y + y, pos.z + z)
for x = -radius, radius do
if (x * x) + (y * y) + (z * z) <=
(radius * radius) + pr:next(-radius, radius) then
local cid = data[vi]
p.x = pos.x + x
p.y = pos.y + y
p.z = pos.z + z
if cid ~= c_air then
destroy(drops, p, cid)
if (x * x) + (y * y) + (z * z) <= (radius * radius) + pr:next(-radius, radius) then
local cid = data[vi]
p.x = pos.x + x
p.y = pos.y + y
p.z = pos.z + z
if cid ~= c_air then
destroy(drops, p, cid)
end
end
vi = vi + 1
end
end
end
vi = vi + 1
end
end
end
return drops
return drops
end
local function boom(pos)
minetest.sound_play("tnt_explode", {pos=pos, gain=1.5, max_hear_distance=2*64})
function tnt.boom(pos)
minetest.sound_play("tnt_explode", {pos = pos, gain = 1.5, max_hear_distance = 128})
minetest.remove_node(pos)
local drops = explode(pos, radius)
@ -220,11 +227,11 @@ minetest.register_node(
local itemname = puncher:get_wielded_item():get_name()
if itemname == "default:flint_and_steel" then
burn(pos)
tnt.burn(pos)
end
end,
on_blast = function(pos, intensity)
burn(pos)
tnt.burn(pos)
end,
})
@ -246,7 +253,7 @@ minetest.register_node(
drop = "tnt:tnt",
groups = {dig_immediate = 2},
sounds = default.node_sound_wood_defaults(),
on_timer = boom,
on_timer = tnt.boom,
-- unaffected by explosions
on_blast = function() end,
})