61 lines
2.0 KiB
Markdown
61 lines
2.0 KiB
Markdown
# Building Location Handler Documentation
|
|||
|
|
|
||
|
|
## Overview
|
||
|
|
This document describes the database relationships and interactions for the `dbBuildingLocationHandler` class. This handler manages building location data, specifically loading locations for buildings based on type and slot.
|
||
|
|
|
||
|
|
## Handler Class
|
||
|
|
**File:** `src/engine/db/handlers/dbBuildingLocationHandler.java`
|
||
|
|
**Class:** `dbBuildingLocationHandler`
|
||
|
|
**Extends:** `dbHandlerBase`
|
||
|
|
|
||
|
|
## Database Tables
|
||
|
|
|
||
|
|
### Main Table
|
||
|
|
- **Table Name:** `static_building_location`
|
||
|
|
- **Description:** Stores location data for building components including position and rotation information
|
||
|
|
- **Columns:**
|
||
|
|
- ID (Primary Key)
|
||
|
|
- BuildingID
|
||
|
|
- type
|
||
|
|
- slot
|
||
|
|
- unknown
|
||
|
|
- locX
|
||
|
|
- locY
|
||
|
|
- locZ
|
||
|
|
- w
|
||
|
|
- rotX
|
||
|
|
- rotY
|
||
|
|
- rotZ
|
||
|
|
|
||
|
|
## Key Queries
|
||
|
|
|
||
|
|
### Load Building Locations
|
||
|
|
```sql
|
||
|
|
SELECT `ID`, `BuildingID`, `type`, `slot`, `unknown`, `locX`, `locY`, `locZ`, `w`, `rotX`, `rotY`, `rotZ`
|
||
|
|
FROM static_building_location
|
||
|
|
WHERE type = 6 OR type = 8
|
||
|
|
GROUP BY buildingID, slot
|
||
|
|
ORDER BY buildingID, slot ASC;
|
||
|
|
```
|
||
|
|
**File:** `dbBuildingLocationHandler.java`, Line ~17
|
||
|
|
|
||
|
|
## Relationships
|
||
|
|
|
||
|
|
1. **Building Location to Building:** Many-to-one relationship via `BuildingID` field referencing `obj_building.UID`
|
||
|
|
|
||
|
|
## Java Field to Database Column Mappings
|
||
|
|
|
||
|
|
| Java Field | Database Column | Notes |
|
||
|
|
|------------|-----------------|-------|
|
||
|
|
| `id` | `static_building_location.ID` | Unique identifier |
|
||
|
|
| `buildingID` | `static_building_location.BuildingID` | Reference to building |
|
||
|
|
| `type` | `static_building_location.type` | Location type |
|
||
|
|
| `slot` | `static_building_location.slot` | Slot number |
|
||
|
|
| `unknown` | `static_building_location.unknown` | Unknown field |
|
||
|
|
| `locX` | `static_building_location.locX` | X coordinate |
|
||
|
|
| `locY` | `static_building_location.locY` | Y coordinate |
|
||
|
|
| `locZ` | `static_building_location.locZ` | Z coordinate |
|
||
|
|
| `w` | `static_building_location.w` | W rotation value |
|
||
|
|
| `rotX` | `static_building_location.rotX` | X rotation |
|
||
|
|
| `rotY` | `static_building_location.rotY` | Y rotation |
|
||
|
|
| `rotZ` | `static_building_location.rotZ` | Z rotation |
|