outsource smelter/furnace to new sub-mod md_technic

master
ademant 2019-02-01 09:50:19 +01:00
parent 65134ecb54
commit 0201d9c5fa
13 changed files with 1421 additions and 21 deletions

View File

@ -1,5 +1,5 @@
title = Minerdream Awards title = Minerdream Awards
namee = md_awards name = md_awards
author = ademant author = ademant
description = Extension of mod minerdream description = Extension of mod minerdream
depends = default,minerdream,awards depends = default,minerdream,awards

4
md_technic/config.lua Normal file
View File

@ -0,0 +1,4 @@
md_technic.smelter_refractory_duration = tonumber(minetest.settings:get("md_technic.smelter_refractory_duration")) or 5000
md_technic.smelter_min_burntime= tonumber(minetest.settings:get("md_technic.smelter_min_burntime")) or 30
md_technic.smelter_speedup = tonumber(minetest.settings:get("md_technic.smelter_speedup")) or 1.5

6
md_technic/init.lua Normal file
View File

@ -0,0 +1,6 @@
md_technic = {}
md_technic.path = minetest.get_modpath("md_technic")
md_technic.modname = minetest.get_current_modname()
dofile(md_technic.path .. "/furnace.lua")
dofile(md_technic.path .. "/smelter.lua")

15
md_technic/license.txt Normal file
View File

@ -0,0 +1,15 @@
License of source code
----------------------
The MIT License (MIT)
Copyright 2018 ademant
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
For more details:
https://opensource.org/licenses/mit-license.php

7
md_technic/mod.conf Normal file
View File

@ -0,0 +1,7 @@
title = Minerdream Technics
name = md_technic
author = ademant
description = Extension of mod minerdream with some technic
depends = default,minerdream,technic
license = MIT
version = 1.0.0

1370
md_technic/nohup.out Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
md_technic.smelter_refractory_duration (Smelting time the refractory lasts) int 6000 600 50000
md_technic.smelter_min_burntime (Min. burntime of fuel for smelter) int 30 10 100
md_technic.smelter_speedup (Speedup of smelter) float 1.5

View File

