package main
// RoomRole identifies the functional purpose of a room aboard a ship.
// Rendering code maps roles to colors; ship data itself stays
// free of any renderer-specific information.
type RoomRole int
const (
RolePilot RoomRole = iota
RoleWeapons
RoleShields
RoleMedBay
RoleEngines
)
// Room describes a rectangular cell on the ship grid.
// All coordinates and sizes are in tile units; conversion to pixels
// happens only in the renderer.
type Room struct {
ID int
Name string
GridX int
GridY int
GridW int
GridH int
Role RoomRole
}
// Ship is a pure-data description of a ship layout.
type Ship struct {
Rooms []Room
}
// NewEnemyShip returns a 5-room layout that mirrors NewPlayerShip but with
// every room shifted +24 tiles along the X axis so the enemy ship sits on
// the right half of the virtual screen.
func NewEnemyShip() Ship {
player := NewPlayerShip()
rooms := make([]Room, len(player.Rooms))
for i, r := range player.Rooms {
r.GridX += 24
rooms[i] = r
}
return Ship{Rooms: rooms}
}
// NewPlayerShip returns a hard-coded 5-room placeholder layout:
// Pilot front-left, Weapons mid-upper, Shields mid-center,
// MedBay mid-lower, Engines rear-right.
func NewPlayerShip() Ship {
return Ship{
Rooms: []Room{
{ID: 1, Name: "Pilot", GridX: 3, GridY: 9, GridW: 3, GridH: 3, Role: RolePilot},
{ID: 2, Name: "Weapons", GridX: 6, GridY: 6, GridW: 4, GridH: 3, Role: RoleWeapons},
{ID: 3, Name: "Shields", GridX: 6, GridY: 9, GridW: 4, GridH: 3, Role: RoleShields},
{ID: 4, Name: "MedBay", GridX: 6, GridY: 12, GridW: 4, GridH: 3, Role: RoleMedBay},
{ID: 5, Name: "Engines", GridX: 10, GridY: 9, GridW: 3, GridH: 3, Role: RoleEngines},
},
}
}