Make nearby light blocks spawn particles when player wield one
This commit is contained in:
parent
7c497d9604
commit
33e2b79b2b
@ -250,6 +250,7 @@ minetest.register_node("mcl_core:realm_barrier", {
|
||||
|
||||
|
||||
--- Light blocks
|
||||
--- TODO: make node only pointable when wielding it
|
||||
|
||||
for i = 0, 14 do --minetest.LIGHT_MAX
|
||||
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",
|
||||
sunlight_propagates = true,
|
||||
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_use = function(itemstack, _, _)
|
||||
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
|
||||
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 r = 8
|
||||
local vm = get_voxel_manip()
|
||||
@ -642,11 +642,15 @@ minetest.register_globalstep(function(dtime)
|
||||
for z=pos.z-r, pos.z+r do
|
||||
local vi = area:indexp({x=x, y=y, z=z})
|
||||
local nodename = get_name_from_content_id(data[vi])
|
||||
local light_block_group = minetest.get_item_group(nodename, "light_block")
|
||||
|
||||
local tex
|
||||
if nodename == "mcl_core:barrier" then
|
||||
tex = "mcl_core_barrier.png"
|
||||
elseif nodename == "mcl_core:realm_barrier" then
|
||||
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
|
||||
if tex then
|
||||
add_particle({
|
||||
|
Loading…
Reference in New Issue
Block a user