wesnoth/data/core/macros/terrain-utils.cfg

74 lines
2.2 KiB
INI

#textdomain wesnoth
# Utility macros for manipulating map terrain and overlays.
# These don't depend on any other macros. Please don't change this.
# ! in comments is used in generating HTML documentation, ignore it otherwise.
#define MODIFY_TERRAIN TERRAIN X_SPAN Y_SPAN
# Changes the terrain at a given list of coordinates
#
# For example, we could make 14,15 and 14,16 grassland:
#! {MODIFY_TERRAIN Gg (14,14) (15,16)}
[terrain]
terrain={TERRAIN}
x={X_SPAN}
y={Y_SPAN}
[/terrain]
#enddef
#define MODIFY_TERRAIN_MASK X Y MASK_VALUE RULES_WML
# Changes the terrain for a given area
[terrain_mask]
x={X}
y={Y}
mask={MASK_VALUE}
{RULES_WML}
[/terrain_mask]
#enddef
#define SCATTER_IMAGE FILTER NUMBER IMAGE
# Place NUMBER copies of the IMAGE on map hexes matching FILTER.
#
# This call will scatter 20 copies of a pine-tree graphic over grassland:
#! {SCATTER_IMAGE (terrain=Gg) 20 scenery/pine1.png}
[random_placement]
num_items={NUMBER}
variable=random_placement_location
allow_less=yes
[filter_location]
{FILTER}
[/filter_location]
[command]
[item]
image={IMAGE}
x,y=$random_placement_location.x,$random_placement_location.y
[/item]
[/command]
[/random_placement]
{CLEAR_VARIABLE random_placement_location}
#enddef
#define SCATTER_EMBELLISHMENTS TERRAINLIST EMBELLISHMENT_NAME PERCENTAGE
# Adds the given embellishment to the given percentage of the given terrain
# on the map.
#
# For example, this will add flowers to 5% of all grassland:
#! {SCATTER_EMBELLISHMENTS G* ^Efm 5}
[random_placement]
num_items="(size * ({PERCENTAGE} / 100))"
variable=random_placement_location
allow_less=yes
[filter_location]
terrain={TERRAINLIST}
[/filter_location]
[command]
[terrain]
x,y=$random_placement_location.x,$random_placement_location.y
terrain={EMBELLISHMENT_NAME}
layer=overlay
[/terrain]
[/command]
[/random_placement]
{CLEAR_VARIABLE random_placement_location}
#enddef