1
0
Fork 0

[mcl_end] fix some warnings

This commit is contained in:
AFCMS 2021-05-22 23:56:52 +02:00
parent fcc2087b97
commit 56310a3624
2 changed files with 9 additions and 8 deletions

View File

@ -29,7 +29,7 @@ local no_detach = {}
-- This detaches all chorus plants that are/were attached -- This detaches all chorus plants that are/were attached
-- at start_pos. -- at start_pos.
mcl_end.detach_chorus_plant = function(start_pos, digger) function mcl_end.detach_chorus_plant(start_pos, digger)
-- This node should not call a detach function, do NOTHING -- This node should not call a detach function, do NOTHING
local hash = minetest.hash_node_position(start_pos) local hash = minetest.hash_node_position(start_pos)
if no_detach[hash] ~= nil then if no_detach[hash] ~= nil then
@ -106,11 +106,11 @@ mcl_end.detach_chorus_plant = function(start_pos, digger)
no_detach = {} no_detach = {}
end end
mcl_end.check_detach_chorus_plant = function(pos, oldnode, oldmetadata, digger) function mcl_end.check_detach_chorus_plant(pos, oldnode, oldmetadata, digger)
mcl_end.detach_chorus_plant(pos, digger) mcl_end.detach_chorus_plant(pos, digger)
end end
mcl_end.check_blast_chorus_plant = function(pos) function mcl_end.check_blast_chorus_plant(pos)
minetest.remove_node(pos) minetest.remove_node(pos)
mcl_end.detach_chorus_plant(pos) mcl_end.detach_chorus_plant(pos)
end end
@ -139,7 +139,7 @@ minetest.register_node("mcl_end:chorus_flower", {
node_placement_prediction = "", node_placement_prediction = "",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local node_under = minetest.get_node(pointed_thing.under) local node_under = minetest.get_node(pointed_thing.under)
local node_above = minetest.get_node(pointed_thing.above) --local node_above = minetest.get_node(pointed_thing.above)
if placer and not placer:get_player_control().sneak then if placer and not placer:get_player_control().sneak then
-- Use pointed node's on_rightclick function first, if present -- Use pointed node's on_rightclick function first, if present
if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then
@ -309,7 +309,7 @@ minetest.register_node("mcl_end:chorus_plant", {
}) })
-- Grow a complete chorus plant at pos -- Grow a complete chorus plant at pos
mcl_end.grow_chorus_plant = function(pos, node, pr) function mcl_end.grow_chorus_plant(pos, node, pr)
local flowers = { pos } local flowers = { pos }
-- Plant initial flower (if it isn't there already) -- Plant initial flower (if it isn't there already)
if not node then if not node then
@ -340,7 +340,7 @@ end
-- Grow a single step of a chorus plant at pos. -- Grow a single step of a chorus plant at pos.
-- Pos must be a chorus flower. -- Pos must be a chorus flower.
mcl_end.grow_chorus_plant_step = function(pos, node, pr) function mcl_end.grow_chorus_plant_step(pos, node, pr)
local new_flower_buds = {} local new_flower_buds = {}
local above = { x = pos.x, y = pos.y + 1, z = pos.z } local above = { x = pos.x, y = pos.y + 1, z = pos.z }
local node_above = minetest.get_node(above) local node_above = minetest.get_node(above)
@ -408,7 +408,6 @@ mcl_end.grow_chorus_plant_step = function(pos, node, pr)
elseif branching == true then elseif branching == true then
branches = pr:next(0, 3) branches = pr:next(0, 3)
end end
local branch_grown = false
for b=1, branches do for b=1, branches do
local next_branch = pr:next(1, #around) local next_branch = pr:next(1, #around)
local branch = vector.add(pos, around[next_branch]) local branch = vector.add(pos, around[next_branch])

View File

@ -1,5 +1,7 @@
local S = minetest.get_translator("mcl_end") local S = minetest.get_translator("mcl_end")
local vector = vector
local explosion_strength = 6 local explosion_strength = 6
local directions = { local directions = {
@ -45,7 +47,7 @@ local function set_crystal_animation(self)
end end
local function spawn_crystal(pos) local function spawn_crystal(pos)
local crystal = minetest.add_entity(pos, "mcl_end:crystal") minetest.add_entity(pos, "mcl_end:crystal")
if not vector.equals(pos, vector.floor(pos)) then return end if not vector.equals(pos, vector.floor(pos)) then return end
if mcl_worlds.pos_to_dimension(pos) ~= "end" then return end if mcl_worlds.pos_to_dimension(pos) ~= "end" then return end
local portal_center local portal_center