Package horizons :: Package world :: Module worldutils
[hide private]
[frames] | no frames]

Module worldutils

source code

Functions [hide private]
 
toggle_health_for_all_health_instances(world)
Show health bar of every instance with an health component, which isnt selected already
source code
 
toggle_translucency(world)
Make certain building types translucent
source code
 
save_map(world, path, prefix) source code
 
add_resource_deposits(world, resource_multiplier)
Place clay deposits and mountains.
source code
 
add_nature_objects(world, natural_resource_multiplier)
Place trees, wild animals, fish deposits, clay deposits, and mountains.
source code
 
check_tile_for_tree(world, position, tile)
Returns true if the current tile is a grass tile and a tree can be built there.
source code
 
get_random_possible_ground_unit_position(world)
Returns a random position upon an island
source code
 
get_random_possible_ship_position(world)
Returns a random position in water, that is not at the border of the world
source code
 
get_random_possible_coastal_ship_position(world)
Returns a random position in water, that is not at the border of the world but on the coast of an island
source code
Function Details [hide private]

add_resource_deposits(world, resource_multiplier)

source code 

Place clay deposits and mountains.

The algorithm:
1. calculate the manhattan distance from each island tile to the sea
2. calculate the value of a tile
3. calculate the value of an object's location as min(covered tile values)
4. for each island place a number of clay deposits and mountains
5. place a number of extra clay deposits and mountains without caring about the island
* the probability of choosing a resource deposit location is proportional to its value

@param natural_resource_multiplier: multiply the amount of clay deposits and mountains by this.

add_nature_objects(world, natural_resource_multiplier)

source code 

Place trees, wild animals, fish deposits, clay deposits, and mountains.

Parameters:
  • natural_resource_multiplier - multiply the amount of fish deposits, clay deposits, and mountains by this.

check_tile_for_tree(world, position, tile)

source code 

Returns true if the current tile is a grass tile and a tree can be built there.

Parameters:
  • position - position of the to be checked tile
  • tile - tile object