Skip to content

structureList

Lemonymous edited this page Nov 20, 2022 · 2 revisions

Table of Contents

 

easyEdit.structureList

  This module can be used to add new structureLists to the game, or fetch existing ones.

Each island has a structureList associated with it, that describes which structures can spawn on the island.

 

add

  • table   add(string structureList_id, string base_structureList_id)

  To add a new structureList, start by calling this function. Use a unique structureList_id for your structureList to avoid potential collisions with structureLists from other mods.

  You can create a structureList with a default base by leaving base_structureList_id empty, or you can use the id of an existing structureList to get a better base to start from. Anything you change after that, will only affect your own structureList.

 

Example - structureList with a default base:

local structureList = easyEdit.structureList:add("structureList_example")

Example - structureList based on the vanilla structureList:

local structureList = easyEdit.structureList:add("structureList_example", "vanilla")

This will return a structureList object, which you can build on using table fields and methods found on this page.

 

get

  • table   get(string structureList_id)

  Returns the structureList object for an existing structureList with this structureList_id.

Vanilla StructureList id
"vanilla"

 

structureList

fields

_id

  • string

  The unique id for this structureList.

 

PowAssets

  • table

  A list of structure id's for structures rewarding power. Use copy or addAssets instead of setting this field directly.

 

RepAssets

  • table

  A list of structure id's for structures rewarding reputation. Use copy or addAssets instead of setting this field directly.

 

TechAssets

  • table

  A list of structure id's for structures rewarding cores. Use copy or addAssets instead of setting this field directly.

 

methods

 

addAssets

  • void   addAssets(table structure_id_table)

  Adds all the structures referred to in the provided structure_id_table. All structures will be entered into the correct tables (PowAssets/RepAssets/TechAssets) according to their respective Reward types (see: CreateStructure).

Example:

structureList:addAssets{
	"Str_Power",
	"Str_Nimbus",
	"Str_Battery",
	"Str_Power",
	"Str_Robotics",
	"Str_Research",
	"Str_Bar",
	"Str_Clinic",
}

This is the vanilla structure list.

 

copy

  • void   copy(table other_structureList)

  Copies structureList variables from another structureList to this structureList.

Example:

-- First you must create an structureList object.
local structureList = easyEdit.structureList:add("structureList_example")

-- Then you must fetch the structureList object of an existing structureList.
local other_structureList = easyEdit.structureList:get("vanilla")

-- Finally you can copy the variables from the other structureList to yours.
structureList:copy(other_structureList)

 

Clone this wiki locally