again replace space indents with tabs and co.

This commit is contained in:
DS-Minetest 2017-07-29 17:59:48 +02:00
parent 307688744f
commit bd8107500b
7 changed files with 176 additions and 182 deletions

View File

@ -4,42 +4,42 @@ local me = microexpansion
-- [register] Incranium Ore -- [register] Incranium Ore
me.register_node("incranium", { me.register_node("incranium", {
description = "Incranium Ore", description = "Incranium Ore",
tiles = { "incranium" }, tiles = { "incranium" },
is_ground_content = true, is_ground_content = true,
groups = { cracky=3, stone=1 }, groups = { cracky=3, stone=1 },
type = "ore", type = "ore",
oredef = { oredef = {
{ {
ore_type = "blob", ore_type = "blob",
wherein = "default:stone", wherein = "default:stone",
clust_scarcity = 4*4*4, clust_scarcity = 4*4*4,
clust_num_ores = 4, clust_num_ores = 4,
clust_size = 3, clust_size = 3,
y_min = -300, y_min = -300,
y_max = -90, y_max = -90,
}, },
}, },
disabled = true, disabled = true,
}) })
-- "Supernatet", pronounced "Super-nat-et" is Latin for "float", this ore will -- "Supernatet", pronounced "Super-nat-et" is Latin for "float", this ore will
-- float up if there are no blocks above it, so be careful! -- float up if there are no blocks above it, so be careful!
-- Supernatet ore will be used to craft wings of flight -- Supernatet ore will be used to craft wings of flight
me.register_node("supernatet", { me.register_node("supernatet", {
description = "Supernatant Ore", description = "Supernatant Ore",
tiles = { "default_stone.png^microexpansion_ore_supernatet.png" }, tiles = { "default_stone.png^microexpansion_ore_supernatet.png" },
is_ground_content = true, is_ground_content = true,
type = "ore", type = "ore",
groups = { cracky=3, stone=1 }, groups = { cracky=3, stone=1 },
oredef = { oredef = {
ore_type = "blob", ore_type = "blob",
wherein = "default:stone", wherein = "default:stone",
clust_scarcity = 4*4*4, clust_scarcity = 4*4*4,
clust_num_ores = 4, clust_num_ores = 4,
clust_size = 3, clust_size = 3,
y_min = -300, y_min = -300,
y_max = -90, y_max = -90,
}, },
status = "unstable", status = "unstable",
}) })

View File

@ -4,8 +4,8 @@ local me = microexpansion
-- [register node] Controller -- [register node] Controller
me.register_node("ctrl", { me.register_node("ctrl", {
description = "Power Controller", description = "Power Controller",
tiles = { tiles = {
"ctrl_sides", "ctrl_sides",
"ctrl_bottom", "ctrl_bottom",
"ctrl_sides", "ctrl_sides",
@ -13,8 +13,8 @@ me.register_node("ctrl", {
"ctrl_sides", "ctrl_sides",
"ctrl_sides" "ctrl_sides"
}, },
drawtype = "nodebox", drawtype = "nodebox",
paramtype = "light", paramtype = "light",
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = { fixed = {
@ -31,29 +31,29 @@ me.register_node("ctrl", {
{-0.1875, -0.5, -0.1875, 0.1875, -0.25, 0.1875}, -- Bottom2 {-0.1875, -0.5, -0.1875, 0.1875, -0.25, 0.1875}, -- Bottom2
}, },
}, },
groups = { cracky = 1, me_connect = 1, }, groups = { cracky = 1, me_connect = 1, },
connect_sides = "nobottom", connect_sides = "nobottom",
status = "no", status = "no",
}) })
-- [register node] Cable -- [register node] Cable
me.register_node("cable", { me.register_node("cable", {
description = "ME Cable", description = "ME Cable",
tiles = { tiles = {
"cable", "cable",
}, },
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
type = "connected", type = "connected",
fixed = {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25}, fixed = {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25},
connect_top = {-0.25, -0.25, -0.25, 0.25, 0.5, 0.25}, -- y+ connect_top = {-0.25, -0.25, -0.25, 0.25, 0.5, 0.25}, -- y+
connect_bottom = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25}, -- y- connect_bottom = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25}, -- y-
connect_front = {-0.25, -0.25, -0.5, 0.25, 0.25, 0.25}, -- z- connect_front = {-0.25, -0.25, -0.5, 0.25, 0.25, 0.25}, -- z-
connect_back = {-0.25, -0.25, 0.25, 0.25, 0.25, 0.5 }, -- z+ connect_back = {-0.25, -0.25, 0.25, 0.25, 0.25, 0.5 }, -- z+
connect_left = {-0.5, -0.25, -0.25, 0.25, 0.25, 0.25}, -- x- connect_left = {-0.5, -0.25, -0.25, 0.25, 0.25, 0.25}, -- x-
connect_right = {-0.25, -0.25, -0.25, 0.5, 0.25, 0.25}, -- x+ connect_right = {-0.25, -0.25, -0.25, 0.5, 0.25, 0.25}, -- x+
}, },
connects_to = {"group:me_connect"}, connects_to = {"group:me_connect"},
groups = { crumbly = 1, me_connect = 1, }, groups = { crumbly = 1, me_connect = 1, },
status = "no", status = "no",
}) })

