Smuggler's Atoll¶
A map on an island of its own: a small atoll of slums and villas, with no canal, no trains and no used-car lots, on sun-bleached streets at golden hour. Its finale is code: after the five-star minute a seaplane waits at the north-east dock. Miss it, and the Collector comes.
| Mod id | Kind | Files |
|---|---|---|
atoll |
Lua code | 5 |
Copy the whole folder into mods/ in the save folder to try it. Browse it on GitHub.
mod.json¶
{"id": "atoll", "title": "Smuggler's Atoll", "version": "1.0", "api": 1, "author": "Taxation Evasion",
"scripts": ["main.lua"],
"description": "A map on an island of its own: a small atoll of slums and villas, with no canal, no trains and no used-car lots, on sun-bleached streets at golden hour. Its finale is code: after the five-star minute a seaplane waits at the north-east dock. Miss it, and the Collector comes."}
main.lua¶
-- The atoll's finale (maps.json `mechanics`). Everything here goes through
-- the `game` API (docs/modding/API.md), and runs only on this map.
local WAIT = 90 -- seconds the seaplane waits at the dock
local REACH = 140 -- how close counts as aboard, in pixels
game.mechanics('atoll.seaplane', {
-- Each tick after the five-star minute. True keeps the map's own finale
-- on; nothing hands over to the Collector, as on the City.
finale = function(s)
local plane = s.atoll_plane
if not plane then
-- The dock: the street nearest the island's north-east corner.
local _, top, right = game.island(s)
local x, y = game.street(s, right - 600, top + 600)
plane = {x = x, y = y, leaves = s.time + WAIT}
s.atoll_plane = plane
end
if plane.missed then return end
if game.distance(s.player, plane) < REACH then
game.win(s, 'THE SEAPLANE FLEW YOU OUT.')
elseif s.time > plane.leaves then
plane.missed = true
return
end
return true
end,
objective = function(s)
local plane = s.atoll_plane
if plane and not plane.missed then
return 'REACH THE SEAPLANE', 'IT LEAVES IN ' .. math.ceil(plane.leaves - s.time) .. 'S'
end
end,
route = function(s)
local plane = s.atoll_plane
if plane and not plane.missed then return plane.x, plane.y end
end,
-- The dock, ringed in gold where the plane waits.
draw_world = function(s, d)
local plane = s.atoll_plane
if plane and not plane.missed and d.visible(plane.x, plane.y, 200) then
local pulse = 0.5 + 0.5 * math.sin(d.time * 4)
d.ring(plane.x, plane.y, REACH, 'gold', 0.4 + 0.4 * pulse)
d.light(plane.x, plane.y, 180, 'gold', 0.6)
end
end,
})
announcer.json¶
[
{"id": "atoll.final", "lines": ["One minute at five stars,", "then get to the seaplane."],
"priority": 4, "stamp": true}
]
maps.json¶
[
{"id": "atoll.atoll", "base": "city", "label": "SMUGGLER'S ATOLL",
"group": "SURVIVAL", "counter": "escapes", "target": 1, "full": true, "requirement": "Escape once",
"island": {"width": 5, "height": 6},
"land": {"airport": 0, "railyard": 0, "suburbs": 0, "slum": 9, "luxury": 6},
"features": {"canal": false, "rails": false, "dealerships": false},
"landmark": "none",
"mechanics": "atoll.seaplane",
"preview": "atoll.preview",
"final": "atoll.final",
"boss_next": "THEN CATCH THE SEAPLANE",
"boss_goal": "THEN CATCH THE SEAPLANE",
"traffic": 2,
"colors": {"road": [58, 50, 44], "highway": [66, 57, 48], "mark": [214, 190, 140], "median": [226, 178, 92],
"rim": [168, 150, 118], "parking": [72, 62, 52]},
"sky": {"keys": [
{"at": 0, "ambient": [0.95, 0.66, 0.42], "shade": [0.32, 0.42, 0.8], "strength": 1, "bearing": 200,
"floor": 30, "reach": 360, "lamp": 0.3, "haze": 0.1, "day": 1},
{"at": 1, "ambient": [0.7, 0.4, 0.4], "strength": 0.6, "lamp": 0.8, "haze": 0.14}]}}
]
sprites/preview.png¶
![]()