Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Effectors that are conductors #638

Open
Desour opened this issue Apr 4, 2023 · 1 comment
Open

Effectors that are conductors #638

Desour opened this issue Apr 4, 2023 · 1 comment

Comments

@Desour
Copy link
Contributor

Desour commented Apr 4, 2023

Defining nodes that are a conductor and an effector at the same time doesn't work.
Example:

local rules_conductor = {
	vector.new( 1, 0, 0),
	vector.new(-1, 0, 0),
}

local rules_effector = {
	vector.new(0, 0, 1),
}

minetest.register_node("mesecons_conduct_effect:node_off", {
	description = "Mesecon Conductor and Effector",
	drawtype = "normal",
	tiles = {"default_stone.png^mesecons_silicon.png"},
	groups = {dig_immediate=2},
	mesecons = {
		conductor = {
			state = mesecon.state.off,
			offstate = "mesecons_conduct_effect:node_off",
			onstate = "mesecons_conduct_effect:node_on",
			rules = rules_conductor,
		},
		effector = {
			rules = rules_effector,
			action_on = function (pos, node)
				minetest.log("(c off) action_on at "..vector.to_string(pos))
			end,
			action_off = function (pos, node)
				minetest.log("(c off) action_off at "..vector.to_string(pos))
			end,
			action_change = function (pos, node)
				minetest.log("(c off) action_change at "..vector.to_string(pos))
			end,
		}
	},
})

minetest.register_node("mesecons_conduct_effect:node_on", {
	description = "You hacker you!",
	drawtype = "normal",
	tiles = {"default_stone.png^mesecons_silicon.png"},
	drop = "mesecons_conduct_effect:node_off",
	groups = {dig_immediate=2, not_in_creative_inventory=1},
	mesecons = {
		conductor = {
			state = mesecon.state.on,
			offstate = "mesecons_conduct_effect:node_off",
			onstate = "mesecons_conduct_effect:node_on",
			rules = rules_conductor,
		},
		effector = {
			rules = rules_effector,
			action_on = function (pos, node)
				minetest.log("(c on) action_on at "..vector.to_string(pos))
			end,
			action_off = function (pos, node)
				minetest.log("(c on) action_off at "..vector.to_string(pos))
			end,
			action_change = function (pos, node)
				minetest.log("(c on) action_change at "..vector.to_string(pos))
			end,
		}
	},
})

One could expect that the action_* callbacks get executed whenever some effector-rule input changes.

I'm unsure if this is a bug report or feature request.

@numberZero
Copy link
Contributor

See also: #406

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants