Docs » API reference » Town

Town

A town: its place, its clinic, and the Voxelord threatening it.

A handle to something in the game. Once that thing is gone, its calls fail with Gone. You get one from world.town_at(...), world.towns_near(...), player.town.

Methods

MethodDescription
fn name(&self) -> Result<String>String name()Its name: what it is built as (MEADOW TOWN, FISHING TOWN, PALISADE TOWN...); the game gives towns no names of their own.
fn centre(&self) -> Result<Place>Place centre()Its plaza's middle, at the plaza's floor.
fn freed(&self) -> Result<bool>boolean freed()Whether its Voxelord has been beaten (saved with the world).
fn voxelord(&self) -> Result<Species>Species voxelord()The species of its Voxelord (by what the town is built as).
fn lair(&self) -> Result<Option<Place>>Optional<Place> lair()Where its Voxelord waits, outside the town; none for the rare town with no fit ground round it. Looked for once, the first time it is asked (a few milliseconds).
fn clinic(&self) -> Result<Option<Place>>Optional<Place> clinic()Its VoxelAid clinic: the middle of the clinic's floor.

ShopGood

One of the goods a shop sells and its price (World shop_goods, set_shop_goods).

Plain data, copied between the server and the plugin.

FieldDescription
item: ItemTypeItemType item()What it sells.
price: i64long price()Its price in coins.

Events

Related events: PlayerEnteredTown, TownFreed.