mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-17 01:13:05 +00:00
More slight refactoring
This commit is contained in:
parent
750fd45e98
commit
fb11e828a3
@ -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 () {
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user