LastMUD/internal/game/world.go

107 lines
2.6 KiB
Go
Raw Normal View History

package game
2025-06-22 17:54:07 +03:00
2025-06-25 20:14:07 +03:00
import (
"code.haedhutner.dev/mvv/LastMUD/internal/ecs"
"code.haedhutner.dev/mvv/LastMUD/internal/game/data"
"code.haedhutner.dev/mvv/LastMUD/internal/game/logic/world"
2025-06-25 20:14:07 +03:00
)
2025-06-22 22:27:56 +03:00
type World struct {
2025-06-25 20:14:07 +03:00
*ecs.World
}
2025-06-22 22:27:56 +03:00
func CreateGameWorld() (gw *World) {
gw = &World{
2025-06-25 20:14:07 +03:00
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(w *ecs.World) {
forest := world.CreateRoom(
w,
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(w, data.ResourceDefaultRoom, forest)
2025-06-25 20:14:07 +03:00
cabin := world.CreateRoom(
w,
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 := world.CreateRoom(
w,
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 := world.CreateRoom(
w,
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 := world.CreateRoom(
w,
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(w, forest, data.NeighborsComponent{
2025-06-25 20:14:07 +03:00
North: cabin,
South: graveyard,
East: lake,
West: chapel,
})
ecs.SetComponent(w, cabin, data.NeighborsComponent{
2025-06-25 20:14:07 +03:00
South: graveyard,
West: chapel,
East: lake,
})
ecs.SetComponent(w, chapel, data.NeighborsComponent{
2025-06-25 20:14:07 +03:00
North: cabin,
South: graveyard,
East: forest,
})
ecs.SetComponent(w, lake, data.NeighborsComponent{
2025-06-25 20:14:07 +03:00
West: forest,
North: cabin,
South: graveyard,
})
ecs.SetComponent(w, graveyard, data.NeighborsComponent{
2025-06-25 20:14:07 +03:00
North: forest,
West: chapel,
East: lake,
})
2025-06-22 17:54:07 +03:00
}