Module:Map icons

From Truck Simulator Wiki
Jump to navigation Jump to search

Module for displaying map icons based on pre-defined values.

Currently available values:

Value Icon Meaning
begin Map icon Autobahn start.svg Start of road
start
city Map icon city.svg Cities
companies Map icon companies.svg Company depots
crossing Map icon Autobahn crossing.svg Road junction
end Map icon Autobahn end.svg End of road
rest Parking ico.png Rest stop
service Gas ico.png Gas station
toll Road toll ico.png Toll gate or toll plaza
tunnel Road train ico.png Tunnel or Channel Tunnel terminal

local p = {}
 
function p.hello()
    return 'Hello!'
end

function p.getMapIcon(frame)
	local label = frame.args[1]
	local imagename = ''
	if label == 'begin' then
		label = 'start'
	end
	
	if label == 'start' or label == 'end' or label == 'crossing' then
		imagename = '[[File:Map icon Autobahn '..label..'.svg]]'
	elseif label == 'city' or label == 'companies' then
		imagename = '[[File:Map icon '..label..'.svg]]'
	elseif label == 'service' then
		imagename = '[[File:Gas_ico.png]]'
	elseif label == 'rest' then
		imagename = '[[File:Parking_ico.png]]'
	elseif label == 'toll' then
		imagename = '[[File:Road_toll_ico.png]]'
	elseif label == 'tunnel' then
		imagename = '[[File:Road_train_ico.png]]'
	else
		imagename = label
	end
	
	return imagename
end
 
return p