Add Trough Component#229
Merged
Merged
Conversation
Collaborator
|
Did a sanity check on the documentation. |
…or non-renderable items (like troughs).
jsm174
approved these changes
Nov 12, 2020
Collaborator
jsm174
left a comment
There was a problem hiding this comment.
Awesome PR. Just a few nitpicks, nothing crazy. Can not wait to try this with WPCEmu!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for trough devices and refactors the switch- and coil mapping so it supports multi-switch/coil devices. Closes #211. Supersedes and closes #228. User documentation can be found here.
The UI was solved a bit differently, since I didn't want to overload the source/destination dropdown. Mockup:
Final screen:
So in case of a Device, the Element column has now two fields, one for the device, and one for the switch/coil within the device.
Switch/Coil Devices
For coils, we now have
ICoilableDevice(item),IApiCoilDevice(API) andICoilDeviceAuthoring(component), for switches it'sISwitchableDevice,IApiSwitchDeviceandISwitchDeviceAuthoring.In terms of auto-population, two more fields were added to the switch/coil objects, in order to match the necessary elements for the default tables.
Trough
For troughs, we now have a new GameItem with ID
101that is read and written to the.vpxfile. While the trough's runtime logic is inTroughApi, the switches and triggers are generated in the mainTroughclass based on its properties.During runtime, the following happens:
Init(), the trough (which is both of the above) creates switch objects based on its configurationThe mentioned switch objects are instances of
DeviceSwitch, which is a standalone implementation ofIApiSwitch. It's basically a proxy whereOnSwitch()can be called on and the event will be dispatched to the switch input(s) of the gamelogic engine.Import: The converter automatically adds a trough when there is none. It also tries to bind it to
DrainandBallRelease. The result is that importing the default table results with a working and fully set up trough.Editor: In order to keep the inspector code DRY, the
SurfaceFieldmethod has been refactored to be generic, so it supports the now necessary kicker- and trigger picker.Other Changes
ItemGroupName, it's attached to the table root directly.OnDestroy()method they can override in case they need to unsubscribe from any events.TODO
IRenderable