Moved the existing FSM implementation into SBFSM.

I think I have solved my FSM problems with a two-variable FSM system. I
just have to implement it in fsm.lua