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

View File

@ -4,8 +4,8 @@ local me = microexpansion
-- [register node] Controller
me.register_node("ctrl", {
description = "Power Controller",
tiles = {
description = "Power Controller",
tiles = {
"ctrl_sides",
"ctrl_bottom",
"ctrl_sides",
@ -13,8 +13,8 @@ me.register_node("ctrl", {
"ctrl_sides",
"ctrl_sides"
},
drawtype = "nodebox",
paramtype = "light",
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
@ -31,29 +31,29 @@ me.register_node("ctrl", {
{-0.1875, -0.5, -0.1875, 0.1875, -0.25, 0.1875}, -- Bottom2
},
},
groups = { cracky = 1, me_connect = 1, },
connect_sides = "nobottom",
status = "no",
groups = { cracky = 1, me_connect = 1, },
connect_sides = "nobottom",
status = "no",
})
-- [register node] Cable
me.register_node("cable", {
description = "ME Cable",
tiles = {
"cable",
},
drawtype = "nodebox",
node_box = {
type = "connected",
fixed = {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25},
description = "ME Cable",
tiles = {
"cable",
},
drawtype = "nodebox",
node_box = {
type = "connected",
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_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_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_right = {-0.25, -0.25, -0.25, 0.5, 0.25, 0.25}, -- x+
},
connects_to = {"group:me_connect"},
groups = { crumbly = 1, me_connect = 1, },
status = "no",
},
connects_to = {"group:me_connect"},
groups = { crumbly = 1, me_connect = 1, },
status = "no",
})

View File

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

View File

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

View File

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

View File

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