View File

@ -4,33 +4,33 @@ local me = microexpansion
-- [register node] Fuel Fired Generator -- [register node] Fuel Fired Generator
me.register_node("fuel_fired_generator", { me.register_node("fuel_fired_generator", {
description = "Fuel-Fired Generator", description = "Fuel-Fired Generator",
tiles = { tiles = {
"machine_sides", "machine_sides",
"machine_sides", "machine_sides",
"machine_sides", "machine_sides",
"machine_sides", "machine_sides",
"machine_sides", "machine_sides",
"fuelgen_front", "fuelgen_front",
}, },
recipe = { recipe = {
{ 1, { { 1, {
{ "default:steel_ingot", "default:furnace", "default:steel_ingot" }, { "default:steel_ingot", "default:furnace", "default:steel_ingot" },
{"default:steel_ingot", "microexpansion:machine_casing", "default:steel_ingot" }, {"default:steel_ingot", "microexpansion:machine_casing", "default:steel_ingot" },
{ "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" }, { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" },
}, },
} }
}, },
groups = { cracky = 1, me_connect = 1, }, groups = { cracky = 1, me_connect = 1, },
connect_sides = "machine", connect_sides = "machine",
paramtype2 = "facedir", paramtype2 = "facedir",
status = "no", status = "no",
}) })
-- [register node] Super Smelter -- [register node] Super Smelter
me.register_node("super_smelter", { me.register_node("super_smelter", {
description = "Super Smelter", description = "Super Smelter",
tiles = { tiles = {
"machine_sides", "machine_sides",
"machine_sides", "machine_sides",
"machine_sides", "machine_sides",
@ -38,24 +38,24 @@ me.register_node("super_smelter", {
"machine_sides", "machine_sides",
"super_smelter_front", "super_smelter_front",
}, },
recipe = { recipe = {
{ 1, { { 1, {
{ "default:furnace", "default:furnace", "default:furnace" }, { "default:furnace", "default:furnace", "default:furnace" },
{ "default:steel_ingot", "microexpansion:machine_casing", "default:steel_ingot" }, { "default:steel_ingot", "microexpansion:machine_casing", "default:steel_ingot" },
{ "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" }, { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" },
}, },
}, },
}, },
groups = { cracky = 1, me_connect = 1, }, groups = { cracky = 1, me_connect = 1, },
connect_sides = "machine", connect_sides = "machine",
paramtype2 = "facedir", paramtype2 = "facedir",
status = "no", status = "no",
}) })
-- [register item] Geothermal Generator -- [register item] Geothermal Generator
me.register_node("geo_generator", { me.register_node("geo_generator", {
description = "Geothermal Generator", description = "Geothermal Generator",
tiles = { tiles = {
"machine_sides", "machine_sides",
"machine_sides", "machine_sides",
"machine_sides", "machine_sides",
@ -63,8 +63,8 @@ me.register_node("geo_generator", {
"machine_sides", "machine_sides",
"geogen_front", "geogen_front",
}, },
groups = { cracky = 1, me_connect = 1, }, groups = { cracky = 1, me_connect = 1, },
connect_sides = "machine", connect_sides = "machine",
paramtype2 = "facedir", paramtype2 = "facedir",
status = "no", status = "no",
}) })

View File

@ -7,24 +7,18 @@ local me = microexpansion
-- [register item] Steel Infused Obsidian Ingot -- [register item] Steel Infused Obsidian Ingot
me.register_item("steel_infused_obsidian_ingot", { me.register_item("steel_infused_obsidian_ingot", {
description = "Steel Infused Obsidian Ingot", description = "Steel Infused Obsidian Ingot",
recipe = { recipe = {{1, {
{ 1, { {"default:steel_ingot", "default:obsidian_shard", "default:steel_ingot"}}}
{ "default:steel_ingot", "default:obsidian_shard", "default:steel_ingot" }, }
},
},
},
}) })
-- [register item] Machine Casing -- [register item] Machine Casing
me.register_item("machine_casing", { me.register_item("machine_casing", {
description = "Machine Casing", description = "Machine Casing",
recipe = { recipe = {{1, {
{ 1, { {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}, {"default:steel_ingot", "default:copper_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:copper_ingot", "default:steel_ingot"}, {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}, }}}
},
},
},
}) })

View File

@ -4,97 +4,97 @@ local BASENAME = "microexpansion"
-- [function] register cell -- [function] register cell
function microexpansion.register_cell(itemstring, def) function microexpansion.register_cell(itemstring, def)
if not def.inventory_image then if not def.inventory_image then
def.inventory_image = itemstring def.inventory_image = itemstring
end end
-- register craftitem -- register craftitem
minetest.register_craftitem(BASENAME..":"..itemstring, { minetest.register_craftitem(BASENAME..":"..itemstring, {
description = def.description, description = def.description,
inventory_image = BASENAME.."_"..def.inventory_image..".png", inventory_image = BASENAME.."_"..def.inventory_image..".png",
groups = {microexpansion_cell = 1}, groups = {microexpansion_cell = 1},
stack_max = 1, stack_max = 1,
microexpansion = { microexpansion = {
base_desc = def.description, base_desc = def.description,
drive = { drive = {
capacity = def.capacity or 5000, capacity = def.capacity or 5000,
}, },
}, },
}) })
-- if recipe, register recipe -- if recipe, register recipe
if def.recipe then if def.recipe then
-- if recipe, register recipe -- if recipe, register recipe
if def.recipe then if def.recipe then
microexpansion.register_recipe(BASENAME..":"..itemstring, def.recipe) microexpansion.register_recipe(BASENAME..":"..itemstring, def.recipe)
end end
end end
end end
-- [function] Get cell size -- [function] Get cell size
function microexpansion.get_cell_size(name) function microexpansion.get_cell_size(name)
local item = minetest.registered_craftitems[name] local item = minetest.registered_craftitems[name]
if item then if item then
return item.microexpansion.drive.capacity return item.microexpansion.drive.capacity
end end
end end
-- [function] Calculate max stacks -- [function] Calculate max stacks
function microexpansion.int_to_stacks(int) function microexpansion.int_to_stacks(int)
return math.floor(int / 99) return math.floor(int / 99)
end end
-- [function] Calculate number of pages -- [function] Calculate number of pages
function microexpansion.int_to_pagenum(int) function microexpansion.int_to_pagenum(int)
return math.floor(microexpansion.int_to_stacks(int) / 32) return math.floor(microexpansion.int_to_stacks(int) / 32)
end end
-- [function] Move items from inv to inv -- [function] Move items from inv to inv
function microexpansion.move_inv(inv1, inv2) function microexpansion.move_inv(inv1, inv2)
local finv, tinv = inv1.inv, inv2.inv local finv, tinv = inv1.inv, inv2.inv
local fname, tname = inv1.name, inv2.name local fname, tname = inv1.name, inv2.name
for i,v in ipairs(finv:get_list(fname) or {}) do for i,v in ipairs(finv:get_list(fname) or {}) do
if tinv and tinv:room_for_item(tname, v) then if tinv and tinv:room_for_item(tname, v) then
local leftover = tinv:add_item( tname, v ) local leftover = tinv:add_item( tname, v )
finv:remove_item(fname, v) finv:remove_item(fname, v)
if leftover and not(leftover:is_empty()) then if leftover and not(leftover:is_empty()) then
finv:add_item(fname, v) finv:add_item(fname, v)
end end
end end
end end
end end
-- [function] Update cell description -- [function] Update cell description
function microexpansion.cell_desc(inv, listname, spos) function microexpansion.cell_desc(inv, listname, spos)
local stack = inv:get_stack(listname, spos) local stack = inv:get_stack(listname, spos)
if stack:get_name() ~= "" then if stack:get_name() ~= "" then
local meta = stack:get_meta() local meta = stack:get_meta()
local base_desc = minetest.registered_craftitems[stack:get_name()].microexpansion.base_desc local base_desc = minetest.registered_craftitems[stack:get_name()].microexpansion.base_desc
local max_slots = inv:get_size("main") local max_slots = inv:get_size("main")
local max_items = math.floor(max_slots * 99) local max_items = math.floor(max_slots * 99)
local slots, items = 0, 0 local slots, items = 0, 0
-- Get amount of items in drive -- Get amount of items in drive
for i = 1, max_items do for i = 1, max_items do
local stack = inv:get_stack("main", i) local stack = inv:get_stack("main", i)
local item = stack:get_name() local item = stack:get_name()
if item ~= "" then if item ~= "" then
slots = slots + 1 slots = slots + 1
local num = stack:get_count() local num = stack:get_count()
if num == 0 then num = 1 end if num == 0 then num = 1 end
items = items + num items = items + num
end end
end end
-- Calculate Percentage -- Calculate Percentage
local percent = math.floor(items / max_items * 100) local percent = math.floor(items / max_items * 100)
-- Update description -- Update description
meta:set_string("description", base_desc.."\n".. meta:set_string("description", base_desc.."\n"..
minetest.colorize("grey", tostring(items).."/"..tostring(max_items).." Items ("..tostring(percent).."%)")) minetest.colorize("grey", tostring(items).."/"..tostring(max_items).." Items ("..tostring(percent).."%)"))
-- Update stack -- Update stack
inv:set_stack(listname, spos, stack) inv:set_stack(listname, spos, stack)
end end
end end

View File

@ -2,24 +2,24 @@
-- [drive] 8k -- [drive] 8k
microexpansion.register_cell("cell_8k", { microexpansion.register_cell("cell_8k", {
description = "8k ME Storage Cell", description = "8k ME Storage Cell",
capacity = 8000, capacity = 8000,
}) })
-- [drive] 16k -- [drive] 16k
microexpansion.register_cell("cell_16k", { microexpansion.register_cell("cell_16k", {
description = "16k ME Storage Cell", description = "16k ME Storage Cell",
capacity = 16000, capacity = 16000,
}) })
-- [drive] 32k -- [drive] 32k
microexpansion.register_cell("cell_32k", { microexpansion.register_cell("cell_32k", {
description = "32k ME Storage Cell", description = "32k ME Storage Cell",
capacity = 32000, capacity = 32000,
}) })
-- [drive] 64k -- [drive] 64k
microexpansion.register_cell("cell_64k", { microexpansion.register_cell("cell_64k", {
description = "64k ME Storage Cell", description = "64k ME Storage Cell",
capacity = 64000, capacity = 64000,
}) })

View File

@ -2,9 +2,9 @@
-- [register tool] Pickaxe -- [register tool] Pickaxe
minetest.register_tool("microexpansion:xtremo_pickaxe", { minetest.register_tool("microexpansion:xtremo_pickaxe", {
description = "In Xtremo Pickaxe", description = "In Xtremo Pickaxe",
inventory_image = "microexpansion_in_xtremo_pickaxe.png", inventory_image = "microexpansion_in_xtremo_pickaxe.png",
tool_capabilities = { tool_capabilities = {
full_punch_interval = 0.9, full_punch_interval = 0.9,
max_drop_level=3, max_drop_level=3,
groupcaps={ groupcaps={
@ -16,9 +16,9 @@ minetest.register_tool("microexpansion:xtremo_pickaxe", {
-- [register tool] Axe -- [register tool] Axe
minetest.register_tool("microexpansion:xtremo_axe", { minetest.register_tool("microexpansion:xtremo_axe", {
description = "In Xtremo Axe", description = "In Xtremo Axe",
inventory_image = "microexpansion_in_xtremo_axe.png", inventory_image = "microexpansion_in_xtremo_axe.png",
tool_capabilities = { tool_capabilities = {
full_punch_interval = 0.9, full_punch_interval = 0.9,
max_drop_level=3, max_drop_level=3,
groupcaps={ groupcaps={