@ -1,6 +1,6 @@
minetest.register_craft({ minetest.register_craft({
output = 'minerdream:smelter', output = 'md_technic:smelter',
recipe = { recipe = {
{'default:steel_ingot', 'group:stone', 'default:steel_ingot'}, {'default:steel_ingot', 'group:stone', 'default:steel_ingot'},
{'group:stone', '', 'group:stone'}, {'group:stone', '', 'group:stone'},
@ -9,7 +9,7 @@ minetest.register_craft({
}) })
local M=minerdream local M=md_technic
-- --
-- Formspecs -- Formspecs
-- --
@ -167,7 +167,7 @@ local function smelter_node_timer(pos, elapsed)
-- is refrac slot filled or empty? -- is refrac slot filled or empty?
if not inv:is_empty("refrac") and (refraclist[1]:get_name() == "default:clay_brick") then if not inv:is_empty("refrac") and (refraclist[1]:get_name() == "default:clay_brick") then
inv:remove_item("refrac",ItemStack("default:clay_brick")) inv:remove_item("refrac",ItemStack("default:clay_brick"))
refrac_time=refrac_time + minerdream.smelter_refractory_duration refrac_time=refrac_time + M.smelter_refractory_duration
else else
cookable = false cookable = false
end end
@ -236,7 +236,7 @@ local function smelter_node_timer(pos, elapsed)
local formspec local formspec
local item_state local item_state
local item_percent = 0 local item_percent = 0
local refrac_percent = math.min(100, math.floor (refrac_time / minerdream.smelter_refractory_duration * 100)) local refrac_percent = math.min(100, math.floor (refrac_time / M.smelter_refractory_duration * 100))
local refrac_state = refrac_percent.."%" local refrac_state = refrac_percent.."%"
if cookable then if cookable then
item_percent = math.floor(src_time / cooked.time * 100) item_percent = math.floor(src_time / cooked.time * 100)
@ -262,7 +262,7 @@ local function smelter_node_timer(pos, elapsed)
local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100) local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100)
fuel_state = fuel_percent .. "%" fuel_state = fuel_percent .. "%"
formspec = M.get_smelter_active_formspec(fuel_percent, item_percent, refrac_percent) formspec = M.get_smelter_active_formspec(fuel_percent, item_percent, refrac_percent)
swap_node(pos, "minerdream:smelter_active") swap_node(pos, "md_technic:smelter_active")
-- make sure timer restarts automatically -- make sure timer restarts automatically
result = true result = true
else else
@ -270,7 +270,7 @@ local function smelter_node_timer(pos, elapsed)
fuel_state = "0%" fuel_state = "0%"
end end
formspec = M.get_smelter_inactive_formspec(refrac_percent) formspec = M.get_smelter_inactive_formspec(refrac_percent)
swap_node(pos, "minerdream:smelter") swap_node(pos, "md_technic:smelter")
-- stop timer on the inactive furnace -- stop timer on the inactive furnace
minetest.get_node_timer(pos):stop() minetest.get_node_timer(pos):stop()
end end
@ -295,7 +295,7 @@ end
-- Node definitions -- Node definitions
-- --
minetest.register_node("minerdream:smelter", { minetest.register_node("md_technic:smelter", {
description = "Smelter", description = "Smelter",
tiles = { tiles = {
"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_top.png", "default_furnace_bottom.png",
@ -314,7 +314,7 @@ minetest.register_node("minerdream:smelter", {
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("formspec", M.get_smelter_inactive_formspec()) meta:set_string("formspec", M.get_smelter_inactive_formspec(0))
local inv = meta:get_inventory() local inv = meta:get_inventory()
inv:set_size('src', 1) inv:set_size('src', 1)
inv:set_size('fuel', 1) inv:set_size('fuel', 1)
@ -335,7 +335,7 @@ minetest.register_node("minerdream:smelter", {
default.get_inventory_drops(pos, "refrac", drops) default.get_inventory_drops(pos, "refrac", drops)
default.get_inventory_drops(pos, "fuel", drops) default.get_inventory_drops(pos, "fuel", drops)
default.get_inventory_drops(pos, "dst", drops) default.get_inventory_drops(pos, "dst", drops)
drops[#drops+1] = "minerdream:smelter" drops[#drops+1] = "md_technic:smelter"
minetest.remove_node(pos) minetest.remove_node(pos)
return drops return drops
end, end,
@ -345,7 +345,7 @@ minetest.register_node("minerdream:smelter", {
allow_metadata_inventory_take = allow_metadata_inventory_take, allow_metadata_inventory_take = allow_metadata_inventory_take,
}) })
minetest.register_node("minerdream:smelter_active", { minetest.register_node("md_technic:smelter_active", {
description = "Smelter", description = "Smelter",
tiles = { tiles = {
"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_top.png", "default_furnace_bottom.png",
@ -364,7 +364,7 @@ minetest.register_node("minerdream:smelter_active", {
}, },
paramtype2 = "facedir", paramtype2 = "facedir",
light_source = 8, light_source = 8,
drop = "minerdream:smelter", drop = "md_technic:smelter",
groups = {cracky=2, not_in_creative_inventory=1}, groups = {cracky=2, not_in_creative_inventory=1},
legacy_facedir_simple = true, legacy_facedir_simple = true,
is_ground_content = false, is_ground_content = false,

View File

@ -4,9 +4,6 @@ local viscosity=1
minerdream.ingot_stack_max = tonumber(minetest.settings:get("minerdream.ingot_stack_max")) or 250 minerdream.ingot_stack_max = tonumber(minetest.settings:get("minerdream.ingot_stack_max")) or 250
minerdream.lump_stack_max = tonumber(minetest.settings:get("minerdream.lump_stack_max")) or 999 minerdream.lump_stack_max = tonumber(minetest.settings:get("minerdream.lump_stack_max")) or 999
minerdream.dust_cooking_time_reduce = tonumber(minetest.settings:get("minerdream.dust_cooking_time_reduce")) or 2 minerdream.dust_cooking_time_reduce = tonumber(minetest.settings:get("minerdream.dust_cooking_time_reduce")) or 2
minerdream.smelter_refractory_duration = tonumber(minetest.settings:get("minerdream.smelter_refractory_duration")) or 5000
minerdream.smelter_min_burntime= tonumber(minetest.settings:get("minerdream.smelter_min_burntime")) or 30
minerdream.smelter_speedup = tonumber(minetest.settings:get("minerdream.smelter_speedup")) or 1.5
minerdream.steel_wire="minerdream:steel_wire" minerdream.steel_wire="minerdream:steel_wire"
if minetest.get_modpath("basic_materials") == nil then if minetest.get_modpath("basic_materials") == nil then

View File

@ -24,8 +24,6 @@ dofile(minerdream.path .. "/treasure.lua")
dofile(minerdream.path .. "/experiments.lua") dofile(minerdream.path .. "/experiments.lua")
--dofile(minerdream.path .. "/mobs.lua") --dofile(minerdream.path .. "/mobs.lua")
dofile(minerdream.path .. "/read_mobs_config.lua") dofile(minerdream.path .. "/read_mobs_config.lua")
dofile(minerdream.path .. "/smelter.lua")
dofile(minerdream.path .. "/furnace.lua")
minetest.log("action", "[MOD]"..minetest.get_current_modname().." -- loaded ") minetest.log("action", "[MOD]"..minetest.get_current_modname().." -- loaded ")

View File

@ -158,6 +158,7 @@ for i,tdef in pairs(miner_definition) do
end end
end end
if (i ~= "default") and (is_enabled) then if (i ~= "default") and (is_enabled) then
local starttime=os.clock()
minerdream.items[i]={} minerdream.items[i]={}
local ore_modname=minerdream.modname local ore_modname=minerdream.modname
if tdef.orig_modname then if tdef.orig_modname then
@ -481,7 +482,9 @@ for i,tdef in pairs(miner_definition) do
end end
end end
end end
print("minerdream registering "..i.." in "..(math.floor(1000000*(os.clock()-starttime))/1000).." milliseconds")
else
print("minerdream: "..i.." not enabled")
end end
end end

View File

@ -1,6 +1,3 @@
minerdream.ingot_stack_max (Max stack for ingots) int 250 99 1000 minerdream.ingot_stack_max (Max stack for ingots) int 250 99 1000
minerdream.lump_stack_max (Max stack for lumps) int 999 99 1000 minerdream.lump_stack_max (Max stack for lumps) int 999 99 1000
minerdream.dust_cooking_time_reduce (Recucing factor for cooking dust instead of lump) float 2 1 5 minerdream.dust_cooking_time_reduce (Recucing factor for cooking dust instead of lump) float 2 1 5
minerdream.smelter_refractory_duration (Smelting time the refractory lasts) int 6000 600 50000
minerdream.smelter_min_burntime (Min. burntime of fuel for smelter) int 30 10 100
minerdream.smelter_speedup (Speedup of smelter) float 1.5