Skip to content

Commit 779aea6

Browse files
committed
Update for Kethane 8.6
1 parent e6d9241 commit 779aea6

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

SCANsatkethane/SCANsatkethane.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public class SCANsatKethane: MonoBehaviour
2525
private bool rebuild, reset;
2626
private int rebuildStep, rebuildValueStep;
2727
private bool initialized, rebuildingArray, rebuildingValue = false;
28+
private Cell cell;
2829

2930
public void Start() {
3031
print("[SCAN Kethane] Starting Up");
@@ -105,9 +106,10 @@ private void updateKethaneData (SCANdata.SCANtype type) {
105106
for (int ilat = 0; ilat < 180; ilat++) {
106107
for (int ilon = 0; ilon < 360; ilon++) {
107108
if (data.isCovered (ilon - 180, ilat - 90, type)) {
108-
Cell cell = getKethaneCell (ilon - 180, ilat - 90);
109-
if (!KethaneData.Current.Scans[resource.name][body.name][cell])
110-
KethaneData.Current.Scans[resource.name][body.name][cell] = true;
109+
cell = getKethaneCell (ilon - 180, ilat - 90);
110+
if (!KethaneData.Current.Scans[resource.name][body.name][cell]) {
111+
KethaneData.Current.Scans[resource.name][body.name][cell] = true;
112+
}
111113
}
112114
}
113115
}
@@ -121,7 +123,7 @@ private void rebuildResourceArray () {
121123
rebuildingArray = true;
122124
}
123125
for (int ilon = 0; ilon < 360; ilon++) {//Run 360 points per frame; 3 seconds at 60FPS
124-
Cell cell = getKethaneCell(ilon - 180, rebuildStep - 90);
126+
cell = getKethaneCell(ilon - 180, rebuildStep - 90);
125127
if (KethaneData.Current.Scans[resource.name][body.name][cell]) {
126128
updateResourceArray(ilon, rebuildStep, resource.type, data);
127129
ICellResource deposit = KethaneData.Current.GetCellDeposit(resource.name, body, cell);
@@ -148,7 +150,7 @@ private void rebuildResourceValue (SCANdata.SCANtype type) {
148150
for (int ilon = 0; ilon < 360; ilon++) {
149151
if (data.isCovered(ilon, ilat, type)) {
150152
if (data.kethaneValueMap[ilon, ilat] == 0) { //Only check unassigned values
151-
Cell cell = getKethaneCell(ilon - 180, ilat - 90);
153+
cell = getKethaneCell(ilon - 180, ilat - 90);
152154
ICellResource deposit = KethaneData.Current.GetCellDeposit(resource.name, body, cell);
153155
if (deposit != null) updateResourceValue (ilon, ilat, deposit.Quantity, data);
154156
else updateResourceValue (ilon, ilat, -1d, data); //Give empty cells -1 resources, account for this later on
@@ -165,7 +167,7 @@ private void rebuildResourceValue (SCANdata.SCANtype type) {
165167

166168
private Cell getKethaneCell (int ilon, int ilat) { //Find the Kethane cell corresponding to the current position
167169
Vector3 pos = body.GetRelSurfaceNVector((double)ilat, (double)ilon);
168-
return Kethane.Cell.Containing(pos, 5);
170+
return Cell.Containing(pos, 5);
169171
}
170172

171173
private void updateResourceArray (int lon, int lat, SCANdata.SCANtype type, SCANdata data) {

0 commit comments

Comments
 (0)