code freeze for adding consumer model
This commit is contained in:
parent
04bd91b6e7
commit
e8c5f02c64
@ -23,12 +23,12 @@ techage.register_node("default:chest", {"default:chest_open"}, {
|
||||
on_push_item = function(pos, in_dir, stack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return techage.put_item(inv, "main", stack)
|
||||
return techage.put_items(inv, "main", stack)
|
||||
end,
|
||||
on_unpull_item = function(pos, in_dir, stack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return techage.put_item(inv, "main", stack)
|
||||
return techage.put_items(inv, "main", stack)
|
||||
end,
|
||||
})
|
||||
|
||||
@ -43,14 +43,14 @@ techage.register_node("default:furnace", {"default:furnace_active"}, {
|
||||
local inv = meta:get_inventory()
|
||||
minetest.get_node_timer(pos):start(1.0)
|
||||
if minetest.get_craft_result({method="fuel", width=1, items={stack}}).time ~= 0 then
|
||||
return techage.put_item(inv, "fuel", stack)
|
||||
return techage.put_items(inv, "fuel", stack)
|
||||
else
|
||||
return techage.put_item(meta, "src", stack)
|
||||
return techage.put_items(meta, "src", stack)
|
||||
end
|
||||
end,
|
||||
on_unpull_item = function(pos, side, stack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return techage.put_item(meta, "dst", stack)
|
||||
return techage.put_items(meta, "dst", stack)
|
||||
end,
|
||||
})
|
||||
|
@ -29,7 +29,6 @@ local M = minetest.get_meta
|
||||
-- Techage Related Data
|
||||
local TRD = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).techage end
|
||||
local TRDN = function(node) return (minetest.registered_nodes[node.name] or {}).techage end
|
||||
|
||||
-- Load support for intllib.
|
||||
local MP = minetest.get_modpath("tubelib2")
|
||||
local I,_ = dofile(MP.."/intllib.lua")
|
||||
@ -41,7 +40,7 @@ local CYCLE_TIME = 2
|
||||
local function pushing(pos, trd, meta, mem)
|
||||
local pull_dir = meta:get_int("pull_dir")
|
||||
local push_dir = meta:get_int("push_dir")
|
||||
local items = techage.pull_items(pos, pull_dir, TRD(pos).num_items)
|
||||
local items = techage.pull_items(pos, pull_dir, trd.num_items)
|
||||
if items ~= nil then
|
||||
if techage.push_items(pos, push_dir, items) == false then
|
||||
-- place item back
|
||||
@ -98,8 +97,8 @@ local function register_pusher(stage, num_items)
|
||||
"techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png",
|
||||
"techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png^techage_appl_outp.png",
|
||||
"techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png^techage_appl_inp.png",
|
||||
"techage_pusher.png^[transformR180]^techage_frame_ta"..stage..".png",
|
||||
"techage_pusher.png^techage_frame_ta"..stage..".png",
|
||||
"techage_appl_pusher.png^[transformR180]^techage_frame_ta"..stage..".png",
|
||||
"techage_appl_pusher.png^techage_frame_ta"..stage..".png",
|
||||
},
|
||||
|
||||
techage = {
|
||||
@ -141,7 +140,7 @@ local function register_pusher(stage, num_items)
|
||||
"techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png^techage_appl_outp.png",
|
||||
"techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png^techage_appl_inp.png",
|
||||
{
|
||||
image = "techage_pusher14.png^[transformR180]^techage_frame14_ta"..stage..".png",
|
||||
image = "techage_appl_pusher14.png^[transformR180]^techage_frame14_ta"..stage..".png",
|
||||
backface_culling = false,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
@ -151,7 +150,7 @@ local function register_pusher(stage, num_items)
|
||||
},
|
||||
},
|
||||
{
|
||||
image = "techage_pusher14.png^techage_frame14_ta"..stage..".png",
|
||||
image = "techage_appl_pusher14.png^techage_frame14_ta"..stage..".png",
|
||||
backface_culling = false,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
@ -184,12 +183,12 @@ local function register_pusher(stage, num_items)
|
||||
description = "TA"..stage.." Pusher",
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
'tubelib_pusher1.png',
|
||||
'tubelib_pusher1.png',
|
||||
'tubelib_outp.png^tubelib_defect.png',
|
||||
'tubelib_inp.png^tubelib_defect.png',
|
||||
"tubelib_pusher1.png^[transformR180]^tubelib_defect.png",
|
||||
"tubelib_pusher1.png^tubelib_defect.png",
|
||||
"techage_filling_ta"..stage..".png^techage_frame_ta"..stage.."_top.png^techage_appl_arrow.png",
|
||||
"techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png",
|
||||
"techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png^techage_appl_outp.png^tubelib_defect.png",
|
||||
"techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png^techage_appl_inp.png^tubelib_defect.png",
|
||||
"techage_appl_pusher.png^[transformR180]^techage_frame_ta"..stage..".png^tubelib_defect.png",
|
||||
"techage_appl_pusher.png^techage_frame_ta"..stage..".png^tubelib_defect.png",
|
||||
},
|
||||
|
||||
techage = {
|
||||
@ -218,21 +217,14 @@ local function register_pusher(stage, num_items)
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "tubelib:pusher 2",
|
||||
recipe = {
|
||||
{"group:wood", "wool:dark_green", "group:wood"},
|
||||
{"tubelib:tubeS", "default:mese_crystal", "tubelib:tubeS"},
|
||||
{"group:wood", "wool:dark_green", "group:wood"},
|
||||
},
|
||||
})
|
||||
|
||||
if stage == 2 then
|
||||
techage.register_node("techage:ta"..stage.."_pusher",
|
||||
{"techage:ta"..stage.."_pusher_active", "techage:ta"..stage.."_pusher_defect"}, {
|
||||
is_pusher = true, -- is a pulling/pushing node
|
||||
|
||||
on_recv_message = function(pos, topic, payload)
|
||||
return "unsupported"
|
||||
end,
|
||||
on_node_load = function(pos)
|
||||
TRD(pos).State:on_node_load(pos)
|
||||
end,
|
||||
@ -267,3 +259,11 @@ register_pusher(2, 2)
|
||||
register_pusher(3, 6)
|
||||
register_pusher(4, 18)
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:ta2_pusher 2",
|
||||
recipe = {
|
||||
{"group:wood", "wool:dark_green", "group:wood"},
|
||||
{"tubelib:tubeS", "default:mese_crystal", "tubelib:tubeS"},
|
||||
{"group:wood", "wool:dark_green", "group:wood"},
|
||||
},
|
||||
})
|
||||
|
@ -127,6 +127,10 @@ end
|
||||
|
||||
techage.side_to_outdir = side_to_dir
|
||||
|
||||
function techage.side_to_indir(side, param2)
|
||||
return tubelib2.Turn180Deg[side_to_dir(side, param2)]
|
||||
end
|
||||
|
||||
local function get_dest_node(pos, out_dir)
|
||||
local spos, in_dir = Tube:get_connected_node_pos(pos, out_dir)
|
||||
local _,node = Tube:get_node(spos)
|
||||
@ -372,7 +376,7 @@ end
|
||||
|
||||
-- Put the given stack into the given ItemList.
|
||||
-- Function returns false if ItemList is full.
|
||||
function techage.put_item(inv, listname, stack)
|
||||
function techage.put_items(inv, listname, stack)
|
||||
if inv:room_for_item(listname, stack) then
|
||||
inv:add_item(listname, stack)
|
||||
return true
|
||||
|
@ -211,9 +211,10 @@ function NodeStates:start(pos, mem, called_from_on_timer)
|
||||
if self.formspec_func then
|
||||
M(pos):set_string("formspec", self.formspec_func(self, pos, mem))
|
||||
end
|
||||
if not minetest.get_node_timer(pos):is_started() then
|
||||
minetest.get_node_timer(pos):start(self.cycle_time)
|
||||
if minetest.get_node_timer(pos):is_started() then
|
||||
minetest.get_node_timer(pos):stop()
|
||||
end
|
||||
minetest.get_node_timer(pos):start(self.cycle_time)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
@ -234,6 +235,9 @@ function NodeStates:standby(pos, mem)
|
||||
if self.formspec_func then
|
||||
M(pos):set_string("formspec", self.formspec_func(self, pos, mem))
|
||||
end
|
||||
if minetest.get_node_timer(pos):is_started() then
|
||||
minetest.get_node_timer(pos):stop()
|
||||
end
|
||||
minetest.get_node_timer(pos):start(self.cycle_time * self.standby_ticks)
|
||||
return true
|
||||
end
|
||||
@ -256,6 +260,9 @@ function NodeStates:blocked(pos, mem)
|
||||
if self.formspec_func then
|
||||
M(pos):set_string("formspec", self.formspec_func(self, pos, mem))
|
||||
end
|
||||
if minetest.get_node_timer(pos):is_started() then
|
||||
minetest.get_node_timer(pos):stop()
|
||||
end
|
||||
minetest.get_node_timer(pos):start(self.cycle_time * self.standby_ticks)
|
||||
return true
|
||||
end
|
||||
|
1
init.lua
1
init.lua
@ -37,6 +37,7 @@ dofile(MP.."/electric/consumer.lua")
|
||||
|
||||
dofile(MP.."/basic_machines/pusher.lua")
|
||||
dofile(MP.."/basic_machines/legacy_nodes.lua")
|
||||
dofile(MP.."/basic_machines/grinder.lua")
|
||||
|
||||
|
||||
--dofile(MP.."/fermenter/biogas_pipe.lua")
|
||||
|
@ -5,7 +5,7 @@ print ">>> Convert"
|
||||
for filename in os.listdir("./"):
|
||||
if fnmatch.fnmatch(filename, "*.png"):
|
||||
print(filename)
|
||||
os.system("pngquant --skip-if-larger --quality=8-16 --output ./%s.new ./%s" % (filename, filename))
|
||||
os.system("pngquant --skip-if-larger --quality=8-32 --output ./%s.new ./%s" % (filename, filename))
|
||||
|
||||
print "\n>>> Copy"
|
||||
for filename in os.listdir("./"):
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 478 B After Width: | Height: | Size: 477 B |
Binary file not shown.
Before Width: | Height: | Size: 613 B After Width: | Height: | Size: 677 B |
Binary file not shown.
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 2.1 KiB |
Loading…
Reference in New Issue
Block a user