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

Pipe wires #65

Merged
merged 1 commit into from Feb 18, 2021
Merged

Pipe wires #65

merged 1 commit into from Feb 18, 2021

Conversation

z-adams
Copy link
Contributor

@z-adams z-adams commented Feb 12, 2021

You can call me the white hat of the wiring system. I abuse the system horribly so we can find out how to stop people like me from breaking things.

The new Pipe wire type is, to cap's horror, just a wrapper for the ActiveEnt at the source end. Right now, this allows for connections between fuel tanks and engines to be programmatically defined in the ship blueprint (good). The MachineRocket at the sink end uses it (in Rocket.cpp:187) to reach into the source and withdraw whatever resources it demands (bad). The primary function of the pipe wire is to allow pipes to be defined in blueprints; we need to figure out what the interface presented to either end of the pipe should be.

Right now, the pipes originate in MachineContainer, and are accepted as an argument by MachineRocket and stored as a member vector, and are iterated over in the main MachineRocket::update loop as before. Hopefully this new use case will help stimulate some brainstorming over how to improve the pipe system.

@z-adams
Copy link
Contributor Author

z-adams commented Feb 12, 2021

Fix "quanta" in accordance with #61 (comment)

@z-adams
Copy link
Contributor Author

z-adams commented Feb 12, 2021

More quanta improvements; constexpr-ify things if possible: #58 (comment)

src/adera/Machines/Rocket.cpp Outdated Show resolved Hide resolved
@@ -61,16 +61,15 @@ WireOutput* MachineRocket::request_output(WireOutPort port)

std::vector<WireInput*> MachineRocket::existing_inputs()
{
/*std::vector<WireInput*> inputs;
std::vector<WireInput*> inputs;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems a bit weird to use a raw pointer for something that you know is always non-null.

std::reference_wrapper might be closer to what you really want.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Capital-Asterisk what do you think of this? I was just following the convention of the other existing_inputs() functions, should we change all of these to references instead of pointers?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want the entire wiring system dead, so there isn't really a point. Changing the syntax won't untangle the spaghetti.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah fair enough

@jonesmz jonesmz mentioned this pull request Feb 14, 2021
New `Pipe` wire payload exposes a MachineContainer (or any other entity)
for direct access by the pipe output. This is used by MachineRocket to
perform instant fuel draw from its fuel recepticle, to prevent engines
drawing more fuel than is available, which would be possible if fuel
levels were only subtracted once per frame. The wiring now allows
rockets and fuel tanks to be connected programmatically; all hard coding
has been removed. Engines currently can only use one fuel and draw from
a single tank until more robust configuration is developed.
@z-adams z-adams merged commit bcab155 into TheOpenSpaceProgram:master Feb 18, 2021
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 this pull request may close these issues.

None yet

3 participants