do
#****************************************************************************
#**
#**  File     :  /cdimage/units/UEL0401/UEL0401_script.lua
#**  Author(s):  John Comes, David Tomandl, Gordon Duclos
#**
#**  Summary  :  UEF Mobile Factory Script
#**  
#**  Domino: Added an rallyPoint to this unit
#**
#**  Copyright © 2005 Gas Powered Games, Inc.  All rights reserved.
#****************************************************************************

local OldUEL0401 = UEL0401
UEL0401 = Class(OldUEL0401) {

	OnStopBeingBuilt = function(self,builder,layer)
		OldUEL0401.OnStopBeingBuilt(self,builder,layer)
		local  worldPos = self:CalculateWorldPositionFromRelative({0, 0, 10})
		AddRallyPoint(self, worldPos)
	end,
    
    RollingOffState = State {
        Main = function(self)
            local unitBuilding = self.UnitBeingBuilt
            if not unitBuilding:IsDead() then
                unitBuilding:ShowBone(0,true)
            end
            WaitFor(self.PrepareToBuildManipulator)
            WaitFor(self.AttachmentSliderManip)
            self:CreateRollOffEffects()
            self.AttachmentSliderManip:SetSpeed(10)
            self.AttachmentSliderManip:SetGoal(0, 0, 17)
            WaitFor( self.AttachmentSliderManip )
            self.AttachmentSliderManip:SetGoal(0, -3, 17)
            WaitFor( self.AttachmentSliderManip )
            if not unitBuilding:IsDead() then
                unitBuilding:DetachFrom(true)
                self:DetachAll(self.BuildAttachBone)
                local  worldPos = self:CalculateWorldPositionFromRelative({0, 0, -15})
                IssueMoveOffFactory({unitBuilding}, self:GetModRallyPoint()) -- this is the code i changed.. 
            end
            self:DestroyRollOffEffects()
            ChangeState(self, self.IdleState)
        end,
    },

}

TypeClass = UEL0401

end