WC: Miscellaneous cleanup
- Remove the IS_ADD_ON check - The indentation of the generator Lua was weird - Don't transclude macros into the Lua code Squashed from the following commits:9a3143215b
163bb2f52d
f64c6c6c46
0cadfb3286
782c176744
315cebf0d9
81b147bc51
cf9fbdd516
24cf433aaf
ceacb9ecad
This commit is contained in:
parent
ecccc60027
commit
8ee8a0647e
6 changed files with 59 additions and 80 deletions
|
@ -13,24 +13,3 @@
|
|||
#enddef
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef LOAD_WC2
|
||||
|
||||
#ifdef IS_ADD_ON
|
||||
|
||||
#define ID_SUFFIX
|
||||
_umc#enddef
|
||||
|
||||
#define WC2_DIR
|
||||
~add-ons/World_Conquest_II/#enddef
|
||||
|
||||
#else
|
||||
|
||||
#define ID_SUFFIX
|
||||
#enddef
|
||||
|
||||
#define WC2_DIR
|
||||
campaigns/World_Conquest/#enddef
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
#define WORLD_CONQUEST_II_ERA
|
||||
[era]
|
||||
id= "{STR_ERA_ID_WC_II}{ID_SUFFIX}"
|
||||
name= {STR_ERA_NAME_WC_II}{ID_SUFFIX}
|
||||
id= "{STR_ERA_ID_WC_II}"
|
||||
name= {STR_ERA_NAME_WC_II}
|
||||
description= {STR_ERA_DESCRIPTION_WC_II}
|
||||
require_era=no
|
||||
# addon_min_version="8.2"
|
||||
|
@ -23,7 +23,7 @@
|
|||
{MULTIPLAYER_SIDE_THE_ALLIANCE}
|
||||
{MULTIPLAYER_SIDE_THE_EMPIRE}
|
||||
[load_resource]
|
||||
id = "wc2_era_res{ID_SUFFIX}"
|
||||
id = "wc2_era_res"
|
||||
[/load_resource]
|
||||
[/era]
|
||||
#enddef
|
||||
|
@ -31,17 +31,17 @@
|
|||
#define WORLD_CONQUEST_II_ERA_RESOURCE
|
||||
## this is needed in both the era and the campaign, in particular in the campaign this data is used to generate the deserters and the ai sides.
|
||||
[resource]
|
||||
id = "wc2_era_res{ID_SUFFIX}"
|
||||
id = "wc2_era_res"
|
||||
[lua]
|
||||
code = " wesnoth.dofile('{WC2_DIR}/lua/era_main.lua') "
|
||||
code = " wesnoth.dofile('campaigns/World_Conquest//lua/era_main.lua') "
|
||||
[/lua]
|
||||
[load_resource]
|
||||
id = "wc2_mainline_heroes{ID_SUFFIX}"
|
||||
id = "wc2_mainline_heroes"
|
||||
[/load_resource]
|
||||
[/resource]
|
||||
|
||||
[resource]
|
||||
id = "wc2_mainline_heroes{ID_SUFFIX}"
|
||||
id = "wc2_mainline_heroes"
|
||||
[world_conquest_data]
|
||||
[hero_types]
|
||||
{WORLD_CONQUEST_II_ERA_HEROES_TYPES}
|
||||
|
|
|
@ -35,7 +35,6 @@ end
|
|||
|
||||
function wc_ii_generate_scenario(nplayers, gen_args)
|
||||
nplayers = settings.nplayers or nplayers
|
||||
local id_suffix = gen_args.id_suffix or ""
|
||||
local scenario_extra = wml.get_child(gen_args, "scenario")
|
||||
local scenario_num = settings.scenario_num or wml.variables.wc2_scenario or 1
|
||||
--todo: does this work properly in the first scenario?
|
||||
|
@ -51,13 +50,13 @@ function wc_ii_generate_scenario(nplayers, gen_args)
|
|||
lua = {},
|
||||
load_resource = {
|
||||
{
|
||||
id = "wc2_era_res" .. id_suffix
|
||||
id = "wc2_era_res"
|
||||
},
|
||||
{
|
||||
id = "wc2_scenario_res" .. id_suffix
|
||||
id = "wc2_scenario_res"
|
||||
},
|
||||
{
|
||||
id = "wc2_scenario_res_extra" .. id_suffix
|
||||
id = "wc2_scenario_res_extra"
|
||||
},
|
||||
},
|
||||
options = {
|
||||
|
@ -80,8 +79,8 @@ function wc_ii_generate_scenario(nplayers, gen_args)
|
|||
wc2_host_version = "0.8.2"
|
||||
},
|
||||
side = {},
|
||||
id = "WC_II_" .. nplayers .. "p" .. id_suffix,
|
||||
next_scenario = "WC_II_" .. nplayers .. "p" .. id_suffix,
|
||||
id = "WC_II_" .. nplayers .. "p",
|
||||
next_scenario = "WC_II_" .. nplayers .. "p",
|
||||
description = "WC_II_" .. nplayers .. "p_desc",
|
||||
modify_placing = false,
|
||||
-- does this work
|
||||
|
|
|
@ -5,23 +5,23 @@
|
|||
|
||||
#define WORLD_CONQUEST_II_CAMPAIGN_RESOURCE
|
||||
[resource]
|
||||
id = "wc2_scenario_res{ID_SUFFIX}"
|
||||
id = "wc2_scenario_res"
|
||||
[lua]
|
||||
code = " wesnoth.dofile('{WC2_DIR}/lua/campaign_main.lua') "
|
||||
code = " wesnoth.dofile('campaigns/World_Conquest//lua/campaign_main.lua') "
|
||||
[/lua]
|
||||
[load_resource]
|
||||
id = "wc2_trainer_data{ID_SUFFIX}"
|
||||
id = "wc2_trainer_data"
|
||||
[/load_resource]
|
||||
[load_resource]
|
||||
id = "wc2_artifact_data{ID_SUFFIX}"
|
||||
id = "wc2_artifact_data"
|
||||
[/load_resource]
|
||||
[load_resource]
|
||||
id = "wc2_trait_data{ID_SUFFIX}"
|
||||
id = "wc2_trait_data"
|
||||
[/load_resource]
|
||||
[/resource]
|
||||
|
||||
[resource]
|
||||
id = "wc2_trait_data{ID_SUFFIX}"
|
||||
id = "wc2_trait_data"
|
||||
[world_conquest_data]
|
||||
[trait_heroic]
|
||||
{WORLD_CONQUEST_II_TRAIT_HEROIC}
|
||||
|
@ -33,31 +33,31 @@
|
|||
[/resource]
|
||||
|
||||
[resource]
|
||||
id = "wc2_trainer_data{ID_SUFFIX}"
|
||||
id = "wc2_trainer_data"
|
||||
[world_conquest_data]
|
||||
{WORLD_CONQUEST_TEK_TRAINER_DEFINITIONS}
|
||||
[/world_conquest_data]
|
||||
[/resource]
|
||||
|
||||
[resource]
|
||||
id = "wc2_artifact_data{ID_SUFFIX}"
|
||||
id = "wc2_artifact_data"
|
||||
[world_conquest_data]
|
||||
{WORLD_CONQUEST_TEK_ARTIFACT_DEFINITIONS}
|
||||
[/world_conquest_data]
|
||||
[/resource]
|
||||
|
||||
[resource]
|
||||
id = "wc2_scenario_res_extra{ID_SUFFIX}"
|
||||
id = "wc2_scenario_res_extra"
|
||||
## additional mods that work independent on the wc2 core.
|
||||
## but note that they use our utils.lua and assume it to be present in global namespace.
|
||||
[lua]
|
||||
code = " wesnoth.dofile('{WC2_DIR}/lua/optional_mechanics/destruction.lua') "
|
||||
code = " wesnoth.dofile('campaigns/World_Conquest//lua/optional_mechanics/destruction.lua') "
|
||||
[/lua]
|
||||
[lua]
|
||||
code = " wesnoth.dofile('{WC2_DIR}/lua/optional_mechanics/pick_advance.lua') "
|
||||
code = " wesnoth.dofile('campaigns/World_Conquest//lua/optional_mechanics/pick_advance.lua') "
|
||||
[/lua]
|
||||
[lua]
|
||||
code = " wesnoth.dofile('{WC2_DIR}/lua/optional_mechanics/unitmarker.lua') "
|
||||
code = " wesnoth.dofile('campaigns/World_Conquest//lua/optional_mechanics/unitmarker.lua') "
|
||||
[/lua]
|
||||
[/resource]
|
||||
|
||||
|
|
|
@ -29,47 +29,48 @@ _ "World Conquest 3p" #enddef
|
|||
## time and generated the second scenario. (same for third, fourth and fifth). All the lua
|
||||
## code inside ./lua/map does map/scenario generation.
|
||||
[multiplayer]
|
||||
id = "WC_II_{PLAYERS}p{ID_SUFFIX}"
|
||||
name= {WC_II_CAMPAIGN_NAME_{PLAYERS}P} + "{ID_SUFFIX}"
|
||||
id = "WC_II_{PLAYERS}p"
|
||||
name= {WC_II_CAMPAIGN_NAME_{PLAYERS}P}
|
||||
description = {WC_II_CAMPAIGN_DESC_{PLAYERS}P}
|
||||
allow_new_game=yes
|
||||
require_scenario=no
|
||||
scenario_generation=lua
|
||||
[generator]
|
||||
id="WC_II_{PLAYERS}p{ID_SUFFIX}"
|
||||
config_name={WC_II_CAMPAIGN_NAME_{PLAYERS}P} + "{ID_SUFFIX}"
|
||||
create_scenario = "
|
||||
local a = ...
|
||||
local function doit()
|
||||
wesnoth.dofile('{WC2_DIR}/lua/map/main.lua'); return wc_ii_generate_scenario({PLAYERS}, a)
|
||||
end
|
||||
id="WC_II_{PLAYERS}p"
|
||||
config_name={WC_II_CAMPAIGN_NAME_{PLAYERS}P}
|
||||
create_scenario = <<
|
||||
local a = ...
|
||||
local function doit()
|
||||
wesnoth.dofile('campaigns/World_Conquest//lua/map/main.lua')
|
||||
return wc_ii_generate_scenario(a.nplayers, a)
|
||||
end
|
||||
|
||||
local status, res = xpcall(doit, function(e) std_print(e, debug.traceback()) end)
|
||||
if status then
|
||||
return res
|
||||
else
|
||||
print(res)
|
||||
std_print(res)
|
||||
end
|
||||
"
|
||||
local status, res = xpcall(doit, function(e) std_print(e, debug.traceback()) end)
|
||||
if status then
|
||||
return res
|
||||
else
|
||||
print(res)
|
||||
std_print(res)
|
||||
end
|
||||
>>
|
||||
#ifdef EDITOR
|
||||
user_config = "
|
||||
local a = ...
|
||||
local function doit()
|
||||
wesnoth.dofile('{WC2_DIR}/lua/map/main.lua');
|
||||
wesnoth.dofile('{WC2_DIR}/lua/map/settings/settings_dialog.lua');
|
||||
return wc2_debug_settings({PLAYERS})
|
||||
end
|
||||
user_config = <<
|
||||
local a = ...
|
||||
local function doit()
|
||||
wesnoth.dofile('campaigns/World_Conquest//lua/map/main.lua');
|
||||
wesnoth.dofile('campaigns/World_Conquest//lua/map/settings/settings_dialog.lua');
|
||||
return wc2_debug_settings(a.nplayers)
|
||||
end
|
||||
|
||||
local status, res = xpcall(doit, function(e) std_print(e, debug.traceback()) end)
|
||||
if status then
|
||||
return res
|
||||
else
|
||||
std_print(res)
|
||||
end
|
||||
"
|
||||
local status, res = xpcall(doit, function(e) std_print(e, debug.traceback()) end)
|
||||
if status then
|
||||
return res
|
||||
else
|
||||
std_print(res)
|
||||
end
|
||||
>>
|
||||
#endif
|
||||
id_suffix={ID_SUFFIX}
|
||||
nplayers={PLAYERS}
|
||||
[scenario]
|
||||
{DEFAULT_SCHEDULE}
|
||||
{DEFAULT_MUSIC_PLAYLIST}
|
||||
|
|
|
@ -80,13 +80,13 @@
|
|||
[/if]
|
||||
# Additional contents for WCII scenario generator
|
||||
[if]
|
||||
glob_on_create_scenario=*onquest*
|
||||
glob_on_create_scenario=*World_Conquest*
|
||||
[then]
|
||||
[tag]
|
||||
name="scenario"
|
||||
super="scenario"
|
||||
[/tag]
|
||||
{SIMPLE_KEY id_suffix string}
|
||||
{SIMPLE_KEY nplayers int}
|
||||
[/then]
|
||||
[/if]
|
||||
[/tag]
|
Loading…
Add table
Reference in a new issue