stackcollision / GardenConquest

A new conquest game mode for Space Engineers
6 stars 7 forks source link

Rewrote /gc fleet and now shows grid coordinates #94

Closed HaoTNN closed 9 years ago

HaoTNN commented 9 years ago

/gc fleet is rewritten to send data to client now instead of just a dialog, which should allow for the implementation of /gc fleet disown. The problem right now with disown is that the current ModAPI doesn't have a changeOwner() method to change the owner of a block, so we can't really disown a player's grid. I've looked through the Space Engineers' source code and mostly figured out what method to expose so I'll throw up a PR on that and see if we can get that changeOwner() functionality.

Regardless, I've included most of the code for /gc fleet disown. Just need to uncomment a few lines when ModAPI supports block.changeOwner().

As for how /gc fleet is rewritten: instead of sending a dialog, the server now sends the client data about their fleet and the client stores it. The client will then build a string and call a dialog to display their fleet information. FleetResponse handles the serialization; it works pretty much the same as SettingsResponse. The data that's being sent can be found in the struct GridData in GridEnforcer.

/gc fleet also shows the player their grid coordinates, given that the player is the owner of the main cockpit OR the owner of the main cockpit is part of the player's faction. If the grid doesn't have a main cockpit, the coordinates won't show up.

Let me know if you want anything changed.

zrisher commented 9 years ago

This is great, so glad to have it. I haven't looked into it in detail yet; on the whole implementation looks good, but here's a couple notes I had so far:

Sound ok?

HaoTNN commented 9 years ago

Alright cool, I made the changes as you suggested. Do you want me to squash these commits down?

Big whoops on the tab indents. Didn't realize VS was converting my tabs to spaces, heh.

zrisher commented 9 years ago

As discussed:

And we should be good to go!