Skip to content

CreateMapSurface

Hangs one of the web interface’s surface pages on the level as a map object - a notice board that stays with the map.

The same board as CreateWebSurface’s - a page of the interface’s ui.toml [surfaces.<page>], live on every screen near it -, but kept in the server’s map: it is there after a restart, the editor moves it, it may sit on another map object (attach) and an export carries it. The map makes its surface for it: GetMapObjectSurface gives it, and the surface functions take it like any (SendWebSurfaceMessage, OnPlayerWebSurfaceReady …). It is as wide as opts.width (metres, 1) and as tall as the page’s shape for that width unless opts.height says otherwise; use is its prompt (OnPlayerUseWebSurface hears it). Move it with SetMapObject (never SetWebSurfacePos: the map puts it back). A page the interface does not have shows nothing until it does.

CreateMapSurface(page, x, y, z [, opts])
Parameter Type
page string the page’s name in ui.toml ([surfaces.<page>])
x number metres - the board’s middle
y number metres
z number metres
opts table as CreateMapPicture’s: yaw, pitch, roll, width, height, transparent, glow, use (or prompt), attach, layer, group, persist (optional)

number - the map object’s id; nil and the reason (no such page, a size out of bounds, no map …)

local board = CreateMapSurface("board", 1290.2, 1096.0, 33.5, {yaw = 180, width = 1.5, prompt = "Read the notices"})
function OnPlayerWebSurfaceReady(pid, surface)
if GetWebSurfaceMapObject(surface) == board then SendPlayerWebSurfaceMessage(pid, surface, {notices = NOTICES}) end
end

GetMapObjectSurface · GetWebSurfaceMapObject · CreateWebSurface · CreateMapPicture · the The server’s map group of the index