@startuml
participant "FlightSimulator" as FS
participant "Rocket" as Rocket
participant "Stage" as Stage
participant "Motor" as Motor
participant "ForcesModel" as FM
participant "Environment" as Env
participant "Integrator" as Integrator
participant "FlightState" as State
participant "RecoverySystem" as Recovery

== Launch Preparation ==
FS -> Rocket: prepareForFlight(environment)

== Launch Simulation ==
loop simulation time steps
    FS -> Stage: updateMotors(deltaTime)
    FS -> FM: computeNetForce(State)
    FM -> Rocket: query mass/CG
    FM -> Env: get air density, gravity
    FM -> Motor: get thrust
    FS -> Integrator: step(State, netForce, deltaTime)
    Integrator -> Rocket: query mass
    FS -> Rocket: applyFlightState(State)

    alt FS -> Rocket: check for burnout, apogee, recovery deployment
    Rocket -> RecoverySystem: checkDeploymentCondition
end

== Landing ==
FS -> FlightState: detect low altitude and low vertical velocity
note over FS
    End simulation after landing detected
end note
@enduml
