Fixed indentation.

This commit is contained in:
anarquimico 2022-11-12 06:28:36 -03:00
parent cb721f37ce
commit 3ef8838a11
1 changed files with 58 additions and 58 deletions

View File

@ -498,68 +498,68 @@ minetest.register_abm({
interval = 1.0, interval = 1.0,
chance = 1, chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local uppos = {x=pos.x,y=pos.y+1,z=pos.z} local uppos = {x=pos.x,y=pos.y+1,z=pos.z}
local downpos = {x=pos.x,y=pos.y-1,z=pos.z} local downpos = {x=pos.x,y=pos.y-1,z=pos.z}
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
--Consume compostable items and update composter below --Consume compostable items and update composter below
local downnode = minetest.get_node(downpos) local downnode = minetest.get_node(downpos)
if downnode.name == "mcl_composters:composter" or downnode.name == "mcl_composters:composter_1" if downnode.name == "mcl_composters:composter" or downnode.name == "mcl_composters:composter_1"
or downnode.name == "mcl_composters:composter_2" or downnode.name == "mcl_composters:composter_3" or downnode.name == "mcl_composters:composter_2" or downnode.name == "mcl_composters:composter_3"
or downnode.name == "mcl_composters:composter_4" or downnode.name == "mcl_composters:composter_5" or downnode.name == "mcl_composters:composter_4" or downnode.name == "mcl_composters:composter_5"
or downnode.name == "mcl_composters:composter_6" or downnode.name == "mcl_composters:composter_7" then or downnode.name == "mcl_composters:composter_6" or downnode.name == "mcl_composters:composter_7" then
local itemcomp = inv:get_list("main") local itemcomp = inv:get_list("main")
local hslot = mcl_util.get_first_occupied_inventory_slot(minetest.get_inventory({type="node", pos = pos}), "main") local hslot = mcl_util.get_first_occupied_inventory_slot(minetest.get_inventory({type="node", pos = pos}), "main")
if hslot == nil then return end if hslot == nil then return end
local compchance = minetest.get_item_group(itemcomp[hslot]:get_name(), "compostability") local compchance = minetest.get_item_group(itemcomp[hslot]:get_name(), "compostability")
if compchance == 0 then if compchance == 0 then
hslot = hslot+1 hslot = hslot+1
if hslot == 6 then return end if hslot == 6 then return end
compchance = minetest.get_item_group(itemcomp[hslot]:get_name(), "compostability") compchance = minetest.get_item_group(itemcomp[hslot]:get_name(), "compostability")
if compchance == 0 then if compchance == 0 then
hslot = hslot+1 hslot = hslot+1
if hslot == 6 then return end if hslot == 6 then return end
compchance = minetest.get_item_group(itemcomp[hslot]:get_name(), "compostability") compchance = minetest.get_item_group(itemcomp[hslot]:get_name(), "compostability")
if compchance == 0 then if compchance == 0 then
hslot = hslot+1 hslot = hslot+1
if hslot == 6 then return end if hslot == 6 then return end
compchance = minetest.get_item_group(itemcomp[hslot]:get_name(), "compostability") compchance = minetest.get_item_group(itemcomp[hslot]:get_name(), "compostability")
if compchance == 0 then if compchance == 0 then
hslot = hslot+1 hslot = hslot+1
if hslot == 6 then return end if hslot == 6 then return end
compchance = minetest.get_item_group(itemcomp[hslot]:get_name(), "compostability") compchance = minetest.get_item_group(itemcomp[hslot]:get_name(), "compostability")
end end
end end
end end
end end
if compchance > 0 then if compchance > 0 then
itemcomp[hslot]:take_item() itemcomp[hslot]:take_item()
inv:set_list("main", itemcomp) inv:set_list("main", itemcomp)
local rand = math.random(0,100) local rand = math.random(0,100)
if compchance >= rand then if compchance >= rand then
local level = 0 local level = 0
if downnode.name == "mcl_composters:composter_1" then if downnode.name == "mcl_composters:composter_1" then
level = 1 level = 1
elseif downnode.name == "mcl_composters:composter_2" then elseif downnode.name == "mcl_composters:composter_2" then
level = 2 level = 2
elseif downnode.name == "mcl_composters:composter_3" then elseif downnode.name == "mcl_composters:composter_3" then
level = 3 level = 3
elseif downnode.name == "mcl_composters:composter_4" then elseif downnode.name == "mcl_composters:composter_4" then
level = 4 level = 4
elseif downnode.name == "mcl_composters:composter_5" then elseif downnode.name == "mcl_composters:composter_5" then
level = 5 level = 5
elseif downnode.name == "mcl_composters:composter_6" then elseif downnode.name == "mcl_composters:composter_6" then
level = 6 level = 6
elseif downnode.name == "mcl_composters:composter_7" then elseif downnode.name == "mcl_composters:composter_7" then
level = 7 level = 7
end end
mcl_dye.add_bone_meal_particle(vector.offset(downpos, 0, level/8, 0)) mcl_dye.add_bone_meal_particle(vector.offset(downpos, 0, level/8, 0))
if level < 7 then if level < 7 then
level = level + 1 level = level + 1
else else
level = "ready" level = "ready"
end end
minetest.swap_node(downpos, {name="mcl_composters:composter_" .. level}) minetest.swap_node(downpos, {name="mcl_composters:composter_" .. level})
end end
end end
end end