kotcity4 / kotcity.data / Building

Building

abstract class Building : HasConcreteInventory, HasConcreteContacts

The basic unit of simulation in this game. Represents a building and all its attributes. We currently count Road as building as well as PowerLine.

Constructors

<init>

Building(cityMap: CityMap)

The basic unit of simulation in this game. Represents a building and all its attributes. We currently count Road as building as well as PowerLine.

Properties

borderColor

open var borderColor: Color

Default border color, used for rendering

cityMap

open val cityMap: CityMap

consumes

open val consumes: MutableMap<Tradeable, Int>

A list of Tradeable (with quantities) that this building consumes

contracts

open val contracts: MutableList<Contract>

description

open var description: String?

Extended description of this building

goodwill

var goodwill: Int

happiness

open var happiness: Int

How happy the building is. This can be positive or negative.

height

abstract var height: Int

Height in BlockCoordinate of the building

inventory

open val inventory: Inventory

level

var level: Int

name

open var name: String?

Friendly name (eg. "Slummy apartment") of building

pollution

open var pollution: Double

How much pollution this building generates...

powerRequired

open val powerRequired: Int

How many units of power this building needs to be happy

powered

var powered: Boolean

true if we have power, false if not

produces

open val produces: MutableMap<Tradeable, Int>

sprite

open var sprite: String?

Filename of sprite asset used to paint this building (I guess maybe this should live in renderer?)

upkeep

open var upkeep: Int

Eventually, how much $$$ is required to keep this building going. Probably going to be used for civic buildings like town hall.

uuid

val uuid: String

Unique ID of building

variety

open val variety: String?

Used for things like PowerPlant so we know what it is (coal/nuclear)

width

abstract var width: Int

Width in BlockCoordinate of the building

zots

var zots: List<Zot>

List of Zot that this building suffers from. Populated by... ZotPopulator

Functions

createContract

fun createContract(otherTradeEntity: TradeEntity, tradeable: Tradeable, quantity: Int, path: Path?): Unit

equals

open fun equals(other: Any?): Boolean

payWorkers

fun payWorkers(): Unit

toString

open fun toString(): String

zone

fun zone(): Zone?

Inherited Functions

addContract

open fun addContract(contract: Contract): Unit

addInventory

open fun addInventory(tradeable: Tradeable, quantity: Int): Int

balance

open fun balance(): Int

How much Tradeable.MONEY that the given thing has.

consumesQuantity

open fun consumesQuantity(tradeable: Tradeable): Int

currentQuantityForSale

open fun currentQuantityForSale(tradeable: Tradeable): Int

currentQuantityWanted

open fun currentQuantityWanted(tradeable: Tradeable): Int

hasAnyContracts

open fun hasAnyContracts(): Boolean

producesQuantity

open fun producesQuantity(tradeable: Tradeable): Int

productList

open fun productList(): List<Tradeable>

quantityOnHand

open fun quantityOnHand(tradeable: Tradeable): Int

setInventory

open fun setInventory(tradeable: Tradeable, quantity: Int): Int

subtractInventory

open fun subtractInventory(tradeable: Tradeable, quantity: Int): Int

summarizeContracts

open fun summarizeContracts(): String

summarizeInventory

open fun summarizeInventory(): String

Used to print a textual description of the Tradeables that this thing has.

totalBeingBought

open fun totalBeingBought(tradeable: Tradeable): Int

totalBeingSold

open fun totalBeingSold(tradeable: Tradeable): Int

transferInventory

open fun transferInventory(to: TradeEntity, tradeable: Tradeable, quantity: Int): Int

Send Tradeable to another TradeEntity but only if we actually have it

voidContractsWith

open fun voidContractsWith(otherEntity: TradeEntity): Unit

voidRandomContract

open fun voidRandomContract(): Unit

Companion Object Functions

classByString

fun classByString(name: String?): KClass<out Building>?

Used by the CityFileAdapter to help turn the names in the datafiles to the actual classes.

Inheritors

FireStation

class FireStation : Building

LoadableBuilding

open class LoadableBuilding : Building

PoliceStation

class PoliceStation : Building

PowerLine

class PowerLine : Building

PowerPlant

class PowerPlant : Building

RailDepot

class RailDepot : Building

Railroad

class Railroad : Building

Road

class Road : Building

TrainStation

class TrainStation : Building