More slight refactoring

This commit is contained in:
Ricardo Lopes 2020-02-13 22:18:41 +01:00
parent 750fd45e98
commit fb11e828a3
2 changed files with 8 additions and 7 deletions

View File

@ -27,10 +27,7 @@ namespace QSB {
}
public void EnterSector (Sector sector) {
var name = sector.GetName();
if (name != Sector.Name.Unnamed && name != Sector.Name.Ship && name != Sector.Name.Sun) {
SectorSync.SetSector(netId, sector.GetName());
}
SectorSync.SetSector(netId, sector.GetName());
}
void Update () {

View File

@ -16,7 +16,11 @@ namespace QSB {
}
public static void SetSector (NetworkInstanceId netId, Sector.Name sectorName, bool skipAnnounce = false) {
playerSectors[netId.Value] = GetSectorByName(sectorName);
if (sectorName == Sector.Name.Unnamed || sectorName != Sector.Name.Ship && sectorName != Sector.Name.Sun) {
return;
}
playerSectors[netId.Value] = GetSectorTransform(sectorName);
if (!skipAnnounce) {
SectorMessage msg = new SectorMessage();
@ -30,7 +34,7 @@ namespace QSB {
return playerSectors[netId.Value];
}
static Transform GetSectorByName (Sector.Name sectorName) {
static Transform GetSectorTransform (Sector.Name sectorName) {
foreach (var sector in _allSectors) {
if (sectorName == sector.GetName()) {
return sector.transform;
@ -43,7 +47,7 @@ namespace QSB {
SectorMessage msg = netMsg.ReadMessage<SectorMessage>();
var sectorName = (Sector.Name) msg.sectorId;
var sectorTransform = GetSectorByName(sectorName);
var sectorTransform = GetSectorTransform(sectorName);
if (sectorTransform == null) {
QSB.LogToScreen("Sector", sectorName, "not found");