Skip to content

Lua:Thing

zstephens edited this page Feb 1, 2020 · 9 revisions

see the doomwiki article on Thing

Properties

selected

is the thing selected? true/false

position

a Vector2D

type

integer number, the editor number determining what class this Thing is (ex. Shotgunner, Imp, Box of Shells, etc).

see the doomwiki article on thing types and thing types by number

tag

integer number, tag. this only works on map formats that support it, such as UDMF or Hexen based formats the doomwiki article on tags

action

arg0

arg1

arg2

arg3

arg4

Methods

IsDisposed()

Dispose()

GetIndex()

gets the editor index of the map element.

note: the value returned will be 0-indexed, like the map format, whereas the tables in Lua start at 1.

note 2: this number can change any time you add or remove map elements. sometimes elements are added at the beginning or middle instead of the end. the manner in which it changes is unpredictable and subject to change between doom builder versions.

IsFlagSet(flagname)

Returns true/false, see below for explanation of flagnames.

SetFlag(flagname,val)

flagname is a string, val is true/false.

flagnames are not hardcoded, but depend on game configuration. For standard Doom/Boom mapping, the full list of flags can be found in Configurations/Includes/Doom_misc.cfg:

"1":  actor appears on skill 1 & 2
"2":  actor appears on skill 3
"4":  actor appears on skill 4 & 5
"8":  actor is set to deaf/ambush
"16": actor only appears in multiplayer

An example for creating an imp and setting it to ambush:

newThing = Map.InsertThing(x, y)
newThing.type = 3001
newThing.SetFlag("8", true)

ClearFlags()

GetUDMFField(key)

SetUDMFField(key,value)

GetRadius()

LuaSector GetSector()

SetAngleRadians(newangle)

SetAngleDoom(newangle)

GetAngleRadians()

GetAngleDoom()

SnapToGrid()

SnapToAccuracy()

DistanceToSq(p)

DistanceTo(p)

Clone(v)

Clone(x,y)

Clone()