TypeName

Does things like an Asteroid have a TypeName?

Im trying to make the long range scanner more useful, The Red Green Blue bar, and the easiest way is to tidy up the readings.

So Im reducing everything to Zero with a

"for _, obj in ipairs(getAllObjects()) do

obj:setRadarSignatureInfo(0, 0, 0)

if obj:getTypeName() == "Asteroid" then

obj:setRadarSignatureInfo(1.0, 1.0, 1.0)

end

end "

And then go though and set certain things to certain levels.

Comments

  • Anything has a typename, but you access it as a string

    obj.typeName == "Asteroid", bit inconsitent, I know, and the documentation used to be wrong on this, should be fixed in the latest release.
  • Does it start with that TypeName? Because the loop above doesn't seem to work sadly.
  • The typename is the exact same as the C++ classname. But you need to access it as a direct member, thus with a period, not with a : like the functions.
  • Thank you once again, you are a star :)
  • Anyway to get the class of the ship?
  • Didn't found a way, but there are two ways to go around it. Either give them a obj.class = "howeveryouwanttoseperatethem"
    at the beginning sorted by there shipTemplate-TypeName eg:

    if randomship:getTypeName() == "Atlantis X23" then
    randomship.class = 1
    end

    or directly take the TypeNames as classes.
Sign In or Register to comment.