Maps and editing
dlmp.list_maps
Returns the names of this resource's maps (maps/<name>.toml in its directory).
Returns names string[]
dlmp.read_map
Returns a map document as a table, including any sections beyond those save_map lists. autosave reads the draft instead. A document that fails the checks load_map applies is an error here too.
Parameters
namestring— a-z, 0-9, - and _, up to 64.opts{ autosave: boolean|nil }|nil
Returns document table|nil, err string|nil
dlmp.save_map
Validates the document and replaces the whole file; on any failure the previous map is kept. Sets saved_at.
Parameters
namestringdocumenttable—version = 1and the listsobject,vehicle,pickup,point,label,blip,marker,gang_zone,colshapeandcheckpoint; other sections are kept as is.opts{ autosave: boolean|nil }|nil
Returns ok boolean|nil, err string|nil
dlmp.load_map
Creates a map's contents in a virtual world: objects, vehicles, pickups, labels, blips and markers at their coordinates and gang zones, shown to everyone in that world, and colshapes, whose outlines are shown to nobody. Checkpoints remain templates (Map:give_checkpoint). Creation is all or nothing: nothing is created if the server has no room for everything. The created elements belong to this resource. Never reads an autosave.
Parameters
namestringopts{ virtual_world: integer|nil }|nil
Returns map Map|nil, err string|nil
dlmp.begin_edit
Starts an edit session for the player: its camera flies freely, its controls are taken over, and it proposes selections and poses for this resource's objects, vehicles, pickups, gang zones and colshapes. These reach this resource as entity_select(player, entity|nil, mode) and entity_edit(player, entity, x, y, z, rx, ry, rz); for a vehicle rx, ry, rz are pitch, roll and heading, and for a pickup they are 0. For a gang zone the event is entity_edit(player, zone, min_x, min_y, max_x, max_y), raised only for a zone shown to the player. For a colshape it is entity_edit(player, colshape, form), with a ColshapeForm of the colshape's kind, raised only for a colshape whose outline is shown to the player (Colshape:show). Apply a proposal with set_position / set_rotation, Pickup:set_position, GangZone:set_area, Colshape:set_form, or dlmp.set_vehicle_position / dlmp.set_vehicle_rotation; a proposal left unapplied is discarded. Vehicles: only one nobody is using, and not a train or a wreck; freeze it, or its physics moves it away from the pose the player sees. Pickups: only one shown to the player; a collected pickup waiting to respawn is not. The session ends with end_edit, when this resource stops, or when the player leaves or dies (edit_end). The player must be alive and on foot. The camera is the player's stream center: in a shared world it lets the player see whatever is around any point, so give each session its own world. A menu or dialog the resource showed stays open after the session ends; guard its callbacks.
Parameters
playerPlayeropts{ grid: number|nil, angle: number|nil }|nil— Snap steps: meters 0..1000 and degrees 0..360, 0 = none.
Returns ok boolean|nil, err string|nil
dlmp.end_edit
Parameters
playerPlayer
Returns ok boolean|nil, err string|nil
dlmp.update_edit
Updates the edit session: the snap steps, whether the next pick selects a parent (entity_select with mode "parent", objects only), and the selected entity.
Parameters
playerPlayeropts{ grid: number|nil, angle: number|nil, pick_parent: boolean|nil, selected: Object|Vehicle|Pickup|GangZone|Colshape|false|nil }
Returns ok boolean|nil, err string|nil
