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
Pipe wires #65
Conversation
Fix "quanta" in accordance with #61 (comment) |
More quanta improvements; |
@@ -61,16 +61,15 @@ WireOutput* MachineRocket::request_output(WireOutPort port) | |||
|
|||
std::vector<WireInput*> MachineRocket::existing_inputs() | |||
{ | |||
/*std::vector<WireInput*> inputs; | |||
std::vector<WireInput*> inputs; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah fair enough
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.
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 theActiveEnt
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.