forked from minetest-mods/mesecons
		
	Compare commits
	
		
			5 Commits
		
	
	
		
			6936c8c2e4
			...
			piston-rot
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 199fb62108 | ||
|  | c7136b72cb | ||
|  | 774aac6e90 | ||
|  | 410f43bbc1 | ||
|  | 5e8c3584d1 | 
| @@ -1 +1,2 @@ | |||||||
| default | default | ||||||
|  | screwdriver? | ||||||
|   | |||||||
| @@ -12,3 +12,86 @@ for hash, _ in pairs(old_forceloaded_blocks) do | |||||||
| 	minetest.forceload_free_block(unhash_blockpos(hash)) | 	minetest.forceload_free_block(unhash_blockpos(hash)) | ||||||
| end | end | ||||||
| os.remove(minetest.get_worldpath()..DIR_DELIM.."mesecon_forceloaded") | os.remove(minetest.get_worldpath()..DIR_DELIM.."mesecon_forceloaded") | ||||||
|  |  | ||||||
|  | -- LBMs to convert old pistons to use facedir instead of separate up/down nodes | ||||||
|  | minetest.register_lbm({ | ||||||
|  | 	label = "Convert up pistons to use facedir", | ||||||
|  | 	name = ":mesecons_pistons:update_up_pistons", | ||||||
|  | 	nodenames = {"mesecons_pistons:piston_up_normal_on","mesecons_pistons:piston_up_normal_off", | ||||||
|  | 			"mesecons_pistons:piston_up_sticky_on","mesecons_pistons:piston_up_sticky_off"}, | ||||||
|  | 	action = function(pos, node) | ||||||
|  | 		if string.find(node.name, "sticky") then | ||||||
|  | 			if string.sub(node.name, -3, -1) == "_on" then | ||||||
|  | 				node.name = "mesecons_pistons:piston_sticky_on" | ||||||
|  | 			else | ||||||
|  | 				node.name = "mesecons_pistons:piston_sticky_off" | ||||||
|  | 			end | ||||||
|  | 		else | ||||||
|  | 			if string.sub(node.name, -3, -1) == "_on" then | ||||||
|  | 				node.name = "mesecons_pistons:piston_normal_on" | ||||||
|  | 			else | ||||||
|  | 				node.name = "mesecons_pistons:piston_normal_off" | ||||||
|  | 			end | ||||||
|  | 		end | ||||||
|  | 		local dir = {x=0, y=-1, z=0} | ||||||
|  | 		node.param2 = minetest.dir_to_facedir(dir, true) | ||||||
|  | 		minetest.swap_node(pos, node) | ||||||
|  | 	end | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_lbm({ | ||||||
|  | 	label = "Convert down pistons to use facedir", | ||||||
|  | 	name = ":mesecons_pistons:update_down_pistons", | ||||||
|  | 	nodenames = {"mesecons_pistons:piston_down_normal_on","mesecons_pistons:piston_down_normal_off", | ||||||
|  | 			"mesecons_pistons:piston_down_sticky_on","mesecons_pistons:piston_down_sticky_off"}, | ||||||
|  | 	action = function(pos, node) | ||||||
|  | 		if string.find(node.name, "sticky") then | ||||||
|  | 			if string.sub(node.name, -3, -1) == "_on" then | ||||||
|  | 				node.name = "mesecons_pistons:piston_sticky_on" | ||||||
|  | 			else | ||||||
|  | 				node.name = "mesecons_pistons:piston_sticky_off" | ||||||
|  | 			end | ||||||
|  | 		else | ||||||
|  | 			if string.sub(node.name, -3, -1) == "_on" then | ||||||
|  | 				node.name = "mesecons_pistons:piston_normal_on" | ||||||
|  | 			else | ||||||
|  | 				node.name = "mesecons_pistons:piston_normal_off" | ||||||
|  | 			end | ||||||
|  | 		end | ||||||
|  | 		local dir = {x=0, y=1, z=0} | ||||||
|  | 		node.param2 = minetest.dir_to_facedir(dir, true) | ||||||
|  | 		minetest.swap_node(pos, node) | ||||||
|  | 	end | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_lbm({ | ||||||
|  | 	label = "Convert up piston pushers to use facedir", | ||||||
|  | 	name = ":mesecons_pistons:update_up_pushers", | ||||||
|  | 	nodenames = {"mesecons_pistons:piston_up_pusher_normal", "mesecons_pistons:piston_up_pusher_sticky"}, | ||||||
|  | 	action = function(pos, node) | ||||||
|  | 		if string.find(node.name, "sticky") then | ||||||
|  | 			node.name = "mesecons_pistons:piston_pusher_sticky" | ||||||
|  | 		else | ||||||
|  | 			node.name = "mesecons_pistons:piston_pusher_normal" | ||||||
|  | 		end | ||||||
|  | 		local dir = {x=0, y=-1, z=0} | ||||||
|  | 		node.param2 = minetest.dir_to_facedir(dir, true) | ||||||
|  | 		minetest.swap_node(pos, node) | ||||||
|  | 	end | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_lbm({ | ||||||
|  | 	label = "Convert down piston pushers to use facedir", | ||||||
|  | 	name = ":mesecons_pistons:update_down_pushers", | ||||||
|  | 	nodenames = {"mesecons_pistons:piston_down_pusher_normal", "mesecons_pistons:piston_down_pusher_sticky"}, | ||||||
|  | 	action = function(pos, node) | ||||||
|  | 		if string.find(node.name, "sticky") then | ||||||
|  | 			node.name = "mesecons_pistons:piston_pusher_sticky" | ||||||
|  | 		else | ||||||
|  | 			node.name = "mesecons_pistons:piston_pusher_normal" | ||||||
|  | 		end | ||||||
|  | 		local dir = {x=0, y=1, z=0} | ||||||
|  | 		node.param2 = minetest.dir_to_facedir(dir, true) | ||||||
|  | 		minetest.swap_node(pos, node) | ||||||
|  | 	end | ||||||
|  | }) | ||||||
|   | |||||||
| @@ -93,3 +93,11 @@ mesecon.queue:add_function("cooldown", function (pos) | |||||||
| 		meta:set_int("heat", heat - 1) | 		meta:set_int("heat", heat - 1) | ||||||
| 	end | 	end | ||||||
| end) | end) | ||||||
|  |  | ||||||
|  | -- "Shim" for simple rotation, will result in the following item in nodedefs using it: | ||||||
|  | -- "on_rotate = screwdriver.rotate_simple" if screwdriver mod is installed | ||||||
|  | -- "on_rotate = nil" (essentially not present) if screwdriver mod is missing | ||||||
|  |  | ||||||
|  | if screwdriver then | ||||||
|  | 	mesecon.rotate_simple = screwdriver.rotate_simple | ||||||
|  | end | ||||||
|   | |||||||
| @@ -37,6 +37,7 @@ minetest.register_node("mesecons_extrawires:corner_on", { | |||||||
| 	sunlight_propagates = true, | 	sunlight_propagates = true, | ||||||
| 	selection_box = corner_selectionbox, | 	selection_box = corner_selectionbox, | ||||||
| 	node_box = corner_nodebox, | 	node_box = corner_nodebox, | ||||||
|  | 	on_rotate = mesecon.rotate_simple, | ||||||
| 	groups = {dig_immediate = 3, not_in_creative_inventory = 1}, | 	groups = {dig_immediate = 3, not_in_creative_inventory = 1}, | ||||||
| 	drop = "mesecons_extrawires:corner_off", | 	drop = "mesecons_extrawires:corner_off", | ||||||
| 	mesecons = {conductor = | 	mesecons = {conductor = | ||||||
| @@ -64,6 +65,7 @@ minetest.register_node("mesecons_extrawires:corner_off", { | |||||||
| 	sunlight_propagates = true, | 	sunlight_propagates = true, | ||||||
| 	selection_box = corner_selectionbox, | 	selection_box = corner_selectionbox, | ||||||
| 	node_box = corner_nodebox, | 	node_box = corner_nodebox, | ||||||
|  | 	on_rotate = mesecon.rotate_simple, | ||||||
| 	groups = {dig_immediate = 3}, | 	groups = {dig_immediate = 3}, | ||||||
| 	mesecons = {conductor = | 	mesecons = {conductor = | ||||||
| 	{ | 	{ | ||||||
|   | |||||||
| @@ -38,6 +38,7 @@ minetest.register_node("mesecons_extrawires:tjunction_on", { | |||||||
| 	sunlight_propagates = true, | 	sunlight_propagates = true, | ||||||
| 	selection_box = tjunction_selectionbox, | 	selection_box = tjunction_selectionbox, | ||||||
| 	node_box = tjunction_nodebox, | 	node_box = tjunction_nodebox, | ||||||
|  | 	on_rotate = mesecon.rotate_simple, | ||||||
| 	groups = {dig_immediate = 3, not_in_creative_inventory = 1}, | 	groups = {dig_immediate = 3, not_in_creative_inventory = 1}, | ||||||
| 	drop = "mesecons_extrawires:tjunction_off", | 	drop = "mesecons_extrawires:tjunction_off", | ||||||
| 	mesecons = {conductor = | 	mesecons = {conductor = | ||||||
| @@ -65,6 +66,7 @@ minetest.register_node("mesecons_extrawires:tjunction_off", { | |||||||
| 	sunlight_propagates = true, | 	sunlight_propagates = true, | ||||||
| 	selection_box = tjunction_selectionbox, | 	selection_box = tjunction_selectionbox, | ||||||
| 	node_box = tjunction_nodebox, | 	node_box = tjunction_nodebox, | ||||||
|  | 	on_rotate = mesecon.rotate_simple, | ||||||
| 	groups = {dig_immediate = 3}, | 	groups = {dig_immediate = 3}, | ||||||
| 	mesecons = {conductor = | 	mesecons = {conductor = | ||||||
| 	{ | 	{ | ||||||
|   | |||||||
| @@ -84,6 +84,7 @@ mesecon.register_node("mesecons_extrawires:vertical", { | |||||||
| 	sunlight_propagates = true, | 	sunlight_propagates = true, | ||||||
| 	selection_box = vertical_box, | 	selection_box = vertical_box, | ||||||
| 	node_box = vertical_box, | 	node_box = vertical_box, | ||||||
|  | 	on_rotate = false, | ||||||
| 	is_vertical_conductor = true, | 	is_vertical_conductor = true, | ||||||
| 	drop = "mesecons_extrawires:vertical_off", | 	drop = "mesecons_extrawires:vertical_off", | ||||||
| 	after_place_node = vertical_update, | 	after_place_node = vertical_update, | ||||||
| @@ -116,6 +117,7 @@ mesecon.register_node("mesecons_extrawires:vertical_top", { | |||||||
| 	groups = {dig_immediate=3, not_in_creative_inventory=1}, | 	groups = {dig_immediate=3, not_in_creative_inventory=1}, | ||||||
| 	selection_box = top_box, | 	selection_box = top_box, | ||||||
| 	node_box = top_box, | 	node_box = top_box, | ||||||
|  | 	on_rotate = false, | ||||||
| 	is_vertical_conductor = true, | 	is_vertical_conductor = true, | ||||||
| 	drop = "mesecons_extrawires:vertical_off", | 	drop = "mesecons_extrawires:vertical_off", | ||||||
| 	after_place_node = vertical_update, | 	after_place_node = vertical_update, | ||||||
| @@ -146,6 +148,7 @@ mesecon.register_node("mesecons_extrawires:vertical_bottom", { | |||||||
| 	groups = {dig_immediate = 3, not_in_creative_inventory = 1}, | 	groups = {dig_immediate = 3, not_in_creative_inventory = 1}, | ||||||
| 	selection_box = bottom_box, | 	selection_box = bottom_box, | ||||||
| 	node_box = bottom_box, | 	node_box = bottom_box, | ||||||
|  | 	on_rotate = false, | ||||||
| 	is_vertical_conductor = true, | 	is_vertical_conductor = true, | ||||||
| 	drop = "mesecons_extrawires:vertical_off", | 	drop = "mesecons_extrawires:vertical_off", | ||||||
| 	after_place_node = vertical_update, | 	after_place_node = vertical_update, | ||||||
|   | |||||||
| @@ -30,6 +30,7 @@ minetest.register_node("mesecons_insulated:insulated_on", { | |||||||
| 		type = "fixed", | 		type = "fixed", | ||||||
| 		fixed = { -16/32-0.001, -17/32, -3/32, 16/32+0.001, -13/32, 3/32 } | 		fixed = { -16/32-0.001, -17/32, -3/32, 16/32+0.001, -13/32, 3/32 } | ||||||
| 	}, | 	}, | ||||||
|  | 	on_rotate = mesecon.rotate_simple, | ||||||
| 	groups = {dig_immediate = 3, not_in_creative_inventory = 1}, | 	groups = {dig_immediate = 3, not_in_creative_inventory = 1}, | ||||||
| 	drop = "mesecons_insulated:insulated_off", | 	drop = "mesecons_insulated:insulated_off", | ||||||
| 	mesecons = {conductor = { | 	mesecons = {conductor = { | ||||||
| @@ -62,6 +63,7 @@ minetest.register_node("mesecons_insulated:insulated_off", { | |||||||
| 		type = "fixed", | 		type = "fixed", | ||||||
| 		fixed = { -16/32-0.001, -17/32, -3/32, 16/32+0.001, -13/32, 3/32 } | 		fixed = { -16/32-0.001, -17/32, -3/32, 16/32+0.001, -13/32, 3/32 } | ||||||
| 	}, | 	}, | ||||||
|  | 	on_rotate = screwdriver.rotate_simple, | ||||||
| 	groups = {dig_immediate = 3}, | 	groups = {dig_immediate = 3}, | ||||||
| 	mesecons = {conductor = { | 	mesecons = {conductor = { | ||||||
| 		state = mesecon.state.off, | 		state = mesecon.state.off, | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| -- Get mesecon rules of pistons | local piston_get_rules = function (node) | ||||||
| local piston_rules = { | 	local all_rules ={ | ||||||
|  {x=0,  y=0,  z=1}, --everything apart from z- (pusher side) | 		{x=0,  y=0,  z=1}, | ||||||
|  | 		{x=0,  y=0,  z=-1}, | ||||||
| 		{x=1,  y=0,  z=0}, | 		{x=1,  y=0,  z=0}, | ||||||
| 		{x=-1, y=0,  z=0}, | 		{x=-1, y=0,  z=0}, | ||||||
| 		{x=1,  y=1,  z=0}, | 		{x=1,  y=1,  z=0}, | ||||||
| @@ -8,37 +9,16 @@ local piston_rules = { | |||||||
| 		{x=-1, y=1,  z=0}, | 		{x=-1, y=1,  z=0}, | ||||||
| 		{x=-1, y=-1, z=0}, | 		{x=-1, y=-1, z=0}, | ||||||
| 		{x=0,  y=1,  z=1}, | 		{x=0,  y=1,  z=1}, | ||||||
|  {x=0,  y=-1, z=1} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| local piston_up_rules = { |  | ||||||
|  {x=0,  y=0,  z=-1}, --everything apart from y+ (pusher side) |  | ||||||
|  {x=1,  y=0,  z=0}, |  | ||||||
|  {x=-1, y=0,  z=0}, |  | ||||||
|  {x=0,  y=0,  z=1}, |  | ||||||
|  {x=1,  y=-1, z=0}, |  | ||||||
|  {x=-1, y=-1, z=0}, |  | ||||||
| 		{x=0,  y=-1, z=1}, | 		{x=0,  y=-1, z=1}, | ||||||
|  {x=0,  y=-1, z=-1} | 		{x=0,  y=1,  z=-1}, | ||||||
| } | 		{x=0,  y=-1, z=-1}} | ||||||
|  | 	local pusher_dir = vector.multiply(minetest.facedir_to_dir(node.param2), -1) | ||||||
| local piston_down_rules = { | 	for k,v in ipairs(all_rules) do | ||||||
|  {x=0,  y=0,  z=-1}, --everything apart from y- (pusher side) | 		if vector.equals(v, pusher_dir) then | ||||||
|  {x=1,  y=0,  z=0}, | 			table.remove(all_rules, k) | ||||||
|  {x=-1, y=0,  z=0}, |  | ||||||
|  {x=0,  y=0,  z=1}, |  | ||||||
|  {x=1,  y=1, z=0}, |  | ||||||
|  {x=-1, y=1, z=0}, |  | ||||||
|  {x=0,  y=1, z=1}, |  | ||||||
|  {x=0,  y=1, z=-1} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| local function piston_get_rules(node) |  | ||||||
| 	local rules = piston_rules |  | ||||||
| 	for i = 1, node.param2 do |  | ||||||
| 		rules = mesecon.rotate_rules_left(rules) |  | ||||||
| 		end | 		end | ||||||
| 	return rules | 	end | ||||||
|  | 	return all_rules | ||||||
| end | end | ||||||
|  |  | ||||||
| local function piston_facedir_direction(node) | local function piston_facedir_direction(node) | ||||||
| @@ -49,17 +29,9 @@ local function piston_facedir_direction(node) | |||||||
| 	return rules[1] | 	return rules[1] | ||||||
| end | end | ||||||
|  |  | ||||||
| local function piston_get_direction(dir, node) |  | ||||||
| 	if type(dir) == "function" then |  | ||||||
| 		return dir(node) |  | ||||||
| 	else |  | ||||||
| 		return dir |  | ||||||
| 	end |  | ||||||
| end |  | ||||||
|  |  | ||||||
| local piston_remove_pusher = function(pos, node) | local piston_remove_pusher = function(pos, node) | ||||||
| 	local pistonspec = minetest.registered_nodes[node.name].mesecons_piston | 	local pistonspec = minetest.registered_nodes[node.name].mesecons_piston | ||||||
| 	local dir = piston_get_direction(pistonspec.dir, node) | 	local dir = vector.multiply(minetest.facedir_to_dir(node.param2), -1) | ||||||
| 	local pusherpos = vector.add(pos, dir) | 	local pusherpos = vector.add(pos, dir) | ||||||
| 	local pushername = minetest.get_node(pusherpos).name | 	local pushername = minetest.get_node(pusherpos).name | ||||||
|  |  | ||||||
| @@ -79,8 +51,7 @@ end | |||||||
|  |  | ||||||
| local piston_on = function(pos, node) | local piston_on = function(pos, node) | ||||||
| 	local pistonspec = minetest.registered_nodes[node.name].mesecons_piston | 	local pistonspec = minetest.registered_nodes[node.name].mesecons_piston | ||||||
|  | 	local dir = vector.multiply(minetest.facedir_to_dir(node.param2), -1) | ||||||
| 	local dir = piston_get_direction(pistonspec.dir, node) |  | ||||||
| 	local np = vector.add(pos, dir) | 	local np = vector.add(pos, dir) | ||||||
| 	local maxpush = mesecon.setting("piston_max_push", 15) | 	local maxpush = mesecon.setting("piston_max_push", 15) | ||||||
| 	local success, stack, oldstack = mesecon.mvps_push(np, dir, maxpush) | 	local success, stack, oldstack = mesecon.mvps_push(np, dir, maxpush) | ||||||
| @@ -101,40 +72,21 @@ local piston_off = function(pos, node) | |||||||
| 	local pistonspec = minetest.registered_nodes[node.name].mesecons_piston | 	local pistonspec = minetest.registered_nodes[node.name].mesecons_piston | ||||||
| 	minetest.set_node(pos, {param2 = node.param2, name = pistonspec.offname}) | 	minetest.set_node(pos, {param2 = node.param2, name = pistonspec.offname}) | ||||||
| 	piston_remove_pusher(pos, node) | 	piston_remove_pusher(pos, node) | ||||||
|  |  | ||||||
| 	if pistonspec.sticky then | 	if pistonspec.sticky then | ||||||
| 		local maxpull = mesecon.setting("piston_max_pull", 15) | 		local maxpull = mesecon.setting("piston_max_pull", 15) | ||||||
| 		local dir = piston_get_direction(pistonspec.dir, node) | 		local dir = vector.multiply(minetest.facedir_to_dir(node.param2), -1) | ||||||
| 		local pullpos = vector.add(pos, vector.multiply(dir, 2)) | 		local pullpos = vector.add(pos, vector.multiply(dir, 2)) | ||||||
| 		local stack = mesecon.mvps_pull_single(pullpos, vector.multiply(dir, -1), maxpull) | 		local stack = mesecon.mvps_pull_single(pullpos, vector.multiply(dir, -1), maxpull) | ||||||
| 		mesecon.mvps_process_stack(pos, dir, stack) | 		mesecon.mvps_process_stack(pos, dir, stack) | ||||||
| 	end | 	end | ||||||
| end | end | ||||||
|  |  | ||||||
| local piston_orientate = function(pos, placer) | local piston_onrotate = function(pos, node, _, _, newparam2) | ||||||
| 	-- not placed by player | 	local node_copy = minetest.get_node(pos) | ||||||
| 	if not placer then return end | 	minetest.after(0, mesecon.on_dignode, pos, node) | ||||||
|  | 	node_copy.param2 = newparam2 | ||||||
| 	-- placer pitch in degrees | 	minetest.after(0, mesecon.on_placenode, pos, node_copy) | ||||||
| 	local pitch = placer:get_look_pitch() * (180 / math.pi) |  | ||||||
|  |  | ||||||
| 	local node = minetest.get_node(pos) |  | ||||||
| 	local pistonspec = minetest.registered_nodes[node.name].mesecons_piston |  | ||||||
|  |  | ||||||
| 	-- looking upwards (pitch > 55) / looking downwards (pitch < -55) |  | ||||||
| 	local nn = nil |  | ||||||
| 	if pitch > 55 then nn = {name = pistonspec.piston_down} end |  | ||||||
| 	if pitch < -55 then nn = {name = pistonspec.piston_up} end |  | ||||||
|  |  | ||||||
| 	if nn then |  | ||||||
| 		minetest.set_node(pos, nn) |  | ||||||
| 		-- minetest.after, because on_placenode for unoriented piston must be processed first |  | ||||||
| 		minetest.after(0, mesecon.on_placenode, pos, nn) |  | ||||||
| end | end | ||||||
| end |  | ||||||
|  |  | ||||||
|  |  | ||||||
| -- Horizontal pistons |  | ||||||
|  |  | ||||||
| local pt = 3/16 -- pusher thickness | local pt = 3/16 -- pusher thickness | ||||||
|  |  | ||||||
| @@ -161,8 +113,6 @@ local pistonspec_normal = { | |||||||
| 	onname = "mesecons_pistons:piston_normal_on", | 	onname = "mesecons_pistons:piston_normal_on", | ||||||
| 	dir = piston_facedir_direction, | 	dir = piston_facedir_direction, | ||||||
| 	pusher = "mesecons_pistons:piston_pusher_normal", | 	pusher = "mesecons_pistons:piston_pusher_normal", | ||||||
| 	piston_down = "mesecons_pistons:piston_down_normal_off", |  | ||||||
| 	piston_up   = "mesecons_pistons:piston_up_normal_off", |  | ||||||
| } | } | ||||||
|  |  | ||||||
| -- offstate | -- offstate | ||||||
| @@ -178,8 +128,8 @@ minetest.register_node("mesecons_pistons:piston_normal_off", { | |||||||
| 		}, | 		}, | ||||||
| 	groups = {cracky = 3}, | 	groups = {cracky = 3}, | ||||||
| 	paramtype2 = "facedir", | 	paramtype2 = "facedir", | ||||||
| 	after_place_node = piston_orientate, |  | ||||||
| 	mesecons_piston = pistonspec_normal, | 	mesecons_piston = pistonspec_normal, | ||||||
|  | 	on_rotate = piston_onrotate, | ||||||
| 	sounds = default.node_sound_wood_defaults(), | 	sounds = default.node_sound_wood_defaults(), | ||||||
| 	mesecons = {effector={ | 	mesecons = {effector={ | ||||||
| 		action_on = piston_on, | 		action_on = piston_on, | ||||||
| @@ -208,6 +158,7 @@ minetest.register_node("mesecons_pistons:piston_normal_on", { | |||||||
| 	node_box = piston_on_box, | 	node_box = piston_on_box, | ||||||
| 	selection_box = piston_on_box, | 	selection_box = piston_on_box, | ||||||
| 	mesecons_piston = pistonspec_normal, | 	mesecons_piston = pistonspec_normal, | ||||||
|  | 	on_rotate = false, | ||||||
| 	sounds = default.node_sound_wood_defaults(), | 	sounds = default.node_sound_wood_defaults(), | ||||||
| 	mesecons = {effector={ | 	mesecons = {effector={ | ||||||
| 		action_off = piston_off, | 		action_off = piston_off, | ||||||
| @@ -229,6 +180,7 @@ minetest.register_node("mesecons_pistons:piston_pusher_normal", { | |||||||
| 	paramtype = "light", | 	paramtype = "light", | ||||||
| 	paramtype2 = "facedir", | 	paramtype2 = "facedir", | ||||||
| 	diggable = false, | 	diggable = false, | ||||||
|  | 	on_rotate = false, | ||||||
| 	corresponding_piston = "mesecons_pistons:piston_normal_on", | 	corresponding_piston = "mesecons_pistons:piston_normal_on", | ||||||
| 	selection_box = piston_pusher_box, | 	selection_box = piston_pusher_box, | ||||||
| 	node_box = piston_pusher_box, | 	node_box = piston_pusher_box, | ||||||
| @@ -242,8 +194,6 @@ local pistonspec_sticky = { | |||||||
| 	dir = piston_facedir_direction, | 	dir = piston_facedir_direction, | ||||||
| 	pusher = "mesecons_pistons:piston_pusher_sticky", | 	pusher = "mesecons_pistons:piston_pusher_sticky", | ||||||
| 	sticky = true, | 	sticky = true, | ||||||
| 	piston_down = "mesecons_pistons:piston_down_sticky_off", |  | ||||||
| 	piston_up   = "mesecons_pistons:piston_up_sticky_off", |  | ||||||
| } | } | ||||||
|  |  | ||||||
| -- offstate | -- offstate | ||||||
| @@ -259,7 +209,7 @@ minetest.register_node("mesecons_pistons:piston_sticky_off", { | |||||||
| 		}, | 		}, | ||||||
| 	groups = {cracky = 3}, | 	groups = {cracky = 3}, | ||||||
| 	paramtype2 = "facedir", | 	paramtype2 = "facedir", | ||||||
| 	after_place_node = piston_orientate, | 	on_rotate = piston_onrotate, | ||||||
| 	mesecons_piston = pistonspec_sticky, | 	mesecons_piston = pistonspec_sticky, | ||||||
| 	sounds = default.node_sound_wood_defaults(), | 	sounds = default.node_sound_wood_defaults(), | ||||||
| 	mesecons = {effector={ | 	mesecons = {effector={ | ||||||
| @@ -289,6 +239,7 @@ minetest.register_node("mesecons_pistons:piston_sticky_on", { | |||||||
| 	node_box = piston_on_box, | 	node_box = piston_on_box, | ||||||
| 	selection_box = piston_on_box, | 	selection_box = piston_on_box, | ||||||
| 	mesecons_piston = pistonspec_sticky, | 	mesecons_piston = pistonspec_sticky, | ||||||
|  | 	on_rotate = false, | ||||||
| 	sounds = default.node_sound_wood_defaults(), | 	sounds = default.node_sound_wood_defaults(), | ||||||
| 	mesecons = {effector={ | 	mesecons = {effector={ | ||||||
| 		action_off = piston_off, | 		action_off = piston_off, | ||||||
| @@ -310,377 +261,12 @@ minetest.register_node("mesecons_pistons:piston_pusher_sticky", { | |||||||
| 	paramtype = "light", | 	paramtype = "light", | ||||||
| 	paramtype2 = "facedir", | 	paramtype2 = "facedir", | ||||||
| 	diggable = false, | 	diggable = false, | ||||||
|  | 	on_rotate = false, | ||||||
| 	corresponding_piston = "mesecons_pistons:piston_sticky_on", | 	corresponding_piston = "mesecons_pistons:piston_sticky_on", | ||||||
| 	selection_box = piston_pusher_box, | 	selection_box = piston_pusher_box, | ||||||
| 	node_box = piston_pusher_box, | 	node_box = piston_pusher_box, | ||||||
| }) | }) | ||||||
|  |  | ||||||
| -- |  | ||||||
| -- |  | ||||||
| -- UP |  | ||||||
| -- |  | ||||||
| -- |  | ||||||
|  |  | ||||||
| local piston_up_pusher_box = { |  | ||||||
| 	type = "fixed", |  | ||||||
| 	fixed = { |  | ||||||
| 		{-2/16, -.5 - pt, -2/16, 2/16, .5 - pt, 2/16}, |  | ||||||
| 		{-.5  ,  .5 - pt, -.5  , .5  , .5     ,   .5}, |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| local piston_up_on_box = { |  | ||||||
| 	type = "fixed", |  | ||||||
| 	fixed = { |  | ||||||
| 		{-.5, -.5, -.5 , .5, .5-pt, .5} |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| -- Normal |  | ||||||
|  |  | ||||||
| local pistonspec_normal_up = { |  | ||||||
| 	offname = "mesecons_pistons:piston_up_normal_off", |  | ||||||
| 	onname = "mesecons_pistons:piston_up_normal_on", |  | ||||||
| 	dir = {x = 0, y = 1, z = 0}, |  | ||||||
| 	pusher = "mesecons_pistons:piston_up_pusher_normal" |  | ||||||
| } |  | ||||||
|  |  | ||||||
| -- offstate |  | ||||||
| minetest.register_node("mesecons_pistons:piston_up_normal_off", { |  | ||||||
| 	tiles = { |  | ||||||
| 		"mesecons_piston_pusher_front.png", |  | ||||||
| 		"mesecons_piston_back.png", |  | ||||||
| 		"mesecons_piston_left.png^[transformR270", |  | ||||||
| 		"mesecons_piston_right.png^[transformR90", |  | ||||||
| 		"mesecons_piston_bottom.png", |  | ||||||
| 		"mesecons_piston_top.png^[transformR180", |  | ||||||
| 		}, |  | ||||||
| 	inventory_image = "mesecons_piston_top.png", |  | ||||||
| 	wield_image = "mesecons_piston_top.png", |  | ||||||
| 	groups = {cracky = 3, not_in_creative_inventory = 1}, |  | ||||||
| 	paramtype2 = "facedir", |  | ||||||
| 	drop = "mesecons_pistons:piston_normal_off", |  | ||||||
| 	mesecons_piston = pistonspec_normal_up, |  | ||||||
| 	mesecons = {effector={ |  | ||||||
| 		action_on = piston_on, |  | ||||||
| 		rules = piston_up_rules, |  | ||||||
| 	}} |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| -- onstate |  | ||||||
| minetest.register_node("mesecons_pistons:piston_up_normal_on", { |  | ||||||
| 	drawtype = "nodebox", |  | ||||||
| 	tiles = { |  | ||||||
| 		"mesecons_piston_on_front.png", |  | ||||||
| 		"mesecons_piston_back.png", |  | ||||||
| 		"mesecons_piston_left.png^[transformR270", |  | ||||||
| 		"mesecons_piston_right.png^[transformR90", |  | ||||||
| 		"mesecons_piston_bottom.png", |  | ||||||
| 		"mesecons_piston_top.png^[transformR180", |  | ||||||
| 		}, |  | ||||||
| 	inventory_image = "mesecons_piston_top.png", |  | ||||||
| 	wield_image = "mesecons_piston_top.png", |  | ||||||
| 	groups = {cracky = 3, not_in_creative_inventory = 1}, |  | ||||||
| 	paramtype = "light", |  | ||||||
| 	paramtype2 = "facedir", |  | ||||||
| 	drop = "mesecons_pistons:piston_normal_off", |  | ||||||
| 	after_dig_node = piston_remove_pusher, |  | ||||||
| 	node_box = piston_up_on_box, |  | ||||||
| 	selection_box = piston_up_on_box, |  | ||||||
| 	mesecons_piston = pistonspec_normal_up, |  | ||||||
| 	sounds = default.node_sound_wood_defaults(), |  | ||||||
| 	mesecons = {effector={ |  | ||||||
| 		action_off = piston_off, |  | ||||||
| 		rules = piston_up_rules, |  | ||||||
| 	}} |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| -- pusher |  | ||||||
| minetest.register_node("mesecons_pistons:piston_up_pusher_normal", { |  | ||||||
| 	drawtype = "nodebox", |  | ||||||
| 	tiles = { |  | ||||||
| 		"mesecons_piston_pusher_front.png", |  | ||||||
| 		"mesecons_piston_pusher_back.png", |  | ||||||
| 		"mesecons_piston_pusher_left.png^[transformR270", |  | ||||||
| 		"mesecons_piston_pusher_right.png^[transformR90", |  | ||||||
| 		"mesecons_piston_pusher_bottom.png", |  | ||||||
| 		"mesecons_piston_pusher_top.png^[transformR180", |  | ||||||
| 		}, |  | ||||||
| 	paramtype = "light", |  | ||||||
| 	paramtype2 = "facedir", |  | ||||||
| 	diggable = false, |  | ||||||
| 	corresponding_piston = "mesecons_pistons:piston_up_normal_on", |  | ||||||
| 	selection_box = piston_up_pusher_box, |  | ||||||
| 	node_box = piston_up_pusher_box, |  | ||||||
| }) |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| -- Sticky |  | ||||||
|  |  | ||||||
|  |  | ||||||
| local pistonspec_sticky_up = { |  | ||||||
| 	offname = "mesecons_pistons:piston_up_sticky_off", |  | ||||||
| 	onname = "mesecons_pistons:piston_up_sticky_on", |  | ||||||
| 	dir = {x = 0, y = 1, z = 0}, |  | ||||||
| 	pusher = "mesecons_pistons:piston_up_pusher_sticky", |  | ||||||
| 	sticky = true |  | ||||||
| } |  | ||||||
|  |  | ||||||
| -- offstate |  | ||||||
| minetest.register_node("mesecons_pistons:piston_up_sticky_off", { |  | ||||||
| 	tiles = { |  | ||||||
| 		"mesecons_piston_pusher_front_sticky.png", |  | ||||||
| 		"mesecons_piston_back.png", |  | ||||||
| 		"mesecons_piston_left.png^[transformR270", |  | ||||||
| 		"mesecons_piston_right.png^[transformR90", |  | ||||||
| 		"mesecons_piston_bottom.png", |  | ||||||
| 		"mesecons_piston_top.png^[transformR180", |  | ||||||
| 		"mesecons_piston_tb.png" |  | ||||||
| 		}, |  | ||||||
| 	inventory_image = "mesecons_piston_top.png", |  | ||||||
| 	wield_image = "mesecons_piston_top.png", |  | ||||||
| 	groups = {cracky = 3, not_in_creative_inventory = 1}, |  | ||||||
| 	paramtype2 = "facedir", |  | ||||||
| 	drop = "mesecons_pistons:piston_sticky_off", |  | ||||||
| 	mesecons_piston = pistonspec_sticky_up, |  | ||||||
| 	sounds = default.node_sound_wood_defaults(), |  | ||||||
| 	mesecons = {effector={ |  | ||||||
| 		action_on = piston_on, |  | ||||||
| 		rules = piston_up_rules, |  | ||||||
| 	}} |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| -- onstate |  | ||||||
| minetest.register_node("mesecons_pistons:piston_up_sticky_on", { |  | ||||||
| 	drawtype = "nodebox", |  | ||||||
| 	tiles = { |  | ||||||
| 		"mesecons_piston_on_front.png", |  | ||||||
| 		"mesecons_piston_back.png", |  | ||||||
| 		"mesecons_piston_left.png^[transformR270", |  | ||||||
| 		"mesecons_piston_right.png^[transformR90", |  | ||||||
| 		"mesecons_piston_bottom.png", |  | ||||||
| 		"mesecons_piston_top.png^[transformR180", |  | ||||||
| 		}, |  | ||||||
| 	inventory_image = "mesecons_piston_top.png", |  | ||||||
| 	wield_image = "mesecons_piston_top.png", |  | ||||||
| 	groups = {cracky = 3, not_in_creative_inventory = 1}, |  | ||||||
| 	paramtype = "light", |  | ||||||
| 	paramtype2 = "facedir", |  | ||||||
| 	drop = "mesecons_pistons:piston_normal_off", |  | ||||||
| 	after_dig_node = piston_remove_pusher, |  | ||||||
| 	node_box = piston_up_on_box, |  | ||||||
| 	selection_box = piston_up_on_box, |  | ||||||
| 	mesecons_piston = pistonspec_sticky_up, |  | ||||||
| 	sounds = default.node_sound_wood_defaults(), |  | ||||||
| 	mesecons = {effector={ |  | ||||||
| 		action_off = piston_off, |  | ||||||
| 		rules = piston_up_rules, |  | ||||||
| 	}} |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| -- pusher |  | ||||||
| minetest.register_node("mesecons_pistons:piston_up_pusher_sticky", { |  | ||||||
| 	drawtype = "nodebox", |  | ||||||
| 	tiles = { |  | ||||||
| 		"mesecons_piston_pusher_front_sticky.png", |  | ||||||
| 		"mesecons_piston_pusher_back.png", |  | ||||||
| 		"mesecons_piston_pusher_left.png^[transformR270", |  | ||||||
| 		"mesecons_piston_pusher_right.png^[transformR90", |  | ||||||
| 		"mesecons_piston_pusher_bottom.png", |  | ||||||
| 		"mesecons_piston_pusher_top.png^[transformR180", |  | ||||||
| 		}, |  | ||||||
| 	paramtype = "light", |  | ||||||
| 	paramtype2 = "facedir", |  | ||||||
| 	diggable = false, |  | ||||||
| 	corresponding_piston = "mesecons_pistons:piston_up_sticky_on", |  | ||||||
| 	selection_box = piston_up_pusher_box, |  | ||||||
| 	node_box = piston_up_pusher_box, |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| -- |  | ||||||
| -- |  | ||||||
| -- DOWN |  | ||||||
| -- |  | ||||||
| -- |  | ||||||
|  |  | ||||||
| local piston_down_pusher_box = { |  | ||||||
| 	type = "fixed", |  | ||||||
| 	fixed = { |  | ||||||
| 		{-2/16, -.5 + pt, -2/16, 2/16,  .5 + pt, 2/16}, |  | ||||||
| 		{-.5  , -.5     , -.5  , .5  , -.5 + pt,   .5}, |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| local piston_down_on_box = { |  | ||||||
| 	type = "fixed", |  | ||||||
| 	fixed = { |  | ||||||
| 		{-.5, -.5+pt, -.5 , .5, .5, .5} |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| -- Normal |  | ||||||
|  |  | ||||||
| local pistonspec_normal_down = { |  | ||||||
| 	offname = "mesecons_pistons:piston_down_normal_off", |  | ||||||
| 	onname = "mesecons_pistons:piston_down_normal_on", |  | ||||||
| 	dir = {x = 0, y = -1, z = 0}, |  | ||||||
| 	pusher = "mesecons_pistons:piston_down_pusher_normal", |  | ||||||
| } |  | ||||||
|  |  | ||||||
| -- offstate |  | ||||||
| minetest.register_node("mesecons_pistons:piston_down_normal_off", { |  | ||||||
| 	tiles = { |  | ||||||
| 		"mesecons_piston_back.png", |  | ||||||
| 		"mesecons_piston_pusher_front.png", |  | ||||||
| 		"mesecons_piston_left.png^[transformR90", |  | ||||||
| 		"mesecons_piston_right.png^[transformR270", |  | ||||||
| 		"mesecons_piston_bottom.png^[transformR180", |  | ||||||
| 		"mesecons_piston_top.png", |  | ||||||
| 		}, |  | ||||||
| 	inventory_image = "mesecons_piston_top.png", |  | ||||||
| 	wield_image = "mesecons_piston_top.png", |  | ||||||
| 	groups = {cracky = 3, not_in_creative_inventory = 1}, |  | ||||||
| 	paramtype2 = "facedir", |  | ||||||
| 	drop = "mesecons_pistons:piston_normal_off", |  | ||||||
| 	mesecons_piston = pistonspec_normal_down, |  | ||||||
| 	sounds = default.node_sound_wood_defaults(), |  | ||||||
| 	mesecons = {effector={ |  | ||||||
| 		action_on = piston_on, |  | ||||||
| 		rules = piston_down_rules, |  | ||||||
| 	}} |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| -- onstate |  | ||||||
| minetest.register_node("mesecons_pistons:piston_down_normal_on", { |  | ||||||
| 	drawtype = "nodebox", |  | ||||||
| 	tiles = { |  | ||||||
| 		"mesecons_piston_back.png", |  | ||||||
| 		"mesecons_piston_on_front.png", |  | ||||||
| 		"mesecons_piston_left.png^[transformR90", |  | ||||||
| 		"mesecons_piston_right.png^[transformR270", |  | ||||||
| 		"mesecons_piston_bottom.png^[transformR180", |  | ||||||
| 		"mesecons_piston_top.png", |  | ||||||
| 		}, |  | ||||||
| 	inventory_image = "mesecons_piston_top.png", |  | ||||||
| 	wield_image = "mesecons_piston_top.png", |  | ||||||
| 	groups = {cracky = 3, not_in_creative_inventory = 1}, |  | ||||||
| 	paramtype = "light", |  | ||||||
| 	paramtype2 = "facedir", |  | ||||||
| 	drop = "mesecons_pistons:piston_normal_off", |  | ||||||
| 	after_dig_node = piston_remove_pusher, |  | ||||||
| 	node_box = piston_down_on_box, |  | ||||||
| 	selection_box = piston_down_on_box, |  | ||||||
| 	mesecons_piston = pistonspec_normal_down, |  | ||||||
| 	sounds = default.node_sound_wood_defaults(), |  | ||||||
| 	mesecons = {effector={ |  | ||||||
| 		action_off = piston_off, |  | ||||||
| 		rules = piston_down_rules, |  | ||||||
| 	}} |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| -- pusher |  | ||||||
| minetest.register_node("mesecons_pistons:piston_down_pusher_normal", { |  | ||||||
| 	drawtype = "nodebox", |  | ||||||
| 	tiles = { |  | ||||||
| 		"mesecons_piston_pusher_back.png", |  | ||||||
| 		"mesecons_piston_pusher_front.png", |  | ||||||
| 		"mesecons_piston_pusher_left.png^[transformR90", |  | ||||||
| 		"mesecons_piston_pusher_right.png^[transformR270", |  | ||||||
| 		"mesecons_piston_pusher_bottom.png^[transformR180", |  | ||||||
| 		"mesecons_piston_pusher_top.png", |  | ||||||
| 		}, |  | ||||||
| 	paramtype = "light", |  | ||||||
| 	paramtype2 = "facedir", |  | ||||||
| 	diggable = false, |  | ||||||
| 	corresponding_piston = "mesecons_pistons:piston_down_normal_on", |  | ||||||
| 	selection_box = piston_down_pusher_box, |  | ||||||
| 	node_box = piston_down_pusher_box, |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| -- Sticky |  | ||||||
|  |  | ||||||
| local pistonspec_sticky_down = { |  | ||||||
| 	onname = "mesecons_pistons:piston_down_sticky_on", |  | ||||||
| 	offname = "mesecons_pistons:piston_down_sticky_off", |  | ||||||
| 	dir = {x = 0, y = -1, z = 0}, |  | ||||||
| 	pusher = "mesecons_pistons:piston_down_pusher_sticky", |  | ||||||
| 	sticky = true |  | ||||||
| } |  | ||||||
|  |  | ||||||
| -- offstate |  | ||||||
| minetest.register_node("mesecons_pistons:piston_down_sticky_off", { |  | ||||||
| 	tiles = { |  | ||||||
| 		"mesecons_piston_back.png", |  | ||||||
| 		"mesecons_piston_pusher_front_sticky.png", |  | ||||||
| 		"mesecons_piston_left.png^[transformR90", |  | ||||||
| 		"mesecons_piston_right.png^[transformR270", |  | ||||||
| 		"mesecons_piston_bottom.png^[transformR180", |  | ||||||
| 		"mesecons_piston_top.png", |  | ||||||
| 		}, |  | ||||||
| 	inventory_image = "mesecons_piston_top.png", |  | ||||||
| 	wield_image = "mesecons_piston_top.png", |  | ||||||
| 	groups = {cracky = 3, not_in_creative_inventory = 1}, |  | ||||||
| 	paramtype2 = "facedir", |  | ||||||
| 	drop = "mesecons_pistons:piston_sticky_off", |  | ||||||
| 	mesecons_piston = pistonspec_sticky_down, |  | ||||||
| 	sounds = default.node_sound_wood_defaults(), |  | ||||||
| 	mesecons = {effector={ |  | ||||||
| 		action_on = piston_on, |  | ||||||
| 		rules = piston_down_rules, |  | ||||||
| 	}} |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| -- onstate |  | ||||||
| minetest.register_node("mesecons_pistons:piston_down_sticky_on", { |  | ||||||
| 	drawtype = "nodebox", |  | ||||||
| 	tiles = { |  | ||||||
| 		"mesecons_piston_back.png", |  | ||||||
| 		"mesecons_piston_on_front.png", |  | ||||||
| 		"mesecons_piston_left.png^[transformR90", |  | ||||||
| 		"mesecons_piston_right.png^[transformR270", |  | ||||||
| 		"mesecons_piston_bottom.png^[transformR180", |  | ||||||
| 		"mesecons_piston_top.png", |  | ||||||
| 		}, |  | ||||||
| 	inventory_image = "mesecons_piston_top.png", |  | ||||||
| 	wield_image = "mesecons_piston_top.png", |  | ||||||
| 	groups = {cracky = 3, not_in_creative_inventory = 1}, |  | ||||||
| 	paramtype = "light", |  | ||||||
| 	paramtype2 = "facedir", |  | ||||||
| 	drop = "mesecons_pistons:piston_sticky_off", |  | ||||||
| 	after_dig_node = piston_remove_pusher, |  | ||||||
| 	node_box = piston_down_on_box, |  | ||||||
| 	selection_box = piston_down_on_box, |  | ||||||
| 	mesecons_piston = pistonspec_sticky_down, |  | ||||||
| 	sounds = default.node_sound_wood_defaults(), |  | ||||||
| 	mesecons = {effector={ |  | ||||||
| 		action_off = piston_off, |  | ||||||
| 		rules = piston_down_rules, |  | ||||||
| 	}} |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| -- pusher |  | ||||||
| minetest.register_node("mesecons_pistons:piston_down_pusher_sticky", { |  | ||||||
| 	drawtype = "nodebox", |  | ||||||
| 	tiles = { |  | ||||||
| 		"mesecons_piston_pusher_back.png", |  | ||||||
| 		"mesecons_piston_pusher_front_sticky.png", |  | ||||||
| 		"mesecons_piston_pusher_left.png^[transformR90", |  | ||||||
| 		"mesecons_piston_pusher_right.png^[transformR270", |  | ||||||
| 		"mesecons_piston_pusher_bottom.png^[transformR180", |  | ||||||
| 		"mesecons_piston_pusher_top.png", |  | ||||||
| 		}, |  | ||||||
| 	paramtype = "light", |  | ||||||
| 	paramtype2 = "facedir", |  | ||||||
| 	diggable = false, |  | ||||||
| 	corresponding_piston = "mesecons_pistons:piston_down_sticky_on", |  | ||||||
| 	selection_box = piston_down_pusher_box, |  | ||||||
| 	node_box = piston_down_pusher_box, |  | ||||||
| }) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| -- Register pushers as stoppers if they would be seperated from the piston | -- Register pushers as stoppers if they would be seperated from the piston | ||||||
| local piston_pusher_get_stopper = function (node, dir, stack, stackid) | local piston_pusher_get_stopper = function (node, dir, stack, stackid) | ||||||
| 	if (stack[stackid + 1] | 	if (stack[stackid + 1] | ||||||
| @@ -707,13 +293,6 @@ end | |||||||
| mesecon.register_mvps_stopper("mesecons_pistons:piston_pusher_normal", piston_pusher_get_stopper) | mesecon.register_mvps_stopper("mesecons_pistons:piston_pusher_normal", piston_pusher_get_stopper) | ||||||
| mesecon.register_mvps_stopper("mesecons_pistons:piston_pusher_sticky", piston_pusher_get_stopper) | mesecon.register_mvps_stopper("mesecons_pistons:piston_pusher_sticky", piston_pusher_get_stopper) | ||||||
|  |  | ||||||
| mesecon.register_mvps_stopper("mesecons_pistons:piston_up_pusher_normal", piston_pusher_up_down_get_stopper) |  | ||||||
| mesecon.register_mvps_stopper("mesecons_pistons:piston_up_pusher_sticky", piston_pusher_up_down_get_stopper) |  | ||||||
|  |  | ||||||
| mesecon.register_mvps_stopper("mesecons_pistons:piston_down_pusher_normal", piston_pusher_up_down_get_stopper) |  | ||||||
| mesecon.register_mvps_stopper("mesecons_pistons:piston_down_pusher_sticky", piston_pusher_up_down_get_stopper) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| -- Register pistons as stoppers if they would be seperated from the stopper | -- Register pistons as stoppers if they would be seperated from the stopper | ||||||
| local piston_up_down_get_stopper = function (node, dir, stack, stackid) | local piston_up_down_get_stopper = function (node, dir, stack, stackid) | ||||||
| 	if (stack[stackid + 1] | 	if (stack[stackid + 1] | ||||||
| @@ -726,8 +305,8 @@ local piston_up_down_get_stopper = function (node, dir, stack, stackid) | |||||||
| end | end | ||||||
|  |  | ||||||
| local piston_get_stopper = function (node, dir, stack, stackid) | local piston_get_stopper = function (node, dir, stack, stackid) | ||||||
| 	pistonspec = minetest.registered_nodes[node.name].mesecons_piston | 	local pistonspec = minetest.registered_nodes[node.name].mesecons_piston | ||||||
| 	dir = piston_get_direction(pistonspec.dir, node) | 	local dir = pistonspec.dir(node) | ||||||
| 	local pusherpos  = vector.add(stack[stackid].pos, dir) | 	local pusherpos  = vector.add(stack[stackid].pos, dir) | ||||||
| 	local pushernode = minetest.get_node(pusherpos) | 	local pushernode = minetest.get_node(pusherpos) | ||||||
|  |  | ||||||
| @@ -745,12 +324,6 @@ end | |||||||
| mesecon.register_mvps_stopper("mesecons_pistons:piston_normal_on", piston_get_stopper) | mesecon.register_mvps_stopper("mesecons_pistons:piston_normal_on", piston_get_stopper) | ||||||
| mesecon.register_mvps_stopper("mesecons_pistons:piston_sticky_on", piston_get_stopper) | mesecon.register_mvps_stopper("mesecons_pistons:piston_sticky_on", piston_get_stopper) | ||||||
|  |  | ||||||
| mesecon.register_mvps_stopper("mesecons_pistons:piston_up_normal_on", piston_up_down_get_stopper) |  | ||||||
| mesecon.register_mvps_stopper("mesecons_pistons:piston_up_sticky_on", piston_up_down_get_stopper) |  | ||||||
|  |  | ||||||
| mesecon.register_mvps_stopper("mesecons_pistons:piston_down_normal_on", piston_up_down_get_stopper) |  | ||||||
| mesecon.register_mvps_stopper("mesecons_pistons:piston_down_sticky_on", piston_up_down_get_stopper) |  | ||||||
|  |  | ||||||
| --craft recipes | --craft recipes | ||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = "mesecons_pistons:piston_normal_off 2", | 	output = "mesecons_pistons:piston_normal_off 2", | ||||||
| @@ -768,3 +341,4 @@ minetest.register_craft({ | |||||||
| 		{"mesecons_pistons:piston_normal_off"}, | 		{"mesecons_pistons:piston_normal_off"}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -200,7 +200,6 @@ local function register_wires() | |||||||
| 		if nodeid ~= "00000000" then | 		if nodeid ~= "00000000" then | ||||||
| 			groups_off["not_in_creative_inventory"] = 1 | 			groups_off["not_in_creative_inventory"] = 1 | ||||||
| 		end | 		end | ||||||
|  |  | ||||||
| 		mesecon.register_node(":mesecons:wire_"..nodeid, { | 		mesecon.register_node(":mesecons:wire_"..nodeid, { | ||||||
| 			description = "Mesecon", | 			description = "Mesecon", | ||||||
| 			drawtype = "nodebox", | 			drawtype = "nodebox", | ||||||
| @@ -212,6 +211,7 @@ local function register_wires() | |||||||
| 			selection_box = selectionbox, | 			selection_box = selectionbox, | ||||||
| 			node_box = nodebox, | 			node_box = nodebox, | ||||||
| 			walkable = false, | 			walkable = false, | ||||||
|  | 			on_rotate = false, | ||||||
| 			drop = "mesecons:wire_00000000_off", | 			drop = "mesecons:wire_00000000_off", | ||||||
| 			mesecon_wire = true | 			mesecon_wire = true | ||||||
| 		}, {tiles = tiles_off, mesecons = meseconspec_off, groups = groups_off}, | 		}, {tiles = tiles_off, mesecons = meseconspec_off, groups = groups_off}, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user