mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-20 07:43:07 +00:00
Update Scenery.lua
#SCENERY - return nil on register when no underlying object found
This commit is contained in:
@@ -61,9 +61,19 @@ function SCENERY:Register( SceneryName, SceneryObject, SceneryZone )
|
|||||||
end
|
end
|
||||||
|
|
||||||
if _SCENERY[ID] then return _SCENERY[ID] end
|
if _SCENERY[ID] then return _SCENERY[ID] end
|
||||||
|
|
||||||
|
if SceneryObject == nil and SceneryZone == nil then return nil end -- no object to attach to
|
||||||
|
|
||||||
local self = BASE:Inherit( self, POSITIONABLE:New( SceneryName ) )
|
local self = BASE:Inherit( self, POSITIONABLE:New( SceneryName ) )
|
||||||
|
|
||||||
|
if SceneryObject == nil and SceneryZone ~= nil then
|
||||||
|
SceneryObject = self:FindByZoneName(SceneryZone)
|
||||||
|
if SceneryObject==nil then
|
||||||
|
self=nil
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
self.SceneryName = tostring(SceneryName)
|
self.SceneryName = tostring(SceneryName)
|
||||||
self.ID = ID
|
self.ID = ID
|
||||||
self.SceneryObject = SceneryObject
|
self.SceneryObject = SceneryObject
|
||||||
|
|||||||
Reference in New Issue
Block a user