Module NeighborCity

Neighbor City library for TheoTown.

This library provides functions to manage custom, virtual neighboring cities the player can do trading with. The goal is to extend the user experience especially in Online Mode where by default no neighborhood commercial is available.

Each neighbor city belongs to the draft that created it. Because of that, uninstalling a plugin that created a virtual neighbor will also remove that neighbor city.

This library was newly introduced in 1.20.77. It is only available while a city is open. As of right now this library is experimental and may change at any time without further notice. You are advised to use it for your own experiments only as of right now.

Functions

create (id[, name=nil]) Creates a new virtual neighboring city using the given id and name.
get (id) Returns the neighbor city object of this draft that has the given id.
getNeighbors () Returns an array of all neighbor city objects that belong to this draft.

Class NeighborCity

neighborCity:delete () Deletes this neighbor city so it can no longer be used for trading.
neighborCity:getBodyDisposal () Returns the amount of body disposal services this neighbor city can export.
neighborCity:getId () Returns the unique id of this neighbor city.
neighborCity:getName () Returns the displayed name for this city.
neighborCity:getPower () Returns the amount of power this neighbor city can export.
neighborCity:getPowerExport () Returns the amount of power that gets exported (+) to / imported (-) from this neighbor city.
neighborCity:getWasteDisposal () Returns the amount of waste disposal services this neighbor city can export.
neighborCity:getWater () Returns the amount of water this neighbor city can export.
neighborCity:isValid () Determines whether this neighbor city object is valid.
neighborCity:setBodyDisposal (amount) Sets the amount of body disposal services this neighbor city can export.
neighborCity:setName (name) Sets a visible name for this city.
neighborCity:setPower (amount) Sets the amount of power this neighbor city can export.
neighborCity:setWasteDisposal (amount) Sets the amount of waste disposal services this neighbor city can export.
neighborCity:setWater (amount) Sets the amount of water this neighbor city can export.


Functions

create (id[, name=nil])
Creates a new virtual neighboring city using the given id and name.

New feature:

    This is a new feature that was added in version 1.20.77

Parameters:

  • id string A draft unique id that can be used to identify the neighbor. If a neighbor with the same id was already created it will be replaced by the new one.
  • name string A name that will be shown for the created city. If no name was provided the game will generate a random one. (default nil)

Returns:

    NeighborCity A neighbor city object.
get (id)
Returns the neighbor city object of this draft that has the given id.

New feature:

    This is a new feature that was added in version 1.20.77

Parameters:

  • id string The id that should be found.

Returns:

    NeighborCity The neighbor city object with the given id or nil if no such neighbor object exists.
getNeighbors ()
Returns an array of all neighbor city objects that belong to this draft.

New feature:

    This is a new feature that was added in version 1.20.77

Returns:

    Array An array of all virtual neighbor cities.

Class NeighborCity

This type represents NeighborCity objects.
neighborCity:delete ()
Deletes this neighbor city so it can no longer be used for trading.
neighborCity:getBodyDisposal ()
Returns the amount of body disposal services this neighbor city can export.

Returns:

    int The amount of body disposal services that can be exported from the neighbor city.
neighborCity:getId ()
Returns the unique id of this neighbor city. The id is unique between the neighbor cities that belong to the calling draft.

Returns:

    string The id associated during the creation process.
neighborCity:getName ()
Returns the displayed name for this city.

Returns:

    string The name of the neighbor city.
neighborCity:getPower ()
Returns the amount of power this neighbor city can export.

Returns:

    int The amount of power that can be exported from the neighbor city.
neighborCity:getPowerExport ()
Returns the amount of power that gets exported (+) to / imported (-) from this neighbor city.
neighborCity:getWasteDisposal ()
Returns the amount of waste disposal services this neighbor city can export.

Returns:

    int The amount of waste disposal services that can be exported from the neighbor city.
neighborCity:getWater ()
Returns the amount of water this neighbor city can export.

Returns:

    int The amount of water that can be exported from the neighbor city.
neighborCity:isValid ()
Determines whether this neighbor city object is valid.

Returns:

    bool True if this neighbor city object is still valid.
neighborCity:setBodyDisposal (amount)
Sets the amount of body disposal services this neighbor city can export.

Parameters:

  • amount int The amount of body disposal services that can be exported from the neighbor city.
neighborCity:setName (name)
Sets a visible name for this city.

Parameters:

  • name string The new name of the neighbor city.
neighborCity:setPower (amount)
Sets the amount of power this neighbor city can export.

Parameters:

  • amount int The amount of power that can be exported from the neighbor city.
neighborCity:setWasteDisposal (amount)
Sets the amount of waste disposal services this neighbor city can export.

Parameters:

  • amount int The amount of waste disposal services that can be exported from the neighbor city.
neighborCity:setWater (amount)
Sets the amount of water this neighbor city can export.

Parameters:

  • amount int The amount of water that can be exported from the neighbor city.
generated by LDoc 1.4.3 Last updated 2024-09-18 09:14:48