-
Notifications
You must be signed in to change notification settings - Fork 4
Game documentation
Contains a set of functions to control the python engine
-
engine.async_mode
:Boolean
(get/set) - If enabled, performance of some methods will be significantly improved. These methods include: create_prop, create_tree, and other create_* methods, draw_circle, draw_vector and possibly more. In return, these methods will always return either null or default object marked as deleted. Exceptions will be ignored and warning will be printed in the output. Usage case is eg. planting trees in bulk
Contains basic set of functions for interaction with Cities:Skylines
-
game.begin_path(IPositionable startNode, Object? options)
:PathBuilder
- Starts a road on a given point. Call path_to(..) on the returned object to build a road -
game.clear()
- Clears all lines drawn on map -
game.create_building(IPositionable position, String type, Double? angle = 0)
:Building
- Creates building -
game.create_node(IPositionable position, Object prefab)
:Node
- Creates node (eg. segment junction) -
game.create_prop(IPositionable position, String prefab_name, Double? angle = 0)
:Prop
- Creates prop -
game.create_segment(IPositionable startNode, IPositionable endNode, Object type)
:Segment
- Creates straight segment (road). Don't use this method, but CreateSegments(..) -
game.create_segment(IPositionable startNode, IPositionable endNode, Object type, IPositionable control_point)
:Segment
- Creates segment (road). Don't use this method, but CreateSegments(..) -
game.create_segment(IPositionable startNode, IPositionable endNode, Object type, Vector start_dir, Vector end_dir)
:Segment
- Creates segment (road). Don't use this method, but CreateSegments(..) -
game.create_segments(IPositionable startNode, IPositionable endNode, Object type)
:IList
1` - Creates set of straight segments (road). Returns array of created segments -
game.create_segments(IPositionable startNode, IPositionable endNode, Object type, IPositionable control_point)
:IList
1` - Creates set of straight segments (road) with specified control point of the underlying bezier curve -
game.create_segments(IPositionable startNode, IPositionable endNode, Object type, Vector start_dir, Vector end_dir)
:IList
1` - Creates set of straight segments (road) with specified direction vectors at the start and end position -
game.create_tree(IPositionable position, String prefab_name)
:Tree
- Creates tree -
game.draw_circle(IPositionable position, Double? radius = 5, String? color = red)
:RenderableObjectHandle
- Draws circle on map. Returns handle which can be used to delete the circle -
game.draw_vector(IPositionable vector, IPositionable origin, String? color = red, Double? length = 20, Double? size = 0,1)
:RenderableObjectHandle
- Draws line on map. Returns handle which can be used to delete the line. Use clear() to delete all lines -
game.get_building(Int32 id)
:Building
- Returns building object from its id -
game.get_net_prefab(String name)
:NetPrefab
- Returns network prefab (used to build nodes and segments). Eg. 'Basic road' -
game.get_node(Int32 id)
:Node
- Returns node object from its id -
game.get_prop(Int32 id)
:Prop
- Returns prop object from its id -
game.get_segment(Int32 id)
:Segment
- Returns segment object from its id -
game.get_tree(Int64 id)
:Tree
- Returns tree object from its id -
game.help(Object? obj)
- Prints help for given object -
game.help_all()
- Dumps all available documentation in the output -
game.is_prefab(String name)
:Boolean
- Returns if name is a valid prefab (network, building, tree etc.) -
game.list_globals()
- Prints all variables available in the global scope -
game.print_list(IEnumerable collection)
- Prints collection content -
game.surface_level(IPositionable pos)
:Single
- Returns terrain height inlucing water level at a given point -
game.terrain_height(IPositionable pos)
:Single
- Returns terrain height at a given point (height is Y coord)
-
game.buildings
: [CitiesObjectEnumerable
2](#Class-CitiesObjectEnumerable
2) - Returns building iterator (can be used only in for loop) -
game.nodes
: [CitiesObjectEnumerable
2](#Class-CitiesObjectEnumerable
2) - Returns node iterator (can be used only in for loop) -
game.props
: [CitiesObjectEnumerable
2](#Class-CitiesObjectEnumerable
2) - Returns prop iterator (can be used only in for loop) -
game.segments
: [CitiesObjectEnumerable
2](#Class-CitiesObjectEnumerable
2) - Returns segment iterator (can be used only in for loop) -
game.trees
: [CitiesObjectEnumerable
2](#Class-CitiesObjectEnumerable
2) - Returns tree iterator (can be used only in for loop)
Structure for building objects (eg. 'Water Tower')
-
delete()
:Boolean
- Delete object -
move(IPositionable pos, Nullable
1? angle)` - Move to new position -
refresh()
- Reloads object properties from game
-
angle
:Double
(get/set) - Building roation in rad -
deleted
:Boolean
- Returns if object exists -
id
:UInt32
- Game ID -
pos
:Vector
(get/set) - Object position. Can be assigned to to move the object -
position
:Vector
(get/set) - Object position. Can be assigned to to move the object -
prefab_name
:String
- Prefab name - eg. 'Elementary School'
Information about natural resources on current map position. Resources are saved in discrete square grid (64*64 cells per tile). If you modify the cells, game must be unpaused so the changes take effect
- static
.ctor(Int32 rowID, Int32 columnID)
- Retrieves resource cell from internal coorinates - static
.ctor(Vector pos)
- Retrieves resource cell from vector - static
column_id_from_vector(Vector pos)
:Int32
- Returns column ID of the natural resources coordinate system -
refresh()
- Reloads cached values from the game - static
row_id_from_vector(Vector pos)
:Int32
- Returns row ID of the natural resources coordinate system
-
default_position
:Vector
- Default position of the resource cell -
fertility
:Byte
(get/set) - 0-256 -
forest
:Byte
- 0-256 -
natural_resources_cell_id
:Int32
- Internal cell id -
natural_resources_column_id
:Int32
- Internal column id -
natural_resources_row_id
:Int32
- Internal row id -
oil
:Byte
(get/set) - 0-256 -
ore
:Byte
(get/set) - 0-256 -
pollution
:Byte
(get/set) - 0-256 -
water
:Byte
- 0-256
Structure holding type of road/network (eg. 'Basic Road' or 'Power Line')
-
bw_vehicle_lane_count
:Int32
- Count of backward vehicle lanes -
fw_vehicle_lane_count
:Int32
- Count of forward vehicle lanes -
is_overground
:Boolean
- Is elevated/bridge -
is_underground
:Boolean
- Is tunnel -
name
:String
- Network name -
width
:Single
- Network width
Node structure - junction of Segments (roads/power lines etc.)
-
delete()
:Boolean
- Delete object -
move(IPositionable pos)
- Move to new position -
refresh()
- Reloads object properties from game
-
building_id
:Int32
- ID of building (usually pillar) -
building
:Building
- Node building (usually pillar) -
deleted
:Boolean
- Returns if object exists -
id
:UInt32
- Game ID -
pos
:Vector
(get/set) - Object position. Can be assigned to to move the object -
position
:Vector
(get/set) - Object position. Can be assigned to to move the object -
prefab_name
:String
- Node asset name (eg. 'Basic Road') -
prefab
:NetPrefab
- Node asset object (eg. 'Basic Road') -
seg_count
:Int32
- Count of adjacent segments -
segments
:List
1` - List of adjacent segments -
terrain_offset
:Double
- Elevation over terrain or water level
Abstract structure for building a row of linked segments
-
path_to(IPositionable endNode)
:PathBuilder
- Creates multiple straight segments to the given position -
path_to(IPositionable endNode, IPositionable middle_pos)
:PathBuilder
- Creates multiple segments to the given position -
path_to(IPositionable endNode, Vector start_dir, Vector end_dir)
:PathBuilder
- Creates multiple segments to the given position
-
first_node
:Node
- Start of the road -
last_node
:Node
- Current end of the road -
last_segments
:IList
1` - Returns list of the last batch of segments built with path_to function -
options
:NetOptions
(get/set) - Road type, elevation etc. -
segments
:IList
1` - Returns list of all segments built with this PathBuilder
Point on map
- static
.ctor(Vector vector)
- Creates new point from the vector
-
position
:Vector
- Position (Y is height) -
resources
:NaturalResourceCell
- Returns natural resources and pollution at the point -
type
:String
- Object type
Free standing prop object
-
delete()
:Boolean
- Delete object -
move(IPositionable pos, Nullable
1? angle)` - Move to new position -
refresh()
- Reloads object properties from game
-
angle
:Double
(get/set) - Prop rotation in rad -
deleted
:Boolean
- Returns if object exists -
id
:UInt32
- Game ID -
pos
:Vector
(get/set) - Object position. Can be assigned to to move the object -
position
:Vector
(get/set) - Object position. Can be assigned to to move the object -
prefab_name
:String
- Prop type (eg. 'Large Fountain')
Handle for deleting shapes rendered on the map
-
delete()
- Deletes the shape
-
id
:Int32
- Handle ID
Network object (road, pipe, power line etc.)
-
delete()
:Boolean
- Delete object -
delete(Boolean keep_nodes)
:Boolean
- Deletes the road. keep_nodes param specifies if the nodes should be deleted too if there are no roads left that connect to them -
get_other_node(Object node)
:Node
- Returns the other junction given the first one -
move(IPositionable pos)
- Moves bezier control point to the new position -
refresh()
- Reloads object properties from game
-
bezier
:Bezier
- Underlying bezier shape -
deleted
:Boolean
- Returns if object exists -
end_dir
:Vector
- Road direction at end node -
end_node_id
:Int32
- ID of end node (junction) -
end_node
:Node
- Road end node (junction) -
id
:UInt32
- Game ID -
is_straight
:Boolean
- Is segment straight -
length
:Single
- Road length -
middle_pos
:Vector
(get/set) - Road middle position -
pos
:Vector
(get/set) - Object position. Can be assigned to to move the object -
position
:Vector
(get/set) - Object position. Can be assigned to to move the object -
prefab_name
:String
- Network asset name (eg. 'Highway') -
prefab
:NetPrefab
- Network asset -
start_dir
:Vector
- Road direction at start node -
start_node_id
:Int32
- ID of start node (junction) -
start_node
:Node
- Road start node (junction)
Free standing tree structure
-
delete()
:Boolean
- Delete object -
move(IPositionable pos)
- Moves node to new position -
refresh()
- Reloads object properties from game
-
deleted
:Boolean
- Returns if object exists -
id
:UInt32
- Game ID -
pos
:Vector
(get/set) - Object position. Can be assigned to to move the object -
position
:Vector
(get/set) - Object position. Can be assigned to to move the object -
prefab_name
:String
- Asset name (eg. 'Conifer')
Abstract bezier structure
- static
.ctor(Vector _a, Vector _b, Vector _c, Vector _d)
- Creates new bezier from 4 control points -
flat_normal(Single t)
:Vector
- Returns normal vector to the bezier. Y coord is undefined -
position(Single t)
:Vector
- Returns point on bezier (t is number from 0 to 1) -
tangent(Single t)
:Vector
- Returns tangent vector to the bezier (t is number from 0 to 1)
-
a
:Vector
- Point A (start) -
b
:Vector
- Point B -
c
:Vector
- Point C -
d
:Vector
- Point D (end) -
inverted
:Bezier
- Returns inverted bezier
Network options object
- static
.ctor(String prefab_name, Object? follow_terrain, String? elevation_mode = default, Boolean? invert = False, Int32? node_spacing = 100)
- Example call: NetOptions("Basic Road", false, "elevated", true)
-
elevation_mode
:String
- Elevation mode: default, ground, elevated, bridge, tunnel, slope -
follow_terrain
:String
- Supported values: True (follow), False (do not follow - default), "auto_offset" - Keeps start and end node at given elevation and interpolates elevation of intermediate nodes -
invert
:Boolean
- Invert road (eg. flip direction of one-way streets) -
node_spacing
:Int32
- Spacing betwwen two nodes (pillars). Default 100 -
prefab_name
:String
- Network type (eg. 'Basic Road')
Any object that has the 'position' attribute
-
position
:Vector
- Object position
3D Vector class
- static
.ctor(Double X, Double Y, Double Z)
- Creates new vector given all 3 coords -
flat_angle(Vector? other)
:Double
- Returns angle in XZ plane. If 'other' vector is null, returns angle with the X axis -
flat_rotate(Double angle, Vector? pivot)
:Vector
- Rotates vector in XZ plane -
increase_y(Double value)
:Vector
- Returns new vector with changed y value - static
Lerp(Vector a, Vector b, Double t)
:Vector
- Linearlly interpolates new postion between a and b - static
vector_xz(Double X, Double Z)
:Vector
- Creates new vector given the X and Z coord
-
flat
:Vector
- Returns new vector with undefined Y coord -
is_height_defined
:Boolean
- Is height (Y coord) defined -
magnitude
:Double
- Vector length -
normalized
:Vector
- Returns new vectors with length 1 - static
pi
:Double
- PI constant -
position
:Vector
- Returns itself -
x
:Double
- X cooord -
y
:Double
- Y cooord (height) -
z
:Double
- Z cooord - static
zero
:Vector
- Returns zero vector