mirror of
				https://github.com/minetest-mods/moreblocks.git
				synced 2025-11-03 23:25:24 +01:00 
			
		
		
		
	invsaw
This commit is contained in:
		@@ -6,18 +6,6 @@ local default_stack_max = tonumber(minetest.settings:get("default_stack_max")) o
 | 
			
		||||
 | 
			
		||||
local station = {}
 | 
			
		||||
 | 
			
		||||
function station.update_infotext(pos)
 | 
			
		||||
	local node = minetest.get_node(pos)
 | 
			
		||||
	local def = minetest.registered_nodes[node.name]
 | 
			
		||||
	return def.update_infotext(pos)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function station.build_formspec(pos)
 | 
			
		||||
	local node = minetest.get_node(pos)
 | 
			
		||||
	local def = minetest.registered_nodes[node.name]
 | 
			
		||||
	return def.build_formspec(pos)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function station.get_cost(shaped_node)
 | 
			
		||||
	if shaped_node == "" then
 | 
			
		||||
		return 0
 | 
			
		||||
@@ -32,59 +20,58 @@ function station.get_cost(shaped_node)
 | 
			
		||||
	return shape_def and shape_def.eighths
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function station.get_current_node(pos)
 | 
			
		||||
	local meta = minetest.get_meta(pos)
 | 
			
		||||
	local inv = meta:get_inventory()
 | 
			
		||||
 | 
			
		||||
	local input_stack = inv:get_stack("input", 1)
 | 
			
		||||
function station.get_current_node(inv)
 | 
			
		||||
	local input_stack = inv:get_stack("stairsplus:input", 1)
 | 
			
		||||
	if not input_stack:is_empty() then
 | 
			
		||||
		return input_stack:get_name()
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	local micro_stack = inv:get_stack("micro", 1)
 | 
			
		||||
	local micro_stack = inv:get_stack("stairsplus:micro", 1)
 | 
			
		||||
	if not micro_stack:is_empty() then
 | 
			
		||||
		return api.get_node_of_shaped_node(micro_stack:get_name())
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	local recycle_stack = inv:get_stack("recycle", 1)
 | 
			
		||||
	local recycle_stack = inv:get_stack("stairsplus:recycle", 1)
 | 
			
		||||
	if not recycle_stack:is_empty() then
 | 
			
		||||
		return api.get_node_of_shaped_node(recycle_stack:get_name())
 | 
			
		||||
	end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function station.can_dig(pos)
 | 
			
		||||
	local meta = minetest.get_meta(pos)
 | 
			
		||||
	local inv = meta:get_inventory()
 | 
			
		||||
	return inv:is_empty("input") and inv:is_empty("micro")
 | 
			
		||||
function station.can_dig(meta, inv)
 | 
			
		||||
	return inv:is_empty("stairsplus:input") and inv:is_empty("stairsplus:micro")
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function station.on_receive_fields(pos, formname, fields, sender)
 | 
			
		||||
	local meta = minetest.get_meta(pos)
 | 
			
		||||
function station.on_receive_fields(meta, inv, formname, fields, sender, build_formspec, update_infotext)
 | 
			
		||||
	local max = tonumber(fields.max_offered)
 | 
			
		||||
	if max and max > 0 then
 | 
			
		||||
		meta:set_int("max_offered", max)
 | 
			
		||||
		meta:set_int("stairsplus:max_offered", max)
 | 
			
		||||
		-- Update to show the correct number of items:
 | 
			
		||||
		station.update_inventory(pos)
 | 
			
		||||
		station.update_infotext(pos)
 | 
			
		||||
		station.update_inventory(meta, inv)
 | 
			
		||||
		if update_infotext then
 | 
			
		||||
			update_infotext(meta, inv)
 | 
			
		||||
		end
 | 
			
		||||
 | 
			
		||||
		if build_formspec then
 | 
			
		||||
			meta:set_string("formspec", build_formspec(meta, inv))
 | 
			
		||||
		end
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	return not not fields.max_offered
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function station.update_inventory(pos, taken_stack)
 | 
			
		||||
	local meta = minetest.get_meta(pos)
 | 
			
		||||
	local inv = meta:get_inventory()
 | 
			
		||||
 | 
			
		||||
	local node = station.get_current_node(pos)
 | 
			
		||||
