Module land

Introduces land plots, and modifies areas to allow companies to own land.

This mod current uses areas as a backend, which means that a plot = an area.

Functions

get_area_tree (list, owner) Generates a tree representing land ownership hierarchy for a particular owner.
get_all (owner) Gets all plots owned by a particular owner
get_by_pos (pos) Gets the owning plot of a particular area

There is at most one owning area of a particular position; because plots must not overlap, and any child of a plot most be fully contained.

get_by_area_id (id) Gets a plot by its area ID (as in the mod area)
transfer (id, newowner, pname) Transfers a plot between two owners, after checking relevant permissions.
can_set_price (area, pname) Whether a user can put a plot up for sale, or change the price when already for sale
set_price (area, pname, price) Puts a plot up for sale, or changes the price when already for sale
can_buy (area, pname, comp) Whether a user can buy a plot
buy (area, pname) Buy a plot
can_teleport_to (area, pname) Whether a user can teleport to a plot
teleport_to (area, player) Teleport a user to a plot
can_set_spawn (area, pname) Whether a user can set the spawn of a plot

Tables

valid_types Dictionary of valid types
land land table


Functions

get_area_tree (list, owner)
Generates a tree representing land ownership hierarchy for a particular owner.

Each element returned will have a children property, which will be a table of child elements.

Parameters:

  • list [table] A list of owned areas
  • owner string Player name or company name

Returns:

    (table,table) root, area by id
get_all (owner)
Gets all plots owned by a particular owner

Parameters:

  • owner string Player name or company name

Returns:

    [table] List of plots
get_by_pos (pos)
Gets the owning plot of a particular area

There is at most one owning area of a particular position; because plots must not overlap, and any child of a plot most be fully contained.

This function essential returns the lowest plot in the tree at a particular point

Parameters:

Returns:

    [table]
get_by_area_id (id)
Gets a plot by its area ID (as in the mod area)

Parameters:

  • id int

Returns:

    table plot
transfer (id, newowner, pname)
Transfers a plot between two owners, after checking relevant permissions.

Parameters:

Returns:

    true

Or

  1. nil
  2. string Error message
can_set_price (area, pname)
Whether a user can put a plot up for sale, or change the price when already for sale

Parameters:

Returns:

    true

Or

  1. nil
  2. string Error message
set_price (area, pname, price)
Puts a plot up for sale, or changes the price when already for sale

Parameters:

Returns:

    true

Or

  1. nil
  2. string Error message
can_buy (area, pname, comp)
Whether a user can buy a plot

Parameters:

Returns:

    true

Or

  1. nil
  2. string Error message
buy (area, pname)
Buy a plot

Parameters:

Returns:

    true

Or

  1. nil
  2. string Error message
can_teleport_to (area, pname)
Whether a user can teleport to a plot

Parameters:

Returns:

    true

Or

  1. nil
  2. string Error message
teleport_to (area, player)
Teleport a user to a plot

Parameters:

  • area table
  • player Player userdata

Returns:

    true

Or

  1. nil
  2. string Error message
can_set_spawn (area, pname)
Whether a user can set the spawn of a plot

Parameters:

Returns:

    true

Or

  1. nil
  2. string Error message

Tables

valid_types
Dictionary of valid types

Fields:

  • commercial
  • residential
  • industrial
land
land table
generated by LDoc 1.4.6 Last updated 2019-01-18 21:14:37