mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-24 17:29:30 +00:00
DiD S04 Todo: Add snow
Lifted code from HttT to add snow coverage.
This commit is contained in:
parent
128413da5a
commit
3f646cc965
@ -133,7 +133,53 @@
|
||||
[/gold_carryover]
|
||||
[/objectives]
|
||||
|
||||
# TODO: manually add snow detritus
|
||||
[lua]
|
||||
code=<<
|
||||
-- For prime-time use the filter terrain needs to come in and the convert
|
||||
-- table needs to be VERY complete. Or, rename this to morph_terrain and
|
||||
-- have the conversion table come in as an argument, too.
|
||||
|
||||
local locations = wesnoth.get_locations{terrain = 'Ce,Chr,Co,Gg,Gg^Efm,Gg^Vc,Gg^Vo,Gs^Fds,Gs^Fms,Gs^Fmw,Gs^Fp,Hh,Hh^Vhh,Hh^Vo,Ke,Khr,Ko,Mm,Mm^Xm'}
|
||||
|
||||
local coverage = 0.15
|
||||
-- Constant 15% random coverage.
|
||||
-- Valid range is (0.0 .. 1.0)
|
||||
-- Do not raise too high or player may not be able to make it in the time allotted.
|
||||
|
||||
local snowNeeded = (#locations * coverage)
|
||||
|
||||
local convert = {
|
||||
['Ce'] = 'Cea',
|
||||
['Chr'] = 'Cha',
|
||||
['Co'] = 'Coa',
|
||||
['Gg'] = 'Aa',
|
||||
['Gg^Efm'] = 'Aa',
|
||||
['Gg^Vc'] = 'Aa^Vca',
|
||||
['Gg^Vo'] = 'Aa^Voa',
|
||||
['Gs^Fds'] = 'Aa^Fda',
|
||||
['Gs^Fms'] = 'Aa^Fma',
|
||||
['Gs^Fmw'] = 'Aa^Fma',
|
||||
['Gs^Fp'] = 'Aa^Fpa',
|
||||
['Hh'] = 'Ha',
|
||||
['Hh^Vhh'] = 'Ha^Vha',
|
||||
['Hh^Vo'] = 'Ha^Voa',
|
||||
['Ke'] = 'Kea',
|
||||
['Khr'] = 'Kha',
|
||||
['Ko'] = 'Koa',
|
||||
['Mm'] = 'Ms',
|
||||
['Mm^Xm'] = 'Ms^Xm'
|
||||
}
|
||||
|
||||
local loopCounter
|
||||
for loopCounter = 1, snowNeeded do
|
||||
local locationsIndex = wesnoth.random(#locations)
|
||||
local coordinate = locations[locationsIndex]
|
||||
local terrainCode = wesnoth.get_terrain(coordinate[1], coordinate[2])
|
||||
wesnoth.set_terrain(coordinate[1], coordinate[2], (convert[terrainCode] or terrainCode))
|
||||
table.remove(locations, locationsIndex)
|
||||
end
|
||||
>>
|
||||
[/lua]
|
||||
|
||||
[recall]
|
||||
id=Darken Volk
|
||||
|
Loading…
x
Reference in New Issue
Block a user