Änderung: Bereinigung und Optimierung der Taxi-Map-Logik
Änderungen: - Entfernen der Methode `getMapByPosition` aus dem `TaxiMapController` und der zugehörigen Logik im `TaxiMapService`, um die Komplexität zu reduzieren. - Anpassung der Datenbankmodelle für `TaxiMap`, `TaxiLevelStats` und `TaxiMapType`, um die Tabellennamen zu vereinheitlichen. - Aktualisierung der Routen im `taxiMapRouter`, um die entfernte Funktionalität zu reflektieren. - Hinzufügung von neuen Importen in `index.js`, um die neuen Modelle zu integrieren. - Verbesserung der Benutzeroberfläche durch neue Erfolgsmeldungen in den Übersetzungsdateien für die Admin-Oberfläche. Diese Anpassungen tragen zur Vereinfachung der Codebasis und zur Verbesserung der Benutzererfahrung im Taxi-Minispiel bei.
This commit is contained in:
@@ -34,7 +34,7 @@ class TaxiMapService extends BaseService {
|
||||
model: TaxiMapType,
|
||||
as: 'mapType'
|
||||
}],
|
||||
order: [['positionY', 'ASC'], ['positionX', 'ASC']]
|
||||
order: [['name', 'ASC']]
|
||||
});
|
||||
return maps;
|
||||
} catch (error) {
|
||||
@@ -65,28 +65,6 @@ class TaxiMapService extends BaseService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Holt eine Map nach Position
|
||||
*/
|
||||
async getMapByPosition(positionX, positionY) {
|
||||
try {
|
||||
const map = await TaxiMap.findOne({
|
||||
where: {
|
||||
positionX: positionX,
|
||||
positionY: positionY,
|
||||
isActive: true
|
||||
},
|
||||
include: [{
|
||||
model: TaxiMapType,
|
||||
as: 'mapType'
|
||||
}]
|
||||
});
|
||||
return map;
|
||||
} catch (error) {
|
||||
console.error('Error getting map by position:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Holt die Standard-Map
|
||||
@@ -231,38 +209,6 @@ class TaxiMapService extends BaseService {
|
||||
* Erstellt eine Standard-Map
|
||||
*/
|
||||
async createDefaultMap() {
|
||||
try {
|
||||
// 8x8 Standard-Map mit verschiedenen Tile-Typen
|
||||
const mapData = [
|
||||
['cornerTopLeft', 'horizontal', 'horizontal', 'horizontal', 'horizontal', 'horizontal', 'horizontal', 'cornerTopRight'],
|
||||
['vertical', 'cross', 'cross', 'cross', 'cross', 'cross', 'cross', 'vertical'],
|
||||
['vertical', 'cross', 'cross', 'cross', 'cross', 'cross', 'cross', 'vertical'],
|
||||
['vertical', 'cross', 'cross', 'cross', 'cross', 'cross', 'cross', 'vertical'],
|
||||
['vertical', 'cross', 'cross', 'cross', 'cross', 'cross', 'cross', 'vertical'],
|
||||
['vertical', 'cross', 'cross', 'cross', 'cross', 'cross', 'cross', 'vertical'],
|
||||
['vertical', 'cross', 'cross', 'cross', 'cross', 'cross', 'cross', 'vertical'],
|
||||
['cornerBottomLeft', 'horizontal', 'horizontal', 'horizontal', 'horizontal', 'horizontal', 'horizontal', 'cornerBottomRight']
|
||||
];
|
||||
|
||||
const map = await TaxiMap.create({
|
||||
name: 'Standard City Map',
|
||||
description: 'A standard 8x8 city map with roads and intersections',
|
||||
width: 8,
|
||||
height: 8,
|
||||
tileSize: 50,
|
||||
mapTypeId: 1, // Assuming first map type
|
||||
mapData: mapData,
|
||||
positionX: 1,
|
||||
positionY: 1,
|
||||
isDefault: true,
|
||||
isActive: true
|
||||
});
|
||||
|
||||
return map;
|
||||
} catch (error) {
|
||||
console.error('Error creating default map:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user