function station.update_inventory(meta, inv, taken_stack)
 | 
			
		||||
	local node = station.get_current_node(inv)
 | 
			
		||||
 | 
			
		||||
	if not node then
 | 
			
		||||
		for i = 1, inv:get_size("output") do
 | 
			
		||||
			inv:set_stack("output", i, ItemStack())
 | 
			
		||||
		for i = 1, inv:get_size("stairsplus:output") do
 | 
			
		||||
			inv:set_stack("stairsplus:output", i, ItemStack())
 | 
			
		||||
		end
 | 
			
		||||
		return
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	local input_stack = inv:get_stack("input", 1)
 | 
			
		||||
	local micro_stack = inv:get_stack("micro", 1)
 | 
			
		||||
	local recycle_stack = inv:get_stack("recycle", 1)
 | 
			
		||||
	local input_stack = inv:get_stack("stairsplus:input", 1)
 | 
			
		||||
	local micro_stack = inv:get_stack("stairsplus:micro", 1)
 | 
			
		||||
	local recycle_stack = inv:get_stack("stairsplus:recycle", 1)
 | 
			
		||||
 | 
			
		||||
	local current_value = 8 * input_stack:get_count() + micro_stack:get_count()
 | 
			
		||||
	local new_value = current_value + station.get_cost(recycle_stack:get_name()) * recycle_stack:get_count()
 | 
			
		||||
@@ -94,21 +81,20 @@ function station.update_inventory(pos, taken_stack)
 | 
			
		||||
	local new_micros = new_value % 8
 | 
			
		||||
	local new_blocks = math.floor(new_value / 8)
 | 
			
		||||
 | 
			
		||||
	inv:set_stack("input", 1, ItemStack({name = node, count = new_blocks}))
 | 
			
		||||
	inv:set_stack("micro", 1, ItemStack({name = api.get_micronode(node), count = new_micros}))
 | 
			
		||||
	inv:set_stack("recycle", 1, ItemStack())
 | 
			
		||||
	inv:set_stack("stairsplus:input", 1, ItemStack({name = node, count = new_blocks}))
 | 
			
		||||
	inv:set_stack("stairsplus:micro", 1, ItemStack({name = api.get_micronode(node), count = new_micros}))
 | 
			
		||||
	inv:set_stack("stairsplus:recycle", 1, ItemStack())
 | 
			
		||||
 | 
			
		||||
	if new_value == 0 then
 | 
			
		||||
		for i = 1, inv:get_size("output") do
 | 
			
		||||
			inv:set_stack("output", i, "")
 | 
			
		||||
		for i = 1, inv:get_size("stairsplus:output") do
 | 
			
		||||
			inv:set_stack("stairsplus:output", i, "")
 | 
			
		||||
		end
 | 
			
		||||
		return
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	local valid_shapes = api.shapes_by_node[node]
 | 
			
		||||
	local shape_groups = minetest.registered_nodes[minetest.get_node(pos).name]._stairsplus_shape_groups
 | 
			
		||||
 | 
			
		||||
	local max_offered = meta:get_int("max_offered")
 | 
			
		||||
	local max_offered = meta:get_int("stairsplus:max_offered")
 | 
			
		||||
	local shape_groups = minetest.parse_json(meta:get_string("stairsplus:shape_groups"))
 | 
			
		||||
 | 
			
		||||
	local i = 1
 | 
			
		||||
	for _, group in ipairs(shape_groups) do
 | 
			
		||||
