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

[added] Dual Elbow & Fork wire components #2000

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mugg91
Copy link
Contributor

@mugg91 mugg91 commented Apr 8, 2024

Status

  • IN DEVELOPMENT
  • May be possible to polish code-wise.
  • Debug render (g_debug = 1 in console) should visualise how much power is in the 2nd set and where it is going.
  • Dual Elbow sprite doesn't align properly (when placing them next to each other there is 1 pixel free space)
  • With Dual Elbow being so round, regular Elbow should be round, too
  • Maybe it's possible to enlarge builder inventory only for one page depending on number of tiles, instead of enlarging it for all pages

Description

[added] Fork wire component
[added] Dual Elbow wire component

Fixes #1716

This PR changes logic in MechanismsCommon.as and all component script files to support a 2nd set of input topology, output topology, power_new and power_old. They have the same names but with a 2 appended to it at the end. The first set is refered to as "section 0" and the second set is refered to as "section 1".

The two new tiles make use of the 2nd set, whereas all the other components don't, making Activate(), Deactivate() and Special() return early from the function if it detects that it is called with any set that isn't "section 0".

Since the builder inventory menu couldn't fit both new component tiles on the 2nd page, I made it so it will be enlarged by an additional row when playing in Sandbox.

It isn't necessary to add a Dual Elbow to the game, I just did it here because I could and wanted to show off it's possible.

Tested offline, works as intended.

Although it is technically ready, it is probably possible to improve the code.
Initially, I tried implementing a class object that contains a whole set (see above), with the MapPowerGrid@ receiving an array of such objects via grid.setAll(). Unfortunately the game kept crashing during loading each time so I resorted to implementing a second set of primitive variables instead.

@mugg91
Copy link
Contributor Author

mugg91 commented Apr 8, 2024

In-game look - Yes, the Dual Elbow sprite is apparently off by 1pixel.
screen-24-04-09-00-08-34

@Vam-Jam Vam-Jam added the change A change to an existing feature or mechanic label Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change A change to an existing feature or mechanic
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Please, add a fork for wires to the game
2 participants