LastMUD/internal/game/data/world.go

109 lines
2.5 KiB
Go
Raw Normal View History

package data
2025-06-22 17:54:07 +03:00
2025-06-25 20:14:07 +03:00
import (
"code.haedhutner.dev/mvv/LastMUD/internal/ecs"
2025-06-25 20:14:07 +03:00
)
2025-06-22 22:27:56 +03:00
2025-06-25 20:14:07 +03:00
const (
ResourceDefaultRoom ecs.Resource = "world:room:default"
)
2025-06-22 17:54:07 +03:00
2025-06-25 20:14:07 +03:00
type GameWorld struct {
*ecs.World
}
2025-06-22 22:27:56 +03:00
2025-06-25 20:14:07 +03:00
func CreateGameWorld() (gw *GameWorld) {
gw = &GameWorld{
World: ecs.CreateWorld(),
2025-06-22 17:54:07 +03:00
}
2025-06-22 22:27:56 +03:00
defineRooms(gw.World)
return
}
func defineRooms(world *ecs.World) {
2025-06-25 20:14:07 +03:00
forest := CreateRoom(
world,
2025-06-25 20:14:07 +03:00
"Forest",
"A dense, misty forest stretches endlessly, its towering trees whispering secrets through rustling leaves. Sunbeams filter through the canopy, dappling the mossy ground with golden light.",
ecs.NilEntity(),
ecs.NilEntity(),
ecs.NilEntity(),
ecs.NilEntity(),
)
ecs.SetResource(world, ResourceDefaultRoom, forest)
2025-06-25 20:14:07 +03:00
cabin := CreateRoom(
world,
2025-06-25 20:14:07 +03:00
"Wooden Cabin",
"The cabins interior is cozy and rustic, with wooden beams overhead and a stone fireplace crackling warmly. A wool rug lies on creaky floorboards, and shelves brim with books, mugs, and old lanterns.",
ecs.NilEntity(),
ecs.NilEntity(),
ecs.NilEntity(),
ecs.NilEntity(),
)
lake := CreateRoom(
world,
2025-06-25 20:14:07 +03:00
"Ethermere Lake",
"Ethermire Lake lies shrouded in mist, its dark, still waters reflecting a sky perpetually overcast. Whispers ride the wind, and strange lights flicker beneath the surface, never breaking it.",
ecs.NilEntity(),
ecs.NilEntity(),
ecs.NilEntity(),
ecs.NilEntity(),
)
graveyard := CreateRoom(
world,
2025-06-25 20:14:07 +03:00
"Graveyard",
"An overgrown graveyard shrouded in fog, with cracked headstones and leaning statues. The wind sighs through dead trees, and unseen footsteps echo faintly among the mossy graves.",
ecs.NilEntity(),
ecs.NilEntity(),
ecs.NilEntity(),
ecs.NilEntity(),
)
chapel := CreateRoom(
world,
2025-06-25 20:14:07 +03:00
"Chapel of the Hollow Light",
"This ruined chapel leans under ivy and age. Faint light filters through shattered stained glass, casting broken rainbows across dust-choked pews and a long-silent altar.",
ecs.NilEntity(),
ecs.NilEntity(),
ecs.NilEntity(),
ecs.NilEntity(),
)
ecs.SetComponent(world, forest, NeighborsComponent{
2025-06-25 20:14:07 +03:00
North: cabin,
South: graveyard,
East: lake,
West: chapel,
})
ecs.SetComponent(world, cabin, NeighborsComponent{
2025-06-25 20:14:07 +03:00
South: graveyard,
West: chapel,
East: lake,
})
ecs.SetComponent(world, chapel, NeighborsComponent{
2025-06-25 20:14:07 +03:00
North: cabin,
South: graveyard,
East: forest,
})
ecs.SetComponent(world, lake, NeighborsComponent{
2025-06-25 20:14:07 +03:00
West: forest,
North: cabin,
South: graveyard,
})
ecs.SetComponent(world, graveyard, NeighborsComponent{
2025-06-25 20:14:07 +03:00
North: forest,
West: chapel,
East: lake,
})
2025-06-22 17:54:07 +03:00
}