@@ -124,41 +110,45 @@ function station.update_inventory(pos, taken_stack)
 | 
			
		||||
				else
 | 
			
		||||
					stack = ""
 | 
			
		||||
				end
 | 
			
		||||
				inv:set_stack("output", i, stack)
 | 
			
		||||
				inv:set_stack("stairsplus:output", i, stack)
 | 
			
		||||
				i = i + 1
 | 
			
		||||
			end
 | 
			
		||||
		end
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	for j = i, inv:get_size("output") do
 | 
			
		||||
		inv:set_stack("output", j, "")
 | 
			
		||||
	for j = i, inv:get_size("stairsplus:output") do
 | 
			
		||||
		inv:set_stack("stairsplus:output", j, "")
 | 
			
		||||
	end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function station.on_metadata_inventory_put(pos, listname, index, stack, player)
 | 
			
		||||
	station.update_inventory(pos)
 | 
			
		||||
	station.update_infotext(pos)
 | 
			
		||||
function station.on_inventory_put(meta, inv, listname, index, stack, player, update_infotext)
 | 
			
		||||
	station.update_inventory(meta, inv)
 | 
			
		||||
	if update_infotext then
 | 
			
		||||
		update_infotext(meta, inv)
 | 
			
		||||
	end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function station.on_metadata_inventory_take(pos, listname, index, stack, player)
 | 
			
		||||
	if listname == "output" then
 | 
			
		||||
		station.update_inventory(pos, stack)
 | 
			
		||||
function station.on_inventory_take(meta, inv, listname, index, stack, player, update_infotext)
 | 
			
		||||
	if listname == "stairsplus:output" then
 | 
			
		||||
		station.update_inventory(meta, inv, stack)
 | 
			
		||||
	else
 | 
			
		||||
		station.update_inventory(pos)
 | 
			
		||||
		station.update_inventory(meta, inv)
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	station.update_infotext(pos)
 | 
			
		||||
	if update_infotext then
 | 
			
		||||
		update_infotext(meta, inv)
 | 
			
		||||
	end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
-- Moving the inventory of the station around is not allowed because it
 | 
			
		||||
-- is a fictional inventory. Moving inventory around would be rather
 | 
			
		||||
-- impractical and make things more difficult to calculate:
 | 
			
		||||
function station.allow_metadata_inventory_move()
 | 
			
		||||
function station.allow_inventory_move()
 | 
			
		||||
	return 0
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function station.allow_metadata_inventory_put(pos, listname, index, stack, player)
 | 
			
		||||
	if listname ~= "recycle" then
 | 
			
		||||
