MapLine

Represents a map linedef.

Inherits MapObject

All properties and functions of MapObject can be used in addition to those below.

Properties

Property Type Description
x1 number The X coordinate of the line's first vertex
y1 number The Y coordinate of the line's first vertex
x2 number The X coordinate of the line's second vertex
y2 number The Y coordinate of the line's second vertex
vertex1 MapVertex The line's first vertex
vertex2 MapVertex The line's second vertex
side1 MapSide The line's first (front) side
side2 MapSide The line's second (back) side
special number The line's action special
length number The length of the line in map units
visibleTextures table The textures of the line that are visible.
The table consists of the following boolean values: frontUpper, frontMiddle, frontLower, backUpper, backMiddle, backLower.

Constructors

No Constructors

This type can not be created directly in scripts.

Functions

flag

Parameters

  • string flag_name: The name of the flag to check

Returns boolean

Returns true if the given flag is set.

If the parent Map's format is UDMF, this behaves exactly the same as MapObject:boolProperty. Otherwise, flag_name needs to be one of the following:

  • blocking
  • twosided
  • dontpegtop
  • dontpegbottom

flip

Parameters

  • [boolean swap_sides : true]: Whether to swap the sides

Flips the line so that it faces the opposite direction. If swap_sides is true, the line's MapSides will also be swapped so that they stay on the same spatial "side" of the line.

Examples

The visibleTextures Property

The visibleTextures property can be used to determine what textures (parts) of the line are showing. Below is an example that checks if a line's front upper texture is missing:

-- Check if front upper texture is visible
if line.visibleTextures.frontUpper == true then
    -- Check if texture is missing
    if line.side1.textureTop == '-' then
        App.logMessage('Line front upper texture is missing')
    end
end

Tip

The visibleTextures property is re-calculated each time it is accessed, so for performance reasons it is best to store it in a variable if it needs to be accessed multiple times.