mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-22 18:41:09 +01:00
Make nearby light blocks spawn particles when player wield one
This commit is contained in:
parent
7c497d9604
commit
33e2b79b2b
2 changed files with 7 additions and 2 deletions
|
@ -250,6 +250,7 @@ minetest.register_node("mcl_core:realm_barrier", {
|
||||||
|
|
||||||
|
|
||||||
--- Light blocks
|
--- Light blocks
|
||||||
|
--- TODO: make node only pointable when wielding it
|
||||||
|
|
||||||
for i = 0, 14 do --minetest.LIGHT_MAX
|
for i = 0, 14 do --minetest.LIGHT_MAX
|
||||||
minetest.register_node("mcl_core:light_" .. i, {
|
minetest.register_node("mcl_core:light_" .. i, {
|
||||||
|
@ -265,7 +266,7 @@ for i = 0, 14 do --minetest.LIGHT_MAX
|
||||||
wield_image = "mcl_core_light_" .. i .. ".png",
|
wield_image = "mcl_core_light_" .. i .. ".png",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
groups = {creative_breakable = 1, not_solid = 1},
|
groups = {creative_breakable = 1, not_solid = 1, light_block = i + 1},
|
||||||
on_blast = function() end,
|
on_blast = function() end,
|
||||||
on_use = function(itemstack, _, _)
|
on_use = function(itemstack, _, _)
|
||||||
itemstack:set_name("mcl_core:light_" .. ((i == 14) and 0 or i + 1))
|
itemstack:set_name("mcl_core:light_" .. ((i == 14) and 0 or i + 1))
|
||||||
|
|
|
@ -627,7 +627,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
-- Show positions of barriers when player is wielding a barrier
|
-- Show positions of barriers when player is wielding a barrier
|
||||||
local wi = player:get_wielded_item():get_name()
|
local wi = player:get_wielded_item():get_name()
|
||||||
if wi == "mcl_core:barrier" or wi == "mcl_core:realm_barrier" then
|
if wi == "mcl_core:barrier" or wi == "mcl_core:realm_barrier" or minetest.get_item_group(wi, "light_block") ~= 0 then
|
||||||
local pos = vector.round(player:get_pos())
|
local pos = vector.round(player:get_pos())
|
||||||
local r = 8
|
local r = 8
|
||||||
local vm = get_voxel_manip()
|
local vm = get_voxel_manip()
|
||||||
|
@ -642,11 +642,15 @@ minetest.register_globalstep(function(dtime)
|
||||||
for z=pos.z-r, pos.z+r do
|
for z=pos.z-r, pos.z+r do
|
||||||
local vi = area:indexp({x=x, y=y, z=z})
|
local vi = area:indexp({x=x, y=y, z=z})
|
||||||
local nodename = get_name_from_content_id(data[vi])
|
local nodename = get_name_from_content_id(data[vi])
|
||||||
|
local light_block_group = minetest.get_item_group(nodename, "light_block")
|
||||||
|
|
||||||
local tex
|
local tex
|
||||||
if nodename == "mcl_core:barrier" then
|
if nodename == "mcl_core:barrier" then
|
||||||
tex = "mcl_core_barrier.png"
|
tex = "mcl_core_barrier.png"
|
||||||
elseif nodename == "mcl_core:realm_barrier" then
|
elseif nodename == "mcl_core:realm_barrier" then
|
||||||
tex = "mcl_core_barrier.png^[colorize:#FF00FF:127^[transformFX"
|
tex = "mcl_core_barrier.png^[colorize:#FF00FF:127^[transformFX"
|
||||||
|
elseif light_block_group ~= 0 then
|
||||||
|
tex = "mcl_core_light_" .. (light_block_group - 1) .. ".png"
|
||||||
end
|
end
|
||||||
if tex then
|
if tex then
|
||||||
add_particle({
|
add_particle({
|
||||||
|
|
Loading…
Reference in a new issue