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

Please, add a fork for wires to the game #1716

Open
NikitaVNsv opened this issue Oct 17, 2023 · 6 comments · May be fixed by #2000
Open

Please, add a fork for wires to the game #1716

NikitaVNsv opened this issue Oct 17, 2023 · 6 comments · May be fixed by #2000

Comments

@NikitaVNsv
Copy link

NikitaVNsv commented Oct 17, 2023

Please, add a fork for wires to the game
.....B.....
A-+-A
.....B.....
If is A is switch on and B is swith off, A is has signal, B hasn't signal
If is A is switch off and B is swith on, A is hasn't signal, B has signal
If is A is switch on and B is swith on, A is has signal, B has signal
If is A is switch off and B is swith off, A is hasn't signal, B hasn't signal

@mugg91
Copy link
Contributor

mugg91 commented Apr 4, 2024

I'm rewriting MechanismsCommon.as to hopefully make it work.
Might also add a dual elbow.

@mugg91
Copy link
Contributor

mugg91 commented Apr 6, 2024

Sorry, I had no luck finishing it. Kept having too many errors.
When changing functions or variables inside the MapPowerChunk class, it said "Shared type 'MapPowerChunk' doesn't match the original declaration in other module".
If someone helps me deal with this, I can continue working on the fork tile.

@mugg91
Copy link
Contributor

mugg91 commented Apr 6, 2024

Basicly I would replace

	array<u8> power_old;
	array<u8> power_new;
	array<u8> topo_in;      
	array<u8> topo_out;     

with

	array<array<IO_Element>> io_element_array;

and add

shared class IO_Element
{
	u8 input_topology;
	u8 output_topology;
	u8 power_new;
	u8 power_old;
	
	IO_Element(u8 input, u8 output, u8 power)
	{
		input_topology = input;
		output_topology = output;
		power_new = power;
		power_old = power;
	}
};

And then changing the entire script to deal with the array instead of the u8 variables.
This would allow multiple input/output topologies and new/old powers in one component, since I would like to make fork work like a wire (a component that keeps track of two wires, basicly) and not like a special tile.

@asumagic
Copy link
Member

asumagic commented Apr 6, 2024

Sorry, I had no luck finishing it. Kept having too many errors. When changing functions or variables inside the MapPowerChunk class, it said "Shared type 'MapPowerChunk' doesn't match the original declaration in other module". If someone helps me deal with this, I can continue working on the fork tile.

I assume you've tried it, but restarting the game may be necessary when editing shared classes, are rebuild is going to have a hard time with it.

@mugg91
Copy link
Contributor

mugg91 commented Apr 6, 2024

I assume you've tried it, but restarting the game may be necessary when editing shared classes, are rebuild is going to have a hard time with it.

Nah, I didn't try. It seems that error stopped showing but now the game just doesn't load the map anymore and crashes.
I guess I will try without objects and will just use plain values to get the basics working.

@mugg91
Copy link
Contributor

mugg91 commented Apr 8, 2024

I did it!!!!11

1233

@mugg91 mugg91 linked a pull request Apr 8, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants