Skip to content

Commit

Permalink
Schema: Definition of the [generator] tag
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Oct 24, 2018
1 parent 4ba0c2b commit defea06
Show file tree
Hide file tree
Showing 4 changed files with 173 additions and 2 deletions.
20 changes: 18 additions & 2 deletions data/schema/core/addons.cfg
Expand Up @@ -516,8 +516,24 @@
[link]
name="terrain_graphics"
[/link]
# TODO: Map generation
{DATA_TAG generator 0 1}
[if]
map_generation=default
[or]
scenario_generation=default
[/or]
[then]
{./mapgen/default.cfg}
[/then]
[elseif]
map_generation=lua
[or]
scenario_generation=lua
[/or]
[then]
{./mapgen/lua.cfg}
[/then]
[/elseif]
[/if]
# TODO: These are needed here for MP campaigns... can we work around that somehow?
{SIMPLE_KEY new_game_title t_string}
{BASE_COMPATIBILITY_KEYS}
Expand Down
68 changes: 68 additions & 0 deletions data/schema/core/mapgen/default.cfg
@@ -0,0 +1,68 @@

[tag]
name="generator"
{SIMPLE_KEY name string}
{SIMPLE_KEY map_width unsigned}
{SIMPLE_KEY map_height unsigned}
{SIMPLE_KEY iterations unsigned}
{SIMPLE_KEY hill_size unsigned}
{SIMPLE_KEY max_lakes unsigned}
{SIMPLE_KEY min_lake_height unsigned}
{SIMPLE_KEY lake_size unsigned}
{SIMPLE_KEY river_frequency unsigned}
{SIMPLE_KEY villages unsigned}
{SIMPLE_KEY players unsigned}
{SIMPLE_KEY castle_size unsigned}
{SIMPLE_KEY temperature_iterations unsigned}
{SIMPLE_KEY temperature_size unsigned}
{SIMPLE_KEY roads unsigned}
{SIMPLE_KEY road_windiness unsigned}
{SIMPLE_KEY island_size unsigned}
{SIMPLE_KEY default_flatland terrain_code}
[tag]
name="height"
max=infinite
{REQUIRED_KEY height unsigned}
{REQUIRED_KEY terrain terrain_code}
[/tag]
[tag]
name="convert"
max=infinite
{SIMPLE_KEY min_height unsigned}
{SIMPLE_KEY max_height unsigned}
{SIMPLE_KEY min_temperature unsigned}
{SIMPLE_KEY max_temperature unsigned}
{REQUIRED_KEY from terrain_list}
{REQUIRED_KEY to terrain_code}
[/tag]
[tag]
name="road_cost"
max=infinite
{REQUIRED_KEY terrain terrain_code}
{REQUIRED_KEY cost unsigned}
{SIMPLE_KEY convert_to_bridge terrain_list}
{SIMPLE_KEY convert_to terrain_code}
[/tag]
[tag]
name="village"
max=infinite
{REQUIRED_KEY terrain terrain_code}
{REQUIRED_KEY convert_to terrain_code}
{REQUIRED_KEY adjacent_liked terrain_list}
{REQUIRED_KEY rating unsigned}
[/tag]
[tag]
name="castle"
{REQUIRED_KEY valid_terrain terrain_list}
{REQUIRED_KEY min_distance unsigned}
[/tag]
[link]
name="naming"
[/link]
[link]
name="village_naming"
[/link]
[link]
name="scenario"
[/link]
[/tag]
79 changes: 79 additions & 0 deletions data/schema/core/mapgen/lua.cfg
@@ -0,0 +1,79 @@

#define CHAMBER_TAG_CONTENTS
max=infinite
{SIMPLE_KEY id string}
{SIMPLE_KEY x range_list}
{SIMPLE_KEY y range_list}
{SIMPLE_KEY size unsigned}
{SIMPLE_KEY jagged unsigned}
{DEFAULT_KEY chance unsigned 100}
{SIMPLE_KEY side unsigned}
[tag]
name="passage"
max=infinite
{SIMPLE_KEY destination string}
{SIMPLE_KEY windiness unsigned}
{SIMPLE_KEY laziness unsigned}
{SIMPLE_KEY width unsigned}
{SIMPLE_KEY jagged unsigned}
{DEFAULT_KEY chance unsigned 100}
[/tag]
[tag]
name="item_location"
max=infinite
{SIMPLE_KEY id string}
{DEFAULT_KEY place_castle bool no}
[/tag]
#enddef

[tag]
name="generator"
# General Lua map generator
{SIMPLE_KEY id string}
{SIMPLE_KEY name t_string}
{SIMPLE_KEY description t_string}
{SIMPLE_KEY error_message t_string}
{SIMPLE_KEY create_map string}
{SIMPLE_KEY create_scenario string}
# Additional contents for Lua cave map generator
[if]
glob_on_create_map=*cave_map_generator*
[or]
glob_on_create_scenario=*cave_map_generator*
[/or]
[then]
{SIMPLE_KEY map_width unsigned}
{SIMPLE_KEY map_height unsigned}
{SIMPLE_KEY village_density unsigned}
{SIMPLE_KEY transform map_transform}
{SIMPLE_KEY transform_chance unsigned}
{SIMPLE_KEY terrain_wall terrain_code}
{SIMPLE_KEY terrain_castle terrain_code}
{SIMPLE_KEY terrain_keep terrain_code}
{SIMPLE_KEY terrain_village terrain_code}
{SIMPLE_KEY terrain_clear terrain_code}
[tag]
name="chamber"
{CHAMBER_TAG_CONTENTS}
[/tag]
[/then]
[/if]
# Additional contents for Lua cave scenario generator
[if]
glob_on_create_scenario=*cave_map_generator*
[then]
[tag]
name="chamber"
{CHAMBER_TAG_CONTENTS}
[tag]
name="items"
super="scenario"
[/tag]
[/tag]
[tag]
name="settings"
super="scenario"
[/tag]
[/then]
[/if]
[/tag]
8 changes: 8 additions & 0 deletions data/schema/game_config.cfg
Expand Up @@ -380,6 +380,14 @@
[/type]
[/union]
[/type]
[type]
name="map_transform"
[list]
[element]
value="flip_(x|y|xy)"
[/element]
[/list]
[/type]
[type]
name="turns"
[union]
Expand Down

0 comments on commit defea06

Please sign in to comment.