-
Notifications
You must be signed in to change notification settings - Fork 230
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
Ksc messages #1972
base: develop
Are you sure you want to change the base?
Ksc messages #1972
Conversation
This looks like a good idea. I haven't had time to look at the code yet because I had my head buried in the GUI system and the fonts changes. But it looks good and we should get around to looking at it. As I understand it, it provides a way for you to send a message using the inter-vessel comms system from the KSC to a vessel. Presumably the message has to be a string. |
Yes, exactly - you open a dedicated window where you write whatever you want and then hit Send and (after a delay, if any) the vessel receives the message with that string as the content. I thought a little bit about sending more than strings but that would need one of two things:
Anyway, I decided to go the simplest way and just send strings for now. It is the receiver's business to parse it. In the future, if the lexicon and list literals show up, it should be easy to integrate - e.g. a checkbox would be added to the window that would tell whether I want to parse it or just send as string and then upon sending the message the typed stuff would be parsed. |
I'm moving the |
* Added images illustrating button for opening uplink channel and the message sending window. * Added a section on sending messages from KSC to a vessel. * Added a TODO to replace the overview image in settingsWindows.rst.
* Documented the SENDER and HASSENDER attributes. * Better description of the general usage.
# Conflicts: # src/kOS/Screen/KOSToolbarWindow.cs
Everything should be documented. The only exception is the |
Thanks. I'm digging through some older issues and PR's so it may be a day or two before I look at this. |
give the space center its own cpu and gui |
@sebseb7 Yes, that would be awesome. However, it would be also a lot of work (a lot of things in kerboscript assumes that there is a vessel to control, e.g. the whole SHIP variable) which for me is too much, as I don't know C# very much and also I know next to nothing about how kOS is internally organized. I thought this could be a first step towards what might be a KSC-side CPU. |
@sebseb7 that is a brilliant idea. If KSC had its own CPU and GUI, the archive could live there. Code could then be transferred between CPUs in the VAB/SPH and on the launchpad/runway as appropriate. Files could be transferred to and from vessels within radio range. Lots of interesting possibilities! On another note, what if anything is left for this PR before it can be merged? |
So, I got a little bored (well, not really) and just went ahead and implemented what I proposed in #1964.
If you want to see it in "action", you can view a few screenshots here: http://imgur.com/a/dUyR0
I added a single new button to the main kOS window (the one that has the list of loaded processors) that allows to open an "uplink channel" to the currently active vessel. When opened a window very similar to the one used to edit source files appears. In this window the player can type whatever she wants to. Then she can hit the Send button and the content of the window is sent as a string with a proper delay (to home since we are sending from KSC).
Now, there are some things that are kind of hackish. Before this, the
SENDER
of a message was eitherVessel
that corresponded to the sender or it wasFalse
. Now I needed to distinguish one extra case - the sender is the KSC. I achieved this by setting theSENDER
toTrue
when this is the case, butHASSENDER
still returns false. In other words, the new "sender table" looks like this:HASSENDER
is true,SENDER
is a vessel:SENDER
contains the vessel that sent the messageHASSENDER
is false,SENDER
is false: the message was sent from a vessel that no longer existsHASSENDER
is false,SENDER
is true: the message was sent from KSCIn order to do that I modified the
GetVesselTarget()
method ofMessageStructure
.The other hackish thing is the way I represent the actual sender when the message is built. The
Message.Create()
needs aVesselTarget
to be the sender. Therefore I created a new classKscTarget
that is a singleton. I also made the methodGetGuid()
inVesselTarget
virtual so thatKscTarget
can override it. When doing theGetVesselTarget()
inMessageStructure
, if no vessel is found (viaGetVessel()
), the singletonKscTarget
's guid is checked for equality with the message's vessel.Be warned that this is effectively my first touch on KSP mods and C# as well (apart from the regexp matching on part tags I have already done) so feel free to bash my head because all the mistakes I have done (which I'm not aware of).
The reason of the [NOT READY] thing is that I have no idea whether I have done it in a good way, and also because the documentation is not updated.