function station.allow_inventory_put(meta, inv, listname, index, stack, player)
 | 
			
		||||
	if listname ~= "stairsplus:recycle" then
 | 
			
		||||
		return 0
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
@@ -170,9 +160,7 @@ function station.allow_metadata_inventory_put(pos, listname, index, stack, playe
 | 
			
		||||
		return 0
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	local meta = minetest.get_meta(pos)
 | 
			
		||||
	local inv = meta:get_inventory()
 | 
			
		||||
	local current_node = station.get_current_node(pos)
 | 
			
		||||
	local current_node = station.get_current_node(inv)
 | 
			
		||||
 | 
			
		||||
	if current_node and node ~= current_node then
 | 
			
		||||
		return 0
 | 
			
		||||
@@ -181,8 +169,8 @@ function station.allow_metadata_inventory_put(pos, listname, index, stack, playe
 | 
			
		||||
	local count = stack:get_count()
 | 
			
		||||
	local cost = station.get_cost(shaped_node)
 | 
			
		||||
 | 
			
		||||
	local input_stack = inv:get_stack("input", 1)
 | 
			
		||||
	local micro_stack = inv:get_stack("micro", 1)
 | 
			
		||||
	local input_stack = inv:get_stack("stairsplus:input", 1)
 | 
			
		||||
	local micro_stack = inv:get_stack("stairsplus:micro", 1)
 | 
			
		||||
 | 
			
		||||
	local current_value = 8 * input_stack:get_count() + micro_stack:get_count()
 | 
			
		||||
	local max_value = 8 * ItemStack(node):get_stack_max() + 7
 | 
			
		||||
@@ -193,20 +181,34 @@ function station.allow_metadata_inventory_put(pos, listname, index, stack, playe
 | 
			
		||||
	return math.min(count, available_count)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function station.on_construct(pos)
 | 
			
		||||
function station.initialize_metadata(meta, inv, shape_groups, build_formspec, update_infotext)
 | 
			
		||||
	meta:set_string("stairsplus:shape_groups", minetest.write_json(shape_groups))
 | 
			
		||||
	if meta:get_int("stairsplus:max_offered") == 0 then
 | 
			
		||||
		meta:set_int("stairsplus:max_offered", default_stack_max)
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	if build_formspec then
 | 
			
		||||
		meta:set_string("formspec", build_formspec(meta, inv))
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	if update_infotext then
 | 
			
		||||
		update_infotext(meta, inv)
 | 
			
		||||
	end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function station.initialize_inventory(inv)
 | 
			
		||||
	inv:set_size("stairsplus:input", 1)
 | 
			
		||||
	inv:set_size("stairsplus:micro", 1)
 | 
			
		||||
	inv:set_size("stairsplus:recycle", 1)
 | 
			
		||||
	inv:set_size("stairsplus:output", 6 * 9)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function station.on_construct(pos, shape_groups, build_formspec, update_infotext)
 | 
			
		||||
	local meta = minetest.get_meta(pos)
 | 
			
		||||
 | 
			
		||||
	meta:set_string("formspec", station.build_formspec(pos))
 | 
			
		||||
	meta:set_string("max_offered", default_stack_max) -- How many items of this kind are offered by default?
 | 
			
		||||
 | 
			
		||||
	local inv = meta:get_inventory()
 | 
			
		||||
 | 
			
		||||
	inv:set_size("input", 1)    -- Input slot for full blocks of material x.
 | 
			
		||||
	inv:set_size("micro", 1)    -- Storage for 1-7 surplus microblocks.
 | 
			
		||||
	inv:set_size("recycle", 1)  -- Surplus partial blocks can be placed here.
 | 
			
		||||
	inv:set_size("output", 6 * 9) -- 6x9 versions of stair-parts of material x.
 | 
			
		||||
 | 
			
		||||
	station.update_infotext(pos)
 | 
			
		||||
	station.initialize_inventory(inv)
 | 
			
		||||
	station.initialize_metadata(meta, inv, shape_groups, build_formspec, update_infotext)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function station.after_place_node(pos, placer)
 | 
			
		||||
@@ -218,14 +220,55 @@ end
 | 
			
		||||
 | 
			
		||||
function api.register_station(name, shape_groups, def)
 | 
			
		||||
	def.after_place_node = def.after_place_node or station.after_place_node
 | 
			
		||||
	def.on_construct = def.on_construct or station.on_construct
 | 
			
		||||
	def.can_dig = def.can_dig or station.can_dig
 | 
			
		||||
	def.on_receive_fields = def.on_receive_fields or station.on_receive_fields
 | 
			
		||||
	def.allow_metadata_inventory_move = def.allow_metadata_inventory_move or station.allow_metadata_inventory_move
 | 
			
		||||
	def.allow_metadata_inventory_put = def.allow_metadata_inventory_put or station.allow_metadata_inventory_put
 | 
			
		||||
	def.allow_metadata_inventory_take = def.allow_metadata_inventory_take or station.allow_metadata_inventory_take
 | 
			
		||||
	def.on_metadata_inventory_put = def.on_metadata_inventory_put or station.on_metadata_inventory_put
 | 
			
		||||
	def.on_metadata_inventory_take = def.on_metadata_inventory_take or station.on_metadata_inventory_take
 | 
			
		||||
	def.on_construct = def.on_construct or
 | 
			
		||||
		function(pos)
 | 
			
		||||
			return station.on_construct(pos, shape_groups, def.build_formspec, def.update_infotext)
 | 
			
		||||
		end
 | 
			
		||||
 | 
			
		||||
	def.can_dig = def.can_dig or
 | 
			
		||||
		function(pos, player)
 | 
			
		||||
			local meta = minetest.get_meta(pos)
 | 
			
		||||
			local inv = meta:get_inventory()
 | 
			
		||||
			return station.can_dig(meta, inv, player)
 | 
			
		||||
		end
 | 
			
		||||
 | 
			
		||||
	def.on_receive_fields = def.on_receive_fields or
 | 
			
		||||
		function(pos, formname, fields, sender)
 | 
			
		||||
			local meta = minetest.get_meta(pos)
 | 
			
		||||
			local inv = meta:get_inventory()
 | 
			
		||||
			return station.on_receive_fields(
 | 
			
		||||
				meta, inv, formname, fields, sender, def.build_formspec, def.update_infotext
 | 
			
		||||
			)
 | 
			
		||||
		end
 | 
			
		||||
 | 
			
		||||
	def.allow_metadata_inventory_move = def.allow_metadata_inventory_move or
 | 
			
		||||
		function(pos, from_list, from_index, to_list, to_index, count, player)
 | 
			
		||||
			local meta = minetest.get_meta(pos)
 | 
			
		||||
			local inv = meta:get_inventory()
 | 
			
		||||
			return station.allow_inventory_move(meta, inv, from_list, from_index, to_list, to_index, count, player)
 | 
			
		||||
		end
 | 
			
		||||
 | 
			
		||||
	def.allow_metadata_inventory_put = def.allow_metadata_inventory_put or
 | 
			
		||||
		function(pos, listname, index, stack, player)
 | 
			
		||||
			local meta = minetest.get_meta(pos)
 | 
			
		||||
			local inv = meta:get_inventory()
 | 
			
		||||
			return station.allow_inventory_put(meta, inv, listname, index, stack, player)
 | 
			
		||||
		end
 | 
			
		||||
 | 
			
		||||
	def.on_metadata_inventory_put = def.on_metadata_inventory_put or
 | 
			
		||||
		function(pos, listname, index, stack, player)
 | 
			
		||||
			local meta = minetest.get_meta(pos)
 | 
			
		||||
			local inv = meta:get_inventory()
 | 
			
		||||
			return station.on_inventory_put(meta, inv, listname, index, stack, player, def.update_infotext)
 | 
			
		||||
		end
 | 
			
		||||
 | 
			
		||||
	def.on_metadata_inventory_take = def.on_metadata_inventory_take or
 | 
			
		||||
		function(pos, listname, index, stack, player)
 | 
			
		||||
			local meta = minetest.get_meta(pos)
 | 
			
		||||
			local inv = meta:get_inventory()
 | 
			
		||||
			return station.on_inventory_take(meta, inv, listname, index, stack, player, def.update_infotext)
 | 
			
		||||
		end
 | 
			
		||||
 | 
			
		||||
	def._stairsplus_shape_groups = shape_groups
 | 
			
		||||
 | 
			
		||||
	minetest.register_node(name, def)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,57 +1,75 @@
 | 
			
		||||
stairsplus.api.circular_saw = {}
 | 
			
		||||
local circular_saw = stairsplus.api.circular_saw
 | 
			
		||||
local api = stairsplus.api
 | 
			
		||||
local station = api.station
 | 
			
		||||
 | 
			
		||||
local get_location_string = stairsplus.util.get_location_string
 | 
			
		||||
 | 
			
		||||
local S = stairsplus.S
 | 
			
		||||
local F = minetest.formspec_escape
 | 
			
		||||
 | 
			
		||||
local formspec_style = stairsplus.resources.formspec_style
 | 
			
		||||
 | 
			
		||||
local function update_infotext(pos)
 | 
			
		||||
	local meta = minetest.get_meta(pos)
 | 
			
		||||
 | 
			
		||||
function circular_saw.build_formspec(meta, inv)
 | 
			
		||||
	local inv_location = get_location_string(inv)
 | 
			
		||||
	return ([[
 | 
			
		||||
		size[12,10]
 | 
			
		||||
		%s
 | 
			
		||||
		label[0,0;%s]
 | 
			
		||||
		list[%s;stairsplus:input;1.7,0;1,1;]
 | 
			
		||||
		label[0,1;%s]
 | 
			
		||||
		list[%s;stairsplus:micro;1.7,1;1,1;]
 | 
			
		||||
		label[0,2;%s]
 | 
			
		||||
		list[%s;stairsplus:recycle;1.7,2;1,1;]
 | 
			
		||||
		field[0.3,3.5;1,1;max_offered;%s:;%i]
 | 
			
		||||
		button[1,3.2;1.7,1;Set;%s]
 | 
			
		||||
 | 
			
		||||
		list[%s;stairsplus:output;2.8,0;9,6;]
 | 
			
		||||
		list[current_player;main;1.5,6.25;8,4;]
 | 
			
		||||
 | 
			
		||||
		listring[%s;stairsplus:output]
 | 
			
		||||
		listring[current_player;main]
 | 
			
		||||
		listring[%s;stairsplus:recycle]
 | 
			
		||||
 | 
			
		||||
		listring[%s;stairsplus:micro]
 | 
			
		||||
		listring[current_player;main]
 | 
			
		||||
 | 
			
		||||
		listring[%s;stairsplus:input]
 | 
			
		||||
		listring[current_player;main]
 | 
			
		||||
	]]):format(
 | 
			
		||||
		formspec_style,
 | 
			
		||||
		F(S("Nodes")),
 | 
			
		||||
		inv_location,
 | 
			
		||||
		F(S("Microblocks")),
 | 
			
		||||
		inv_location,
 | 
			
		||||
		F(S("Input")),
 | 
			
		||||
		inv_location,
 | 
			
		||||
		F(S("Max")),
 | 
			
		||||
		meta:get_int("stairsplus:max_offered"),
 | 
			
		||||
		F(S("Set")),
 | 
			
		||||
		inv_location,
 | 
			
		||||
		inv_location,
 | 
			
		||||
		inv_location,
 | 
			
		||||
		inv_location,
 | 
			
		||||
		inv_location
 | 
			
		||||
	)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function circular_saw.update_infotext(meta, inv)
 | 
			
		||||
	local parts = {}
 | 
			
		||||
	if station.can_dig(pos) then
 | 
			
		||||
	if station.can_dig(meta, inv) then
 | 
			
		||||
		table.insert(parts, S("Circular Saw is empty"))
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	local owner = meta:get_string("owner")
 | 
			
		||||
	if owner ~= "" then
 | 
			
		||||
		table.insert(parts, S("(owned by @1)", meta:get_string("owner")))
 | 
			
		||||
		table.insert(parts, S("(owned by @1)", owner))
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	meta:set_string("infotext", table.concat(parts, " "))
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
local function build_formspec()
 | 
			
		||||
	return ([[
 | 
			
		||||
		size[12,10]
 | 
			
		||||
		%s
 | 
			
		||||
		label[0,0;%s]
 | 
			
		||||
		list[current_name;input;1.7,0;1,1;]
 | 
			
		||||
		label[0,1;%s]
 | 
			
		||||
		list[current_name;micro;1.7,1;1,1;]
 | 
			
		||||
		label[0,2;%s]
 | 
			
		||||
		list[current_name;recycle;1.7,2;1,1;]
 | 
			
		||||
		field[0.3,3.5;1,1;max_offered;%s:;${max_offered}]
 | 
			
		||||
		button[1,3.2;1.7,1;Set;%s]
 | 
			
		||||
 | 
			
		||||
		list[current_name;output;2.8,0;9,6;]
 | 
			
		||||
		list[current_player;main;1.5,6.25;8,4;]
 | 
			
		||||
 | 
			
		||||
		listring[current_name;output]
 | 
			
		||||
		listring[current_player;main]
 | 
			
		||||
		listring[current_name;recycle]
 | 
			
		||||
 | 
			
		||||
		listring[current_name;micro]
 | 
			
		||||
		listring[current_player;main]
 | 
			
		||||
 | 
			
		||||
		listring[current_name;input]
 | 
			
		||||
		listring[current_player;main]
 | 
			
		||||
	]]):format(
 | 
			
		||||
		formspec_style, S("Nodes"), F(S("Microblocks")), F(S("Input")), F(S("Max")), F(S("Set"))
 | 
			
		||||
	)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
api.register_station("stairsplus:circular_saw", {"legacy"}, {
 | 
			
		||||
	description = S("Circular Saw"),
 | 
			
		||||
	drawtype = "nodebox",
 | 
			
		||||
@@ -79,8 +97,8 @@ api.register_station("stairsplus:circular_saw", {"legacy"}, {
 | 
			
		||||
	groups = {choppy = 2, oddly_breakable_by_hand = 2},
 | 
			
		||||
	sounds = stairsplus.resources.sounds.wood,
 | 
			
		||||
 | 
			
		||||
	build_formspec = build_formspec,
 | 
			
		||||
	update_infotext = update_infotext,
 | 
			
		||||
	build_formspec = circular_saw.build_formspec,
 | 
			
		||||
	update_infotext = circular_saw.update_infotext,
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
local cm = stairsplus.resources.craft_materials
 | 
			
		||||
 
 | 
			
		||||
@@ -8,12 +8,12 @@ local api = stairsplus.api
 | 
			
		||||
 | 
			
		||||
i3.register_craft_type("stairsplus:craft_schema", {
 | 
			
		||||
	description = "Stairs+ craft schema",
 | 
			
		||||
	icon = "stairsplus_circular_saw_top.png",
 | 
			
		||||
	icon = "stairsplus_saw_button.png",
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
i3.register_craft_type("stairsplus:craft_schema", {
 | 
			
		||||
	description = "Stairs+ circular saw",
 | 
			
		||||
	icon = "stairsplus_circular_saw_top.png",
 | 
			
		||||
	icon = "stairsplus_saw_button.png",
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
local function convert_schema_recipe_item(item)
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,7 @@ unified_inventory.register_craft_type("stairsplus:craft_schema", {
 | 
			
		||||
	-- ^ Unique identifier for `register_craft`
 | 
			
		||||
	description = "Stairs+ craft schema",
 | 
			
		||||
	-- ^ Text shown below the crafting arrow
 | 
			
		||||
	icon = "stairsplus_circular_saw_top.png",
 | 
			
		||||
	icon = "stairsplus_saw_button.png",
 | 
			
		||||
	-- ^ Image shown above the crafting arrow
 | 
			
		||||
	width = 3,
 | 
			
		||||
	height = 3,
 | 
			
		||||
@@ -22,7 +22,7 @@ unified_inventory.register_craft_type("stairsplus:circular_saw", {
 | 
			
		||||
	-- ^ Unique identifier for `register_craft`
 | 
			
		||||
	description = "Stairs+ circular saw",
 | 
			
		||||
	-- ^ Text shown below the crafting arrow
 | 
			
		||||
	icon = "stairsplus_circular_saw_top.png",
 | 
			
		||||
	icon = "stairsplus_saw_button.png",
 | 
			
		||||
	-- ^ Image shown above the crafting arrow
 | 
			
		||||
	width = 1,
 | 
			
		||||
	height = 1,
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								stairsplus/textures/stairsplus_saw_button.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								stairsplus/textures/stairsplus_saw_button.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 1.9 KiB  | 
@@ -67,5 +67,18 @@ stairsplus.util = {
 | 
			
		||||
			end
 | 
			
		||||
		end
 | 
			
		||||
		return f
 | 
			
		||||
	end
 | 
			
		||||
	end,
 | 
			
		||||
 | 
			
		||||
	get_location_string = function(inv)
 | 
			
		||||
		local location = inv:get_location()
 | 
			
		||||
		if location.type == "node" then
 | 
			
		||||
			return ("nodemeta:%i,%i,%i"):format(location.pos.x, location.pos.y, location.pos.z)
 | 
			
		||||
		elseif location.type == "player" then
 | 
			
		||||
			return ("player:%s"):format(location.name)
 | 
			
		||||
		elseif location.type == "detached" then
 | 
			
		||||
			return ("detached:%s"):format(location.name)
 | 
			
		||||
		else
 | 
			
		||||
			error(("unexpected location? %s"):format(dump(location)))
 | 
			
		||||
		end
 | 
			
		||||
	end,
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user